개정판 442f079d
QResultTreeWidget에 Run 단위로 출력하기 위한 준비 작업
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
31 | 31 |
@date 2018.04.16 |
32 | 32 |
@history 2018.04.26 Jeongwoo docDatalineNos = self.lineNos, Not For loop |
33 | 33 |
humkyung 2018.05.08 add flow arrow |
34 |
Jeongwoo 2018.05.14 Add [runs] on Primary/Secondary Line - Need to modify Secondary Line |
|
34 | 35 |
''' |
35 | 36 |
def execute(self, toler=50): |
36 | 37 |
from QEngineeringLineItem import QEngineeringLineItem |
38 |
from SymbolSvgItem import SymbolSvgItem |
|
37 | 39 |
|
38 | 40 |
try: |
39 | 41 |
docData = AppDocData.instance() |
... | ... | |
65 | 67 |
for item in connectedItems: item.owner = lineno # set item's owner |
66 | 68 |
|
67 | 69 |
connectedLines = [item for item in connectedItems if type(item) is QEngineeringLineItem] |
70 |
connectedSymbols = [item for item in connectedItems if issubclass(type(item), SymbolSvgItem)] |
|
71 |
lineno.runs.append(connectedSymbols) |
|
68 | 72 |
|
69 | 73 |
maxLength = None |
70 | 74 |
maxLengthItem = None |
... | ... | |
83 | 87 |
matches = [x for x in self._lines if x.owner is not None and x.isConnectable(line)] |
84 | 88 |
if matches: |
85 | 89 |
connectedItems = self.findConnectedObjects(line, toler=10) |
86 |
for item in connectedItems: item.owner = matches[0] |
|
90 |
for item in connectedItems: item.owner = matches[0].owner
|
|
87 | 91 |
|
88 | 92 |
connectedLines = [item for item in connectedItems if type(item) is QEngineeringLineItem] |
93 |
connectedSymbols = [item for item in connectedItems if issubclass(type(item), SymbolSvgItem)] |
|
94 |
if connectedSymbols is not None and len(connectedSymbols) > 0: |
|
95 |
matches[0].owner.runs.append(connectedSymbols) |
|
89 | 96 |
|
90 | 97 |
maxLength = None |
91 | 98 |
maxLengthItem = None |
DTI_PID/DTI_PID/QResultTreeWidget.py | ||
---|---|---|
58 | 58 |
@brief Pick Color for Line No |
59 | 59 |
@author Jeongwoo |
60 | 60 |
@date 18.05.11 |
61 |
@history 18.05.14 Jeongwoo Change method to change color by changeTreeWidgetItemColorRecursively() |
|
61 | 62 |
''' |
62 | 63 |
def pickColorClickEvent(self, lineNoTreeWidgetItem): |
63 | 64 |
'''''' |
... | ... | |
72 | 73 |
if connectedItems is not None: |
73 | 74 |
for connectedItem in connectedItems: |
74 | 75 |
connectedItem.setColor(color.name()) |
75 |
for index in range(lineNoTreeWidgetItem.childCount()): |
|
76 |
child = lineNoTreeWidgetItem.child(index) |
|
77 |
child.setForeground(0, QBrush(color)) |
|
78 |
child.setFont(0, lineNoTreeWidgetItem.font(0)) |
|
76 |
self.changeTreeWidgetItemColorRecursively(lineNoTreeWidgetItem, color) |
|
77 |
|
|
78 |
''' |
|
79 |
@brief Change Color recursively |
|
80 |
@author Jeongwoo |
|
81 |
@date 18.05.14 |
|
82 |
''' |
|
83 |
def changeTreeWidgetItemColorRecursively(self, item, color): |
|
84 |
for index in range(item.childCount()): |
|
85 |
child = item.child(index) |
|
86 |
child.setForeground(0, QBrush(color)) |
|
87 |
child.setFont(0, child.font(0)) |
|
88 |
self.changeTreeWidgetItemColorRecursively(child, color) |
|
79 | 89 |
|
80 | 90 |
''' |
81 | 91 |
@brief Clear TreeWidget and Set Current PID |
... | ... | |
137 | 147 |
for item in foundItems: |
138 | 148 |
data = item.data(0, self.TREE_DATA_ROLE) |
139 | 149 |
if data is not None and (data == child) and (parent is not item.parent()): |
140 |
item.parent().removeChild(item) |
|
141 |
brush = parent.foreground(0) |
|
142 |
item.setForeground(0, brush) |
|
143 |
item.data(0, self.TREE_DATA_ROLE).setColor(brush.color().name()) |
|
144 |
item.setFont(0, item.font(0)) |
|
145 |
parent.addChild(item) |
|
150 |
parentData = parent.data(0, self.TREE_DATA_ROLE) |
|
151 |
if type(parentData) is QEngineeringLineNoTextItem: |
|
152 |
for index in range(len(parentData.runs)): |
|
153 |
runGroup = parentData.runs[index] |
|
154 |
if data in runGroup: |
|
155 |
item.parent().removeChild(item) |
|
156 |
runParent = parent.child(index) |
|
157 |
brush = parent.foreground(0) |
|
158 |
item.setForeground(0, brush) |
|
159 |
item.data(0, self.TREE_DATA_ROLE).setColor(brush.color().name()) |
|
160 |
item.setFont(0, item.font(0)) |
|
161 |
runParent.addChild(item) |
|
162 |
else: |
|
163 |
print(item.text(0) + " Not Found on " + parent.text(0)) |
|
164 |
|
|
165 |
#brush = parent.foreground(0) |
|
166 |
#item.setForeground(0, brush) |
|
167 |
#item.data(0, self.TREE_DATA_ROLE).setColor(brush.color().name()) |
|
168 |
#item.setFont(0, item.font(0)) |
|
169 |
#parent.addChild(item) |
|
146 | 170 |
break |
147 | 171 |
elif type(child) is QEngineeringLineNoTextItem: |
148 | 172 |
foundItems = self.findItems(child.text(), Qt.MatchExactly|Qt.MatchRecursive, 0) |
... | ... | |
150 | 174 |
for item in foundItems: |
151 | 175 |
data = item.data(0, self.TREE_DATA_ROLE) |
152 | 176 |
if data is not None and (data == child): |
177 |
for index in range(len(data.runs)): |
|
178 |
item.addChild(QTreeWidgetItem(['RUNS' + str(index+1)])) |
|
153 | 179 |
return item |
154 | 180 |
|
155 | 181 |
return item |
DTI_PID/DTI_PID/Shapes/QEngineeringLineNoTextItem.py | ||
---|---|---|
22 | 22 |
class QEngineeringLineNoTextItem(QEngineeringTextItem): |
23 | 23 |
#removed = pyqtSignal(QGraphicsItem) |
24 | 24 |
|
25 |
''' |
|
26 |
@history 18.05.14 Jeongwoo Add variable self.runs |
|
27 |
''' |
|
25 | 28 |
def __init__(self, parent=None): |
26 | 29 |
import uuid |
30 |
|
|
31 |
self.runs = [] |
|
27 | 32 |
|
28 | 33 |
QEngineeringTextItem.__init__(self, parent) |
29 | 34 |
|
DTI_PID/DTI_PID/Shapes/QEngineeringRunItem.py | ||
---|---|---|
1 |
from PyQt5.QtCore import pyqtSignal, QObject |
|
2 |
import os.path |
|
3 |
import copy |
|
4 |
try: |
|
5 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
|
6 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform |
|
7 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsPathItem |
|
8 |
except ImportError: |
|
9 |
try: |
|
10 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
11 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
12 |
except ImportError: |
|
13 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
14 |
|
|
15 |
from QGraphicsPolylineItem import QGraphicsPolylineItem |
|
16 |
|
|
17 |
class QEngineeringRunItem(QGraphicsPolylineItem): |
|
18 |
def __init__(self, parent=None): |
|
19 |
QGraphicsPolylineItem.__init__(self, parent) |
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
내보내기 Unified diff