개정판 be3e0c2d
issue #387:
- apply Note No regular expression
- remove instrument tag rule
DTI_PID/DTI_PID/Commands/ConnectionPointCommand.py | ||
---|---|---|
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 |
|
14 | 14 |
class ConnectionPointCommand(AbstractCommand.AbstractCommand): |
15 |
""" |
|
16 |
ConnectionPointCommand class |
|
17 |
""" |
|
18 |
|
|
15 | 19 |
onSuccess = pyqtSignal(QGraphicsItem) |
16 | 20 |
|
17 | 21 |
def __init__(self, imageViewer, connectionPointLineEdit): |
DTI_PID/DTI_PID/Commands/OriginalPointCommand.py | ||
---|---|---|
8 | 8 |
try: |
9 | 9 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal |
10 | 10 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform, QCursor |
11 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox, QGraphicsEllipseItem |
|
11 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox, QGraphicsEllipseItem, QGraphicsItem
|
|
12 | 12 |
except ImportError: |
13 | 13 |
try: |
14 | 14 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
... | ... | |
23 | 23 |
""" |
24 | 24 |
OriginalPointCommand class |
25 | 25 |
""" |
26 |
onSuccess = pyqtSignal() |
|
26 |
onSuccess = pyqtSignal(QGraphicsItem)
|
|
27 | 27 |
|
28 | 28 |
''' |
29 | 29 |
@history 2018.06.12 Jeongwoo coords type changed (int → float) |
DTI_PID/DTI_PID/ConfigurationDialog.py | ||
---|---|---|
113 | 113 |
self.tempLineNoAttributeUID.append(value) |
114 | 114 |
self.ui.listViewProperties.setModel(self.itemModel) |
115 | 115 |
|
116 |
configs = docData.getConfigs('Note No Tag Rule', 'Note No Prefix') |
|
117 |
self.ui.lineEditNoteNoPrefix.setText(configs[0].value if configs else '') |
|
118 |
configs = docData.getConfigs('Note No Tag Rule', 'Note No Suffix') |
|
119 |
self.ui.lineEditNoteNoSuffix.setText(configs[0].value if configs else '') |
|
120 |
|
|
121 |
configs = docData.getConfigs('Instrument Tag No Rule', 'Measured Variable Code') |
|
122 |
self.ui.lineEditMeasuredVariableCode.setText(configs[0].value if configs else '') |
|
123 |
configs = docData.getConfigs('Instrument Tag No Rule', 'Type Modifier') |
|
124 |
self.ui.lineEditTypeModifier.setText(configs[0].value if configs else '') |
|
125 |
configs = docData.getConfigs('Instrument Tag No Rule', 'Tag Seq No') |
|
126 |
self.ui.lineEditTagSeqNo.setText(configs[0].value if configs else '') |
|
127 |
configs = docData.getConfigs('Instrument Tag No Rule', 'Tag Suffix') |
|
128 |
self.ui.lineEditTagSuffix.setText(configs[0].value if configs else '') |
|
116 |
configs = docData.getConfigs('Note No Tag Rule', 'Note No Expression') |
|
117 |
self.ui.lineEditNoteNoExpression.setText(configs[0].value if configs else '') |
|
129 | 118 |
|
130 | 119 |
configs = docData.getConfigs('OPC Tag No Rule', 'Description') |
131 | 120 |
self.ui.lineEditDescription.setText(configs[0].value if configs else '') |
... | ... | |
472 | 461 |
configs.append(Config('Small Line Minimum Length', 'Min Length', self.ui.smallLineMinLengthSpinBox.value())) |
473 | 462 |
configs.append(Config('Line No', 'Size Unit', 'Metric' if self.ui.radioButtonMetric.isChecked() else 'Inch')) |
474 | 463 |
configs.append(Config('Line No', 'Delimiter', self.ui.lineEdit.text())) |
475 |
configs.append(Config('Note No Tag Rule', 'Note No Prefix', self.ui.lineEditNoteNoPrefix.text())) |
|
476 |
configs.append(Config('Note No Tag Rule', 'Note No Suffix', self.ui.lineEditNoteNoSuffix.text())) |
|
477 |
configs.append(Config('Instrument Tag No Rule', 'Measured Variable Code', self.ui.lineEditMeasuredVariableCode.text())) |
|
478 |
configs.append(Config('Instrument Tag No Rule', 'Type Modifier', self.ui.lineEditTypeModifier.text())) |
|
479 |
configs.append(Config('Instrument Tag No Rule', 'Tag Seq No', self.ui.lineEditTagSeqNo.text())) |
|
480 |
configs.append(Config('Instrument Tag No Rule', 'Tag Suffix', self.ui.lineEditTagSuffix.text())) |
|
464 |
configs.append(Config('Note No Tag Rule', 'Note No Expression', self.ui.lineEditNoteNoExpression.text())) |
|
481 | 465 |
configs.append(Config('OPC Tag No Rule', 'Description', self.ui.lineEditDescription.text())) |
482 | 466 |
configs.append(Config('OPC Tag No Rule', 'OPC Tag', self.ui.lineEditOPCTag.text())) |
483 | 467 |
|
DTI_PID/DTI_PID/Configuration_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file '.\UI\Configuration.ui'
|
|
3 |
# Form implementation generated from reading ui file '.\ui\Configuration.ui'
|
|
4 | 4 |
# |
5 | 5 |
# Created by: PyQt5 UI code generator 5.11.3 |
6 | 6 |
# |
... | ... | |
260 | 260 |
self.tabTagNoRule.setObjectName("tabTagNoRule") |
261 | 261 |
self.gridLayout_7 = QtWidgets.QGridLayout(self.tabTagNoRule) |
262 | 262 |
self.gridLayout_7.setObjectName("gridLayout_7") |
263 |
self.groupBox_4 = QtWidgets.QGroupBox(self.tabTagNoRule) |
|
264 |
self.groupBox_4.setObjectName("groupBox_4") |
|
265 |
self.gridLayout_12 = QtWidgets.QGridLayout(self.groupBox_4) |
|
266 |
self.gridLayout_12.setObjectName("gridLayout_12") |
|
267 |
self.gridLayout_20 = QtWidgets.QGridLayout() |
|
268 |
self.gridLayout_20.setObjectName("gridLayout_20") |
|
269 |
self.lineEditNoteNoExpression = QtWidgets.QLineEdit(self.groupBox_4) |
|
270 |
self.lineEditNoteNoExpression.setObjectName("lineEditNoteNoExpression") |
|
271 |
self.gridLayout_20.addWidget(self.lineEditNoteNoExpression, 0, 1, 1, 1) |
|
272 |
self.label_15 = QtWidgets.QLabel(self.groupBox_4) |
|
273 |
self.label_15.setObjectName("label_15") |
|
274 |
self.gridLayout_20.addWidget(self.label_15, 0, 0, 1, 1) |
|
275 |
self.gridLayout_12.addLayout(self.gridLayout_20, 1, 0, 1, 1) |
|
276 |
self.gridLayout_7.addWidget(self.groupBox_4, 0, 0, 1, 1) |
|
263 | 277 |
self.groupBox_3 = QtWidgets.QGroupBox(self.tabTagNoRule) |
264 | 278 |
self.groupBox_3.setObjectName("groupBox_3") |
265 | 279 |
self.gridLayout_10 = QtWidgets.QGridLayout(self.groupBox_3) |
... | ... | |
287 | 301 |
self.gridLayout_11.addWidget(self.lineEditOPCTag, 1, 1, 1, 1) |
288 | 302 |
self.horizontalLayout_10.addLayout(self.gridLayout_11) |
289 | 303 |
self.gridLayout_10.addLayout(self.horizontalLayout_10, 0, 0, 1, 1) |
290 |
self.gridLayout_7.addWidget(self.groupBox_3, 3, 0, 1, 1) |
|
291 |
self.groupBox_4 = QtWidgets.QGroupBox(self.tabTagNoRule) |
|
292 |
self.groupBox_4.setObjectName("groupBox_4") |
|
293 |
self.gridLayout_12 = QtWidgets.QGridLayout(self.groupBox_4) |
|
294 |
self.gridLayout_12.setObjectName("gridLayout_12") |
|
295 |
self.gridLayout_20 = QtWidgets.QGridLayout() |
|
296 |
self.gridLayout_20.setObjectName("gridLayout_20") |
|
297 |
self.lineEditNoteNoSuffix = QtWidgets.QLineEdit(self.groupBox_4) |
|
298 |
self.lineEditNoteNoSuffix.setObjectName("lineEditNoteNoSuffix") |
|
299 |
self.gridLayout_20.addWidget(self.lineEditNoteNoSuffix, 1, 1, 1, 1) |
|
300 |
self.label_23 = QtWidgets.QLabel(self.groupBox_4) |
|
301 |
self.label_23.setObjectName("label_23") |
|
302 |
self.gridLayout_20.addWidget(self.label_23, 1, 0, 1, 1) |
|
303 |
self.label_15 = QtWidgets.QLabel(self.groupBox_4) |
|
304 |
self.label_15.setObjectName("label_15") |
|
305 |
self.gridLayout_20.addWidget(self.label_15, 0, 0, 1, 1) |
|
306 |
self.lineEditNoteNoPrefix = QtWidgets.QLineEdit(self.groupBox_4) |
|
307 |
self.lineEditNoteNoPrefix.setObjectName("lineEditNoteNoPrefix") |
|
308 |
self.gridLayout_20.addWidget(self.lineEditNoteNoPrefix, 0, 1, 1, 1) |
|
309 |
self.gridLayout_12.addLayout(self.gridLayout_20, 1, 0, 1, 1) |
|
310 |
self.gridLayout_7.addWidget(self.groupBox_4, 0, 0, 1, 1) |
|
311 |
self.groupBox_2 = QtWidgets.QGroupBox(self.tabTagNoRule) |
|
312 |
self.groupBox_2.setObjectName("groupBox_2") |
|
313 |
self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_2) |
|
314 |
self.gridLayout_8.setObjectName("gridLayout_8") |
|
315 |
self.horizontalLayout_9 = QtWidgets.QHBoxLayout() |
|
316 |
self.horizontalLayout_9.setObjectName("horizontalLayout_9") |
|
317 |
self.label_7 = QtWidgets.QLabel(self.groupBox_2) |
|
318 |
self.label_7.setMaximumSize(QtCore.QSize(80, 16777215)) |
|
319 |
self.label_7.setText("") |
|
320 |
self.label_7.setPixmap(QtGui.QPixmap(":/newPrefix/Symbols/B01_Inst_FAHH.png")) |
|
321 |
self.label_7.setAlignment(QtCore.Qt.AlignCenter) |
|
322 |
self.label_7.setObjectName("label_7") |
|
323 |
self.horizontalLayout_9.addWidget(self.label_7) |
|
324 |
self.verticalLayout_4 = QtWidgets.QVBoxLayout() |
|
325 |
self.verticalLayout_4.setObjectName("verticalLayout_4") |
|
326 |
self.gridLayout_9 = QtWidgets.QGridLayout() |
|
327 |
self.gridLayout_9.setObjectName("gridLayout_9") |
|
328 |
self.label_8 = QtWidgets.QLabel(self.groupBox_2) |
|
329 |
self.label_8.setObjectName("label_8") |
|
330 |
self.gridLayout_9.addWidget(self.label_8, 0, 0, 1, 1) |
|
331 |
self.lineEditMeasuredVariableCode = QtWidgets.QLineEdit(self.groupBox_2) |
|
332 |
self.lineEditMeasuredVariableCode.setObjectName("lineEditMeasuredVariableCode") |
|
333 |
self.gridLayout_9.addWidget(self.lineEditMeasuredVariableCode, 0, 1, 1, 1) |
|
334 |
self.lineEditTagSeqNo = QtWidgets.QLineEdit(self.groupBox_2) |
|
335 |
self.lineEditTagSeqNo.setObjectName("lineEditTagSeqNo") |
|
336 |
self.gridLayout_9.addWidget(self.lineEditTagSeqNo, 2, 1, 1, 1) |
|
337 |
self.label_9 = QtWidgets.QLabel(self.groupBox_2) |
|
338 |
self.label_9.setObjectName("label_9") |
|
339 |
self.gridLayout_9.addWidget(self.label_9, 1, 0, 1, 1) |
|
340 |
self.lineEditTypeModifier = QtWidgets.QLineEdit(self.groupBox_2) |
|
341 |
self.lineEditTypeModifier.setObjectName("lineEditTypeModifier") |
|
342 |
self.gridLayout_9.addWidget(self.lineEditTypeModifier, 1, 1, 1, 1) |
|
343 |
self.label_10 = QtWidgets.QLabel(self.groupBox_2) |
|
344 |
self.label_10.setObjectName("label_10") |
|
345 |
self.gridLayout_9.addWidget(self.label_10, 2, 0, 1, 1) |
|
346 |
self.label_11 = QtWidgets.QLabel(self.groupBox_2) |
|
347 |
self.label_11.setObjectName("label_11") |
|
348 |
self.gridLayout_9.addWidget(self.label_11, 3, 0, 1, 1) |
|
349 |
self.lineEditTagSuffix = QtWidgets.QLineEdit(self.groupBox_2) |
|
350 |
self.lineEditTagSuffix.setObjectName("lineEditTagSuffix") |
|
351 |
self.gridLayout_9.addWidget(self.lineEditTagSuffix, 3, 1, 1, 1) |
|
352 |
self.verticalLayout_4.addLayout(self.gridLayout_9) |
|
353 |
self.horizontalLayout_9.addLayout(self.verticalLayout_4) |
|
354 |
self.gridLayout_8.addLayout(self.horizontalLayout_9, 0, 0, 1, 1) |
|
355 |
self.gridLayout_7.addWidget(self.groupBox_2, 2, 0, 1, 1) |
|
304 |
self.gridLayout_7.addWidget(self.groupBox_3, 2, 0, 1, 1) |
|
356 | 305 |
self.groupBox_8 = QtWidgets.QGroupBox(self.tabTagNoRule) |
357 | 306 |
self.groupBox_8.setObjectName("groupBox_8") |
358 | 307 |
self.gridLayout_17 = QtWidgets.QGridLayout(self.groupBox_8) |
... | ... | |
490 | 439 |
ConfigurationDialog.setTabOrder(self.pushButtonAddDelimiter, self.pushButtonLineNoAttribute) |
491 | 440 |
ConfigurationDialog.setTabOrder(self.pushButtonLineNoAttribute, self.comboBoxProperties) |
492 | 441 |
ConfigurationDialog.setTabOrder(self.comboBoxProperties, self.pushButtonAddProperty) |
493 |
ConfigurationDialog.setTabOrder(self.pushButtonAddProperty, self.lineEditNoteNoPrefix) |
|
494 |
ConfigurationDialog.setTabOrder(self.lineEditNoteNoPrefix, self.lineEditNoteNoSuffix) |
|
495 |
ConfigurationDialog.setTabOrder(self.lineEditNoteNoSuffix, self.lineEdit_2) |
|
496 |
ConfigurationDialog.setTabOrder(self.lineEdit_2, self.lineEditMeasuredVariableCode) |
|
497 |
ConfigurationDialog.setTabOrder(self.lineEditMeasuredVariableCode, self.lineEditTypeModifier) |
|
498 |
ConfigurationDialog.setTabOrder(self.lineEditTypeModifier, self.lineEditTagSeqNo) |
|
499 |
ConfigurationDialog.setTabOrder(self.lineEditTagSeqNo, self.lineEditTagSuffix) |
|
500 |
ConfigurationDialog.setTabOrder(self.lineEditTagSuffix, self.lineEditDescription) |
|
442 |
ConfigurationDialog.setTabOrder(self.pushButtonAddProperty, self.lineEditNoteNoExpression) |
|
443 |
ConfigurationDialog.setTabOrder(self.lineEditNoteNoExpression, self.lineEdit_2) |
|
444 |
ConfigurationDialog.setTabOrder(self.lineEdit_2, self.lineEditDescription) |
|
501 | 445 |
ConfigurationDialog.setTabOrder(self.lineEditDescription, self.lineEditOPCTag) |
502 | 446 |
ConfigurationDialog.setTabOrder(self.lineEditOPCTag, self.tableWidgetLineTypes) |
503 | 447 |
ConfigurationDialog.setTabOrder(self.tableWidgetLineTypes, self.fontComboBox) |
... | ... | |
539 | 483 |
self.label_26.setText(_translate("ConfigurationDialog", "Property : ")) |
540 | 484 |
self.pushButtonAddProperty.setText(_translate("ConfigurationDialog", "추가")) |
541 | 485 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.Recognition), _translate("ConfigurationDialog", "인식")) |
486 |
self.groupBox_4.setTitle(_translate("ConfigurationDialog", "Note No Tag Rule")) |
|
487 |
self.label_15.setText(_translate("ConfigurationDialog", "Note No Expression")) |
|
542 | 488 |
self.groupBox_3.setTitle(_translate("ConfigurationDialog", "OPC Tag No Rule")) |
543 | 489 |
self.label_13.setText(_translate("ConfigurationDialog", "Description")) |
544 | 490 |
self.label_14.setText(_translate("ConfigurationDialog", "OPC Tag")) |
545 |
self.groupBox_4.setTitle(_translate("ConfigurationDialog", "Note No Tag Rule")) |
|
546 |
self.label_23.setText(_translate("ConfigurationDialog", "Note No Suffix")) |
|
547 |
self.label_15.setText(_translate("ConfigurationDialog", "Note No Prefix")) |
|
548 |
self.groupBox_2.setTitle(_translate("ConfigurationDialog", "Instrument Tag No Rule")) |
|
549 |
self.label_8.setText(_translate("ConfigurationDialog", "Measured Variable Code")) |
|
550 |
self.label_9.setText(_translate("ConfigurationDialog", "Type Modifier")) |
|
551 |
self.label_10.setText(_translate("ConfigurationDialog", "Tag Seq No")) |
|
552 |
self.label_11.setText(_translate("ConfigurationDialog", "Tag Suffix")) |
|
553 | 491 |
self.groupBox_8.setTitle(_translate("ConfigurationDialog", "Nozzle Name Rule")) |
554 | 492 |
self.label_27.setText(_translate("ConfigurationDialog", "Nozzle Name : ")) |
555 | 493 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabTagNoRule), _translate("ConfigurationDialog", "태그 넘버 룰")) |
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
6 | 6 |
import sys |
7 | 7 |
import math |
8 | 8 |
import shapely |
9 |
from AppDocData import AppDocData |
|
9 |
from AppDocData import AppDocData, MessageType
|
|
10 | 10 |
from EngineeringLineItem import QEngineeringLineItem |
11 | 11 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
12 | 12 |
from QEngineeringFlowArrowItem import QEngineeringFlowArrowItem |
... | ... | |
332 | 332 |
# connect attribut |
333 | 333 |
texts = [item for item in worker.graphicsView.scene.items() if issubclass(type(item), QEngineeringTextItem)] |
334 | 334 |
for symbol in symbols: |
335 |
symbol.connectAttribute(texts) |
|
335 |
try: |
|
336 |
symbol.connectAttribute(texts) |
|
337 |
except Exception as ex: |
|
338 |
from App import App |
|
339 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
340 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
341 |
|
|
336 | 342 |
# up to here |
337 | 343 |
except Exception as ex: |
338 | 344 |
print('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/EngineeringInstrumentItem.py | ||
---|---|---|
34 | 34 |
self._typeModifier = None |
35 | 35 |
self._tagSeqNo = None |
36 | 36 |
self._tagSuffix = None |
37 |
self._texts = [] # contains text items |
|
38 |
self._symbols = [] # contains symbol items |
|
39 | 37 |
|
40 | 38 |
''' |
41 | 39 |
@brief getter of measured variable code |
... | ... | |
118 | 116 |
self._texts.clear() |
119 | 117 |
self._symbols.clear() |
120 | 118 |
|
121 |
rect = self.sceneBoundingRect() |
|
122 |
for attr in attributes: |
|
123 |
if rect.contains(attr.center()): |
|
124 |
if issubclass(type(attr), QEngineeringTextItem): |
|
125 |
self._texts.append(attr) |
|
126 |
elif issubclass(type(attr), SymbolSvgItem): |
|
127 |
self._symbols.append(attr) |
|
119 |
try: |
|
120 |
rect = self.sceneBoundingRect() |
|
121 |
for attr in attributes: |
|
122 |
if rect.contains(attr.center()): |
|
123 |
if issubclass(type(attr), QEngineeringTextItem): |
|
124 |
self._texts.append(attr) |
|
125 |
elif issubclass(type(attr), SymbolSvgItem): |
|
126 |
self._symbols.append(attr) |
|
127 |
|
|
128 |
self._texts = sorted(self._texts, key=lambda attr: attr.loc[1]) # sort by y coordinate |
|
129 |
except Exception as ex: |
|
130 |
from App import App |
|
131 |
from AppDocData import MessageType |
|
128 | 132 |
|
129 |
self._texts = sorted(self._texts, key=lambda attr: attr.loc[1]) # sort by y coordinate |
|
133 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
134 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
130 | 135 |
|
131 | 136 |
''' |
132 | 137 |
@brief get attributes |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
275 | 275 |
|
276 | 276 |
for key in attrs.keys(): |
277 | 277 |
if type(key) is not UserInputAttribute: |
278 |
lineProp = docData.getLinePropertiesByUID(key.UID)
|
|
278 |
lineProp = docData.getLinePropertiesByUID(key) |
|
279 | 279 |
if lineProp: |
280 | 280 |
attrName = lineProp[0].Attribute.upper().replace(' ','') |
281 | 281 |
else: |
282 |
attrName = key.UID.upper().replace(' ','') |
|
283 |
data = key.Attribute if key.Attribute is not None else '' |
|
282 |
attrName = key.upper().replace(' ','') |
|
283 |
|
|
284 |
data = attrs[key] |
|
284 | 285 |
if attrName == 'NOMINALDIAMETER': |
285 | 286 |
dataList[1] = data |
286 | 287 |
elif attrName == 'FLUIDCODE': |
... | ... | |
292 | 293 |
dataList[16] = data |
293 | 294 |
elif attrName == 'STREAMNO': |
294 | 295 |
pass |
295 |
elif attrName == 'LINENO': |
|
296 |
elif attrName == 'LINENO' or attrName == 'LINE NO':
|
|
296 | 297 |
dataList[3] = data |
297 | 298 |
elif attrName == 'PNIDNUMBER': |
298 | 299 |
pass |
... | ... | |
309 | 310 |
if lineColumnList[index] == lineAttr[0].Attribute: |
310 | 311 |
dataList[index] = value |
311 | 312 |
except Exception as ex: |
312 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
313 |
from App import App |
|
314 |
from AppDocData import MessageType |
|
315 |
|
|
316 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
317 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
313 | 318 |
|
314 | 319 |
if dataList[0] == '': |
315 | 320 |
dataList[0] = str(uuid.uuid4()) |
DTI_PID/DTI_PID/Shapes/QEngineeringOPCItem.py | ||
---|---|---|
62 | 62 |
@date 2018.05.02 |
63 | 63 |
''' |
64 | 64 |
def connectAttribute(self, attributes): |
65 |
from AppDocData import AppDocData |
|
65 |
from AppDocData import AppDocData, MessageType
|
|
66 | 66 |
|
67 | 67 |
self.attrs.clear() |
68 | 68 |
|
69 |
rect = self.sceneBoundingRect() |
|
70 |
for attr in attributes: |
|
71 |
if rect.contains(attr.center()): |
|
72 |
self.attrs.append(attr) |
|
73 |
|
|
74 |
if 0 == self.angle: |
|
75 |
sorted(self.attrs, key=lambda attr: attr.loc[0]) # sort by x coordinate |
|
76 |
elif 3.14 == self.angle: |
|
77 |
sorted(self.attrs, key=lambda attr: attr.loc[0], reverse=True) # sort by x coordinate by descending |
|
78 |
elif 1.57 == self.angle: |
|
79 |
sorted(self.attrs, key=lambda attr: attr.loc[1], reverse=True) # sort by y coordinate |
|
80 |
elif 4.71 == self.angle: |
|
81 |
sorted(self.attrs, key=lambda attr: attr.loc[1]) # sort by y coordinate |
|
82 |
|
|
83 |
attrs = [attr.text() for attr in self.attrs] # will be used in eval function's parameter |
|
84 |
|
|
85 |
docData = AppDocData.instance() |
|
86 | 69 |
try: |
87 |
self.description = '' |
|
88 |
configs = docData.getConfigs('OPC Tag No Rule', 'Description') |
|
89 |
self.description = eval(configs[0].value) if configs else '' |
|
70 |
rect = self.sceneBoundingRect() |
|
71 |
for attr in attributes: |
|
72 |
if rect.contains(attr.center()): |
|
73 |
self._texts.append(attr) |
|
74 |
|
|
75 |
if 0 == self.angle: |
|
76 |
sorted(self._texts, key=lambda attr: attr.loc[0]) # sort by x coordinate |
|
77 |
elif 3.14 == self.angle: |
|
78 |
sorted(self._texts, key=lambda attr: attr.loc[0], reverse=True) # sort by x coordinate by descending |
|
79 |
elif 1.57 == self.angle: |
|
80 |
sorted(self._texts, key=lambda attr: attr.loc[1], reverse=True) # sort by y coordinate |
|
81 |
elif 4.71 == self.angle: |
|
82 |
sorted(self._texts, key=lambda attr: attr.loc[1]) # sort by y coordinate |
|
83 |
|
|
84 |
attrs = [attr.text() for attr in self._texts] # will be used in eval function's parameter |
|
85 |
|
|
86 |
docData = AppDocData.instance() |
|
87 |
try: |
|
88 |
self.description = '' |
|
89 |
configs = docData.getConfigs('OPC Tag No Rule', 'Description') |
|
90 |
self.description = eval(configs[0].value) if configs else '' |
|
91 |
except Exception as ex: |
|
92 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
93 |
|
|
94 |
try: |
|
95 |
self.tagNo = '' |
|
96 |
configs = docData.getConfigs('OPC Tag No Rule', 'OPC Tag') |
|
97 |
self.tagNo = eval(configs[0].value) if configs else '' |
|
98 |
except Exception as ex: |
|
99 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
90 | 100 |
except Exception as ex: |
91 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
|
|
101 |
from App import App
|
|
92 | 102 |
|
93 |
try: |
|
94 |
self.tagNo = '' |
|
95 |
configs = docData.getConfigs('OPC Tag No Rule', 'OPC Tag') |
|
96 |
self.tagNo = eval(configs[0].value) if configs else '' |
|
97 |
except Exception as ex: |
|
98 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
103 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
104 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
99 | 105 |
|
100 | 106 |
''' |
101 | 107 |
@brief generate xml code for attribute |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
49 | 49 |
self.hasInstrumentLabel = 0 |
50 | 50 |
# attributeType uid |
51 | 51 |
self.attribute = '' |
52 |
|
|
53 |
self._texts = [] # contains text items |
|
54 |
self._symbols = [] # contains symbol items |
|
52 | 55 |
|
53 | 56 |
self.setAcceptHoverEvents(True) |
54 | 57 |
self.setAcceptedMouseButtons(Qt.LeftButton) |
... | ... | |
487 | 490 |
|
488 | 491 |
self.attrs.clear() |
489 | 492 |
|
490 |
dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width()) |
|
491 |
center = self.sceneBoundingRect().center() |
|
492 |
|
|
493 |
minDist = None |
|
494 |
selected = None |
|
495 |
for attr in attributes: |
|
496 |
if type(attr) is QEngineeringSizeTextItem: |
|
497 |
dx = attr.center().x() - center.x() |
|
498 |
dy = attr.center().y() - center.y() |
|
499 |
length = math.sqrt(dx*dx + dy*dy) |
|
500 |
if (length < dist*2) and (minDist is None or length < minDist): |
|
501 |
minDist = length |
|
502 |
selected = attr |
|
503 |
|
|
504 |
if selected is not None: self.attrs.append(selected) |
|
505 |
|
|
493 |
try: |
|
494 |
dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width()) |
|
495 |
center = self.sceneBoundingRect().center() |
|
496 |
|
|
497 |
minDist = None |
|
498 |
selected = None |
|
499 |
for attr in attributes: |
|
500 |
if type(attr) is QEngineeringSizeTextItem: |
|
501 |
dx = attr.center().x() - center.x() |
|
502 |
dy = attr.center().y() - center.y() |
|
503 |
length = math.sqrt(dx*dx + dy*dy) |
|
504 |
if (length < dist*2) and (minDist is None or length < minDist): |
|
505 |
minDist = length |
|
506 |
selected = attr |
|
507 |
|
|
508 |
if selected is not None: |
|
509 |
self.attrs.append(selected) |
|
510 |
except Exception as ex: |
|
511 |
from App import App |
|
512 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
513 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
506 | 514 |
|
507 | 515 |
''' |
508 | 516 |
@Auther Yecheol |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
314 | 314 |
''' |
315 | 315 |
def isNoteNoText(self, text): |
316 | 316 |
appDocData = AppDocData.instance() |
317 |
configs = appDocData.getConfigs('Note No Tag Rule', 'Note No Prefix') |
|
318 |
prefix = configs[0].value if 1 == len(configs) else '' |
|
319 |
configs = appDocData.getConfigs('Note No Tag Rule', 'Note No Suffix') |
|
320 |
suffix = configs[0].value if 1 == len(configs) else '' |
|
321 |
|
|
322 |
if QRegExpValidator(QRegExp('^\{}NOTE\s\d+\{}$'.format(prefix, suffix))).validate(text, 0)[0] == QValidator.Acceptable : |
|
323 |
return True |
|
324 |
else: |
|
325 |
return False |
|
317 |
configs = appDocData.getConfigs('Note No Tag Rule', 'Note No Expression') |
|
318 |
if 1 == len(configs): |
|
319 |
expression = configs[0].value |
|
320 |
match = re.search(re.compile(expression), text) |
|
321 |
return (True if match else False) |
|
322 |
|
|
323 |
return False |
|
326 | 324 |
|
327 | 325 |
''' |
328 | 326 |
@brief check if given text is size text |
... | ... | |
349 | 347 |
docData = AppDocData.instance() |
350 | 348 |
dataList = docData.getEquipmentDataList() |
351 | 349 |
matches = [data for data in dataList if data[1] == text] |
352 |
return (len(matches) > 0) |
|
353 |
|
|
350 |
return (len(matches) > 0) |
DTI_PID/DTI_PID/UI/Configuration.ui | ||
---|---|---|
480 | 480 |
<string>태그 넘버 룰</string> |
481 | 481 |
</attribute> |
482 | 482 |
<layout class="QGridLayout" name="gridLayout_7"> |
483 |
<item row="3" column="0"> |
|
483 |
<item row="0" column="0"> |
|
484 |
<widget class="QGroupBox" name="groupBox_4"> |
|
485 |
<property name="title"> |
|
486 |
<string>Note No Tag Rule</string> |
|
487 |
</property> |
|
488 |
<layout class="QGridLayout" name="gridLayout_12"> |
|
489 |
<item row="1" column="0"> |
|
490 |
<layout class="QGridLayout" name="gridLayout_20"> |
|
491 |
<item row="0" column="1"> |
|
492 |
<widget class="QLineEdit" name="lineEditNoteNoExpression"/> |
|
493 |
</item> |
|
494 |
<item row="0" column="0"> |
|
495 |
<widget class="QLabel" name="label_15"> |
|
496 |
<property name="text"> |
|
497 |
<string>Note No Expression</string> |
|
498 |
</property> |
|
499 |
</widget> |
|
500 |
</item> |
|
501 |
</layout> |
|
502 |
</item> |
|
503 |
</layout> |
|
504 |
</widget> |
|
505 |
</item> |
|
506 |
<item row="2" column="0"> |
|
484 | 507 |
<widget class="QGroupBox" name="groupBox_3"> |
485 | 508 |
<property name="title"> |
486 | 509 |
<string>OPC Tag No Rule</string> |
... | ... | |
530 | 553 |
</layout> |
531 | 554 |
</widget> |
532 | 555 |
</item> |
533 |
<item row="0" column="0"> |
|
534 |
<widget class="QGroupBox" name="groupBox_4"> |
|
535 |
<property name="title"> |
|
536 |
<string>Note No Tag Rule</string> |
|
537 |
</property> |
|
538 |
<layout class="QGridLayout" name="gridLayout_12"> |
|
539 |
<item row="1" column="0"> |
|
540 |
<layout class="QGridLayout" name="gridLayout_20"> |
|
541 |
<item row="1" column="1"> |
|
542 |
<widget class="QLineEdit" name="lineEditNoteNoSuffix"/> |
|
543 |
</item> |
|
544 |
<item row="1" column="0"> |
|
545 |
<widget class="QLabel" name="label_23"> |
|
546 |
<property name="text"> |
|
547 |
<string>Note No Suffix</string> |
|
548 |
</property> |
|
549 |
</widget> |
|
550 |
</item> |
|
551 |
<item row="0" column="0"> |
|
552 |
<widget class="QLabel" name="label_15"> |
|
553 |
<property name="text"> |
|
554 |
<string>Note No Prefix</string> |
|
555 |
</property> |
|
556 |
</widget> |
|
557 |
</item> |
|
558 |
<item row="0" column="1"> |
|
559 |
<widget class="QLineEdit" name="lineEditNoteNoPrefix"/> |
|
560 |
</item> |
|
561 |
</layout> |
|
562 |
</item> |
|
563 |
</layout> |
|
564 |
</widget> |
|
565 |
</item> |
|
566 |
<item row="2" column="0"> |
|
567 |
<widget class="QGroupBox" name="groupBox_2"> |
|
568 |
<property name="title"> |
|
569 |
<string>Instrument Tag No Rule</string> |
|
570 |
</property> |
|
571 |
<layout class="QGridLayout" name="gridLayout_8"> |
|
572 |
<item row="0" column="0"> |
|
573 |
<layout class="QHBoxLayout" name="horizontalLayout_9"> |
|
574 |
<item> |
|
575 |
<widget class="QLabel" name="label_7"> |
|
576 |
<property name="maximumSize"> |
|
577 |
<size> |
|
578 |
<width>80</width> |
|
579 |
<height>16777215</height> |
|
580 |
</size> |
|
581 |
</property> |
|
582 |
<property name="text"> |
|
583 |
<string/> |
|
584 |
</property> |
|
585 |
<property name="pixmap"> |
|
586 |
<pixmap>:/newPrefix/Symbols/B01_Inst_FAHH.png</pixmap> |
|
587 |
</property> |
|
588 |
<property name="alignment"> |
|
589 |
<set>Qt::AlignCenter</set> |
|
590 |
</property> |
|
591 |
</widget> |
|
592 |
</item> |
|
593 |
<item> |
|
594 |
<layout class="QVBoxLayout" name="verticalLayout_4"> |
|
595 |
<item> |
|
596 |
<layout class="QGridLayout" name="gridLayout_9"> |
|
597 |
<item row="0" column="0"> |
|
598 |
<widget class="QLabel" name="label_8"> |
|
599 |
<property name="text"> |
|
600 |
<string>Measured Variable Code</string> |
|
601 |
</property> |
|
602 |
</widget> |
|
603 |
</item> |
|
604 |
<item row="0" column="1"> |
|
605 |
<widget class="QLineEdit" name="lineEditMeasuredVariableCode"/> |
|
606 |
</item> |
|
607 |
<item row="2" column="1"> |
|
608 |
<widget class="QLineEdit" name="lineEditTagSeqNo"/> |
|
609 |
</item> |
|
610 |
<item row="1" column="0"> |
|
611 |
<widget class="QLabel" name="label_9"> |
|
612 |
<property name="text"> |
|
613 |
<string>Type Modifier</string> |
|
614 |
</property> |
|
615 |
</widget> |
|
616 |
</item> |
|
617 |
<item row="1" column="1"> |
|
618 |
<widget class="QLineEdit" name="lineEditTypeModifier"/> |
|
619 |
</item> |
|
620 |
<item row="2" column="0"> |
|
621 |
<widget class="QLabel" name="label_10"> |
|
622 |
<property name="text"> |
|
623 |
<string>Tag Seq No</string> |
|
624 |
</property> |
|
625 |
</widget> |
|
626 |
</item> |
|
627 |
<item row="3" column="0"> |
|
628 |
<widget class="QLabel" name="label_11"> |
|
629 |
<property name="text"> |
|
630 |
<string>Tag Suffix</string> |
|
631 |
</property> |
|
632 |
</widget> |
|
633 |
</item> |
|
634 |
<item row="3" column="1"> |
|
635 |
<widget class="QLineEdit" name="lineEditTagSuffix"/> |
|
636 |
</item> |
|
637 |
</layout> |
|
638 |
</item> |
|
639 |
</layout> |
|
640 |
</item> |
|
641 |
</layout> |
|
642 |
</item> |
|
643 |
</layout> |
|
644 |
</widget> |
|
645 |
</item> |
|
646 | 556 |
<item row="1" column="0"> |
647 | 557 |
<widget class="QGroupBox" name="groupBox_8"> |
648 | 558 |
<property name="title"> |
... | ... | |
869 | 779 |
<tabstop>pushButtonLineNoAttribute</tabstop> |
870 | 780 |
<tabstop>comboBoxProperties</tabstop> |
871 | 781 |
<tabstop>pushButtonAddProperty</tabstop> |
872 |
<tabstop>lineEditNoteNoPrefix</tabstop> |
|
873 |
<tabstop>lineEditNoteNoSuffix</tabstop> |
|
782 |
<tabstop>lineEditNoteNoExpression</tabstop> |
|
874 | 783 |
<tabstop>lineEdit_2</tabstop> |
875 |
<tabstop>lineEditMeasuredVariableCode</tabstop> |
|
876 |
<tabstop>lineEditTypeModifier</tabstop> |
|
877 |
<tabstop>lineEditTagSeqNo</tabstop> |
|
878 |
<tabstop>lineEditTagSuffix</tabstop> |
|
879 | 784 |
<tabstop>lineEditDescription</tabstop> |
880 | 785 |
<tabstop>lineEditOPCTag</tabstop> |
881 | 786 |
<tabstop>tableWidgetLineTypes</tabstop> |
DTI_PID/DTI_PID/pagefold.qss | ||
---|---|---|
18 | 18 |
/* mainFrame won't have this border-image since we have |
19 | 19 |
explicitly set it to 'none' using a more specific selector. */ |
20 | 20 |
QFrame, QLineEdit, QComboBox[editable="true"], QSpinBox { |
21 |
border-image: url(:/images/frame.png) 4; |
|
22 | 21 |
border-width: 3; |
23 | 22 |
} |
24 | 23 |
|
... | ... | |
135 | 134 |
|
136 | 135 |
QPushButton, QComboBox[editable="false"], |
137 | 136 |
QComboBox[editable="true"]::drop-down { |
138 |
border-image: url(:/images/pushbutton.png) 5; |
|
139 | 137 |
border-width: 5; |
140 | 138 |
} |
141 | 139 |
|
142 | 140 |
QPushButton:hover, QComboBox[editable="false"]:hover, |
143 | 141 |
QComboBox[editable="true"]::drop-down:hover, QMenuBar::item:hover { |
144 |
border-image: url(:/images/pushbutton_hover.png) 5; |
|
145 | 142 |
border-width: 5; |
146 | 143 |
} |
147 | 144 |
|
148 | 145 |
QPushButton:pressed, QComboBox[editable="false"]:on, |
149 | 146 |
QComboBox[editable="true"]::drop-down:on, QMenuBar::item:on { |
150 |
border-image: url(:/images/pushbutton_pressed.png) 5; |
|
151 | 147 |
border-width: 5; |
152 | 148 |
} |
153 | 149 |
|
... | ... | |
162 | 158 |
} |
163 | 159 |
|
164 | 160 |
/* Customize read-only comboboxes. */ |
165 |
|
|
166 | 161 |
QComboBox[editable="false"] { |
167 | 162 |
padding-left: 3px; |
168 | 163 |
padding-right: 20px; /* space for the arrow */ |
... | ... | |
192 | 187 |
} |
193 | 188 |
|
194 | 189 |
/* Customize editable comboboxes. */ |
195 |
|
|
196 | 190 |
QComboBox[editable="true"] { |
197 | 191 |
padding-right: 16px; |
198 | 192 |
} |
... | ... | |
212 | 206 |
QComboBox[editable="true"]::drop-down:on { |
213 | 207 |
border-width: 0px; |
214 | 208 |
border-left-width: 3px; /* we need only left and center part */ |
209 |
color: white; |
|
215 | 210 |
} |
216 | 211 |
|
217 | 212 |
/* Shift the arrow when it's open. */ |
... | ... | |
231 | 226 |
height: 13px; |
232 | 227 |
} |
233 | 228 |
|
234 |
QCheckBox::indicator:unchecked { |
|
235 |
image: url(:/images/checkbox_unchecked.png); |
|
236 |
} |
|
237 |
|
|
238 |
QCheckBox::indicator:unchecked:hover { |
|
239 |
image: url(:/images/checkbox_unchecked_hover.png); |
|
240 |
} |
|
241 |
|
|
242 |
QCheckBox::indicator:unchecked:pressed { |
|
243 |
image: url(:/images/checkbox_unchecked_pressed.png); |
|
244 |
} |
|
245 |
|
|
246 |
QCheckBox::indicator:checked { |
|
247 |
image: url(:/images/checkbox_checked.png); |
|
248 |
} |
|
249 |
|
|
250 |
QCheckBox::indicator:checked:hover { |
|
251 |
image: url(:/images/checkbox_checked_hover.png); |
|
252 |
} |
|
253 |
|
|
254 |
QCheckBox::indicator:checked:pressed { |
|
255 |
image: url(:/images/checkbox_checked_pressed.png); |
|
256 |
} |
|
257 |
|
|
258 | 229 |
/* Customize the size grip. */ |
259 | 230 |
QSizeGrip { |
260 | 231 |
image: url(:/images/sizegrip.png); |
... | ... | |
281 | 252 |
QSpinBox::up-button { |
282 | 253 |
subcontrol-origin: border; |
283 | 254 |
subcontrol-position: top right; |
284 |
|
|
285 | 255 |
width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */ |
286 |
border-image: url(:/images/spinup.png) 1; |
|
287 | 256 |
border-width: 1px; |
288 | 257 |
} |
289 | 258 |
|
290 |
QSpinBox::up-button:hover { |
|
291 |
border-image: url(:/images/spinup_hover.png) 1; |
|
292 |
} |
|
293 |
|
|
294 |
QSpinBox::up-button:pressed { |
|
295 |
border-image: url(:/images/spinup_pressed.png) 1; |
|
296 |
} |
|
297 |
|
|
298 | 259 |
QSpinBox::down-button { |
299 | 260 |
subcontrol-origin: border; |
300 | 261 |
subcontrol-position: bottom right; |
301 | 262 |
|
302 | 263 |
width: 16px; |
303 |
border-image: url(:/images/spindown.png) 1; |
|
304 | 264 |
border-width: 1px; |
305 | 265 |
border-top-width: 0; |
306 | 266 |
} |
307 | 267 |
|
308 |
QSpinBox::down-button:hover { |
|
309 |
border-image: url(:/images/spindown_hover.png) 1; |
|
268 |
QProgressBar{ |
|
269 |
border: 2px solid grey; |
|
270 |
border-radius: 5px; |
|
271 |
text-align: center; |
|
310 | 272 |
} |
311 | 273 |
|
312 |
QSpinBox::down-button:pressed {
|
|
313 |
border-image: url(:/images/spindown_pressed.png) 1;
|
|
314 |
} |
|
274 |
QProgressBar:chunk{
|
|
275 |
background-color: grey;
|
|
276 |
} |
DTI_PID/DTI_PID/tesseract_ocr_module.py | ||
---|---|---|
192 | 192 |
textInfoList = [] |
193 | 193 |
|
194 | 194 |
docData = AppDocData.instance() |
195 |
oCRLang = 'eng+' + docData.getCurrentProject().getName()
|
|
195 |
oCRLang = docData.getCurrentProject().getName() + '+eng'
|
|
196 | 196 |
configs = docData.getConfigs('Text Size', 'Min Text Size') |
197 | 197 |
minSize = int(configs[0].value) if 1 == len(configs) else 30 |
198 | 198 |
configs = docData.getConfigs('Text Size', 'Max Text Size') |
내보내기 Unified diff