개정판 27479ed9
issue #000: extend offset range and fix symbol load
Change-Id: I383b0962f83bd62fe530beff5ca8da187fb5babf
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
28 | 28 |
self.ui.pushButtonImport.clicked.connect(self.importTextFromCAD) |
29 | 29 |
self.ui.pushButtonClose.clicked.connect(self.close) |
30 | 30 |
|
31 |
self.width = None |
|
31 | 32 |
self.height = None |
32 | 33 |
|
33 | 34 |
def addID2Click(self): |
... | ... | |
78 | 79 |
originXml = parse(xmlPath) |
79 | 80 |
textRoot = textXml.getroot() |
80 | 81 |
originRoot = originXml.getroot() |
82 |
self.width = int(originRoot.find('SIZE').text.split(',')[0]) |
|
81 | 83 |
self.height = int(originRoot.find('SIZE').text.split(',')[1]) |
82 | 84 |
|
83 | 85 |
textInfo = originRoot.find(xg.TEXT_INFO_LIST_NODE_NAME) |
... | ... | |
97 | 99 |
|
98 | 100 |
for textNode in textRoot.iter('Text'): |
99 | 101 |
node = self.toXml(textNode) |
100 |
textInfo.append(node) |
|
102 |
if node: |
|
103 |
textInfo.append(node) |
|
101 | 104 |
|
102 | 105 |
originXml.write(xmlPath, encoding="utf-8", xml_declaration=True) |
103 | 106 |
|
... | ... | |
130 | 133 |
height, width = width, height |
131 | 134 |
loc[0], loc[1] = loc[0] - width, loc[1] + height - width |
132 | 135 |
|
136 |
if loc[0] <= 0 or loc[1] <= 0 or width <= 0 or height <= 0: return None |
|
137 |
if loc[0] >= self.width or loc[1] >= self.height or loc[0] + width >= self.width or loc[1] + height >= self.height: return None |
|
138 |
|
|
133 | 139 |
node = Element('ATTRIBUTE') |
134 | 140 |
uidNode = Element('UID') |
135 | 141 |
uidNode.text = str(uuid.uuid4()) |
DTI_PID/DTI_PID/ImportTextFromCAD_UI.py | ||
---|---|---|
57 | 57 |
self.label_3.setObjectName("label_3") |
58 | 58 |
self.horizontalLayout_5.addWidget(self.label_3) |
59 | 59 |
self.doubleSpinBoxX = QtWidgets.QDoubleSpinBox(ImportTextFromCADDialog) |
60 |
self.doubleSpinBoxX.setMaximum(10000.0) |
|
60 |
self.doubleSpinBoxX.setMinimum(-100000.0) |
|
61 |
self.doubleSpinBoxX.setMaximum(100000.0) |
|
61 | 62 |
self.doubleSpinBoxX.setObjectName("doubleSpinBoxX") |
62 | 63 |
self.horizontalLayout_5.addWidget(self.doubleSpinBoxX) |
63 | 64 |
self.label_5 = QtWidgets.QLabel(ImportTextFromCADDialog) |
... | ... | |
65 | 66 |
self.label_5.setObjectName("label_5") |
66 | 67 |
self.horizontalLayout_5.addWidget(self.label_5) |
67 | 68 |
self.doubleSpinBoxY = QtWidgets.QDoubleSpinBox(ImportTextFromCADDialog) |
68 |
self.doubleSpinBoxY.setMaximum(10000.0) |
|
69 |
self.doubleSpinBoxY.setMinimum(-100000.0) |
|
70 |
self.doubleSpinBoxY.setMaximum(100000.0) |
|
69 | 71 |
self.doubleSpinBoxY.setObjectName("doubleSpinBoxY") |
70 | 72 |
self.horizontalLayout_5.addWidget(self.doubleSpinBoxY) |
71 | 73 |
self.label_4 = QtWidgets.QLabel(ImportTextFromCADDialog) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
782 | 782 |
try: |
783 | 783 |
self.onCommandRejected() |
784 | 784 |
dialog = QImportTextFromCADDialog(self) |
785 |
dialog.show() |
|
785 | 786 |
dialog.exec_() |
786 | 787 |
except Exception as ex: |
787 | 788 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
494 | 494 |
|
495 | 495 |
tooltip = '<b>{}</b><br>{}={}'.format(str(self.uid), self.type, self.name) |
496 | 496 |
self.setToolTip(tooltip) |
497 |
|
|
498 |
return True |
|
497 | 499 |
except Exception as ex: |
498 | 500 |
from App import App |
499 | 501 |
|
500 | 502 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
501 | 503 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
502 | 504 |
|
505 |
return False |
|
506 |
|
|
503 | 507 |
''' |
504 | 508 |
@brief return bounding box of symbol |
505 | 509 |
@author humkyung |
... | ... | |
1198 | 1202 |
if os.path.isfile(svgFilePath): |
1199 | 1203 |
item = SymbolSvgItem.createItem(_type, svgFilePath, uid, owner=owner, flip=flipLabel) |
1200 | 1204 |
item.setVisible(False) |
1201 |
item.buildItem(name, _type, angle, pt, size, origin, connPts, baseSymbol, childSymbol, hasInstrumentLabel, dbUid=dbUid) |
|
1205 |
if item.buildItem(name, _type, angle, pt, size, origin, connPts, baseSymbol, childSymbol, hasInstrumentLabel, dbUid=dbUid): |
|
1206 |
pass |
|
1207 |
else: |
|
1208 |
return None |
|
1202 | 1209 |
|
1203 | 1210 |
for prop_node in node.iter('PROPERTY'): |
1204 | 1211 |
matches = [prop for prop in item._properties.keys() if prop.Attribute == prop_node.attrib['Attribute']] |
... | ... | |
1266 | 1273 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
1267 | 1274 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1268 | 1275 |
|
1276 |
return None |
|
1277 |
|
|
1269 | 1278 |
return item |
1270 | 1279 |
|
1271 | 1280 |
''' |
DTI_PID/DTI_PID/UI/ImportTextFromCAD.ui | ||
---|---|---|
109 | 109 |
</item> |
110 | 110 |
<item> |
111 | 111 |
<widget class="QDoubleSpinBox" name="doubleSpinBoxX"> |
112 |
<property name="minimum"> |
|
113 |
<double>-100000.000000000000000</double> |
|
114 |
</property> |
|
112 | 115 |
<property name="maximum"> |
113 |
<double>10000.000000000000000</double> |
|
116 |
<double>100000.000000000000000</double>
|
|
114 | 117 |
</property> |
115 | 118 |
</widget> |
116 | 119 |
</item> |
... | ... | |
129 | 132 |
</item> |
130 | 133 |
<item> |
131 | 134 |
<widget class="QDoubleSpinBox" name="doubleSpinBoxY"> |
135 |
<property name="minimum"> |
|
136 |
<double>-100000.000000000000000</double> |
|
137 |
</property> |
|
132 | 138 |
<property name="maximum"> |
133 |
<double>10000.000000000000000</double> |
|
139 |
<double>100000.000000000000000</double>
|
|
134 | 140 |
</property> |
135 | 141 |
</widget> |
136 | 142 |
</item> |
내보내기 Unified diff