개정판 318bf424
dev issue #587: MainWindow, QtImageViewer에 있는 SelectAttributeCommand 수정
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
11 | 11 |
import AreaOcrCommand |
12 | 12 |
import CreateSymbolCommand |
13 | 13 |
import AreaZoomCommand |
14 |
import SelectAttributeCommand |
|
15 | 14 |
import FenceCommand |
16 | 15 |
import PlaceLineCommand |
17 | 16 | |
... | ... | |
181 | 180 |
self.graphicsView.scene.changed.connect(self.onSceneChanged) |
182 | 181 |
self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged) |
183 | 182 |
self.actionInitialize.triggered.connect(self.onInitializeScene) |
184 |
self.resultPropertyTableWidget.cellDoubleClicked.connect(self.cellDoubleClickedEvent) |
|
183 |
self.resultPropertyTableWidget.cellDoubleClicked.connect(self.resultPropertyTableWidget.cellDoubleClickedEvent)
|
|
185 | 184 |
self.resultPropertyTableWidget.cellClicked.connect(self.cellClickedEvent) |
186 | 185 |
self.actionSave.triggered.connect(self.actionSaveCliked) |
187 | 186 |
self.addMessage.connect(self.onAddMessage) |
... | ... | |
374 | 373 |
elif (issubclass(type(attr), SymbolSvgItem) or type(attr) is QEngineeringTextItem): |
375 | 374 |
attr.unsetHightlight() |
376 | 375 | |
377 |
''' |
|
378 |
@brief resultPropertyTableWidget Cell Double Click Event |
|
379 |
@author kyouho |
|
380 |
@date 2018.07.19 |
|
381 |
''' |
|
382 |
def cellDoubleClickedEvent(self, row, column): |
|
383 |
if column == 1: |
|
384 |
keyCell = self.resultPropertyTableWidget.item(row, 0) |
|
385 |
attr = keyCell.tag |
|
386 |
cell = self.resultPropertyTableWidget.item(row, column) |
|
387 | ||
388 |
uid = attr.UID if attr else None |
|
389 |
""" |
|
390 |
for data in self.resultPropertyTableWidget.attrValueList: |
|
391 |
if data[0] == cell: |
|
392 |
uid = data[1] |
|
393 |
break |
|
394 |
""" |
|
395 |
|
|
396 |
items = self.graphicsView.scene.selectedItems() |
|
397 |
|
|
398 |
if uid is not None: |
|
399 |
if items is not None and len(items) == 1: |
|
400 |
if issubclass(type(items[0]), SymbolSvgItem): |
|
401 |
#appDocData = AppDocData.instance() |
|
402 |
#attrType = docData.getSymbolAttributeByUID(uid) |
|
403 |
if attr.AttributeType == 'Text Item' or attr.AttributeType == 'Symbol Item': |
|
404 |
cmd = SelectAttributeCommand.SelectAttributeCommand(items[0], attr, self.graphicsView) |
|
405 |
cmd.onSuccess.connect(self.onSuccessSelectAttribute) |
|
406 |
self.graphicsView.command = cmd |
|
407 |
self.graphicsView.command.setType(attr.AttributeType) |
|
408 |
cursor = QCursor(Qt.PointingHandCursor) |
|
409 |
QApplication.instance().setOverrideCursor(cursor) |
|
410 |
self.graphicsView.currentAttribute = uid |
|
411 |
|
|
412 |
# 기존 cellText를 가진 attrs 삭제 |
|
413 |
items[0].removeSelfAttr(uid) |
|
414 | ||
415 |
from PyQt5 import QtGui |
|
416 |
cellItem = QTableWidgetItem('') |
|
417 |
icon = QtGui.QIcon() |
|
418 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
419 |
cellItem.setIcon(icon) |
|
420 |
self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
|
421 |
else: |
|
422 |
self.resultPropertyTableWidget.editItem(cell) |
|
423 |
else: |
|
424 |
self.resultPropertyTableWidget.editItem(cell) |
|
425 |
elif items is not None and len(items) == 1 and type(items[0]) is QEngineeringLineNoTextItem: |
|
426 |
connCell = self.resultPropertyTableWidget.item(row, 0) |
|
427 |
if connCell.text() == 'CONN': |
|
428 |
## Line No Text Item의 CONN 속성 초기화 |
|
429 |
items[0].conns.clear() |
|
430 | ||
431 |
self.graphicsView.command = SelectAttributeCommand.SelectAttributeCommand(self.graphicsView) |
|
432 |
self.graphicsView.command.setType('Line Item') |
|
433 |
cursor = QCursor(Qt.PointingHandCursor) |
|
434 |
QApplication.instance().setOverrideCursor(cursor) |
|
435 |
|
|
436 |
from PyQt5 import QtGui |
|
437 |
cellItem = QTableWidgetItem('') |
|
438 |
icon = QtGui.QIcon() |
|
439 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
440 |
cellItem.setIcon(icon) |
|
441 |
self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
|
442 | ||
443 |
def onSuccessSelectAttribute(self, attr): |
|
444 |
self.resultPropertyTableWidget.refreshAttr(attr) |
|
445 | 376 | |
446 | 377 |
''' |
447 | 378 |
@brief add message listwidget |
내보내기 Unified diff