개정판 708824e3
issue #000: fix progress bar pop up twice
Change-Id: I15953d41c85f8efcff73080caa7e9637fbebbf49
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
247 | 247 |
pass |
248 | 248 |
''' |
249 | 249 |
|
250 |
|
|
251 | 250 |
if updateProgress: updateProgress.emit(maxValue) |
252 | 251 |
except Exception as ex: |
253 | 252 |
from App import App |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1168 | 1168 |
break |
1169 | 1169 |
|
1170 | 1170 |
try: |
1171 |
self.progress = QProgressDialog(self.tr("Please wait for a while"), self.tr("Cancel"), 0, 100, self) if not hasattr(self, 'progress') else self.progress |
|
1172 |
self.progress.setWindowModality(Qt.WindowModal) |
|
1173 |
self.progress.setAutoReset(True) |
|
1174 |
self.progress.setAutoClose(True) |
|
1175 |
self.progress.setMinimum(0) |
|
1176 |
self.progress.setMaximum(100) |
|
1177 |
self.progress.resize(600,100) |
|
1178 |
self.progress.setWindowTitle(self.tr("Reading file...")) |
|
1179 |
self.progress.show() |
|
1171 |
self.show_Progress_bar() |
|
1180 | 1172 |
## Load data |
1181 | 1173 |
path = os.path.join(appDocData.getCurrentProject().getTempPath(), appDocData.imgName + '.xml') |
1182 | 1174 |
configs = appDocData.getConfigs('Data Load', 'Xml First') |
... | ... | |
1185 | 1177 |
else: |
1186 | 1178 |
self.load_drawing(appDocData.activeDrawing) |
1187 | 1179 |
finally: |
1188 |
self.progress.setValue(self.progress.maximum()) |
|
1189 |
self.progress.hide() |
|
1180 |
if hasattr(self, 'progress'): |
|
1181 |
self.progress.setValue(self.progress.maximum()) |
|
1182 |
#self.progress.hide() |
|
1190 | 1183 |
|
1191 | 1184 |
self.changeViewCheckedState(True) |
1192 | 1185 |
except Exception as ex: |
... | ... | |
1195 | 1188 |
|
1196 | 1189 |
return self.path |
1197 | 1190 |
|
1191 |
def show_Progress_bar(self): |
|
1192 |
""" show progress bar """ |
|
1193 |
self.progress = QProgressDialog(self.tr("Please wait for a while"), self.tr("Cancel"), 0, 100, self) if not hasattr(self, 'progress') else self.progress |
|
1194 |
self.progress.setWindowModality(Qt.WindowModal) |
|
1195 |
self.progress.setAutoReset(True) |
|
1196 |
self.progress.setAutoClose(True) |
|
1197 |
self.progress.setMinimum(0) |
|
1198 |
self.progress.setMaximum(100) |
|
1199 |
self.progress.resize(600,100) |
|
1200 |
self.progress.setWindowTitle(self.tr("Reading file...")) |
|
1201 |
self.progress.show() |
|
1202 |
|
|
1198 | 1203 |
def changeViewCheckedState(self, checked, clear=True): |
1199 | 1204 |
''' |
1200 | 1205 |
@brief change view checked state |
... | ... | |
2395 | 2400 |
|
2396 | 2401 |
components = app_doc_data.get_components(drawing.UID) |
2397 | 2402 |
maxValue = len(components) |
2398 |
self.progress.setMaximum(maxValue) |
|
2403 |
self.progress.setMaximum(maxValue) if maxValue > 0 else None
|
|
2399 | 2404 |
|
2400 | 2405 |
""" parsing all symbols """ |
2401 | 2406 |
for symbol in [component for component in components if int(component['SymbolType_UID']) != -1]: |
... | ... | |
2602 | 2607 |
maxValue = maxValue + len(list(root.iter('UNKNOWN'))) |
2603 | 2608 |
#maxValue = maxValue + len(list(root.iter('SIZETEXT'))) |
2604 | 2609 |
maxValue = maxValue + len(list(root.iter('TRIM_LINE_NO'))) |
2605 |
self.progress.setMaximum(maxValue) |
|
2610 |
self.progress.setMaximum(maxValue) if maxValue > 0 else None
|
|
2606 | 2611 |
|
2607 | 2612 |
""" parsing all symbols """ |
2608 | 2613 |
for symbol in root.find('SYMBOLS').iter('SYMBOL'): |
내보내기 Unified diff