Drop splitter resizes except for once at startup
Also adds a `GodWidget.resize_all()` helper method which resizes all sub-widgets and charts to their default ratios and/or parent-widget dependent defaults using the detected available space on screen. This is a "default layout" config method that eventually we'll probably want allow users to customize.history_view
parent
445849337f
commit
4f15ce346b
|
@ -292,11 +292,6 @@ class GodWidget(QWidget):
|
|||
if hist_chart:
|
||||
hist_chart.qframe.set_sidepane(self.search)
|
||||
|
||||
# NOTE: this resizes the fast chart as well as all it's
|
||||
# downstream fsp subcharts AND the slow chart which is part of
|
||||
# the same splitter.
|
||||
self.rt_linked.set_split_sizes()
|
||||
|
||||
# set window titlebar info
|
||||
symbol = self.rt_linked.symbol
|
||||
if symbol is not None:
|
||||
|
@ -356,6 +351,19 @@ class GodWidget(QWidget):
|
|||
for linked in [self.hist_linked, self.rt_linked]:
|
||||
yield linked
|
||||
|
||||
def resize_all(self) -> None:
|
||||
'''
|
||||
Dynamic resize sequence: adjusts all sub-widgets/charts to
|
||||
sensible default ratios of what space is detected as available
|
||||
on the display / window.
|
||||
|
||||
'''
|
||||
rt_linked = self.rt_linked
|
||||
rt_linked.set_split_sizes()
|
||||
self.rt_linked.resize_sidepanes()
|
||||
self.hist_linked.resize_sidepanes(from_linked=rt_linked)
|
||||
self.search.on_resize()
|
||||
|
||||
|
||||
class ChartnPane(QFrame):
|
||||
'''
|
||||
|
@ -488,7 +496,7 @@ class LinkedSplits(QWidget):
|
|||
prop = 3/8
|
||||
|
||||
h = self.height()
|
||||
histview_h = h * ((6/16) ** 2)
|
||||
histview_h = h * (6/16) * 0.666
|
||||
h = h - histview_h
|
||||
|
||||
major = 1 - prop
|
||||
|
@ -740,8 +748,6 @@ class LinkedSplits(QWidget):
|
|||
anchor_at=anchor_at,
|
||||
)
|
||||
|
||||
# scale split regions
|
||||
self.set_split_sizes()
|
||||
self.resize_sidepanes()
|
||||
return cpw
|
||||
|
||||
|
|
|
@ -979,6 +979,8 @@ async def display_symbol_data(
|
|||
# rt_linked.splitter.addWidget(hist_linked)
|
||||
rt_linked.focus()
|
||||
|
||||
godwidget.resize_all()
|
||||
|
||||
vlm_chart: Optional[ChartPlotWidget] = None
|
||||
async with trio.open_nursery() as ln:
|
||||
|
||||
|
@ -1027,6 +1029,8 @@ async def display_symbol_data(
|
|||
hist_linked.graphics_cycle()
|
||||
await trio.sleep(0)
|
||||
|
||||
godwidget.resize_all()
|
||||
|
||||
async with (
|
||||
open_order_mode(
|
||||
feed,
|
||||
|
@ -1042,9 +1046,9 @@ async def display_symbol_data(
|
|||
# let Qt run to render all widgets and make sure the
|
||||
# sidepanes line up vertically.
|
||||
await trio.sleep(0)
|
||||
rt_linked.resize_sidepanes()
|
||||
rt_linked.set_split_sizes()
|
||||
hist_linked.resize_sidepanes(from_linked=rt_linked)
|
||||
|
||||
# dynamic resize steps
|
||||
godwidget.resize_all()
|
||||
|
||||
# TODO: look into this because not sure why it was
|
||||
# commented out / we ever needed it XD
|
||||
|
@ -1067,7 +1071,7 @@ async def display_symbol_data(
|
|||
# push it 1/16th away from the y-axis
|
||||
y_offset=round(bars_in_mem / 16),
|
||||
)
|
||||
rt_linked.set_split_sizes()
|
||||
godwidget.resize_all()
|
||||
|
||||
# let the app run.. bby
|
||||
await trio.sleep_forever()
|
||||
|
|
Loading…
Reference in New Issue