개정판 64adee37
Runs 분리 후 QResultTreeWidget에 출력되도록 수정
DTI_PID/DTI_PID/QResultTreeWidget.py | ||
---|---|---|
128 | 128 |
Insert if-statement for QEngineeringNoteItem |
129 | 129 |
Add if-statement for QEngineeringLineNoTextItem |
130 | 130 |
Jeongwoo 2018.05.11 Set color when SymbolSvgItem moved into new parent(Line No) |
131 |
Jeongwoo 2018.05.15 Add break keyword on if-statement |
|
131 | 132 |
''' |
132 | 133 |
def addTreeItem(self, parent, child): |
133 | 134 |
item = None |
... | ... | |
177 | 178 |
item.data(0, self.TREE_DATA_ROLE).setColor(brush.color().name()) |
178 | 179 |
item.setFont(0, item.font(0)) |
179 | 180 |
runItem.addChild(item) |
181 |
break |
|
180 | 182 |
else: |
181 | 183 |
print(item.text(0) + " Not Found on " + parent.text(0)) |
182 |
#brush = parent.foreground(0) |
|
183 |
#item.setForeground(0, brush) |
|
184 |
#item.data(0, self.TREE_DATA_ROLE).setColor(brush.color().name()) |
|
185 |
#item.setFont(0, item.font(0)) |
|
186 |
#parent.addChild(item) |
|
187 | 184 |
break |
188 | 185 |
elif type(child) is QEngineeringLineNoTextItem: |
189 | 186 |
foundItems = self.findItems(child.text(), Qt.MatchExactly|Qt.MatchRecursive, 0) |
DTI_PID/DTI_PID/Shapes/QEngineeringAbstractItem.py | ||
---|---|---|
1 | 1 |
from PyQt5.QtCore import pyqtSignal, QObject |
2 | 2 |
|
3 |
class QEngineeringAbstractItem(QObject): |
|
3 |
''' |
|
4 |
@history 2018.05.15 Jeongwoo Remove Parent Object [QObject] |
|
5 |
''' |
|
6 |
class QEngineeringAbstractItem(): |
|
7 |
''' |
|
8 |
@history 2018.05.15 Jeongwoo Remove call super |
|
9 |
''' |
|
4 | 10 |
def __init__(self): |
5 |
super(QEngineeringAbstractItem, self).__init__() |
|
11 |
#super(QEngineeringAbstractItem, self).__init__()
|
|
6 | 12 |
|
7 | 13 |
self._color = '#0000FF' # default color |
8 | 14 |
self._owner = None |
DTI_PID/DTI_PID/Shapes/QEngineeringLineItem.py | ||
---|---|---|
20 | 20 |
|
21 | 21 |
''' |
22 | 22 |
@history 2018.05.11 Jeongwoo Make Comments self.setPen() |
23 |
2018.05.15 Jeongwoo Change method to call parent's __init__ |
|
23 | 24 |
''' |
24 | 25 |
def __init__(self, parent=None): |
25 |
QGraphicsPolylineItem.__init__(self, parent) |
|
26 |
super(QEngineeringLineItem, self).__init__() |
|
27 |
#QGraphicsPolylineItem.__init__(self, parent) |
|
26 | 28 |
|
27 | 29 |
self.conns = [None, None] |
28 | 30 |
self._owner = None |
DTI_PID/DTI_PID/Shapes/QEngineeringLineNoTextItem.py | ||
---|---|---|
176 | 176 |
pass |
177 | 177 |
|
178 | 178 |
def hoverMoveEvent(self, event): |
179 |
pass |
|
179 |
pass |
|
180 |
|
|
181 |
''' |
|
182 |
@Override (QEngineeringTextItem) |
|
183 |
@brief get connected items |
|
184 |
@author Jeongwoo |
|
185 |
@date 2018.05.15 |
|
186 |
''' |
|
187 |
def getConnectedItems(self): |
|
188 |
visited = [] |
|
189 |
|
|
190 |
try: |
|
191 |
if self.runs is not None: |
|
192 |
for run in self.runs: |
|
193 |
items = run.items |
|
194 |
if items is not None: |
|
195 |
for item in items: |
|
196 |
pool = [] |
|
197 |
pool.append(item) |
|
198 |
while len(pool) > 0: |
|
199 |
it = pool.pop() |
|
200 |
visited.append(it) |
|
201 |
for conn in it.conns: |
|
202 |
if (conn is not None) and (conn not in visited): pool.append(conn) |
|
203 |
except Exception as ex: |
|
204 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
205 |
|
|
206 |
return visited |
DTI_PID/DTI_PID/Shapes/QGraphicsPolylineItem.py | ||
---|---|---|
15 | 15 |
class QGraphicsPolylineItem(QGraphicsPathItem, QEngineeringAbstractItem): |
16 | 16 |
''' |
17 | 17 |
@history 2018.05.11 Jeongwoo Declare variable self.pen |
18 |
2018.05.15 Jeongwoo Change method to call parent's __init__ |
|
18 | 19 |
''' |
19 | 20 |
def __init__(self, parent=None): |
20 | 21 |
import uuid |
21 |
|
|
22 |
QGraphicsPathItem.__init__(self, parent) |
|
22 |
super(QGraphicsPolylineItem, self).__init__() |
|
23 |
#QGraphicsPathItem.__init__(self, parent)
|
|
23 | 24 |
QEngineeringAbstractItem.__init__(self) |
24 | 25 |
self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
25 | 26 |
|
내보내기 Unified diff