Fix stage line updating, size up arrow heads?
parent
0449734c53
commit
ac84087755
|
@ -253,18 +253,19 @@ class LineEditor:
|
||||||
dotted=dotted,
|
dotted=dotted,
|
||||||
size=size,
|
size=size,
|
||||||
)
|
)
|
||||||
line.label._use_extra_fields = size is not None
|
# line.label._use_extra_fields = size is not None
|
||||||
|
|
||||||
# cache staging line after creation
|
# cache staging line after creation
|
||||||
self._stage_line = line
|
self._stage_line = line
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# apply input settings to existing staging line
|
||||||
label = line.label
|
label = line.label
|
||||||
|
|
||||||
# disable order size and other extras in label
|
# disable order size and other extras in label
|
||||||
label._use_extra_fields = size is not None
|
label._use_extra_fields = size is not None
|
||||||
label.size = size
|
label.size = size
|
||||||
# label.size_digits = line.label.size_digits
|
|
||||||
label.color = color
|
label.color = color
|
||||||
|
|
||||||
# Use the existing staged line instead but copy
|
# Use the existing staged line instead but copy
|
||||||
|
@ -276,11 +277,14 @@ class LineEditor:
|
||||||
line.setMouseHover(hl_on_hover)
|
line.setMouseHover(hl_on_hover)
|
||||||
line.show()
|
line.show()
|
||||||
|
|
||||||
# XXX: must have this to trigger updated
|
# XXX: must have this to trigger updated
|
||||||
# label contents rendering
|
# label contents rendering
|
||||||
line.setPos(y)
|
line.setPos(y)
|
||||||
line.set_level()
|
line.set_level()
|
||||||
label.show()
|
|
||||||
|
# show order info label
|
||||||
|
line.label.update()
|
||||||
|
line.label.show()
|
||||||
|
|
||||||
self._active_staged_line = line
|
self._active_staged_line = line
|
||||||
|
|
||||||
|
@ -302,15 +306,13 @@ class LineEditor:
|
||||||
|
|
||||||
# delete "staged" cursor tracking line from view
|
# delete "staged" cursor tracking line from view
|
||||||
line = self._active_staged_line
|
line = self._active_staged_line
|
||||||
|
if line:
|
||||||
cursor._trackers.remove(line)
|
cursor._trackers.remove(line)
|
||||||
|
|
||||||
if self._stage_line:
|
|
||||||
self._stage_line.hide()
|
|
||||||
self._stage_line.label.hide()
|
|
||||||
|
|
||||||
self._active_staged_line = None
|
self._active_staged_line = None
|
||||||
|
|
||||||
|
self._stage_line.hide()
|
||||||
|
self._stage_line.label.hide()
|
||||||
|
|
||||||
# show the crosshair y line
|
# show the crosshair y line
|
||||||
hl = cursor.graphics[chart]['hl']
|
hl = cursor.graphics[chart]['hl']
|
||||||
hl.show()
|
hl.show()
|
||||||
|
@ -422,17 +424,17 @@ class ArrowEditor:
|
||||||
None: 180, # pointing to right
|
None: 180, # pointing to right
|
||||||
}[pointing]
|
}[pointing]
|
||||||
|
|
||||||
yb = pg.mkBrush(hcolor(color))
|
|
||||||
arrow = pg.ArrowItem(
|
arrow = pg.ArrowItem(
|
||||||
angle=angle,
|
angle=angle,
|
||||||
baseAngle=0,
|
baseAngle=0,
|
||||||
headLen=5,
|
headLen=5*3,
|
||||||
headWidth=2,
|
headWidth=2*3,
|
||||||
tailLen=None,
|
tailLen=None,
|
||||||
|
pxMode=True,
|
||||||
|
|
||||||
# coloring
|
# coloring
|
||||||
pen=pg.mkPen(hcolor('papas_special')),
|
pen=pg.mkPen(hcolor('papas_special')),
|
||||||
brush=yb,
|
brush=pg.mkBrush(hcolor(color)),
|
||||||
)
|
)
|
||||||
arrow.setPos(x, y)
|
arrow.setPos(x, y)
|
||||||
|
|
||||||
|
@ -866,6 +868,8 @@ class ChartView(ViewBox):
|
||||||
key = ev.key()
|
key = ev.key()
|
||||||
mods = ev.modifiers()
|
mods = ev.modifiers()
|
||||||
|
|
||||||
|
print(f'text: {text}, key: {key}')
|
||||||
|
|
||||||
if mods == QtCore.Qt.ShiftModifier:
|
if mods == QtCore.Qt.ShiftModifier:
|
||||||
if self.state['mouseMode'] == ViewBox.PanMode:
|
if self.state['mouseMode'] == ViewBox.PanMode:
|
||||||
self.setMouseMode(ViewBox.RectMode)
|
self.setMouseMode(ViewBox.RectMode)
|
||||||
|
@ -890,6 +894,8 @@ class ChartView(ViewBox):
|
||||||
# https://forum.qt.io/topic/532/how-to-catch-ctrl-c-on-a-widget/9
|
# https://forum.qt.io/topic/532/how-to-catch-ctrl-c-on-a-widget/9
|
||||||
self.select_box.clear()
|
self.select_box.clear()
|
||||||
|
|
||||||
|
# cancel order or clear graphics
|
||||||
|
if key == QtCore.Qt.Key_C:
|
||||||
# delete any lines under the cursor
|
# delete any lines under the cursor
|
||||||
mode = self.mode
|
mode = self.mode
|
||||||
for line in mode.lines.lines_under_cursor():
|
for line in mode.lines.lines_under_cursor():
|
||||||
|
|
Loading…
Reference in New Issue