개정판 59643c3f
fixed some bugs and enhance UX
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
59 | 59 |
Jeongwoo 2018.05.10 Add Signal/Slot Connection 'lineNoSingleClicked' |
60 | 60 |
Add QActionGroup for managing checkable action |
61 | 61 |
Jeongwoo 2018.06.27 Add Action [Zoom, Fit Window] and Add new actions into ActionGroup |
62 |
humkyung 2018.08.23 add labelStatus to statusbar |
|
62 | 63 |
''' |
63 | 64 |
def __init__(self): |
64 | 65 |
super(self.__class__, self).__init__() |
65 | 66 |
self.setupUi(self) |
66 |
|
|
67 |
self.lastClickedCheckableAction = None |
|
67 |
self.labelStatus = QLabel(self.statusbar) |
|
68 |
self.labelStatus.setText('미인식 : ') |
|
69 |
self.statusbar.addPermanentWidget(self.labelStatus) |
|
68 | 70 |
|
69 | 71 |
docData = AppDocData.instance() |
70 | 72 |
project = docData.getCurrentProject() |
... | ... | |
157 | 159 |
self.actionFitWindow.triggered.connect(self.fitWindow) |
158 | 160 |
self.actionpdf_to_image.triggered.connect(self.onConvertPDFToImage) |
159 | 161 |
self.graphicsView.scene.changed.connect(lambda: self.resultTreeWidget.sceneChanged(self.graphicsView.scene.items())) |
162 |
self.graphicsView.scene.changed.connect(self.onSceneChanged) |
|
160 | 163 |
self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged) |
161 | 164 |
self.actionInitialize.triggered.connect(self.onInitializeScene) |
162 | 165 |
self.resultPropertyTableWidget.cellDoubleClicked.connect(self.cellDoubleClickedEvent) |
... | ... | |
172 | 175 |
self.delimiter = '"' |
173 | 176 |
|
174 | 177 |
''' |
178 |
@brief show unknownitem's count |
|
179 |
@author humkyung |
|
180 |
@date 2018.08.23 |
|
181 |
''' |
|
182 |
def onSceneChanged(self): |
|
183 |
items = [item for item in self.graphicsView.scene.items() if type(item) is QEngineeringUnknownItem] |
|
184 |
if len(items) > 0: |
|
185 |
self.labelStatus.setText("<font color='red'>미인식 : {}</font>".format(len(items))) |
|
186 |
else: |
|
187 |
self.labelStatus.setText("<font color='black'>미인식 : {}</font>".format(len(items))) |
|
188 |
|
|
189 |
''' |
|
175 | 190 |
@brief action save click event |
176 | 191 |
@author kyouho |
177 | 192 |
@date 2018.08.09 |
... | ... | |
425 | 440 |
def actionGroupTriggered(self, action): |
426 | 441 |
if self.graphicsView.command is not None: |
427 | 442 |
self.graphicsView.useDefaultCommand() |
428 |
if self.lastClickedCheckableAction is not None and self.lastClickedCheckableAction == action and action.isChecked(): |
|
429 |
action.setChecked(False) |
|
430 |
self.lastClickedCheckableAction = None |
|
431 |
elif action.isCheckable(): |
|
432 |
self.lastClickedCheckableAction = action |
|
433 |
else: |
|
434 |
if self.lastClickedCheckableAction is not None: |
|
435 |
self.lastClickedCheckableAction.setChecked(False) |
|
436 |
self.lastClickedCheckableAction = None |
|
443 |
|
|
444 |
for _action in self.actionGroup.actions(): |
|
445 |
_action.setChecked(False) |
|
446 |
|
|
447 |
action.setChecked(True) |
|
437 | 448 |
|
438 | 449 |
''' |
439 | 450 |
@brief Create Equipment |
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
493 | 493 |
|
494 | 494 |
if hasattr(self, '_underItem') and self._underItem is not None: |
495 | 495 |
self._underItem.hoverLeaveEvent(event) |
496 |
self._underItem = None |
|
496 | 497 |
|
497 | 498 |
scenePos = self.mapToScene(event.pos()) |
498 | 499 |
svgFileName = event.mimeData().text() |
499 | 500 |
svg = self.createSymbolObject(svgFileName) |
500 | 501 |
self.matchSymbolToLine(svg, scenePos) |
502 |
|
|
501 | 503 |
event.acceptProposedAction() |
502 | 504 |
|
503 | 505 |
''' |
... | ... | |
522 | 524 |
return svg |
523 | 525 |
|
524 | 526 |
''' |
525 |
@brief match symbol to line |
|
526 |
@author kyouho |
|
527 |
@date 2018.07.27 |
|
527 |
@brief match symbol to line |
|
528 |
@author kyouho |
|
529 |
@date 2018.07.27 |
|
530 |
@history humkyung 2018.08.23 change scenePos to connector's center when symbol is placed on connector |
|
528 | 531 |
''' |
529 | 532 |
def matchSymbolToLine(self, svg, scenePos): |
533 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
534 |
|
|
535 |
items = [item for item in self.scene.items(scenePos) if type(item) is not QGraphicsPixmapItem] |
|
536 |
if len(items) > 0 and type(items[0]) is QEngineeringConnectorItem: |
|
537 |
scenePos = QPointF(items[0].center()[0], items[0].center()[1]) |
|
538 |
|
|
530 | 539 |
matches = [item for item in self.scene.items() if (type(item) is QEngineeringLineItem) and (item.distanceTo((scenePos.x(), scenePos.y())) < 20)] |
531 | 540 |
if len(matches) == 1: |
532 | 541 |
matches[0].insertSymbol(svg, scenePos) |
DTI_PID/DTI_PID/Shapes/EngineeringUnknownItem.py | ||
---|---|---|
20 | 20 |
|
21 | 21 |
class QEngineeringUnknownItem(QEngineeringPolylineItem, QEngineeringAbstractItem): |
22 | 22 |
HIGHLIGHT = '#BC4438' |
23 |
ZVALUE = 30
|
|
23 |
ZVALUE = 60
|
|
24 | 24 |
|
25 | 25 |
''' |
26 | 26 |
@history 2018.06.18 Jeongwoo Add variable [transfer] for pyqtSignal |
내보내기 Unified diff