개정판 62762fec
revised issue #563: recognize value and reducer size
Change-Id: I158470900ac01abc43c8a8a8c924af59f03f3f0d
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
96 | 96 |
|
97 | 97 |
if type(item) is QEngineeringLineItem: |
98 | 98 |
self.initTitleCell(item) |
99 |
self.setItem(0, 3, QTableWidgetItem(str(item.uid))) |
|
100 |
|
|
101 |
""" show icon item """ |
|
102 |
attr = SymbolAttr() |
|
103 |
attr.AttributeType = "OWNER" |
|
104 |
self.show_icon_item(1, 2, attr) |
|
105 |
self.item(1, 1).setData(Qt.UserRole, attr) |
|
106 |
|
|
107 |
owner_item = QTableWidgetItem('{}'.format('None' if item.owner is None else str(item.owner))) |
|
108 |
self.setItem(1, 3, owner_item) |
|
109 |
|
|
110 |
pt = item.startPoint() |
|
111 |
key_item = QTableWidgetItem(self.tr("시작점")) |
|
112 |
key_item.setFlags(Qt.ItemIsEnabled) |
|
113 |
key_item.setBackground(Qt.lightGray) |
|
114 |
self.setItem(3, 1, key_item) |
|
115 |
self.setItem(3, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
|
116 |
pt = item.endPoint() |
|
117 |
key_item = QTableWidgetItem(self.tr("끝점")) |
|
118 |
key_item.setFlags(Qt.ItemIsEnabled) |
|
119 |
key_item.setBackground(Qt.lightGray) |
|
120 |
self.setItem(4, 1, key_item) |
|
121 |
self.setItem(4, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
|
122 |
self.show_item_connectors(item) |
|
99 |
self.initContentsCell() |
|
123 | 100 |
elif issubclass(type(item), SymbolSvgItem): |
124 | 101 |
self.onSymbolClicked(item) |
125 | 102 |
elif type(item) is QEngineeringLineNoTextItem: |
... | ... | |
510 | 487 |
from SymbolAttr import SymbolAttr |
511 | 488 |
|
512 | 489 |
try: |
513 |
if self._item is not None: |
|
490 |
if self._item is not None and issubclass(type(self._item), SymbolSvgItem):
|
|
514 | 491 |
docData = AppDocData.instance() |
515 | 492 |
|
516 | 493 |
self.setItem(0, 3, QTableWidgetItem(str(self._item.uid))) |
... | ... | |
555 | 532 |
for index in range(self.rowCount()): |
556 | 533 |
item = self.item(index, 3) |
557 | 534 |
if item is not None: item.setToolTip(item.text()) |
535 |
elif self._item is not None and type(self._item) is QEngineeringLineItem: |
|
536 |
self.setItem(0, 3, QTableWidgetItem(str(self._item.uid))) |
|
537 |
|
|
538 |
""" show icon item """ |
|
539 |
attr = SymbolAttr() |
|
540 |
attr.AttributeType = "OWNER" |
|
541 |
self.show_icon_item(1, 2, attr) |
|
542 |
self.item(1, 1).setData(Qt.UserRole, attr) |
|
543 |
|
|
544 |
owner_item = QTableWidgetItem('{}'.format('None' if self._item.owner is None else str(self._item.owner))) |
|
545 |
self.setItem(1, 3, owner_item) |
|
546 |
|
|
547 |
self.show_item_properties(self._item) |
|
548 |
|
|
549 |
pt = self._item.startPoint() |
|
550 |
key_item = QTableWidgetItem(self.tr("시작점")) |
|
551 |
key_item.setFlags(Qt.ItemIsEnabled) |
|
552 |
key_item.setBackground(Qt.lightGray) |
|
553 |
self.setItem(3, 1, key_item) |
|
554 |
self.setItem(3, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
|
555 |
pt = self._item.endPoint() |
|
556 |
key_item = QTableWidgetItem(self.tr("끝점")) |
|
557 |
key_item.setFlags(Qt.ItemIsEnabled) |
|
558 |
key_item.setBackground(Qt.lightGray) |
|
559 |
self.setItem(4, 1, key_item) |
|
560 |
self.setItem(4, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
|
561 |
|
|
562 |
self.show_item_connectors(self._item) |
|
558 | 563 |
else: |
559 | 564 |
self.setRowCount(0) |
560 | 565 |
except Exception as ex: |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1555 | 1555 |
elif type(item) is QEngineeringNoteItem: |
1556 | 1556 |
self.removedItems['NOTE'].append(str(item.uid)) |
1557 | 1557 |
|
1558 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'connectors') and [connector for connector in _item.connectors if connector.connectedItem is item]] |
|
1559 |
for matche in matches: |
|
1560 |
for connector in matche.connectors: |
|
1561 |
if connector.connectedItem is item: connector.connectedItem = None |
|
1562 |
|
|
1563 |
|
|
1564 |
""" |
|
1558 | 1565 |
if hasattr(item, 'connectors'): |
1559 | 1566 |
for sceneItem in self.graphicsView.scene.items(): |
1560 | 1567 |
if hasattr(sceneItem, 'connectors'): |
1561 | 1568 |
for sceneConnector in sceneItem.connectors: |
1562 | 1569 |
if sceneConnector.connectedItem is not None and item.uid == sceneConnector.connectedItem.uid: |
1563 | 1570 |
sceneConnector.connectedItem = None |
1571 |
""" |
|
1564 | 1572 |
|
1565 | 1573 |
if item.scene() is not None: item.scene().removeItem(item) |
1566 | 1574 |
except Exception as ex: |
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
179 | 179 |
self.update() |
180 | 180 |
|
181 | 181 |
""" set label positon at center of connector """ |
182 |
#self._label.setPos(QPointF(self._loc[0] - self._label.boundingRect().width()*0.5, self._loc[1] - self._label.boundingRect().height()*0.5)) |
|
183 | 182 |
self._label.setPos(QPointF(self._loc[0], self._loc[1])) |
184 | 183 |
|
185 | 184 |
def connect(self, item, at=QEngineeringAbstractItem.CONNECTED_AT_PT): |
... | ... | |
239 | 238 |
if self.scene() and self.scene().sceneRect().contains(self.sceneBoundingRect()): |
240 | 239 |
self.update() |
241 | 240 |
else: |
242 |
self.scene().update() |
|
241 |
if self.scene(): self.scene().update()
|
|
243 | 242 |
|
244 | 243 |
''' |
245 | 244 |
@brief |
... | ... | |
534 | 533 |
onRemoved = pyqtSignal(QGraphicsItem) |
535 | 534 |
|
536 | 535 |
def __init__(self, parent = None): |
537 |
QObject.__init__(self, parent) |
|
536 |
QObject.__init__(self, parent) |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
33 | 33 |
humkyung 2018.06.21 add vertices to parameter |
34 | 34 |
''' |
35 | 35 |
def __init__(self, vertices=[], thickness=None, parent=None, uid=None): |
36 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
37 | 36 |
import uuid |
37 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
38 |
from SymbolAttr import SymbolProp |
|
39 |
|
|
38 | 40 |
try: |
39 | 41 |
QGraphicsLineItem.__init__(self, parent) |
40 | 42 |
QEngineeringAbstractItem.__init__(self) |
... | ... | |
48 | 50 |
self._owner = None |
49 | 51 |
self._flowMark = None |
50 | 52 |
self._lineType = 'Primary' # defulat line type is 'Primary' |
53 |
self._properties = \ |
|
54 |
{\ |
|
55 |
SymbolProp(None, 'Size', 'Size Text Item', Expression='self.EvaluatedSize'):None\ |
|
56 |
} |
|
51 | 57 |
|
52 | 58 |
self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
53 | 59 |
|
... | ... | |
89 | 95 |
""" return string represent uuid """ |
90 | 96 |
return str(self.uid) |
91 | 97 |
|
98 |
@property |
|
99 |
def properties(self): |
|
100 |
""" getter of properties """ |
|
101 |
import uuid |
|
102 |
|
|
103 |
for prop,value in self._properties.items(): |
|
104 |
if prop.is_selectable and type(value) is uuid.UUID and self.scene(): |
|
105 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)] |
|
106 |
if matches: self._properties[prop] = matches[0] |
|
107 |
|
|
108 |
if prop.Expression: self._properties[prop] = eval(prop.Expression) |
|
109 |
|
|
110 |
return self._properties |
|
111 |
|
|
112 |
def set_property(self, property, value): |
|
113 |
""" set property with given value """ |
|
114 |
if issubclass(type(value), QEngineeringAbstractItem): self.add_assoc_item(value, 0) |
|
115 |
matches = [prop for prop,_ in self._properties.items() if prop.Attribute == property] |
|
116 |
if matches: self._properties[matches[0]] = value |
|
117 |
|
|
118 |
def prop(self, name): |
|
119 |
""" return the value of given property with name """ |
|
120 |
matches = [(prop,value) for prop,value in self.properties.items() if prop.Attribute == name] |
|
121 |
if matches: return matches[0][1] |
|
122 |
|
|
123 |
return None |
|
124 |
|
|
125 |
@property |
|
126 |
def Size(self): |
|
127 |
""" always return None """ |
|
128 |
return None |
|
129 |
|
|
130 |
@property |
|
131 |
def EvaluatedSize(self): |
|
132 |
from EngineeringReducerItem import QEngineeringReducerItem |
|
133 |
|
|
134 |
if self.Size: return self.Size |
|
135 |
if self.owner: |
|
136 |
matches = [run for run in self.owner.runs if self in run.items] |
|
137 |
if matches: |
|
138 |
at = matches[0].items.index(self) |
|
139 |
upstream = matches[0].items[:at] |
|
140 |
upstream.reverse() |
|
141 |
prev = self |
|
142 |
for item in upstream: |
|
143 |
if type(item) is QEngineeringReducerItem: |
|
144 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
145 |
if item.MainSize: return item.MainSize |
|
146 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
147 |
if item.SubSize: return item.SubSize |
|
148 |
else: |
|
149 |
if item.Size: return item.Size |
|
150 |
prev = item |
|
151 |
|
|
152 |
downstream = matches[0].items[at:] |
|
153 |
prev = self |
|
154 |
for item in downstream: |
|
155 |
if type(item) is QEngineeringReducerItem: |
|
156 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
157 |
if item.MainSize: return item.MainSize |
|
158 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
159 |
if item.SubSize: return item.SubSize |
|
160 |
else: |
|
161 |
if item.Size: return item.Size |
|
162 |
prev = item |
|
163 |
|
|
164 |
if 'Drain' == matches[0].Type: return "1'" |
|
165 |
|
|
166 |
return self.owner.Size |
|
167 |
|
|
168 |
return None |
|
169 |
|
|
92 | 170 |
''' |
93 | 171 |
@breif getter owner |
94 | 172 |
@author humkyung |
... | ... | |
1070 | 1148 |
try: |
1071 | 1149 |
uidNode = node.find('UID') |
1072 | 1150 |
uid = uidNode.text if uidNode is not None else uuid.uuid4() # generate UUID |
1073 |
owner = uuid.UUID(node.attrib['OWNER'], version=4) if 'OWNER' in node.attrib else None |
|
1151 |
owner = uuid.UUID(node.attrib['OWNER'], version=4) if 'OWNER' in node.attrib and node.attrib['OWNER'] != 'None' else None
|
|
1074 | 1152 |
|
1075 | 1153 |
startPoint = [float(x) for x in node.find('STARTPOINT').text.split(',')] |
1076 | 1154 |
endPoint = [float(x) for x in node.find('ENDPOINT').text.split(',')] |
DTI_PID/DTI_PID/Shapes/EngineeringReducerItem.py | ||
---|---|---|
73 | 73 |
super(QEngineeringReducerItem, self).connectAttribute(attributes) |
74 | 74 |
|
75 | 75 |
def getAttributes(self): |
76 |
""" |
|
77 |
get attributes of reducer |
|
78 |
""" |
|
76 |
""" get attributes of reducer """ |
|
79 | 77 |
|
80 | 78 |
_attrs = {} |
81 | 79 |
try: |
... | ... | |
110 | 108 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
111 | 109 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
112 | 110 |
|
113 |
return _attrs |
|
111 |
return _attrs |
|
112 |
|
|
113 |
def toSql(self): |
|
114 |
""" convert valve data to sql query """ |
|
115 |
import uuid |
|
116 |
from AppDocData import AppDocData |
|
117 |
|
|
118 |
res = [] |
|
119 |
appDocData = AppDocData.instance() |
|
120 |
|
|
121 |
cols = ['UID', 'ITEM_NO', 'MainSize', 'SubSize', 'PNID_NO'] |
|
122 |
values = ['?','?','?', '?', '?'] |
|
123 |
main_size = self.prop('MainSize') |
|
124 |
sub_size = self.prop('SubSize') |
|
125 |
param = [str(self.uid), self.name, main_size if main_size else '', sub_size if sub_size else '', appDocData.activeDrawing.name] |
|
126 |
sql = 'insert or replace into VALVE_DATA_LIST({}) values({})'.format(','.join(cols), ','.join(values)) |
|
127 |
res.append((sql, tuple(param))) |
|
128 |
|
|
129 |
_attrs = self.getAttributes() |
|
130 |
for key in _attrs.keys(): |
|
131 |
cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value'] |
|
132 |
values = ['?', '?', '?', '?'] |
|
133 |
param = [str(uuid.uuid4()), str(self.uid), str(key.UID), str(_attrs[key])] |
|
134 |
|
|
135 |
sql = 'insert or replace into Attributes({}) values({})'.format(','.join(cols), ','.join(values)) |
|
136 |
res.append((sql, tuple(param))) |
|
137 |
|
|
138 |
# save connectors to database |
|
139 |
for connector in self.connectors: |
|
140 |
res.append(connector.toSql()) |
|
141 |
# up to here |
|
142 |
|
|
143 |
return res |
DTI_PID/DTI_PID/Shapes/EngineeringRunItem.py | ||
---|---|---|
30 | 30 |
self.owner = None |
31 | 31 |
|
32 | 32 |
@property |
33 |
def Type(self): |
|
34 |
""" return type of run(Drain/Process) """ |
|
35 |
from SymbolSvgItem import SymbolSvgItem |
|
36 |
from EngineeringLineItem import QEngineeringLineItem |
|
37 |
|
|
38 |
if len(self._items) == 2: |
|
39 |
if 1 == len([item for item in self._items if type(item) is QEngineeringLineItem]) and\ |
|
40 |
1 == len([item for item in self._items if type(item) is SymbolSvgItem]): return 'Drain' |
|
41 |
|
|
42 |
return 'Process' |
|
43 |
|
|
44 |
@property |
|
33 | 45 |
def visible(self): |
34 | 46 |
""" return visible """ |
35 | 47 |
return self._visible |
... | ... | |
152 | 164 |
|
153 | 165 |
try: |
154 | 166 |
node = Element('RUN') |
167 |
node.attrib['TYPE'] = self.Type |
|
155 | 168 |
for item in self.items: |
156 | 169 |
# skip line item which's connected items are same |
157 | 170 |
if (type(item) is QEngineeringLineItem) and (item.connectors[0].connectedItem is item.connectors[1].connectedItem): |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
138 | 138 |
|
139 | 139 |
def set_property(self, property, value): |
140 | 140 |
""" set property with given value """ |
141 |
if hasattr(value, 'uid'): self.add_assoc_item(value, 0)
|
|
141 |
if issubclass(type(value), QEngineeringAbstractItem): self.add_assoc_item(value, 0)
|
|
142 | 142 |
matches = [prop for prop,_ in self._properties.items() if prop.Attribute == property] |
143 | 143 |
if matches: self._properties[matches[0]] = value |
144 | 144 |
|
... | ... | |
171 | 171 |
|
172 | 172 |
@property |
173 | 173 |
def EvaluatedSize(self): |
174 |
size = self.Size |
|
175 |
return size if size else self.owner.Size if self.owner else None |
|
174 |
from EngineeringReducerItem import QEngineeringReducerItem |
|
175 |
|
|
176 |
if self.Size: return self.Size |
|
177 |
if self.owner: |
|
178 |
matches = [run for run in self.owner.runs if self in run.items] |
|
179 |
if matches: |
|
180 |
at = matches[0].items.index(self) |
|
181 |
upstream = matches[0].items[:at] |
|
182 |
upstream.reverse() |
|
183 |
prev = self |
|
184 |
for item in upstream: |
|
185 |
if type(item) is QEngineeringReducerItem: |
|
186 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
187 |
if item.MainSize: return item.MainSize |
|
188 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
189 |
if item.SubSize: return item.SubSize |
|
190 |
else: |
|
191 |
if item.Size: return item.Size |
|
192 |
prev = item |
|
193 |
|
|
194 |
downstream = matches[0].items[at:] |
|
195 |
prev = self |
|
196 |
for item in downstream: |
|
197 |
if type(item) is QEngineeringReducerItem: |
|
198 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
199 |
if item.MainSize: return item.MainSize |
|
200 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
201 |
if item.SubSize: return item.SubSize |
|
202 |
else: |
|
203 |
if item.Size: return item.Size |
|
204 |
prev = item |
|
205 |
|
|
206 |
if 'Drain' == matches[0].Type: return "1'" |
|
207 |
|
|
208 |
return self.owner.Size |
|
209 |
|
|
210 |
return None |
|
176 | 211 |
|
177 | 212 |
def validate(self): |
178 | 213 |
''' |
... | ... | |
287 | 322 |
res = [] |
288 | 323 |
appDocData = AppDocData.instance() |
289 | 324 |
|
290 |
cols = ['UID', 'ITEM_NO', 'PNID_NO'] |
|
291 |
values = ['?','?','?'] |
|
292 |
param = [str(self.uid), self.name, appDocData.activeDrawing.name] |
|
325 |
cols = ['UID', 'ITEM_NO', 'MainSize', 'SubSize', 'PNID_NO'] |
|
326 |
values = ['?','?','?', '?', '?'] |
|
327 |
size = self.prop('Size') |
|
328 |
param = [str(self.uid), self.name, size if size else '', size if size else '', appDocData.activeDrawing.name] |
|
293 | 329 |
sql = 'insert or replace into VALVE_DATA_LIST({}) values({})'.format(','.join(cols), ','.join(values)) |
294 | 330 |
res.append((sql, tuple(param))) |
295 | 331 |
|
DTI_PID/DTI_PID/SymbolEditorDialog.py | ||
---|---|---|
221 | 221 |
2018.07.04 Yecheol Remove is Symbol ID(idLineEdit) |
222 | 222 |
''' |
223 | 223 |
def initContents(self): |
224 |
if self.selectedSymbol is not None: |
|
225 |
self.ui.immediateInsertCheckBox.setDisabled(True) |
|
226 |
|
|
227 |
self.ui.nameLineEdit.setText(self.selectedSymbol.getName()) |
|
228 |
self.ui.thresholdLineEdit.setText(str(int(self.selectedSymbol.getThreshold() * 100))) |
|
229 |
self.ui.minMatchPointLineEdit.setText(str(self.selectedSymbol.getMinMatchCount())) |
|
230 |
self.ui.rotationCountSpinBox.setValue(self.selectedSymbol.getRotationCount()) |
|
231 |
self.ui.isContainChildCheckBox.setChecked(True if self.selectedSymbol.getIsContainChild() else False) |
|
232 |
self.ui.typeComboBox.setCurrentIndex(self.ui.typeComboBox.findText(self.selectedSymbol.getType())) |
|
233 |
self.ui.baseSymbolComboBox.setCurrentIndex(self.ui.baseSymbolComboBox.findText(self.selectedSymbol.getBaseSymbol())) |
|
234 |
self.ui.isExceptDetectCheckBox.setChecked(True if self.selectedSymbol.getIsExceptDetect() else False) |
|
235 |
self.ui.makeFlipCheckBox.setChecked(True if self.selectedSymbol.getDetectFlip() else False) |
|
236 |
|
|
237 |
self.ui.hasInstrumentLabelCheckBox.setChecked(True if self.selectedSymbol.getHasInstrumentLabel() else False) |
|
238 |
|
|
239 |
additionalSymbol = self.selectedSymbol.getAdditionalSymbol() |
|
240 |
if additionalSymbol is not None and len(additionalSymbol) > 0: |
|
241 |
splitAdditionalSymbolList = additionalSymbol.split("/") |
|
242 |
for symString in splitAdditionalSymbolList: |
|
243 |
splitSymString = symString.split(",") |
|
244 |
self.addAdditionalSymbol(splitSymString[0], splitSymString[1]) |
|
245 |
|
|
246 |
originalPoint = self.selectedSymbol.getOriginalPoint() |
|
247 |
self.ui.originalPointLineEdit.setText(originalPoint) |
|
248 |
OriginalPointCommand.OriginalPointCommand.drawCircle(self.ui.imageView, originalPoint.split(",")[0], originalPoint.split(",")[1]) |
|
249 |
self.ui.imageView.isOriginalPointSelected = True |
|
250 |
|
|
251 |
connectionPoint = self.selectedSymbol.getConnectionPoint() |
|
252 |
if connectionPoint is not None and len(connectionPoint) > 0: |
|
253 |
splitConnectionPointList = connectionPoint.split("/") |
|
254 |
symbol_indecies = [str(idx) for idx in range(self.ui.additionalSymbolListWidget.count()+1)] |
|
255 |
|
|
256 |
self.ui.tableWidgetConnList.setRowCount(len(splitConnectionPointList)) |
|
257 |
row = 0 |
|
258 |
for conString in splitConnectionPointList: # conString : x,y |
|
259 |
direction = 'AUTO' |
|
260 |
symbol_idx = '0' |
|
261 |
tokens = conString.split(',') |
|
262 |
if len(tokens) == 4: |
|
263 |
direction = tokens[0] |
|
264 |
x = tokens[1] |
|
265 |
y = tokens[2] |
|
266 |
symbol_idx = tokens[3] |
|
267 |
if len(tokens) == 3: |
|
268 |
direction = tokens[0] |
|
269 |
x = tokens[1] |
|
270 |
y = tokens[2] |
|
271 |
elif len(tokens) == 2: |
|
272 |
x = tokens[0] |
|
273 |
y = tokens[1] |
|
274 |
|
|
275 |
conn = ConnectionPointCommand.ConnectionPointCommand.drawCircle(self.ui.imageView, x, y) |
|
276 |
|
|
277 |
item = QTableWidgetItem('{},{}'.format(x, y)) |
|
278 |
item.setFlags(Qt.ItemIsEnabled) |
|
279 |
item.setData(Qt.UserRole, conn) |
|
280 |
self.ui.tableWidgetConnList.setItem(row, 0, item) |
|
281 |
|
|
282 |
directionComboBox = QComboBox(self.ui.tableWidgetConnList) |
|
283 |
directionComboBox.addItems(['AUTO', 'LEFT', 'RIGHT', 'UP', 'DOWN']) |
|
284 |
directionComboBox.setCurrentText(direction) |
|
285 |
self.ui.tableWidgetConnList.setCellWidget(row, 1, directionComboBox) |
|
286 |
|
|
287 |
# add symbol index combobox - 2019.01.04 added by humkyung |
|
288 |
symbol_idx_combobox = QComboBox(self.ui.tableWidgetConnList) |
|
289 |
symbol_idx_combobox.addItems(symbol_indecies) |
|
290 |
if symbol_idx in symbol_indecies: |
|
291 |
symbol_idx_combobox.setCurrentText(symbol_idx) |
|
292 |
else: |
|
293 |
symbol_idx_combobox.setCurrentText('0') |
|
294 |
self.ui.tableWidgetConnList.setCellWidget(row, 2, symbol_idx_combobox) |
|
295 |
# up to here |
|
296 |
|
|
297 |
row = row + 1 |
|
224 |
try: |
|
225 |
if self.selectedSymbol is not None: |
|
226 |
self.ui.immediateInsertCheckBox.setDisabled(True) |
|
227 |
|
|
228 |
self.ui.nameLineEdit.setText(self.selectedSymbol.getName()) |
|
229 |
self.ui.thresholdLineEdit.setText(str(int(self.selectedSymbol.getThreshold() * 100))) |
|
230 |
self.ui.minMatchPointLineEdit.setText(str(self.selectedSymbol.getMinMatchCount())) |
|
231 |
self.ui.rotationCountSpinBox.setValue(self.selectedSymbol.getRotationCount()) |
|
232 |
self.ui.isContainChildCheckBox.setChecked(True if self.selectedSymbol.getIsContainChild() else False) |
|
233 |
self.ui.typeComboBox.setCurrentIndex(self.ui.typeComboBox.findText(self.selectedSymbol.getType())) |
|
234 |
self.ui.baseSymbolComboBox.setCurrentIndex(self.ui.baseSymbolComboBox.findText(self.selectedSymbol.getBaseSymbol())) |
|
235 |
self.ui.isExceptDetectCheckBox.setChecked(True if self.selectedSymbol.getIsExceptDetect() else False) |
|
236 |
self.ui.makeFlipCheckBox.setChecked(True if self.selectedSymbol.getDetectFlip() else False) |
|
237 |
|
|
238 |
self.ui.hasInstrumentLabelCheckBox.setChecked(True if self.selectedSymbol.getHasInstrumentLabel() else False) |
|
239 |
|
|
240 |
additionalSymbol = self.selectedSymbol.getAdditionalSymbol() |
|
241 |
if additionalSymbol is not None and len(additionalSymbol) > 0: |
|
242 |
splitAdditionalSymbolList = additionalSymbol.split("/") |
|
243 |
for symString in splitAdditionalSymbolList: |
|
244 |
splitSymString = symString.split(",") |
|
245 |
self.addAdditionalSymbol(splitSymString[0], splitSymString[1]) |
|
246 |
|
|
247 |
originalPoint = self.selectedSymbol.getOriginalPoint() |
|
248 |
self.ui.originalPointLineEdit.setText(originalPoint) |
|
249 |
OriginalPointCommand.OriginalPointCommand.drawCircle(self.ui.imageView, originalPoint.split(",")[0], originalPoint.split(",")[1]) |
|
250 |
self.ui.imageView.isOriginalPointSelected = True |
|
251 |
|
|
252 |
connectionPoint = self.selectedSymbol.getConnectionPoint() |
|
253 |
if connectionPoint is not None and len(connectionPoint) > 0: |
|
254 |
splitConnectionPointList = connectionPoint.split("/") |
|
255 |
symbol_indecies = [str(idx) for idx in range(self.ui.additionalSymbolListWidget.count()+1)] |
|
256 |
|
|
257 |
self.ui.tableWidgetConnList.setRowCount(len(splitConnectionPointList)) |
|
258 |
row = 0 |
|
259 |
for conString in splitConnectionPointList: # conString : x,y |
|
260 |
direction = 'AUTO' |
|
261 |
symbol_idx = '0' |
|
262 |
tokens = conString.split(',') |
|
263 |
if len(tokens) == 4: |
|
264 |
direction = tokens[0] |
|
265 |
x = tokens[1] |
|
266 |
y = tokens[2] |
|
267 |
symbol_idx = tokens[3] |
|
268 |
if len(tokens) == 3: |
|
269 |
direction = tokens[0] |
|
270 |
x = tokens[1] |
|
271 |
y = tokens[2] |
|
272 |
elif len(tokens) == 2: |
|
273 |
x = tokens[0] |
|
274 |
y = tokens[1] |
|
275 |
|
|
276 |
conn = ConnectionPointCommand.ConnectionPointCommand.drawCircle(self.ui.imageView, x, y) |
|
277 |
|
|
278 |
item = QTableWidgetItem('{},{}'.format(x, y)) |
|
279 |
item.setFlags(Qt.ItemIsEnabled) |
|
280 |
item.setData(Qt.UserRole, conn) |
|
281 |
self.ui.tableWidgetConnList.setItem(row, 0, item) |
|
282 |
|
|
283 |
directionComboBox = QComboBox(self.ui.tableWidgetConnList) |
|
284 |
directionComboBox.addItems(['AUTO', 'LEFT', 'RIGHT', 'UP', 'DOWN']) |
|
285 |
directionComboBox.setCurrentText(direction) |
|
286 |
self.ui.tableWidgetConnList.setCellWidget(row, 1, directionComboBox) |
|
287 |
|
|
288 |
# add symbol index combobox - 2019.01.04 added by humkyung |
|
289 |
symbol_idx_combobox = QComboBox(self.ui.tableWidgetConnList) |
|
290 |
symbol_idx_combobox.addItems(symbol_indecies) |
|
291 |
if symbol_idx in symbol_indecies: |
|
292 |
symbol_idx_combobox.setCurrentText(symbol_idx) |
|
293 |
else: |
|
294 |
symbol_idx_combobox.setCurrentText('0') |
|
295 |
self.ui.tableWidgetConnList.setCellWidget(row, 2, symbol_idx_combobox) |
|
296 |
# up to here |
|
297 |
|
|
298 |
row = row + 1 |
|
299 |
|
|
300 |
self.ui.tableWidgetConnList.resizeColumnsToContents() |
|
301 |
else: |
|
302 |
self.ui.minMatchPointLineEdit.setText('0') |
|
303 |
except Exception as ex: |
|
304 |
from App import App |
|
298 | 305 |
|
299 |
self.ui.tableWidgetConnList.resizeColumnsToContents() |
|
300 |
else: |
|
301 |
self.ui.minMatchPointLineEdit.setText('0') |
|
306 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
307 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
302 | 308 |
|
303 | 309 |
''' |
304 | 310 |
@brief Init ComboBox Items For Direction of DB Field [additionalSymbol] |
내보내기 Unified diff