48 |
48 |
SymbolProp(None, 'Config', 'String'): None } # , SymbolProp(None, 'Freeze', 'Boolean'):False}
|
49 |
49 |
self._runs = []
|
50 |
50 |
|
51 |
|
self._labels = []
|
52 |
|
|
53 |
51 |
""" create freeze control """
|
54 |
52 |
# self.freeze_item = QEngineeringFreezeItem(-QEngineeringFreezeItem.FREEZE_SIZE*0.5, -QEngineeringFreezeItem.FREEZE_SIZE*0.5, QEngineeringFreezeItem.FREEZE_SIZE, QEngineeringFreezeItem.FREEZE_SIZE)
|
55 |
53 |
# self.freeze_item.setParentItem(self)
|
... | ... | |
110 |
108 |
""" highlight line no text and run's item """
|
111 |
109 |
from App import App
|
112 |
110 |
|
113 |
|
self.hover = True
|
114 |
|
self.update()
|
|
111 |
try:
|
|
112 |
self.hover = True
|
|
113 |
self.update()
|
|
114 |
|
|
115 |
for run in self.runs:
|
|
116 |
for item in run.items:
|
|
117 |
item.hoverEnterEvent(event)
|
|
118 |
|
|
119 |
add_doc_data = AppDocData.instance()
|
|
120 |
|
|
121 |
# display from / to indicator
|
|
122 |
if not add_doc_data.lineNoFromToIndicator or len(add_doc_data.lineNoFromToIndicator) < 2:
|
|
123 |
if run is self.runs[0] and (item is run.items[0] or item is run.items[-1]):
|
|
124 |
_label = QGraphicsTextItem('{}'.format("F")) if item is run.items[0] else QGraphicsTextItem('{}'.format("T"))
|
|
125 |
_label.setZValue(500)
|
|
126 |
font = QFont('Arial', 45)
|
|
127 |
font.setBold(True)
|
|
128 |
_label.setFont(font)
|
|
129 |
self.scene().addItem(_label)
|
|
130 |
_label.setPos(QPointF(item.origin[0] - 25, item.origin[1] - 25))
|
|
131 |
_label.setDefaultTextColor(Qt.green)
|
|
132 |
add_doc_data.lineNoFromToIndicator.append(_label)
|
|
133 |
elif add_doc_data.lineNoFromToIndicator:
|
|
134 |
if run is self.runs[0] and (item is run.items[0]):
|
|
135 |
add_doc_data.lineNoFromToIndicator[0].setPos(QPointF(item.origin[0] - 25, item.origin[1] - 25))
|
|
136 |
add_doc_data.lineNoFromToIndicator[0].setVisible(True)
|
|
137 |
elif run is self.runs[0] and (item is run.items[-1]):
|
|
138 |
add_doc_data.lineNoFromToIndicator[1].setPos(QPointF(item.origin[0] - 25, item.origin[1] - 25))
|
|
139 |
add_doc_data.lineNoFromToIndicator[1].setVisible(True)
|
|
140 |
# up to here
|
|
141 |
except Exception as ex:
|
|
142 |
from App import App
|
|
143 |
from AppDocData import MessageType
|
|
144 |
|
|
145 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
146 |
sys.exc_info()[-1].tb_lineno)
|
|
147 |
App.mainWnd().addMessage.emit(MessageType.Error, message)
|
115 |
148 |
|
116 |
|
for run in self.runs:
|
117 |
|
for item in run.items:
|
118 |
|
item.hoverEnterEvent(event)
|
119 |
|
|
120 |
|
# display from / to indicator
|
121 |
|
if not self._labels or len(self._labels) < 2:
|
122 |
|
if run is self.runs[0] and (item is run.items[0] or item is run.items[-1]):
|
123 |
|
_label = QGraphicsTextItem('{}'.format("F")) if item is run.items[0] else QGraphicsTextItem('{}'.format("T"))
|
124 |
|
_label.setZValue(500)
|
125 |
|
font = QFont('Arial', 45)
|
126 |
|
font.setBold(True)
|
127 |
|
_label.setFont(font)
|
128 |
|
self.scene().addItem(_label)
|
129 |
|
_label.setPos(QPointF(item.origin[0] - 25, item.origin[1] - 25))
|
130 |
|
_label.setDefaultTextColor(Qt.green)
|
131 |
|
self._labels.append(_label)
|
132 |
|
# up to here
|
133 |
149 |
|
134 |
150 |
def hoverLeaveEvent(self, event):
|
135 |
151 |
""" unhighlight line no text and run's item """
|
136 |
|
self.hover = False
|
137 |
|
self.update()
|
|
152 |
try:
|
|
153 |
self.hover = False
|
|
154 |
self.update()
|
138 |
155 |
|
139 |
|
for run in self.runs:
|
140 |
|
for item in run.items:
|
141 |
|
item.hoverLeaveEvent(event)
|
|
156 |
for run in self.runs:
|
|
157 |
for item in run.items:
|
|
158 |
item.hoverLeaveEvent(event)
|
|
159 |
|
|
160 |
add_doc_data = AppDocData.instance()
|
|
161 |
if add_doc_data.lineNoFromToIndicator:
|
|
162 |
for _label in add_doc_data.lineNoFromToIndicator:
|
|
163 |
_label.setVisible(False)
|
|
164 |
#self.scene().removeItem(_label)
|
|
165 |
#self._labels = []
|
|
166 |
except Exception as ex:
|
|
167 |
from App import App
|
|
168 |
from AppDocData import MessageType
|
|
169 |
|
|
170 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
171 |
sys.exc_info()[-1].tb_lineno)
|
|
172 |
App.mainWnd().addMessage.emit(MessageType.Error, message)
|
142 |
173 |
|
143 |
|
if self._labels:
|
144 |
|
for _label in self._labels:
|
145 |
|
self.scene().removeItem(_label)
|
146 |
|
self._labels = []
|
147 |
174 |
|
148 |
175 |
def keyPressEvent(self, event):
|
149 |
176 |
""" reverse line routine when user press 'C' key """
|