개정판 a13021e5
issue #563: move function and fix icon
Change-Id: If53030530ced912d0e363515dc0bc0fb0e38f4fe
DTI_PID/DTI_PID/OcrResultDialog_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file '.\UI\OcrResultDialog.ui'
|
|
3 |
# Form implementation generated from reading ui file './UI/OcrResultDialog.ui'
|
|
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.13.1
|
|
5 |
# Created by: PyQt5 UI code generator 5.11.3
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 |
|
9 |
|
|
10 | 9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
11 | 10 |
|
12 |
|
|
13 | 11 |
class Ui_Dialog(object): |
14 | 12 |
def setupUi(self, Dialog): |
15 | 13 |
Dialog.setObjectName("Dialog") |
... | ... | |
68 | 66 |
self.clockPushButton_2.setMaximumSize(QtCore.QSize(60, 16777215)) |
69 | 67 |
self.clockPushButton_2.setText("") |
70 | 68 |
icon2 = QtGui.QIcon() |
71 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Rotate_Plus.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
69 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Rotate_Plus.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
72 | 70 |
self.clockPushButton_2.setIcon(icon2) |
73 | 71 |
self.clockPushButton_2.setIconSize(QtCore.QSize(32, 32)) |
74 | 72 |
self.clockPushButton_2.setObjectName("clockPushButton_2") |
... | ... | |
158 | 156 |
self.pushButtonCopyHori.setText(_translate("Dialog", "Copy")) |
159 | 157 |
self.checkBoxSeperate.setText(_translate("Dialog", "Seperate")) |
160 | 158 |
self.pushButtonMakeTrainingImage.setText(_translate("Dialog", "Save OCR Training Image")) |
159 |
|
|
161 | 160 |
import MainWindow_rc |
161 |
|
|
162 |
if __name__ == "__main__": |
|
163 |
import sys |
|
164 |
app = QtWidgets.QApplication(sys.argv) |
|
165 |
Dialog = QtWidgets.QDialog() |
|
166 |
ui = Ui_Dialog() |
|
167 |
ui.setupUi(Dialog) |
|
168 |
Dialog.show() |
|
169 |
sys.exit(app.exec_()) |
|
170 |
|
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
241 | 241 |
|
242 | 242 |
return res |
243 | 243 |
|
244 |
@property |
|
245 |
def Size(self): |
|
246 |
""" return symbol's size """ |
|
247 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
|
248 |
|
|
249 |
matches = [assoc for assoc in self.associations() if type(assoc) is QEngineeringSizeTextItem] |
|
250 |
if matches: |
|
251 |
return matches[0].mainSize |
|
252 |
else: |
|
253 |
return None |
|
254 |
|
|
255 |
@property |
|
256 |
def EvaluatedSize(self): |
|
257 |
from EngineeringReducerItem import QEngineeringReducerItem |
|
258 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
259 |
|
|
260 |
try: |
|
261 |
if self.Size: return self.Size |
|
262 |
if self.owner and issubclass(type(self.owner), QEngineeringLineNoTextItem): |
|
263 |
matches = [run for run in self.owner.runs if self in run.items] |
|
264 |
if matches: |
|
265 |
at = matches[0].items.index(self) |
|
266 |
upstream = matches[0].items[:at] |
|
267 |
upstream.reverse() |
|
268 |
prev = self |
|
269 |
for item in upstream: |
|
270 |
if type(item) is QEngineeringReducerItem: |
|
271 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
272 |
if item.mainSubSize: return item.mainSubSize[0] |
|
273 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
274 |
if item.mainSubSize: return item.mainSubSize[1] |
|
275 |
else: |
|
276 |
if item.Size: return item.Size |
|
277 |
prev = item |
|
278 |
|
|
279 |
downstream = matches[0].items[at:] |
|
280 |
prev = self |
|
281 |
for item in downstream: |
|
282 |
if type(item) is QEngineeringReducerItem: |
|
283 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
284 |
if item.mainSubSize: return item.mainSubSize[0] |
|
285 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
286 |
if item.mainSubSize: return item.mainSubSize[1] |
|
287 |
else: |
|
288 |
if item.Size: return item.Size |
|
289 |
prev = item |
|
290 |
|
|
291 |
if 'Drain' == matches[0].Type: return AppDocData.instance().drain_size |
|
292 |
|
|
293 |
return self.owner.Size |
|
294 |
|
|
295 |
return None |
|
296 |
except Exception as ex: |
|
297 |
from App import App |
|
298 |
from AppDocData import MessageType |
|
299 |
|
|
300 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
301 |
sys.exc_info()[-1].tb_lineno) |
|
302 |
App.mainWnd().addMessage.emit(MessageType.Error, str(self.uid) + self.name + message) |
|
303 |
|
|
304 |
def EvaluatedLineNo(self, prop): |
|
305 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
306 |
|
|
307 |
if self.owner and type(self.owner) is QEngineeringLineNoTextItem: |
|
308 |
attrs = self.owner.getAttributes() |
|
309 |
for attr, value in attrs.items(): |
|
310 |
if prop == attr.Attribute: |
|
311 |
return value |
|
312 |
|
|
313 |
return None |
|
314 |
|
|
244 | 315 |
def getAttributes(self, findOwner=False): |
245 | 316 |
"""calculate all attributes of item""" |
246 | 317 |
import re |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
112 | 112 |
return tooltip |
113 | 113 |
|
114 | 114 |
@property |
115 |
def Size(self): |
|
116 |
""" always return None """ |
|
117 |
return None |
|
118 |
|
|
119 |
@property |
|
120 | 115 |
def symbolOrigin(self): |
121 | 116 |
# return center point like symbol |
122 | 117 |
return [self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()] |
... | ... | |
128 | 123 |
|
129 | 124 |
@property |
130 | 125 |
def flip(self): |
131 |
# return 0 |
|
132 | 126 |
return 0 |
133 | 127 |
|
134 |
@property |
|
135 |
def EvaluatedSize(self): |
|
136 |
from EngineeringReducerItem import QEngineeringReducerItem |
|
137 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
138 |
|
|
139 |
if self.Size: return self.Size |
|
140 |
if self.owner and issubclass(type(self.owner), QEngineeringLineNoTextItem): |
|
141 |
matches = [run for run in self.owner.runs if self in run.items] |
|
142 |
if matches: |
|
143 |
at = matches[0].items.index(self) |
|
144 |
upstream = matches[0].items[:at] |
|
145 |
upstream.reverse() |
|
146 |
prev = self |
|
147 |
for item in upstream: |
|
148 |
if type(item) is QEngineeringReducerItem: |
|
149 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
150 |
if item.mainSubSize: return item.mainSubSize[0] |
|
151 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
152 |
if item.mainSubSize: return item.mainSubSize[1] |
|
153 |
else: |
|
154 |
if item.Size: return item.Size |
|
155 |
prev = item |
|
156 |
|
|
157 |
downstream = matches[0].items[at:] |
|
158 |
prev = self |
|
159 |
for item in downstream: |
|
160 |
if type(item) is QEngineeringReducerItem: |
|
161 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
162 |
if item.mainSubSize: return item.mainSubSize[0] |
|
163 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
164 |
if item.mainSubSize: return item.mainSubSize[1] |
|
165 |
else: |
|
166 |
if item.Size: return item.Size |
|
167 |
prev = item |
|
168 |
|
|
169 |
if 'Drain' == matches[0].Type: |
|
170 |
from AppDocData import AppDocData |
|
171 |
return AppDocData.instance().drain_size |
|
172 |
|
|
173 |
return self.owner.Size |
|
174 |
|
|
175 |
return None |
|
176 |
|
|
177 | 128 |
''' |
178 | 129 |
@breif getter owner |
179 | 130 |
@author humkyung |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
194 | 194 |
else: |
195 | 195 |
self.attrs[attr] = '' |
196 | 196 |
|
197 |
@property |
|
198 |
def Size(self): |
|
199 |
""" return symbol's size """ |
|
200 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
|
201 |
|
|
202 |
matches = [assoc for assoc in self.associations() if type(assoc) is QEngineeringSizeTextItem] |
|
203 |
if matches: |
|
204 |
return matches[0].mainSize |
|
205 |
else: |
|
206 |
return None |
|
207 |
|
|
208 |
@property |
|
209 |
def EvaluatedSize(self): |
|
210 |
from EngineeringReducerItem import QEngineeringReducerItem |
|
211 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
212 |
|
|
213 |
try: |
|
214 |
if self.Size: return self.Size |
|
215 |
if self.owner and issubclass(type(self.owner), QEngineeringLineNoTextItem): |
|
216 |
matches = [run for run in self.owner.runs if self in run.items] |
|
217 |
if matches: |
|
218 |
at = matches[0].items.index(self) |
|
219 |
upstream = matches[0].items[:at] |
|
220 |
upstream.reverse() |
|
221 |
prev = self |
|
222 |
for item in upstream: |
|
223 |
if type(item) is QEngineeringReducerItem: |
|
224 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
225 |
if item.mainSubSize: return item.mainSubSize[0] |
|
226 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
227 |
if item.mainSubSize: return item.mainSubSize[1] |
|
228 |
else: |
|
229 |
if item.Size: return item.Size |
|
230 |
prev = item |
|
231 |
|
|
232 |
downstream = matches[0].items[at:] |
|
233 |
prev = self |
|
234 |
for item in downstream: |
|
235 |
if type(item) is QEngineeringReducerItem: |
|
236 |
if item.connectors[0].connectedItem is prev: ### Main Size |
|
237 |
if item.mainSubSize: return item.mainSubSize[0] |
|
238 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
|
239 |
if item.mainSubSize: return item.mainSubSize[1] |
|
240 |
else: |
|
241 |
if item.Size: return item.Size |
|
242 |
prev = item |
|
243 |
|
|
244 |
if 'Drain' == matches[0].Type: return AppDocData.instance().drain_size |
|
245 |
|
|
246 |
return self.owner.Size |
|
247 |
|
|
248 |
return None |
|
249 |
except Exception as ex: |
|
250 |
from App import App |
|
251 |
from AppDocData import MessageType |
|
252 |
|
|
253 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
254 |
sys.exc_info()[-1].tb_lineno) |
|
255 |
App.mainWnd().addMessage.emit(MessageType.Error, str(self.uid) + self.name + message) |
|
256 |
|
|
257 |
def EvaluatedLineNo(self, prop): |
|
258 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
259 |
|
|
260 |
if self.owner and type(self.owner) is QEngineeringLineNoTextItem: |
|
261 |
attrs = self.owner.getAttributes() |
|
262 |
for attr, value in attrs.items(): |
|
263 |
if prop == attr.Attribute: |
|
264 |
return value |
|
265 |
|
|
266 |
return None |
|
267 |
|
|
268 | 197 |
def validate(self): |
269 | 198 |
"""validation check""" |
270 | 199 |
|
DTI_PID/DTI_PID/UI/OcrResultDialog.ui | ||
---|---|---|
148 | 148 |
</property> |
149 | 149 |
<property name="icon"> |
150 | 150 |
<iconset resource="../res/MainWindow.qrc"> |
151 |
<normaloff>:/newPrefix/Rotate_Plus.png</normaloff>:/newPrefix/Rotate_Plus.png</iconset>
|
|
151 |
<normaloff>:/newPrefix/Rotate_Plus.svg</normaloff>:/newPrefix/Rotate_Plus.svg</iconset>
|
|
152 | 152 |
</property> |
153 | 153 |
<property name="iconSize"> |
154 | 154 |
<size> |
내보내기 Unified diff