Commit Graph

30 Commits (1f8a365240fb5eb557d24cbeb166072b73db9577)

Author SHA1 Message Date
Tyler Goodlet cc67d23eee Drop old marker drawing code from `LevelLine.paint()`
We haven't been using it for a while and the supposed (remembered)
latency issue on interaction doesn't seem existing after applying the
cache mode. This allows dropping some internal state-logic and generally
simplifying the show-on-hover checks.

Further add `.show_markers()` and `.hide_markers()` as explicit methods
that can be called externally by UI business logic.
2022-09-23 17:17:32 -04:00
Tyler Goodlet 7c6d12d982 Always set marker y-pos even if we're tracking its x-pos 2022-09-19 16:17:05 -04:00
Tyler Goodlet df42e7acc4 Add `LevelLine.get_cursor()` to get any currently hovering mouse-cursor 2022-09-13 18:26:06 -04:00
Tyler Goodlet 44c6f6dfda Add level line flag to allow tracking its marker x-position 2022-09-13 17:43:04 -04:00
Tyler Goodlet 2a06dc997f Use pixel caching on our level lines 2022-09-12 20:25:15 -04:00
Tyler Goodlet 4d2e23b5ce Expose level line marker via property 2022-08-18 16:00:41 -04:00
Tyler Goodlet 1a0e89d07e Even more correct "default view" snap-to-pp-marker
This makes the `'r'` hotkey snap the last bar to the middle of the pp
line arrow marker no matter the zoom level. Now we also boot with
approximately the most number of x units on screen that keep the bars
graphics drawn in full (just before downsampling to a line).

Moved some internals around to get this all in place,
- drop `_anchors.marker_right_points()` and move it to a chart method.
- change `.pre_l1_x()` -> `.pre_l1_xs()` and just have it return the
  two view-mapped x values from the former method.
2022-04-30 11:36:23 -04:00
Tyler Goodlet 56c163cdd7 Make `ChartPlotWidget.default_view()` pin to L1
Instead of using a guess about how many x-indexes to reset the last
datum in-view to, calculate and shift the latest index such that it's
just before any L1 spread labels on the y-axis. This makes the view
placement "widget aware" and gives a much more cross-display UX.

Summary:
- add `ChartPlotWidget.pre_l1_x()` which returns a `tuple` of
  x view-coord points for the absolute x-pos and length of any L1
  line/labels
- make `.default_view()` only shift to see the xlast just outside
  the l1 but keep whatever view range xfirst as the first datum in view
- drop `LevelLine.right_point()` since this is now just a
  `.pre_l1_x()` call and can be retrieved from the line's internal chart
  ref
- drop `._style.bars_from/to_..` vars since we aren't using hard coded
  offsets any more
2022-04-30 11:36:23 -04:00
Tyler Goodlet d351fe14a8 Annoying doc string(s) 2022-01-25 08:30:00 -05:00
Tyler Goodlet 5e947e7887 Maybe show account names on order lines 2021-09-09 10:34:14 -04:00
Tyler Goodlet 1d8767d548 Make `order_line()` configurable for a pp line
We were re-implementing a few things order lines already support.
All we really needed was to not add a pp size label if one is provided.
Use `.hide_label()` in the mouse hover handler.
2021-09-06 09:28:11 -04:00
Tyler Goodlet 32f8931d79 Show "slots used" aka proportion "x" on order lines 2021-09-06 09:28:10 -04:00
Tyler Goodlet 09fccdf8e5 Add fiat size to each order line label 2021-09-06 09:28:10 -04:00
Tyler Goodlet 37f5648883 Clarify comment 2021-09-06 09:28:10 -04:00
Tyler Goodlet 1cb311602c Revert commenting bounding rect fix.. 2021-09-06 09:28:10 -04:00
Tyler Goodlet 69a1f5e8a8 Add line copy func, drop old markers cruft 2021-09-06 09:28:10 -04:00
Tyler Goodlet 92d6b19777 Rejig order line creation / config
In an effort to simplify line creation and management from an order
mode here's a slew of changes:
- use our new ``LevelMarker`` for order lines and fully drop usage
 of the original marker implementation stuff from `pg.InfiniteLine`
- add a left side label which shows the instrument's "units" value
  - the most fundamental unit for the "size" of the order
- allow passing in an optional `marker_size: str` so that `action: str`
  doesn't necessarily have to be passed (eg. when copying from an
  existing line)
- change a couple of internal line config options to be public attrs
  which can now be configured dynamically in real-time (since they're
  all `bool` anyway):
  * `hl_on_hover` -> `highlight_on_hover`
  * `_always_show_labels` -> `always_show_labels`
- `LevelLine.set_level()` now only sets the position if it was **not**
  called from the position changed signal (which would be redundant)
2021-09-06 09:28:10 -04:00
Tyler Goodlet 3ddd4bc2c2 Add a private level change cb, fix marker hidingn 2021-09-06 09:28:10 -04:00
Tyler Goodlet 4ddfea654b Lol, initial size calcs on order line update 2021-09-06 09:28:10 -04:00
Tyler Goodlet 64ccc79a33 Change order label format to color:count 2021-09-06 09:28:10 -04:00
Tyler Goodlet d283872eb6 Add a scene bounding rect getter to our label 2021-09-06 09:28:10 -04:00
Tyler Goodlet 7367ed5464 Drop all `ChartPlotWidget._lc` remap to `.linked 2021-09-06 09:28:10 -04:00
Tyler Goodlet d3457cd423 Drop position-line factory from lines module, add endpoint getter 2021-09-06 09:28:10 -04:00
Tyler Goodlet afcb323c49 Use `QGraphicsPathItem` for marker, add line hide method 2021-09-06 09:28:10 -04:00
Tyler Goodlet 69091a894f Move marker label anchor to anchors mod 2021-09-06 09:28:10 -04:00
Tyler Goodlet e58a980786 Move all anchor funcs to new mod 2021-09-06 09:28:10 -04:00
Tyler Goodlet 94d3f67707 Move marker level-line-positioning anchor to new module 2021-09-06 09:28:10 -04:00
Tyler Goodlet 3aab6d67e9 Use label anchor 2021-09-06 09:28:10 -04:00
Tyler Goodlet 791fd23524 Remove `LevelLine.add_label()`, add dynamic pp marker label 2021-09-06 09:28:10 -04:00
Tyler Goodlet 62dd327ef3 Drop `_graphics` subpkg; flat is better then nested 2021-09-05 13:59:40 -04:00