pass ConfigPanel into all other panels
This commit is contained in:
+11
-12
@@ -15,22 +15,21 @@ class DAQFrame(wx.Frame):
|
||||
wx.Frame.__init__(self, None, title=title)#, size=(350,200))
|
||||
self.SetIcon(get_wx_icon())
|
||||
|
||||
acquisition = scanner.default_acquisitions[0] #TODO loop!
|
||||
instrument = acquisition.instrument
|
||||
|
||||
panel_main = MainPanel(self)
|
||||
notebook = NotebookDX(panel_main)
|
||||
panel_main.wrap(notebook)
|
||||
|
||||
panel_config = ConfigPanel( notebook, acquisition, name="Config")
|
||||
panel_static = StaticPanel( notebook, acquisition, instrument, name="Static")
|
||||
panel_scan = ScanPanel( notebook, scanner, instrument, name="Scan")
|
||||
panel_spec = SpecialScanPanel(notebook, scanner, instrument, name="Special")
|
||||
panel_scan2D = Scan2DPanel( notebook, scanner, instrument, name="Scan2D")
|
||||
panel_tweak = TweakPanel( notebook, name="Tweak")
|
||||
panel_goto = GoToPanel( notebook, name="GoTo")
|
||||
panel_run = RunPanel( notebook, acquisition, instrument, name="Run")
|
||||
panel_sfx = SFXPanel( notebook, acquisition, instrument, name="SFX")
|
||||
panel_config = cfg = ConfigPanel(notebook, scanner, name="Config")
|
||||
|
||||
panel_static = StaticPanel( notebook, cfg, name="Static")
|
||||
panel_scan = ScanPanel( notebook, cfg, name="Scan")
|
||||
panel_spec = SpecialScanPanel(notebook, cfg, name="Special")
|
||||
panel_scan2D = Scan2DPanel( notebook, cfg, name="Scan2D")
|
||||
panel_tweak = TweakPanel( notebook, cfg, name="Tweak")
|
||||
panel_goto = GoToPanel( notebook, cfg, name="GoTo")
|
||||
panel_run = RunPanel( notebook, cfg, name="Run")
|
||||
panel_sfx = SFXPanel( notebook, cfg, name="SFX")
|
||||
|
||||
|
||||
notebook.AddPage(panel_config)
|
||||
if show_static: notebook.AddPage(panel_static)
|
||||
|
||||
@@ -13,13 +13,13 @@ class ConfigPanel(wx.Panel):
|
||||
# instrument
|
||||
# pgroup
|
||||
|
||||
def __init__(self, parent, acquisition, *args, **kwargs):
|
||||
def __init__(self, parent, scanner, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.acquisition = acquisition
|
||||
|
||||
instrument = acquisition.instrument
|
||||
pgroup = acquisition.pgroup
|
||||
self.scanner = scanner
|
||||
self.acquisition = acquisition = scanner.default_acquisitions[0] #TODO loop!
|
||||
self.instrument = instrument = acquisition.instrument
|
||||
self.pgroup = pgroup = acquisition.pgroup
|
||||
|
||||
#SFDAQ: rate_multiplicator only for sf_daq
|
||||
rate_multiplicator = acquisition.client.config.rate_multiplicator
|
||||
|
||||
@@ -9,7 +9,7 @@ from .tools import run
|
||||
|
||||
class GoToPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
def __init__(self, parent, _config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
markers = sorted(instances(Marker), key=repr)
|
||||
|
||||
@@ -15,10 +15,12 @@ class RunPanel(wx.Panel):
|
||||
# continuous=False
|
||||
# wait=True
|
||||
|
||||
def __init__(self, parent, acquisition, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.acquisition = acquisition
|
||||
self.acquisition = config.acquisition
|
||||
instrument = config.instrument
|
||||
|
||||
self.task = None
|
||||
|
||||
# widgets:
|
||||
|
||||
@@ -17,10 +17,12 @@ class ScanPanel(wx.Panel):
|
||||
# start_immediately=True, step_info=None
|
||||
# return_to_initial_values=None
|
||||
|
||||
def __init__(self, parent, scanner, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.scanner = scanner
|
||||
self.scanner = config.scanner
|
||||
instrument = config.instrument
|
||||
|
||||
self.scan = None
|
||||
|
||||
# widgets:
|
||||
|
||||
@@ -9,10 +9,12 @@ from .tools import AdjustableSelection, ETADisplay, correct_n_pulses, run
|
||||
|
||||
class Scan2DPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, scanner, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.scanner = scanner
|
||||
self.scanner = config.scanner
|
||||
instrument = config.instrument
|
||||
|
||||
self.scan = None
|
||||
|
||||
# widgets:
|
||||
|
||||
@@ -35,10 +35,13 @@ class SFXPanel(wx.Panel):
|
||||
# continuous=False
|
||||
# wait=True
|
||||
|
||||
def __init__(self, parent, acquisition, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.acquisition = acquisition
|
||||
self.acquisition = config.acquisition
|
||||
instrument = config.instrument
|
||||
pgroup = config.pgroup
|
||||
|
||||
self.task = None
|
||||
|
||||
# widgets:
|
||||
@@ -48,7 +51,7 @@ class SFXPanel(wx.Panel):
|
||||
self.le_npulses = le_npulses = LabeledMathEntry(self, label="#Pulses", value="100")
|
||||
self.le_fname = le_fname = LabeledFilenameEntry(self, label="Filename", value="test")
|
||||
|
||||
fn_pattern = f"/sf/{acquisition.instrument}/data/{acquisition.pgroup}/res/automatic/CELL/*.cell"
|
||||
fn_pattern = f"/sf/{instrument}/data/{pgroup}/res/automatic/CELL/*.cell"
|
||||
fns = sorted(iglob(fn_pattern))
|
||||
cell_names = [
|
||||
fn.split("/")[-1].split(".")[0] for fn in fns
|
||||
|
||||
@@ -10,10 +10,12 @@ from .tools import AdjustableSelection, ETADisplay, correct_n_pulses, run, post_
|
||||
|
||||
class SpecialScanPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, scanner, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.scanner = scanner
|
||||
self.scanner = config.scanner
|
||||
instrument = config.instrument
|
||||
|
||||
self.scan = None
|
||||
|
||||
# widgets:
|
||||
|
||||
@@ -14,10 +14,12 @@ class StaticPanel(wx.Panel):
|
||||
# n_pulses=100
|
||||
# wait=True
|
||||
|
||||
def __init__(self, parent, acquisition, instrument, *args, **kwargs):
|
||||
def __init__(self, parent, config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.acquisition = acquisition
|
||||
self.acquisition = config.acquisition
|
||||
instrument = config.instrument
|
||||
|
||||
self.task = None
|
||||
|
||||
# widgets:
|
||||
|
||||
@@ -26,7 +26,7 @@ TWEAK_COLORS = {
|
||||
|
||||
class TweakPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
def __init__(self, parent, _config, *args, **kwargs):
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.task = None
|
||||
|
||||
Reference in New Issue
Block a user