introduced MDISubPlotBase
This commit is contained in:
@ -3,30 +3,36 @@ from .mdisubwin import MDISubWindow
|
||||
from ..theme import pg_plot_style, pg_plot_style_cycler, pg_legend_style
|
||||
|
||||
|
||||
class MDISubPlot(MDISubWindow):
|
||||
class MDISubPlotBase(MDISubWindow):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.pw = pw = pg.PlotWidget()
|
||||
self.setWidget(pw)
|
||||
|
||||
|
||||
|
||||
class MDISubPlot(MDISubPlotBase):
|
||||
|
||||
def __init__(self, name, desc, *args, **kwargs):
|
||||
super().__init__(name, *args, **kwargs)
|
||||
pw = pg.PlotWidget()
|
||||
self.setWidget(pw)
|
||||
|
||||
style = pg_plot_style()
|
||||
|
||||
plot = desc.make_plot(pw, style)
|
||||
plot = desc.make_plot(self.pw, style)
|
||||
self.plots = {name: plot}
|
||||
|
||||
|
||||
|
||||
class MDISubMultiPlot(MDISubWindow):
|
||||
class MDISubMultiPlot(MDISubPlotBase):
|
||||
|
||||
def __init__(self, name, descs, *args, **kwargs):
|
||||
super().__init__(name, *args, **kwargs)
|
||||
pw = pg.PlotWidget()
|
||||
self.setWidget(pw)
|
||||
|
||||
ls = pg_legend_style()
|
||||
psc = pg_plot_style_cycler()
|
||||
|
||||
pw = self.pw
|
||||
pw.addLegend(**ls)
|
||||
self.plots = {name: desc.make_plot(pw, style) for (name, desc), style in zip(descs.items(), psc)}
|
||||
|
||||
|
Reference in New Issue
Block a user