diff --git a/piker/ui/_display.py b/piker/ui/_display.py index 690bfb18..9cedcc63 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -21,6 +21,7 @@ this module ties together quote and computational (fsp) streams with graphics update methods via our custom ``pyqtgraph`` charting api. ''' +from functools import partial import itertools from math import floor import time @@ -208,6 +209,7 @@ class DisplayState(Struct): async def increment_history_view( # min_istream: tractor.MsgStream, ds: DisplayState, + loglevel: str = 'warning', ): hist_chart: ChartPlotWidget = ds.hist_chart hist_viz: Viz = ds.hist_viz @@ -229,7 +231,10 @@ async def increment_history_view( hist_viz.reset_graphics() # hist_viz.update_graphics(force_redraw=True) - async with open_sample_stream(1.) as min_istream: + async with open_sample_stream( + period_s=1., + loglevel=loglevel, + ) as min_istream: async for msg in min_istream: profiler = Profiler( @@ -310,7 +315,6 @@ async def increment_history_view( async def graphics_update_loop( - dss: dict[str, DisplayState], nurse: trio.Nursery, godwidget: GodWidget, @@ -319,6 +323,7 @@ async def graphics_update_loop( pis: dict[str, list[pgo.PlotItem, pgo.PlotItem]] = {}, vlm_charts: dict[str, ChartPlotWidget] = {}, + loglevel: str = 'warning', ) -> None: ''' @@ -462,9 +467,12 @@ async def graphics_update_loop( # }) nurse.start_soon( - increment_history_view, - # min_istream, - ds, + partial( + increment_history_view, + # min_istream, + ds=ds, + loglevel=loglevel, + ), ) await trio.sleep(0) @@ -511,14 +519,19 @@ async def graphics_update_loop( fast_chart.linked.isHidden() or not rt_pi.isVisible() ): - print(f'{fqme} skipping update for HIDDEN CHART') + log.debug( + f'{fqme} skipping update for HIDDEN CHART' + ) fast_chart.pause_all_feeds() continue ic = fast_chart.view._in_interact if ic: fast_chart.pause_all_feeds() - print(f'{fqme} PAUSING DURING INTERACTION') + log.debug( + f'Pausing chart updaates during interaction\n' + f'fqme: {fqme!r}' + ) await ic.wait() fast_chart.resume_all_feeds() @@ -1591,15 +1604,18 @@ async def display_symbol_data( # start update loop task dss: dict[str, DisplayState] = {} ln.start_soon( - graphics_update_loop, - dss, - ln, - godwidget, - feed, - # min_istream, + partial( + graphics_update_loop, + dss=dss, + nurse=ln, + godwidget=godwidget, + feed=feed, + # min_istream, - pis, - vlm_charts, + pis=pis, + vlm_charts=vlm_charts, + loglevel=loglevel, + ) ) # boot order-mode diff --git a/piker/ui/_fsp.py b/piker/ui/_fsp.py index 3a1a80a5..7a2df5e6 100644 --- a/piker/ui/_fsp.py +++ b/piker/ui/_fsp.py @@ -183,13 +183,17 @@ async def open_fsp_sidepane( @acm async def open_fsp_actor_cluster( - names: list[str] = ['fsp_0', 'fsp_1'], + names: list[str] = [ + 'fsp_0', + 'fsp_1', + ], ) -> AsyncGenerator[ int, dict[str, tractor.Portal] ]: + # TODO! change to .experimental! from tractor._clustering import open_actor_cluster # profiler = Profiler( @@ -197,7 +201,7 @@ async def open_fsp_actor_cluster( # disabled=False # ) async with open_actor_cluster( - count=2, + count=len(names), names=names, modules=['piker.fsp._engine'], @@ -497,7 +501,8 @@ class FspAdmin: portal: tractor.Portal = ( self.cluster.get(worker_name) - or self.rr_next_portal() + or + self.rr_next_portal() ) # TODO: this should probably be turned into a diff --git a/piker/ui/_widget.py b/piker/ui/_widget.py index b6a7322e..6d5c2b13 100644 --- a/piker/ui/_widget.py +++ b/piker/ui/_widget.py @@ -300,7 +300,10 @@ class GodWidget(QWidget): getattr(widget, 'on_resize') self._widgets[widget.mode_name] = widget - def on_win_resize(self, event: QtCore.QEvent) -> None: + def on_win_resize( + self, + event: QtCore.QEvent, + ) -> None: ''' Top level god widget handler from window (the real yaweh) resize events such that any registered widgets which wish to be @@ -315,7 +318,10 @@ class GodWidget(QWidget): self._resizing = True - log.info('God widget resize') + log.debug( + f'God widget resize\n' + f'{event}\n' + ) for name, widget in self._widgets.items(): widget.on_resize() diff --git a/piker/ui/_window.py b/piker/ui/_window.py index 39335092..aa2b9ea0 100644 --- a/piker/ui/_window.py +++ b/piker/ui/_window.py @@ -255,8 +255,16 @@ class MainWindow(QMainWindow): current: QWidget, ) -> None: + ''' + Focus handler. - log.info(f'widget focus changed from {last} -> {current}') + For now updates the "current mode" name. + + ''' + log.debug( + f'widget focus changed from,\n' + f'{last} -> {current}' + ) if current is not None: # cursor left window? diff --git a/piker/ui/cli.py b/piker/ui/cli.py index dfc7c7ea..d2072900 100644 --- a/piker/ui/cli.py +++ b/piker/ui/cli.py @@ -177,7 +177,7 @@ def chart( return # global opts - brokernames = config['brokers'] + # brokernames: list[str] = config['brokers'] brokermods = config['brokermods'] assert brokermods tractorloglevel = config['tractorloglevel'] @@ -216,6 +216,7 @@ def chart( layers['tcp']['port'], )) + # breakpoint() from tractor.devx import maybe_open_crash_handler pdb: bool = config['pdb'] with maybe_open_crash_handler(pdb=pdb): diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 3528ae64..0f655749 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -513,13 +513,14 @@ class OrderMode: def on_submit( self, uuid: str, - order: Order | None = None, + order: Order|None = None, - ) -> Dialog | None: + ) -> Dialog|None: ''' Order submitted status event handler. - Commit the order line and registered order uuid, store ack time stamp. + Commit the order line and registered order uuid, store ack + time stamp. ''' lines = self.lines.commit_line(uuid)