개정판 fd329e57
issue #000: prevent same line no color
Change-Id: I14f0674734ad78102c25e1dcced20a12b286fb13
DTI_PID/DTI_PID/App.py | ||
---|---|---|
124 | 124 |
AppDocData.instance().setCurrentProject(selectedProject) |
125 | 125 |
app._mainWnd = MainWindow.instance() |
126 | 126 |
app._mainWnd.show() |
127 |
sys.exit(app.exec_()) |
|
127 |
sys.exit(app.exec_()) |
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
225 | 225 |
''' |
226 | 226 |
@property |
227 | 227 |
def colors(self): |
228 |
if self._colors is None: |
|
228 |
import random |
|
229 |
|
|
230 |
if self._colors is None or self._colors == []: |
|
229 | 231 |
self._colors = [] |
230 | 232 |
try: |
231 | 233 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath() , AppDocData.DATABASE) |
... | ... | |
248 | 250 |
finally: |
249 | 251 |
conn.close() |
250 | 252 |
|
251 |
return self._colors |
|
253 |
return self._colors.pop(random.randrange(0, len(self._colors)))
|
|
252 | 254 |
|
253 | 255 |
''' |
254 | 256 |
@brief setter of colors |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
40 | 40 |
euisung 2018.11.19 now textitemfactory set plain text in createTextItem() for allowables |
41 | 41 |
''' |
42 | 42 |
def createTextItem(self, textInfo): |
43 |
import random |
|
44 | 43 |
from Configs import LineNoConfig |
45 | 44 |
|
46 | 45 |
item = None |
... | ... | |
88 | 87 |
|
89 | 88 |
# set line no color |
90 | 89 |
if visibleOption == 'Random': |
91 |
colorCount = len(docData.colors) |
|
92 |
if colorCount: |
|
93 |
colorIdx = random.randrange(0, colorCount) |
|
94 |
rgb = docData.colors[colorIdx] |
|
95 |
item.change_color(QColor(rgb.red, rgb.green, rgb.blue).name()) |
|
96 |
#item.setColor(QColor(rgb.red, rgb.green, rgb.blue).name()) |
|
90 |
rgb = docData.colors |
|
91 |
item.change_color(QColor(rgb.red, rgb.green, rgb.blue).name()) |
|
92 |
#item.setColor(QColor(rgb.red, rgb.green, rgb.blue).name()) |
|
97 | 93 |
else: |
98 | 94 |
configs = docData.getConfigs('Line No', 'Configuration') |
99 | 95 |
configs = configs[0].value.split(self.delimiter) |
내보내기 Unified diff