개정판 d2389ee1
issue #578: 도면 리스트 갱신시 프로그래스 바를 표시한다
Change-Id: I67f312f28354845dcfdd41cedf32921c2e182d6c
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
228 | 228 |
|
229 | 229 |
def getDrawingFileList(self): |
230 | 230 |
""" get drawing files which's extension is .png or jpg from drawing folder """ |
231 |
drawingFileList = [] |
|
232 |
|
|
231 | 233 |
try: |
232 | 234 |
project = AppDocData.instance().getCurrentProject() |
233 | 235 |
path = project.getDrawingFilePath() |
234 |
drawingFileList = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and (
|
|
235 |
os.path.splitext(f)[1] == '.png' or os.path.splitext(f)[1] == '.jpg' or os.path.splitext(f)[
|
|
236 |
1] == '.jpeg' or os.path.splitext(f)[1] == '.JPEG' or os.path.splitext(f)[1] == '.PNG')]
|
|
236 |
drawingFileList = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and |
|
237 |
(os.path.splitext(f)[1].upper() == '.PNG' or os.path.splitext(f)[1].upper() == '.JPG' or
|
|
238 |
os.path.splitext(f)[1].upper() == '.JPEG')]
|
|
237 | 239 |
drawingFileList.sort() |
238 | 240 |
except Exception as ex: |
239 | 241 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
469 | 469 |
self.retranslateUi(self) |
470 | 470 |
self.propertyTableWidget.retranslateUi() |
471 | 471 |
|
472 |
''' |
|
473 |
@brief Clear TreeWidget and Set Current PID |
|
474 |
@author Jeongwoo |
|
475 |
@date 18.04.11 |
|
476 |
@history 2018.04.26 Jeongwoo Add Child [SYMBOLS, NOTES] into root item |
|
477 |
2018.05.09 Jeongwoo Change method to add default tree items |
|
478 |
humkyung 2018.06.10 add tree item for Line No and Unknown Item |
|
479 |
''' |
|
480 |
|
|
481 | 472 |
def load_drawing_list(self): |
482 | 473 |
"""load p&id drawing list""" |
483 | 474 |
from Drawing import Drawing |
... | ... | |
493 | 484 |
self.treeWidgetDrawingList.root.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) |
494 | 485 |
self.treeWidgetDrawingList.root.setCheckState(0, Qt.Unchecked) |
495 | 486 |
files = app_doc_data.getDrawingFileList() |
487 |
|
|
488 |
self.progress_bar.setMaximum(len(files)) |
|
489 |
count = 0 |
|
490 |
self.progress_bar.setValue(count) |
|
496 | 491 |
for file in files: |
497 | 492 |
x = [drawing for drawing in drawings if drawing.name == file] |
498 | 493 |
if not x or not x[0].UID: |
... | ... | |
507 | 502 |
item.setCheckState(0, Qt.Unchecked) |
508 | 503 |
item.setData(Qt.UserRole, 0, drawing) |
509 | 504 |
|
510 |
self.treeWidgetDrawingList.root.setText(0, self.tr('P&ID Drawings') + '({})'.format( |
|
511 |
self.treeWidgetDrawingList.root.childCount())) |
|
505 |
count += 1 |
|
506 |
self.progress_bar.setValue(count) |
|
507 |
QApplication.processEvents() |
|
508 |
|
|
509 |
self.treeWidgetDrawingList.root.setText(0, self.tr('P&ID Drawings') + |
|
510 |
f"({self.treeWidgetDrawingList.root.childCount()})") |
|
512 | 511 |
self.treeWidgetDrawingList.expandItem(self.treeWidgetDrawingList.root) |
513 | 512 |
self.treeWidgetDrawingList.root.sortChildren(0, Qt.AscendingOrder) |
514 | 513 |
self.treeWidgetDrawingList.resizeColumnToContents(0) |
... | ... | |
518 | 517 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
519 | 518 |
sys.exc_info()[-1].tb_lineno) |
520 | 519 |
self.addMessage.emit(MessageType.Error, message) |
520 |
finally: |
|
521 |
self.progress_bar.setValue(self.progress_bar.maximum()) |
|
521 | 522 |
|
522 | 523 |
def open_selected_drawing(self, item, column): |
523 | 524 |
"""open selected p&id drawing""" |
내보내기 Unified diff