You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make a PlotFrame class for Toolbar and sidecar functionality #310
I don't think we can use Widget or any ipywidget imports, such as VBox directly within show() because if ipywidgets is not installed in the environment (if they are using fastplotlib with only glfw or Qt), this will raise a error.
Likewise, since Sidecar is referenced in show(), it will raise an error if it's not installed.
Proposed solution:
Create PlotFrameBase and two subclasses PlotFrameNotebook and PlotFrameDesktop. The notebook subclass implements the toolbar, other ipywidget stuff, and sidecar. The desktop subclass has a more basic show().
Need to think about how exactly to implement this. Should Plot and GridPlot just inherit from PlotFrame? Can probably use a __init_subclass__ method that determines if it's running in a nb or not, and then starts the right subclass.
@clewis7 what are you thoughts on making a PlotFrame that's compatible with both ipywidgets and Qt? As much as we like ipywidgets, I think it's inevitable that a lot of people will want Qt. In notebooks we are quite limited by the jpeg encoding, which really becomes limiting as we approach 4k resolutions especially on laptops.
Activity
clewis7 commentedon Sep 23, 2023
show()method is getting pretty spaghetti-like, need to create a class forPlotandGridPlotto subclass fromkushalkolar commentedon Sep 24, 2023
More thoughts from #300 :
Widgetor anyipywidgetimports, such asVBoxdirectly withinshow()because ifipywidgetsis not installed in the environment (if they are usingfastplotlibwith onlyglfworQt), this will raise a error.Sidecaris referenced inshow(), it will raise an error if it's not installed.Proposed solution:
PlotFrameBaseand two subclassesPlotFrameNotebookandPlotFrameDesktop. The notebook subclass implements the toolbar, otheripywidgetstuff, andsidecar. The desktop subclass has a more basicshow().Need to think about how exactly to implement this. Should
PlotandGridPlotjust inherit fromPlotFrame? Can probably use a__init_subclass__method that determines if it's running in a nb or not, and then starts the right subclass.kushalkolar commentedon Oct 2, 2023
All toolbar buttons should be
@propertiesso the button states and programmatic access are syncedkushalkolar commentedon Oct 4, 2023
Thinking about this a bit, and I think that the best way to organize this is to get some direct inspiration from pyqtgraph 😄
https://pyqtgraph.readthedocs.io/en/latest/getting_started/plotting.html#organization-of-plotting-classes
kushalkolar commentedon Oct 12, 2023
sidecar instance, and other plot "housekeeping" instances should be read-only properties.
kushalkolar commentedon Oct 26, 2023
@clewis7 what are you thoughts on making a
PlotFramethat's compatible with bothipywidgetsandQt? As much as we likeipywidgets, I think it's inevitable that a lot of people will wantQt. In notebooks we are quite limited by the jpeg encoding, which really becomes limiting as we approach 4k resolutions especially on laptops.clewis7 commentedon Oct 26, 2023
I think supporting Qt would be great, would also help with the napari embedding too probably
kushalkolar commentedon Oct 26, 2023
this wouldn't help with napari, that's really a napari-specific issue where their canvas isn't easily swapped out