개정판 d32122ba
- issue #1061: create connector when creating stream line
Change-Id: Ia828f9acd1dfe01abfa40efdb85434bd3425c9b0
HYTOS/HYTOS/Commands/PlacePolygonCommand.py | ||
---|---|---|
27 | 27 |
|
28 | 28 |
self._polyline = None |
29 | 29 |
|
30 |
|
|
31 |
|
|
30 | 32 |
''' |
31 | 33 |
@brief reset command status |
32 | 34 |
@author humkyung |
... | ... | |
78 | 80 |
pass |
79 | 81 |
|
80 | 82 |
def redo(self): |
81 |
pass |
|
83 |
pass |
|
84 |
|
|
85 |
|
|
86 |
|
HYTOS/HYTOS/Commands/PlaceStreamlineCommand.py | ||
---|---|---|
4 | 4 |
import os.path |
5 | 5 |
import AbstractCommand |
6 | 6 |
try: |
7 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
|
|
8 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor, QTransform
|
|
9 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog
|
|
7 |
from PyQt5.QtCore import *
|
|
8 |
from PyQt5.QtGui import *
|
|
9 |
from PyQt5.QtWidgets import *
|
|
10 | 10 |
except ImportError: |
11 | 11 |
try: |
12 | 12 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
... | ... | |
26 | 26 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
27 | 27 |
|
28 | 28 |
self._streamline = None |
29 |
|
|
29 |
self.connectorItems = [] |
|
30 |
|
|
31 |
@property |
|
32 |
def streamline(self): |
|
33 |
""" getter of _streamline """ |
|
34 |
|
|
35 |
return self._streamline |
|
36 |
|
|
30 | 37 |
''' |
31 | 38 |
@brief reset command status |
32 | 39 |
@author humkyung |
... | ... | |
50 | 57 |
|
51 | 58 |
event = param[1] |
52 | 59 |
if 'mousePressEvent' == param[0] and event.button() == Qt.LeftButton: |
53 |
if self._streamline is None: |
|
54 |
selected = self.imageViewer.scene.itemAt(param[2], QTransform()) |
|
60 |
selected = self.imageViewer.scene.itemAt(param[2], QTransform()) |
|
61 |
|
|
62 |
if self._streamline is None: |
|
55 | 63 |
if selected is not None and type(selected) is QEngineeringConnectorItem: |
56 | 64 |
self._streamline = QEngineeringStreamlineItem() |
57 | 65 |
self._streamline._vertices.append(selected.center()) |
58 | 66 |
self.imageViewer.scene.addItem(self._streamline) |
59 | 67 |
self.imageViewer.scene.setFocusItem(self._streamline) |
68 |
|
|
69 |
self.connectorItems.append(selected) |
|
60 | 70 |
else: |
61 |
try: |
|
71 |
try: |
|
72 |
if selected is not None and type(selected) is QEngineeringConnectorItem: |
|
73 |
self.connectorItems.append(selected) |
|
74 |
|
|
75 |
#self.buildConnectors(self.connectorItems) |
|
76 |
|
|
62 | 77 |
QGraphicsView.mouseReleaseEvent(self.imageViewer, event) |
63 | 78 |
self._streamline.update() |
79 |
self.buildConnectors(self.connectorItems) |
|
64 | 80 |
self.onSuccess.emit() |
81 |
self.connectorItems.clear() |
|
65 | 82 |
finally: |
66 | 83 |
pass |
67 | 84 |
elif 'mouseReleaseEvent' == param[0] and event.button() == Qt.RightButton: |
... | ... | |
77 | 94 |
pass |
78 | 95 |
|
79 | 96 |
def redo(self): |
80 |
pass |
|
97 |
pass |
|
98 |
|
|
99 |
def buildConnectors(self, connectorItems): |
|
100 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
101 |
|
|
102 |
index = 0 |
|
103 |
for vertex in [self._streamline._vertices[0],self._streamline._vertices[-1]]: |
|
104 |
connector = QEngineeringConnectorItem(parent=self._streamline, index=index+1) |
|
105 |
connector.setPos(vertex) |
|
106 |
connector.setParentItem(self._streamline) |
|
107 |
# connector의 connectPoint, sceneConnectPoint를 vertex로 함 추후 좀 알아봐서 수정 필요 |
|
108 |
connector.connectPoint = vertex |
|
109 |
connector.sceneConnectPoint = vertex |
|
110 |
|
|
111 |
# add connector move ables |
|
112 |
connector.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
|
113 |
connector.setAcceptTouchEvents(True) |
|
114 |
#connector.transfer.onPosChanged.connect(self.onConnectorPosChaned) |
|
115 |
|
|
116 |
connector.setZValue(self._streamline.zValue() + 1) |
|
117 |
self._streamline.connectors.append(connector) |
|
118 |
if len(connectorItems) > index: |
|
119 |
connector.connectedItem = connectorItems[index] |
|
120 |
|
|
121 |
index = index + 1 |
|
122 |
|
|
123 |
if len(connectorItems) > 1: |
|
124 |
connectorItems[0].connectedItem = self._streamline.connectors[0] |
|
125 |
connectorItems[1].connectedItem = self._streamline.connectors[1] |
|
126 |
else: |
|
127 |
connectorItems[0].connectedItem = self._streamline.connectors[0] |
HYTOS/HYTOS/ConfigurationDialog.py | ||
---|---|---|
13 | 13 |
from AppDocData import Color |
14 | 14 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
15 | 15 |
import Configuration_UI |
16 |
import tesseract_ocr_module as TOCR |
|
16 |
|
|
17 | 17 |
|
18 | 18 |
class ListView(QListView): |
19 | 19 |
def __init__(self, *args, **kwargs): |
... | ... | |
65 | 65 |
self.ui.spinBoxShrinkSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxShrinkSize.setValue(0) |
66 | 66 |
configs = docData.getConfigs('Text Recognition', 'Merge Size') |
67 | 67 |
self.ui.spinBoxMergeSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMergeSize.setValue(10) |
68 |
configs = docData.getConfigs('Text Recognition', 'White Character List') |
|
69 |
self.ui.lineEditWhiteCharList.setText(configs[0].value) if 1 == len(configs) else self.ui.lineEditWhiteCharList.setText(TOCR.DEFAULT_CONF[40:]) |
|
70 |
|
|
68 |
|
|
71 | 69 |
configs = docData.getConfigs('Text Size', 'Min Text Size') |
72 | 70 |
self.ui.minTextSizeSpinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.minTextSizeSpinBox.setValue(30) |
73 | 71 |
configs = docData.getConfigs('Text Size', 'Max Text Size') |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
13 | 13 |
import CreateSymbolCommand |
14 | 14 |
import AreaZoomCommand |
15 | 15 |
import FenceCommand |
16 |
import PlaceLineCommand
|
|
17 |
import PlacePolygonCommand |
|
16 |
import PlaceStreamlineCommand
|
|
17 |
|
|
18 | 18 |
|
19 | 19 |
import cv2 |
20 | 20 |
import numpy as np |
... | ... | |
104 | 104 |
_translate = QCoreApplication.translate |
105 | 105 |
self.setWindowTitle(_translate(App.NAME + " - {}".format(project.name), App.NAME + " - {}".format(project.name))) |
106 | 106 |
|
107 |
self.lineComboBox = QComboBox(self.toolBar) |
|
108 |
for condition in LineTypeConditions.items(): |
|
109 |
self.lineComboBox.addItem(condition.name) |
|
110 |
self.lineComboBox.currentIndexChanged.connect(self.onLineTypeChanged) |
|
111 |
|
|
112 |
self.toolBar.insertWidget(self.actionOCR, self.lineComboBox) |
|
113 |
self.toolBar.insertSeparator(self.actionOCR) |
|
107 |
self.toolBar.insertSeparator(self.actionValidate) |
|
114 | 108 |
|
115 | 109 |
self.graphicsView = QtImageViewer.QtImageViewer(self) |
116 | 110 |
self.graphicsView.setParent(self.centralwidget) |
... | ... | |
140 | 134 |
self.symbolTabVerticalLayout.addWidget(self.dirTreeWidget) |
141 | 135 |
|
142 | 136 |
# Add Custom Property TableWidget |
143 |
self.propertyTableWidget = SymbolPropertyTableWidget.QSymbolPropertyTableWidget() |
|
144 |
self.symbolTabVerticalLayout.addWidget(self.propertyTableWidget) |
|
145 |
self.dirTreeWidget.singleClicked.connect(self.propertyTableWidget.getClickedSymbol) |
|
137 |
#self.propertyTableWidget = SymbolPropertyTableWidget.QSymbolPropertyTableWidget()
|
|
138 |
#self.symbolTabVerticalLayout.addWidget(self.propertyTableWidget)
|
|
139 |
#self.dirTreeWidget.singleClicked.connect(self.propertyTableWidget.getClickedSymbol)
|
|
146 | 140 |
# add splitter widget |
147 |
splitter = QSplitter(Qt.Vertical) |
|
148 |
splitter.addWidget(self.dirTreeWidget) |
|
149 |
splitter.addWidget(self.propertyTableWidget) |
|
150 |
self.symbolTabVerticalLayout.addWidget(splitter) |
|
141 |
#splitter = QSplitter(Qt.Vertical)
|
|
142 |
#splitter.addWidget(self.dirTreeWidget)
|
|
143 |
#splitter.addWidget(self.propertyTableWidget)
|
|
144 |
#self.symbolTabVerticalLayout.addWidget(splitter)
|
|
151 | 145 |
# up to here |
152 | 146 |
|
153 | 147 |
# Add Custom Result Tree Widget (Symbol Explorer) |
... | ... | |
175 | 169 |
self.actionGroup.addAction(self.actionLineRecognition) |
176 | 170 |
self.actionGroup.addAction(self.actionLine) |
177 | 171 |
self.actionGroup.addAction(self.actionGenerateOutput) |
178 |
self.actionGroup.addAction(self.actionOCR) |
|
172 |
|
|
179 | 173 |
self.actionGroup.addAction(self.actionZoom) |
180 | 174 |
self.actionGroup.addAction(self.actionFitWindow) |
181 | 175 |
self.actionGroup.addAction(self.actionSave) |
182 | 176 |
self.actionGroup.addAction(self.actionValidate) |
183 |
self.actionGroup.addAction(self.actionVendor) |
|
177 |
|
|
184 | 178 |
self.actionGroup.triggered.connect(self.actionGroupTriggered) |
185 | 179 |
|
186 | 180 |
# connect signals and slots |
... | ... | |
191 | 185 |
self.actionRecognition.triggered.connect(self.recognize) |
192 | 186 |
self.actionLineRecognition.triggered.connect(self.connect_attributes) |
193 | 187 |
self.actionConfiguration.triggered.connect(self.configuration) |
194 |
self.actionOCR.triggered.connect(self.onAreaOcr) |
|
188 |
|
|
195 | 189 |
self.actionGenerateOutput.triggered.connect(self.generateOutput) |
196 | 190 |
self.pushButtonClearLog.clicked.connect(self.onClearLog) |
197 | 191 |
self.actionHMB_DATA.triggered.connect(self.onHMBData) |
... | ... | |
209 | 203 |
self.actionViewVendor_Area.triggered.connect(self.onViewVendorArea) |
210 | 204 |
self.actionRotate.triggered.connect(self.onRotate) |
211 | 205 |
self.actionZoom.triggered.connect(self.onAreaZoom) |
212 |
self.actionVendor.triggered.connect(self.onVendor) |
|
206 |
|
|
213 | 207 |
self.actionFitWindow.triggered.connect(self.fitWindow) |
214 | 208 |
self.actionpdf_to_image.triggered.connect(self.onConvertPDFToImage) |
215 | 209 |
self.actionCreate_Symbol.triggered.connect(self.create_symbol) |
... | ... | |
222 | 216 |
self.actionFindReplaceText.triggered.connect(self.findReplaceTextClicked) |
223 | 217 |
|
224 | 218 |
|
225 |
|
|
226 |
|
|
227 |
configs = docData.getAppConfigs('app', 'mode') |
|
228 |
if configs and 1 == len(configs) and 'advanced' == configs[0].value: |
|
229 |
self.actionOCR_Training.triggered.connect(self.oCRTrainingClicked) |
|
230 |
else: |
|
231 |
self.actionOCR_Training.setVisible(False) |
|
232 |
|
|
233 | 219 |
# removedItems |
234 | 220 |
''' |
235 | 221 |
self.removedItems = {} |
... | ... | |
409 | 395 |
action.setChecked(False) |
410 | 396 |
finally: |
411 | 397 |
self.retranslateUi(self) |
412 |
self.propertyTableWidget.retranslateUi() |
|
413 | 398 |
|
414 | 399 |
''' |
415 | 400 |
@brief Clear TreeWidget and Set Current PID |
... | ... | |
706 | 691 |
cmd.onRejected.connect(self.onCommandRejected) |
707 | 692 |
self.graphicsView.command = cmd |
708 | 693 |
|
709 |
def onVendor(self, action): |
|
710 |
''' |
|
711 |
@brief make vendor package area |
|
712 |
@author euisung |
|
713 |
@date 2019.04.29 |
|
714 |
''' |
|
715 |
if not self.graphicsView.hasImage(): |
|
716 |
self.actionVendor.setChecked(False) |
|
717 |
self.showImageSelectionMessageBox() |
|
718 |
return |
|
719 |
|
|
720 |
self.actionVendor.setChecked(True) |
|
721 |
if not hasattr(self.actionVendor, 'tag'): |
|
722 |
self.actionVendor.tag = PlacePolygonCommand.PlacePolygonCommand(self.graphicsView) |
|
723 |
self.actionVendor.tag.onSuccess.connect(self.onVendorCreated) |
|
724 |
self.actionVendor.tag.onRejected.connect(self.onCommandRejected) |
|
725 |
|
|
726 |
self.graphicsView.command = self.actionVendor.tag |
|
727 |
|
|
728 |
def onVendorCreated(self): |
|
729 |
''' |
|
730 |
@brief add created vendor polygon area to scene |
|
731 |
@author euisung |
|
732 |
@date 2019.04.29 |
|
733 |
''' |
|
734 |
try: |
|
735 |
count = len(self.actionVendor.tag._polyline._vertices) |
|
736 |
if count > 2: |
|
737 |
qPoints = [] |
|
738 |
points = [] |
|
739 |
for point in self.actionVendor.tag._polyline._vertices: |
|
740 |
points.append([round(point[0]), round(point[1])]) |
|
741 |
qPoints.append(QPoint(round(point[0]), round(point[1]))) |
|
742 |
vendorArea = QPolygonF(qPoints) |
|
743 |
vendorItem = QEngineeringVendorItem(vendorArea, points) |
|
744 |
vendorItem.area = 'Drawing' |
|
745 |
vendorItem.transfer.onRemoved.connect(self.itemRemoved) |
|
746 |
self.graphicsView.scene.addItem(vendorItem) |
|
747 |
finally: |
|
748 |
self.graphicsView.scene.removeItem(self.actionVendor.tag._polyline) |
|
749 |
self.actionVendor.tag.reset() |
|
750 | 694 |
|
751 | 695 |
''' |
752 | 696 |
@brief Fit Window |
... | ... | |
854 | 798 |
if hasattr(self.actionLine, 'tag'): |
855 | 799 |
self.actionLine.tag.onRejected.emit(None) |
856 | 800 |
|
857 |
if hasattr(self.actionVendor, 'tag'): |
|
858 |
self.actionVendor.tag.onRejected.emit(None) |
|
859 |
|
|
860 | 801 |
if self.graphicsView.command is not None: |
861 | 802 |
self.graphicsView.useDefaultCommand() |
862 | 803 |
|
... | ... | |
899 | 840 |
self.graphicsView.useDefaultCommand() |
900 | 841 |
|
901 | 842 |
''' |
902 |
@brief Area OCR |
|
903 |
@author Jeongwoo |
|
904 |
@date 18.04.18 |
|
905 |
@history 2018.05.02 Jeongwoo Change graphicsView.command by actionOCR checked state |
|
906 |
Show MessageBox when imageviewer doesn't have image |
|
907 |
''' |
|
908 |
def onAreaOcr(self): |
|
909 |
if not self.graphicsView.hasImage(): |
|
910 |
self.actionOCR.setChecked(False) |
|
911 |
self.showImageSelectionMessageBox() |
|
912 |
return |
|
913 |
|
|
914 |
if self.actionOCR.isChecked(): |
|
915 |
cmd = AreaOcrCommand.AreaOcrCommand(self.graphicsView) |
|
916 |
cmd.onSuccess.connect(self.onRecognizeText) |
|
917 |
cmd.onRejected.connect(self.onCommandRejected) |
|
918 |
self.graphicsView.command = cmd |
|
919 |
else: |
|
920 |
self.graphicsView.useDefaultCommand() |
|
921 |
|
|
922 |
''' |
|
923 | 843 |
@brief show text recognition dialog |
924 | 844 |
@author humkyung |
925 | 845 |
@date 2018.08.08 |
... | ... | |
1031 | 951 |
def showImageSelectionMessageBox(self): |
1032 | 952 |
QMessageBox.about(self.graphicsView, self.tr("Notice"), self.tr("First select image drawing")) |
1033 | 953 |
|
1034 |
''' |
|
1035 |
@brief change selected lines' type by selected line type |
|
1036 |
@author humkyung |
|
1037 |
@date 2018.06.27 |
|
1038 |
''' |
|
1039 |
def onLineTypeChanged(self, param): |
|
1040 |
lineType = self.lineComboBox.itemText(param) |
|
1041 |
selected = [item for item in self.graphicsView.scene.selectedItems() if type(item) is QEngineeringLineItem] |
|
1042 |
if selected: |
|
1043 |
for item in selected: |
|
1044 |
item.lineType = lineType |
|
1045 | 954 |
|
1046 | 955 |
def display_colors(self, value): |
1047 | 956 |
""" display colors """ |
... | ... | |
1383 | 1292 |
@history Jeongwoo 2018.05.10 Change method for Checkable action |
1384 | 1293 |
''' |
1385 | 1294 |
def onPlaceLine(self): |
1386 |
import PlaceStreamlineCommand |
|
1295 |
#import PlaceStreamlineCommand
|
|
1387 | 1296 |
|
1388 | 1297 |
""" |
1389 | 1298 |
if not self.graphicsView.hasImage(): |
... | ... | |
1406 | 1315 |
@date 2018.07.23 |
1407 | 1316 |
''' |
1408 | 1317 |
def onLineCreated(self): |
1409 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
1318 |
from EngineeringConnectorItem import QEngineeringConnectorItem
|
|
1410 | 1319 |
|
1411 | 1320 |
try: |
1412 |
count = len(self.actionLine.tag._polyline._vertices)
|
|
1321 |
count = len(self.actionLine.tag.streamline._vertices)
|
|
1413 | 1322 |
if count > 1: |
1323 |
""" |
|
1324 |
#ZVALUE = 100 |
|
1325 |
|
|
1326 |
#self.setZValue(ZVALUE) |
|
1327 |
|
|
1328 |
index = 0 |
|
1329 |
for vertex in [self.actionLine.tag.streamline._vertices[0],self.actionLine.tag.streamline._vertices[-1]]: |
|
1330 |
connector = QEngineeringConnectorItem(parent=self.actionLine.tag.streamline, index=index+1) |
|
1331 |
connector.setPos(vertex) |
|
1332 |
connector.setParentItem(self.actionLine.tag.streamline) |
|
1333 |
# connector의 connectPoint, sceneConnectPoint를 vertex로 함 추후 좀 알아봐서 수정 필요 |
|
1334 |
connector.connectPoint = vertex |
|
1335 |
connector.sceneConnectPoint = vertex |
|
1336 |
|
|
1337 |
# add connector move ables |
|
1338 |
connector.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
|
1339 |
connector.setAcceptTouchEvents(True) |
|
1340 |
#connector.transfer.onPosChanged.connect(self.onConnectorPosChaned) |
|
1341 |
|
|
1342 |
connector.setZValue(self.actionLine.tag.streamline.zValue() + 1) |
|
1343 |
self.actionLine.tag.streamline.connectors.append(connector) |
|
1344 |
#index = index + 1 |
|
1345 |
|
|
1346 |
|
|
1347 |
|
|
1414 | 1348 |
items = [] |
1349 |
|
|
1350 |
poly = QEngineeringPolylineItem() |
|
1415 | 1351 |
|
1416 |
lineType = self.lineComboBox.currentText() |
|
1417 |
for index in range(count - 1): |
|
1418 |
start = self.actionLine.tag._polyline._vertices[index] |
|
1419 |
end = self.actionLine.tag._polyline._vertices[index + 1] |
|
1352 |
lineType = 'Stream Line' |
|
1353 |
for index in range(count - 1): |
|
1354 |
|
|
1355 |
start = self.actionLine.tag.streamline._vertices[index] |
|
1356 |
end = self.actionLine.tag.streamline._vertices[index + 1] |
|
1357 |
|
|
1358 |
poly._pol.append(QPointF(start[0], start[1])) |
|
1359 |
poly._pol.append(QPointF(end[0], end[1])) |
|
1360 |
#poly.setPen(QPen(Qt.red, 2, Qt.SolidLine)) |
|
1361 |
poly.buildItem() |
|
1362 |
|
|
1363 |
items.append(poly) |
|
1364 |
selected = [item for item in self.graphicsView.scene.items(poly._pol.first()) if type(item) is QEngineeringConnectorItem or type(item) is QEngineeringPolylineItem] |
|
1365 |
if selected: |
|
1366 |
poly.connect_if_possible(selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], 5) |
|
1367 |
|
|
1368 |
|
|
1369 |
self.graphicsView.scene.addItem(poly) |
|
1370 |
|
|
1371 |
|
|
1372 |
#pt = poly._pol[-1].endPoint() |
|
1373 |
#selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if type(item) is QEngineeringConnectorItem and item.parent is not items[-1]] |
|
1374 |
#if selected: |
|
1375 |
# items[-1].connect_if_possible(selected[0].parent, 5) |
|
1376 |
|
|
1377 |
|
|
1378 |
|
|
1379 |
lineType = 'Stream Line' |
|
1380 |
for index in range(count - 1): |
|
1381 |
start = self.actionLine.tag.streamline._vertices[index] |
|
1382 |
end = self.actionLine.tag.streamline._vertices[index + 1] |
|
1420 | 1383 |
|
1421 | 1384 |
lineItem = QEngineeringLineItem(vertices=[start, end]) |
1422 | 1385 |
lineItem.transfer.onRemoved.connect(self.itemRemoved) |
... | ... | |
1436 | 1399 |
selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if type(item) is QEngineeringConnectorItem and item.parent is not items[-1]] |
1437 | 1400 |
if selected: |
1438 | 1401 |
items[-1].connect_if_possible(selected[0].parent, 5) |
1439 |
|
|
1402 |
|
|
1403 |
""" |
|
1440 | 1404 |
finally: |
1441 |
self.graphicsView.scene.removeItem(self.actionLine.tag._polyline)
|
|
1405 |
#self.graphicsView.scene.removeItem(self.actionLine.tag._streamline)
|
|
1442 | 1406 |
self.actionLine.tag.reset() |
1443 | 1407 |
|
1444 | 1408 |
''' |
... | ... | |
1448 | 1412 |
''' |
1449 | 1413 |
def onCommandRejected(self, cmd=None): |
1450 | 1414 |
try: |
1451 |
if type(cmd) is PlaceLineCommand.PlaceLineCommand:
|
|
1452 |
if self.actionLine.tag._polyline:
|
|
1453 |
self.graphicsView.scene.removeItem(self.actionLine.tag._polyline)
|
|
1415 |
if type(cmd) is PlaceStreamlineCommand.PlaceStreamlineCommand:
|
|
1416 |
if self.actionLine.tag.streamline:
|
|
1417 |
self.graphicsView.scene.removeItem(self.actionLine.tag.streamline)
|
|
1454 | 1418 |
self.graphicsView.scene.update() |
1455 | 1419 |
self.actionLine.tag.reset() |
1456 | 1420 |
|
1457 |
self.actionLine.setChecked(False) |
|
1421 |
self.actionLine.setChecked(False)
|
|
1458 | 1422 |
elif type(cmd) is AreaZoomCommand.AreaZoomCommand: |
1459 |
self.actionZoom.setChecked(False) |
|
1460 |
elif type(cmd) is PlacePolygonCommand.PlacePolygonCommand: |
|
1461 |
self.actionVendor.setChecked(False) |
|
1423 |
self.actionZoom.setChecked(False) |
|
1462 | 1424 |
else: |
1463 |
if hasattr(self.actionLine, 'tag') and self.actionLine.tag._polyline:
|
|
1464 |
self.graphicsView.scene.removeItem(self.actionLine.tag._polyline)
|
|
1425 |
if hasattr(self.actionLine, 'tag') and self.actionLine.tag.streamline:
|
|
1426 |
self.graphicsView.scene.removeItem(self.actionLine.tag.streamline)
|
|
1465 | 1427 |
self.graphicsView.scene.update() |
1466 |
self.actionLine.tag.reset() |
|
1467 |
if hasattr(self.actionVendor, 'tag') and self.actionVendor.tag._polyline: |
|
1468 |
self.graphicsView.scene.removeItem(self.actionVendor.tag._polyline) |
|
1469 |
self.graphicsView.scene.update() |
|
1470 |
self.actionVendor.tag.reset() |
|
1428 |
self.actionLine.tag.reset() |
|
1429 |
|
|
1471 | 1430 |
self.actionLine.setChecked(False) |
1472 |
self.actionZoom.setChecked(False) |
|
1473 |
self.actionOCR.setChecked(False) |
|
1474 |
self.actionVendor.setChecked(False) |
|
1431 |
self.actionZoom.setChecked(False) |
|
1475 | 1432 |
finally: |
1476 | 1433 |
self.graphicsView.useDefaultCommand() |
1477 | 1434 |
|
... | ... | |
2521 | 2478 |
item = QEngineeringVendorItem.fromXml(vendor) |
2522 | 2479 |
item.transfer.onRemoved.connect(self.itemRemoved) |
2523 | 2480 |
self.graphicsView.scene.addItem(item) |
2524 |
|
|
2525 |
# connect flow item to line |
|
2526 |
for flowMark in [item for item in symbols if type(item) is QEngineeringFlowMarkItem]: |
|
2527 |
for line in lines: |
|
2528 |
if flowMark.owner is line: |
|
2529 |
line._flowMark.append(flowMark) |
|
2530 |
flowMark.setParentItem(line) |
|
2531 |
# up to here |
|
2481 |
|
|
2532 | 2482 |
|
2533 | 2483 |
""" update scene """ |
2534 | 2484 |
self.graphicsView.scene.update(self.graphicsView.sceneRect()) |
HYTOS/HYTOS/MainWindow_UI.py | ||
---|---|---|
225 | 225 |
self.actionConfiguration.setIcon(icon4) |
226 | 226 |
font = QtGui.QFont() |
227 | 227 |
font.setFamily("맑은 고딕") |
228 |
font.setBold(True)
|
|
229 |
font.setWeight(75)
|
|
228 |
font.setBold(False)
|
|
229 |
font.setWeight(50)
|
|
230 | 230 |
self.actionConfiguration.setFont(font) |
231 | 231 |
self.actionConfiguration.setObjectName("actionConfiguration") |
232 | 232 |
self.actionArea = QtWidgets.QAction(MainWindow) |
... | ... | |
467 | 467 |
self.toolBar.addAction(self.actionInitialize) |
468 | 468 |
self.toolBar.addSeparator() |
469 | 469 |
self.toolBar.addAction(self.actionLine) |
470 |
self.toolBar.addAction(self.actionOCR) |
|
471 |
self.toolBar.addAction(self.actionVendor) |
|
472 | 470 |
self.toolBar.addAction(self.actionValidate) |
473 | 471 |
self.toolBar.addSeparator() |
474 | 472 |
self.toolBar.addAction(self.actionGenerateOutput) |
... | ... | |
512 | 510 |
self.actionClose.setText(_translate("MainWindow", "Exit")) |
513 | 511 |
self.actionRecognition.setText(_translate("MainWindow", "Recognize Eng. Info.")) |
514 | 512 |
self.actionRecognition.setToolTip(_translate("MainWindow", "Recognize Eng. Info.")) |
515 |
self.actionLine.setText(_translate("MainWindow", "Create Line")) |
|
516 |
self.actionLine.setToolTip(_translate("MainWindow", "Create Line(L)")) |
|
513 |
self.actionLine.setText(_translate("MainWindow", "Create Stream Line"))
|
|
514 |
self.actionLine.setToolTip(_translate("MainWindow", "Create Stream Line(L)"))
|
|
517 | 515 |
self.actionLine.setShortcut(_translate("MainWindow", "L")) |
518 | 516 |
self.actionValidate.setText(_translate("MainWindow", "Validate")) |
519 | 517 |
self.actionValidate.setToolTip(_translate("MainWindow", "Validate(V)")) |
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
292 | 292 |
self.setPos(items[0].center()) |
293 | 293 |
|
294 | 294 |
if self.connectedItem is not None: |
295 |
for connect in self.connectedItem.connectors: |
|
296 |
if connect.connectedItem == self.parent: |
|
297 |
connect.connect(None) |
|
295 |
pass |
|
296 |
#for connect in self.connectedItem.connectors: |
|
297 |
# if connect.connectedItem == self.parent: |
|
298 |
# connect.connect(None) |
|
298 | 299 |
|
299 | 300 |
self.connect(items[0].parent) |
300 | 301 |
items[0].connect(self.parent) |
HYTOS/HYTOS/SymbolAttrEditorDialog.py | ||
---|---|---|
42 | 42 |
self.ui.horizontalLayout_2.addWidget(self.ui.tableWidgetAttr) |
43 | 43 |
## up to here |
44 | 44 |
## combobox logic |
45 |
self.settingComboBoxSymbolType(symbolType[2])
|
|
45 |
self.settingComboBoxSymbolType(symbolType[1])
|
|
46 | 46 |
self.ui.comboBoxSymbolType.currentTextChanged.connect(self.changeSymbolType) |
47 | 47 |
## up to here |
48 | 48 |
self.ui.pushButtonAddAttr.clicked.connect(self.onAddAttr) |
... | ... | |
238 | 238 |
''' |
239 | 239 |
def onDelAttr(self): |
240 | 240 |
model = self.ui.tableWidgetAttr.model() |
241 |
#row = self.ui.tableWidgetAttr.currentRow()
|
|
241 |
row = self.ui.tableWidgetAttr.currentRow() |
|
242 | 242 |
|
243 | 243 |
#if row != -1 and not self.ui.tableWidgetAttr.item(row, 1).tag.IsProp: |
244 | 244 |
model.removeRow(row) |
HYTOS/HYTOS/UI/MainWindow.ui | ||
---|---|---|
148 | 148 |
<addaction name="actionInitialize"/> |
149 | 149 |
<addaction name="separator"/> |
150 | 150 |
<addaction name="actionLine"/> |
151 |
<addaction name="actionOCR"/> |
|
152 |
<addaction name="actionVendor"/> |
|
153 | 151 |
<addaction name="actionValidate"/> |
154 | 152 |
<addaction name="separator"/> |
155 | 153 |
<addaction name="actionGenerateOutput"/> |
... | ... | |
439 | 437 |
<normaloff>:/newPrefix/line.png</normaloff>:/newPrefix/line.png</iconset> |
440 | 438 |
</property> |
441 | 439 |
<property name="text"> |
442 |
<string>Create Line</string> |
|
440 |
<string>Create Stream Line</string>
|
|
443 | 441 |
</property> |
444 | 442 |
<property name="toolTip"> |
445 |
<string>Create Line(L)</string> |
|
443 |
<string>Create Stream Line(L)</string>
|
|
446 | 444 |
</property> |
447 | 445 |
<property name="font"> |
448 | 446 |
<font> |
... | ... | |
488 | 486 |
<property name="font"> |
489 | 487 |
<font> |
490 | 488 |
<family>맑은 고딕</family> |
491 |
<weight>75</weight>
|
|
492 |
<bold>true</bold>
|
|
489 |
<weight>50</weight>
|
|
490 |
<bold>false</bold>
|
|
493 | 491 |
</font> |
494 | 492 |
</property> |
495 | 493 |
</action> |
내보내기 Unified diff