개정판 7dda9fab
add batch link
Change-Id: Idd2691a642b20654a2dafba6782d98e7722fef09
DTI_PID/DTI_PID/AppRibbon.py | ||
---|---|---|
247 | 247 |
pane.ui.toolButtonConnectLineToSymbol.clicked.connect(main_wnd.on_connect_line_to_symbol) |
248 | 248 |
pane.ui.toolButtonOCRUnknown.clicked.connect(main_wnd.on_ocr_unknown_items) |
249 | 249 |
pane.ui.toolButtonSymbolRecognition.clicked.connect(main_wnd.recognizeSymbol) |
250 |
pane.ui.toolButtonLinkBatch.clicked.connect(main_wnd.connect_attributes_batch) |
|
250 | 251 |
cSection.addCustomWidget(pane) |
251 | 252 |
except Exception as ex: |
252 | 253 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
DTI_PID/DTI_PID/ConnectAttrDialog.py | ||
---|---|---|
200 | 200 |
sys.exc_info()[-1].tb_lineno) |
201 | 201 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
202 | 202 |
finally: |
203 |
#print('finish') |
|
203 | 204 |
pass |
204 | 205 |
|
205 | 206 |
''' |
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
676 | 676 |
error_item.transfer.onRemoved.emit(error_item) |
677 | 677 |
|
678 | 678 |
for end_break in [item for item in worker.scene.items() if type(item) is QEngineeringEndBreakItem]: |
679 |
if not end_break.prop('Freeze'): |
|
679 |
if not end_break.prop('Freeze') or not end_break.owner or not end_break.prop('Connected Item'):
|
|
680 | 680 |
end_break.transfer.onRemoved.emit(end_break) |
681 | 681 |
else: |
682 | 682 |
end_breaks.append(end_break) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1316 | 1316 |
return False |
1317 | 1317 |
return True |
1318 | 1318 |
|
1319 |
def actionSaveCliked(self): |
|
1319 |
def actionSaveCliked(self, batch=False):
|
|
1320 | 1320 |
""" |
1321 | 1321 |
save current drawing |
1322 | 1322 |
@return: |
... | ... | |
1347 | 1347 |
self._save_work_cmd = SaveWorkCommand(self.graphicsView.scene()) |
1348 | 1348 |
self._save_work_cmd.show_progress.connect(self.progress_bar.setValue) |
1349 | 1349 |
self._save_work_cmd.display_message.connect(self.onAddMessage) |
1350 |
self._save_work_cmd.finished.connect(self.save_finished) |
|
1350 |
if not batch: |
|
1351 |
self._save_work_cmd.finished.connect(self.save_finished) |
|
1352 |
else: |
|
1353 |
self._save_work_cmd.finished.connect(self.save_finished_batch) |
|
1351 | 1354 |
|
1352 | 1355 |
self._save_work_cmd.start() |
1353 | 1356 |
except Exception as ex: |
... | ... | |
1377 | 1380 |
home_pane = self.ribbon.get_pane('Home File') |
1378 | 1381 |
home_pane.ui.toolButtonFileSave.setEnabled(True) |
1379 | 1382 |
|
1383 |
def save_finished_batch(self): |
|
1384 |
""" |
|
1385 |
reload drawing list when save is finished |
|
1386 |
@return: None |
|
1387 |
""" |
|
1388 |
|
|
1389 |
try: |
|
1390 |
self._save_work_cmd.show_progress.emit(100) |
|
1391 |
#QMessageBox.about(self.graphicsView, self.tr('Information'), self._save_work_cmd.resultStr) |
|
1392 |
self.load_drawing_list() |
|
1393 |
|
|
1394 |
app_doc_data = AppDocData.instance() |
|
1395 |
app_doc_data.activeDrawing.modified = False |
|
1396 |
title = self.windowTitle() |
|
1397 |
self.setWindowTitle(title[:-1] if title[-1] == '*' else title) |
|
1398 |
|
|
1399 |
# save alarm |
|
1400 |
#self.save_alarm_enable(True) |
|
1401 |
finally: |
|
1402 |
home_pane = self.ribbon.get_pane('Home File') |
|
1403 |
home_pane.ui.toolButtonFileSave.setEnabled(True) |
|
1404 |
#print('saved') |
|
1405 |
|
|
1380 | 1406 |
''' |
1381 | 1407 |
@brief refresh resultPropertyTableWidget |
1382 | 1408 |
@author kyouho |
... | ... | |
1547 | 1573 |
|
1548 | 1574 |
self.on_export_PDF(path) |
1549 | 1575 |
|
1576 |
def connect_attributes_batch(self): |
|
1577 |
from ConnectAttrDialog import QConnectAttrDialog |
|
1578 |
|
|
1579 |
# save alarm |
|
1580 |
self.save_alarm_enable(False) |
|
1581 |
|
|
1582 |
try: |
|
1583 |
# get checked drawings |
|
1584 |
drawing_top = self.treeWidgetDrawingList.topLevelItem(0) |
|
1585 |
count = drawing_top.childCount() |
|
1586 |
checked_drawings = {} |
|
1587 |
for idx in range(count): |
|
1588 |
child = drawing_top.child(idx) |
|
1589 |
if child.checkState(0) == Qt.Checked and child.data(Qt.UserRole, 0): |
|
1590 |
checked_drawings[child.data(Qt.UserRole, 0)] = child |
|
1591 |
# up to here |
|
1592 |
|
|
1593 |
if not checked_drawings: |
|
1594 |
self.showImageSelectionMessageBox() |
|
1595 |
return |
|
1596 |
|
|
1597 |
self.progress_bar.setMaximum(len(checked_drawings) + 2) |
|
1598 |
count = 1 |
|
1599 |
self.progress_bar.setValue(count) |
|
1600 |
|
|
1601 |
for drawing in checked_drawings.keys(): |
|
1602 |
self.open_image_drawing(drawing, force=True, ocrUnknown=False, timer=False, pdf=False) |
|
1603 |
|
|
1604 |
dlg = QConnectAttrDialog(self, self.graphicsView.scene()) |
|
1605 |
#print('start') |
|
1606 |
dlg.start_job() |
|
1607 |
#print('end') |
|
1608 |
self.actionSaveCliked(batch=True) |
|
1609 |
|
|
1610 |
count += 1 |
|
1611 |
self.progress_bar.setValue(count) |
|
1612 |
|
|
1613 |
self.open_image_drawing(drawing, force=True, ocrUnknown=False) # for reset |
|
1614 |
self.progress_bar.setValue(self.progress_bar.maximum()) |
|
1615 |
|
|
1616 |
QMessageBox.about(self, self.tr("Information"), self.tr('Successfully saved.')) |
|
1617 |
|
|
1618 |
except Exception as ex: |
|
1619 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1620 |
sys.exc_info()[-1].tb_lineno) |
|
1621 |
self.addMessage.emit(MessageType.Error, message) |
|
1622 |
|
|
1550 | 1623 |
def on_export_PDF(self, path=None): |
1551 | 1624 |
# save alarm |
1552 | 1625 |
self.save_alarm_enable(False) |
... | ... | |
1621 | 1694 |
|
1622 | 1695 |
count += 1 |
1623 | 1696 |
self.progress_bar.setValue(count) |
1697 |
|
|
1624 | 1698 |
self.open_image_drawing(drawing, force=True, ocrUnknown=False) # for reset |
1625 | 1699 |
self.progress_bar.setValue(self.progress_bar.maximum()) |
1626 | 1700 |
|
... | ... | |
2098 | 2172 |
@date 2018.05.02 |
2099 | 2173 |
''' |
2100 | 2174 |
def showImageSelectionMessageBox(self): |
2101 |
QMessageBox.about(self.graphicsView, self.tr("Notice"), self.tr("First select image drawing"))
|
|
2175 |
QMessageBox.about(self.graphicsView, self.tr("Notice"), self.tr("First Select Drawing"))
|
|
2102 | 2176 |
|
2103 | 2177 |
def on_search_text_changed(self): |
2104 | 2178 |
"""filter symbol tree view""" |
... | ... | |
3337 | 3411 |
item._cond.wakeAll() |
3338 | 3412 |
''' |
3339 | 3413 |
|
3340 |
|
|
3341 | 3414 |
def connect_attributes(self, MainWindow): |
3342 | 3415 |
"""connect attributes to symbol""" |
3343 |
from LineNoTracer import LineNoTracer |
|
3344 | 3416 |
from ConnectAttrDialog import QConnectAttrDialog |
3345 | 3417 |
|
3346 | 3418 |
if not self.graphicsView.hasImage(): |
... | ... | |
3361 | 3433 |
self.onValidation() |
3362 | 3434 |
|
3363 | 3435 |
self.graphicsView.invalidateScene() |
3436 |
|
|
3364 | 3437 |
except Exception as ex: |
3365 | 3438 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
3366 | 3439 |
sys.exc_info()[-1].tb_lineno) |
DTI_PID/DTI_PID/UI/Edit.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>587</width>
|
|
9 |
<width>674</width>
|
|
10 | 10 |
<height>84</height> |
11 | 11 |
</rect> |
12 | 12 |
</property> |
... | ... | |
34 | 34 |
<property name="spacing"> |
35 | 35 |
<number>0</number> |
36 | 36 |
</property> |
37 |
<item row="0" column="3">
|
|
38 |
<widget class="QToolButton" name="toolButtonOCRUnknown">
|
|
37 |
<item row="0" column="9">
|
|
38 |
<widget class="QToolButton" name="toolButtonConnectLineToSymbol">
|
|
39 | 39 |
<property name="text"> |
40 |
<string>OCR Unknown Items</string> |
|
40 |
<string>Connect |
|
41 |
Symbols and Lines</string> |
|
41 | 42 |
</property> |
42 | 43 |
<property name="icon"> |
43 | 44 |
<iconset resource="../res/MainWindow.qrc"> |
44 |
<normaloff>:/newPrefix/OCR.svg</normaloff>:/newPrefix/OCR.svg</iconset>
|
|
45 |
<normaloff>:/newPrefix/connect_symbol_line.svg</normaloff>:/newPrefix/connect_symbol_line.svg</iconset>
|
|
45 | 46 |
</property> |
46 | 47 |
<property name="iconSize"> |
47 | 48 |
<size> |
... | ... | |
57 | 58 |
</property> |
58 | 59 |
</widget> |
59 | 60 |
</item> |
60 |
<item row="0" column="5">
|
|
61 |
<widget class="QToolButton" name="toolButtonConnectLineToSymbol">
|
|
61 |
<item row="0" column="2">
|
|
62 |
<widget class="QToolButton" name="toolButtonSymbolRecognition">
|
|
62 | 63 |
<property name="text"> |
63 |
<string>Connect
|
|
64 |
Symbols and Lines</string>
|
|
64 |
<string>Recognize
|
|
65 |
Symbol</string> |
|
65 | 66 |
</property> |
66 | 67 |
<property name="icon"> |
67 | 68 |
<iconset resource="../res/MainWindow.qrc"> |
68 |
<normaloff>:/newPrefix/connect_symbol_line.svg</normaloff>:/newPrefix/connect_symbol_line.svg</iconset>
|
|
69 |
<normaloff>:/newPrefix/Recognition.svg</normaloff>:/newPrefix/Recognition.svg</iconset>
|
|
69 | 70 |
</property> |
70 | 71 |
<property name="iconSize"> |
71 | 72 |
<size> |
... | ... | |
81 | 82 |
</property> |
82 | 83 |
</widget> |
83 | 84 |
</item> |
84 |
<item row="0" column="0"> |
|
85 |
<widget class="QToolButton" name="toolButtonFindReplaceText"> |
|
85 |
<item row="0" column="6"> |
|
86 |
<widget class="QToolButton" name="toolButtonOCRUnknown"> |
|
87 |
<property name="text"> |
|
88 |
<string>OCR Unknown Items</string> |
|
89 |
</property> |
|
90 |
<property name="icon"> |
|
91 |
<iconset resource="../res/MainWindow.qrc"> |
|
92 |
<normaloff>:/newPrefix/OCR.svg</normaloff>:/newPrefix/OCR.svg</iconset> |
|
93 |
</property> |
|
94 |
<property name="iconSize"> |
|
95 |
<size> |
|
96 |
<width>32</width> |
|
97 |
<height>32</height> |
|
98 |
</size> |
|
99 |
</property> |
|
100 |
<property name="toolButtonStyle"> |
|
101 |
<enum>Qt::ToolButtonTextUnderIcon</enum> |
|
102 |
</property> |
|
103 |
<property name="autoRaise"> |
|
104 |
<bool>true</bool> |
|
105 |
</property> |
|
106 |
</widget> |
|
107 |
</item> |
|
108 |
<item row="0" column="5"> |
|
109 |
<widget class="QToolButton" name="toolButtonTextDataList"> |
|
86 | 110 |
<property name="text"> |
87 | 111 |
<string>Text |
88 |
Find/Replace |
|
89 |
(Ctrl+F)</string> |
|
112 |
Data List</string> |
|
90 | 113 |
</property> |
91 | 114 |
<property name="icon"> |
92 | 115 |
<iconset resource="../res/MainWindow.qrc"> |
93 |
<normaloff>:/newPrefix/ReplaceText.svg</normaloff>:/newPrefix/ReplaceText.svg</iconset>
|
|
116 |
<normaloff>:/newPrefix/text_list_32px.svg</normaloff>:/newPrefix/text_list_32px.svg</iconset>
|
|
94 | 117 |
</property> |
95 | 118 |
<property name="iconSize"> |
96 | 119 |
<size> |
... | ... | |
106 | 129 |
</property> |
107 | 130 |
</widget> |
108 | 131 |
</item> |
109 |
<item row="0" column="4">
|
|
132 |
<item row="0" column="8">
|
|
110 | 133 |
<widget class="QToolButton" name="toolButtonSymbolReplaceInsert"> |
111 | 134 |
<property name="text"> |
112 | 135 |
<string>Symbol |
... | ... | |
130 | 153 |
</property> |
131 | 154 |
</widget> |
132 | 155 |
</item> |
133 |
<item row="0" column="2">
|
|
134 |
<widget class="QToolButton" name="toolButtonTextDataList">
|
|
156 |
<item row="0" column="0">
|
|
157 |
<widget class="QToolButton" name="toolButtonFindReplaceText">
|
|
135 | 158 |
<property name="text"> |
136 | 159 |
<string>Text |
137 |
Data List</string> |
|
160 |
Find/Replace |
|
161 |
(Ctrl+F)</string> |
|
138 | 162 |
</property> |
139 | 163 |
<property name="icon"> |
140 | 164 |
<iconset resource="../res/MainWindow.qrc"> |
141 |
<normaloff>:/newPrefix/text_list_32px.svg</normaloff>:/newPrefix/text_list_32px.svg</iconset>
|
|
165 |
<normaloff>:/newPrefix/ReplaceText.svg</normaloff>:/newPrefix/ReplaceText.svg</iconset>
|
|
142 | 166 |
</property> |
143 | 167 |
<property name="iconSize"> |
144 | 168 |
<size> |
... | ... | |
154 | 178 |
</property> |
155 | 179 |
</widget> |
156 | 180 |
</item> |
157 |
<item row="0" column="1">
|
|
158 |
<widget class="QToolButton" name="toolButtonSymbolRecognition">
|
|
181 |
<item row="0" column="3">
|
|
182 |
<widget class="QToolButton" name="toolButtonLinkBatch">
|
|
159 | 183 |
<property name="text"> |
160 |
<string>Recognize
|
|
161 |
Symbol</string>
|
|
184 |
<string>Link Attribute
|
|
185 |
Batch</string>
|
|
162 | 186 |
</property> |
163 | 187 |
<property name="icon"> |
164 | 188 |
<iconset resource="../res/MainWindow.qrc"> |
165 |
<normaloff>:/newPrefix/Recognition.svg</normaloff>:/newPrefix/Recognition.svg</iconset>
|
|
189 |
<normaloff>:/newPrefix/Connection.svg</normaloff>:/newPrefix/Connection.svg</iconset>
|
|
166 | 190 |
</property> |
167 | 191 |
<property name="iconSize"> |
168 | 192 |
<size> |
... | ... | |
178 | 202 |
</property> |
179 | 203 |
</widget> |
180 | 204 |
</item> |
205 |
<item row="0" column="1"> |
|
206 |
<widget class="Line" name="line"> |
|
207 |
<property name="orientation"> |
|
208 |
<enum>Qt::Vertical</enum> |
|
209 |
</property> |
|
210 |
</widget> |
|
211 |
</item> |
|
212 |
<item row="0" column="4"> |
|
213 |
<widget class="Line" name="line_2"> |
|
214 |
<property name="orientation"> |
|
215 |
<enum>Qt::Vertical</enum> |
|
216 |
</property> |
|
217 |
</widget> |
|
218 |
</item> |
|
219 |
<item row="0" column="7"> |
|
220 |
<widget class="Line" name="line_3"> |
|
221 |
<property name="orientation"> |
|
222 |
<enum>Qt::Vertical</enum> |
|
223 |
</property> |
|
224 |
</widget> |
|
225 |
</item> |
|
181 | 226 |
</layout> |
182 | 227 |
</item> |
183 | 228 |
</layout> |
내보내기 Unified diff