개정판 842c72ff
symbol registration
Change-Id: Ie2bd412ae41227cf76199302c0f8231d249d4b8d
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1799 | 1799 |
else: |
1800 | 1800 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount, |
1801 | 1801 |
a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,a.BaseSymbol,a.AdditionalSymbol, |
1802 |
a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a |
|
1802 |
a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.TextArea,b.UID as DB_UID FROM Symbol a
|
|
1803 | 1803 |
inner join SymbolType b on a.SymbolType_UID=b.UID""" |
1804 | 1804 |
try: |
1805 | 1805 |
cursor.execute(sql, (param,)) if param is not None else cursor.execute(sql) |
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
362 | 362 |
child_index = model.index(child_row, 0, category_index) |
363 | 363 |
id2_symbol_item = model.itemFromIndex(child_index) |
364 | 364 |
id2_symbol_uid = id2_symbol_item.data(Qt.UserRole) |
365 |
cad_symbol_list = [(symbol if '+' not in symbol else symbol.split('+')[0], symbol) for symbol in self._symbol_types]
|
|
366 |
matches = [cad_symbol for cad_symbol in cad_symbol_list if cad_symbol[0] == id2_symbol_item.text()]
|
|
365 |
cad_symbol_list = [(symbol if '+' not in symbol else symbol.split('+')[1], symbol) for symbol in self._symbol_types]
|
|
366 |
matches = [cad_symbol for cad_symbol in cad_symbol_list if cad_symbol[0].upper() == id2_symbol_item.text().upper()]
|
|
367 | 367 |
if matches: |
368 | 368 |
row_index.insert(0, [row, child_row, matches[0][1], id2_symbol_uid, id2_symbol_item]) |
369 | 369 |
|
DTI_PID/DTI_PID/SymbolRegiDataListDialog.py | ||
---|---|---|
46 | 46 |
# connect signals and slots |
47 | 47 |
self.ui.tableWidget.cellDoubleClicked.connect(self.listCellDoubleClicked) |
48 | 48 |
self.ui.pushButtonEdit.clicked.connect(self.pushButtonEditClicked) |
49 |
self.ui.pushButtonCreateAll.clicked.connect(self.pushButtonCreateAllClicked) |
|
49 | 50 |
|
50 | 51 |
self.ui.tableWidget.verticalHeader().setDefaultSectionSize(60) |
51 | 52 |
self.ui.tableWidget.setRowCount(len(self.symbolInfos)) |
52 | 53 |
self.ui.tableWidget.keyPressEvent = self.keyPressEvent |
54 |
|
|
55 |
app_doc_data = AppDocData.instance() |
|
56 |
self.symbolList = app_doc_data.getSymbolListByType() |
|
57 |
self.symbolList = [_sym.getName().upper() for _sym in self.symbolList] |
|
53 | 58 |
|
54 | 59 |
row = 0 |
55 | 60 |
for key, symbolInfo in self.symbolInfos.items(): |
56 | 61 |
imageWidget = QTableWidgetItem() |
57 |
symbolImage = self.image.copy(math.floor(symbolInfo[2][0]), math.floor(symbolInfo[2][1]), math.ceil(symbolInfo[3] + 1), math.ceil(symbolInfo[4] + 1))
|
|
62 |
symbolImage = self.image.copy(round(symbolInfo[2][0]), round(symbolInfo[2][1]), math.ceil(symbolInfo[3] + 2), math.ceil(symbolInfo[4] + 1))
|
|
58 | 63 |
|
59 | 64 |
symbolImage = symbolImage.scaled(500, 60, Qt.KeepAspectRatio, Qt.SmoothTransformation) |
60 | 65 |
imageWidget.setData(Qt.DecorationRole, symbolImage) |
... | ... | |
63 | 68 |
textWidget = QTableWidgetItem(str(symbolInfo)) |
64 | 69 |
textWidget.tag = symbolInfo |
65 | 70 |
self.ui.tableWidget.setItem(row, 1, textWidget) |
71 |
|
|
72 |
_name = symbolInfo[0] if '+' not in symbolInfo[0] else symbolInfo[0].split('+')[1] |
|
73 |
_state = 'New' |
|
74 |
_condition = True |
|
75 |
if _name.upper() in self.symbolList: |
|
76 |
_state = 'Created' |
|
77 |
_condition = False |
|
78 |
|
|
66 | 79 |
font = QFont('Consolas', 15, QFont.Bold) |
67 |
text_edit = SpellTextEdit(str(symbolInfo)) |
|
80 |
text_edit = SpellTextEdit(_name + ' : ' + _state) |
|
81 |
text_edit.tag = symbolInfo |
|
68 | 82 |
text_edit.setFont(font) |
69 | 83 |
text_edit.setEnabled(False) |
70 | 84 |
self.ui.tableWidget.setCellWidget(row, 1, text_edit) |
71 | 85 |
|
72 | 86 |
item = QTableWidgetItem() |
73 |
item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) |
|
87 |
if _condition: |
|
88 |
item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) |
|
89 |
else: |
|
90 |
item.setFlags(Qt.ItemIsUserCheckable) |
|
74 | 91 |
item.setCheckState(Qt.Unchecked) |
75 | 92 |
self.ui.tableWidget.setItem(row, 2, item) |
76 | 93 |
|
77 | 94 |
row = row + 1 |
78 | 95 |
|
96 |
def pushButtonCreateAllClicked(self): |
|
97 |
target = [] |
|
98 |
for row in range(self.ui.tableWidget.rowCount()): |
|
99 |
if int(self.ui.tableWidget.item(row, 2).checkState()) is int(Qt.Checked): |
|
100 |
self.target.append(str(self.ui.tableWidget.item(row, 1).tag)) |
|
101 |
|
|
102 |
|
|
103 |
|
|
79 | 104 |
def listCellDoubleClicked(self, row, col): |
80 | 105 |
self.pushButtonEditClicked(row, col) |
81 | 106 |
|
82 | 107 |
def pushButtonEditClicked(self, row=None, col=None): |
83 | 108 |
try: |
84 |
if not row: |
|
85 |
row = self.ui.tableWidget.selectedIndexes()[0].row() |
|
86 | 109 |
col = 1 |
87 | 110 |
symbolItem = self.ui.tableWidget.item(row, col).tag |
88 | 111 |
|
89 |
symbolEditorDialog = QSymbolEditorDialog(self, self.image.copy(math.floor(symbolItem[2][0]), math.floor(symbolItem[2][1]), \
|
|
90 |
math.ceil(symbolItem[3] + 1), math.ceil(symbolItem[4] + 1)), \
|
|
112 |
symbolEditorDialog = QSymbolEditorDialog(self, self.image.copy(round(symbolItem[2][0]), round(symbolItem[2][1]), \
|
|
113 |
math.ceil(symbolItem[3] + 2), math.ceil(symbolItem[4] + 1)), \
|
|
91 | 114 |
AppDocData.instance().getCurrentProject(), symbolItem[1], False) |
92 | 115 |
(isAccepted, _, _, _, _) = symbolEditorDialog.showDialog() |
93 | 116 |
if isAccepted: |
94 | 117 |
self.isAccepted = True |
118 |
self.ui.tableWidget.item(row, col + 1).setCheckState(Qt.Unchecked) |
|
119 |
self.ui.tableWidget.item(row, col + 1).setFlags(Qt.ItemIsUserCheckable) |
|
120 |
self.ui.tableWidget.cellWidget(row, col).setPlainText(self.ui.tableWidget.cellWidget(row, col).toPlainText().replace('New', 'Created')) |
|
95 | 121 |
|
96 | 122 |
except Exception as ex: |
97 | 123 |
from App import App |
DTI_PID/DTI_PID/SymbolRegiDataList_UI.py | ||
---|---|---|
24 | 24 |
self.pushButtonEdit.setFocusPolicy(QtCore.Qt.NoFocus) |
25 | 25 |
self.pushButtonEdit.setObjectName("pushButtonEdit") |
26 | 26 |
self.horizontalLayout.addWidget(self.pushButtonEdit) |
27 |
self.pushButtonCreateAll = QtWidgets.QPushButton(SymbolRegiDataList) |
|
28 |
self.pushButtonCreateAll.setObjectName("pushButtonCreateAll") |
|
29 |
self.horizontalLayout.addWidget(self.pushButtonCreateAll) |
|
27 | 30 |
self.verticalLayout.addLayout(self.horizontalLayout) |
28 | 31 |
self.tableWidget = QtWidgets.QTableWidget(SymbolRegiDataList) |
29 | 32 |
self.tableWidget.setObjectName("tableWidget") |
... | ... | |
53 | 56 |
_translate = QtCore.QCoreApplication.translate |
54 | 57 |
SymbolRegiDataList.setWindowTitle(_translate("SymbolRegiDataList", "Symbol Registration")) |
55 | 58 |
self.pushButtonEdit.setText(_translate("SymbolRegiDataList", "Create")) |
59 |
self.pushButtonCreateAll.setText(_translate("SymbolRegiDataList", "Create All")) |
|
56 | 60 |
item = self.tableWidget.horizontalHeaderItem(0) |
57 | 61 |
item.setText(_translate("SymbolRegiDataList", "No.")) |
58 | 62 |
item = self.tableWidget.horizontalHeaderItem(1) |
DTI_PID/DTI_PID/TextDataListDialog.py | ||
---|---|---|
85 | 85 |
|
86 | 86 |
def pushButtonEditClicked(self, row=None, col=None): |
87 | 87 |
try: |
88 |
if not row: |
|
89 |
row = self.ui.tableWidget.selectedIndexes()[0].row() |
|
90 | 88 |
col = 1 |
91 | 89 |
textItem = self.ui.tableWidget.item(row, col).tag |
92 |
except Exception as ex: |
|
93 |
return |
|
94 | 90 |
|
95 |
try: |
|
96 | 91 |
if self.integrityCheck(textItem): |
97 | 92 |
newTextItem = textItem.edit_text() |
98 | 93 |
if newTextItem is not None: |
... | ... | |
105 | 100 |
from AppDocData import MessageType |
106 | 101 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
107 | 102 |
sys.exc_info()[-1].tb_lineno) |
108 |
print(message) |
|
109 | 103 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
110 | 104 |
|
111 | 105 |
def integrityCheck(self, textItem): |
DTI_PID/DTI_PID/UI/SymbolRegiDataList.ui | ||
---|---|---|
41 | 41 |
</property> |
42 | 42 |
</widget> |
43 | 43 |
</item> |
44 |
<item> |
|
45 |
<widget class="QPushButton" name="pushButtonCreateAll"> |
|
46 |
<property name="text"> |
|
47 |
<string>Create All</string> |
|
48 |
</property> |
|
49 |
</widget> |
|
50 |
</item> |
|
44 | 51 |
</layout> |
45 | 52 |
</item> |
46 | 53 |
<item> |
내보내기 Unified diff