def __init__(self, parent, global_store, vsrc_name, *args, **kwargs):
		# If the device doesn't exist, give up.
		try:
			vsrc = global_store.devices[vsrc_name].device
		except (KeyError, AttributeError):
			self.Destroy()

			return

		Dialog.__init__(self, parent, title='Voltage source settings', *args, **kwargs)

		self.vsrc_name = vsrc_name

		# Dialog.
		dialog_box = wx.BoxSizer(wx.VERTICAL)

		## Settings panel.
		self.panel = VoltageSourceSettingsPanel(self, global_store, vsrc)
		dialog_box.Add(self.panel)

		self.SetSizerAndFit(dialog_box)

		# Subscriptions.
		pub.subscribe(self.msg_device, 'device.added')
		pub.subscribe(self.msg_device, 'device.removed')
Example #2
0
    def __init__(self, parent, global_store, vsrc_name, *args, **kwargs):
        # If the device doesn't exist, give up.
        try:
            vsrc = global_store.devices[vsrc_name].device
        except (KeyError, AttributeError):
            self.Destroy()

            return

        Dialog.__init__(self,
                        parent,
                        title='Voltage source settings',
                        *args,
                        **kwargs)

        self.vsrc_name = vsrc_name

        # Dialog.
        dialog_box = wx.BoxSizer(wx.VERTICAL)

        ## Settings panel.
        self.panel = VoltageSourceSettingsPanel(self, global_store, vsrc)
        dialog_box.Add(self.panel)

        self.SetSizerAndFit(dialog_box)

        # Subscriptions.
        pub.subscribe(self.msg_device, 'device.added')
        pub.subscribe(self.msg_device, 'device.removed')
Example #3
0
    def __init__(self, parent, global_store, model4g_name, *args, **kwargs):
        # If the device doesn't exist, give up.
        try:
            model4g = global_store.devices[model4g_name].device
        except (KeyError, AttributeError):
            self.Destroy()

            return

        Dialog.__init__(self,
                        parent,
                        title='Model4G Front Panel',
                        *args,
                        **kwargs)

        self.model4g_name = model4g_name

        # Dialog.
        dialog_box = wx.BoxSizer(wx.VERTICAL)

        ## Settings panel.
        self.panel = Model4GFrontPanel(self, global_store, model4g)
        dialog_box.Add(self.panel)

        self.SetSizerAndFit(dialog_box)

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Subscriptions.
        pub.subscribe(self.msg_device, 'device.added')
        pub.subscribe(self.msg_device, 'device.removed')
	def __init__(self, parent, global_store, model4g_name, *args, **kwargs):
		# If the device doesn't exist, give up.
		try:
			model4g = global_store.devices[model4g_name].device
		except (KeyError, AttributeError):
			self.Destroy()

			return

		Dialog.__init__(self, parent, title='Model4G Front Panel', *args, **kwargs)

		self.model4g_name = model4g_name

		# Dialog.
		dialog_box = wx.BoxSizer(wx.VERTICAL)

		## Settings panel.
		self.panel = Model4GFrontPanel(self, global_store, model4g)
		dialog_box.Add(self.panel)

		self.SetSizerAndFit(dialog_box)
		
		self.Bind(wx.EVT_CLOSE, self.OnClose)

		# Subscriptions.
		pub.subscribe(self.msg_device, 'device.added')
		pub.subscribe(self.msg_device, 'device.removed')
	def __init__(self, parent, global_store, ok_callback, port,	*args, **kwargs):
		Dialog.__init__(self, parent, title='Port {0} tuning'.format(port.num))

		self.global_store = global_store
		self.ok_callback = ok_callback
		self.port = port

		# Dialog.
		dialog_box = wx.BoxSizer(wx.VERTICAL)

		## Self-calibration.
		calibration_static_box = wx.StaticBox(self, label='DAC self-calibration')
		calibration_box = wx.StaticBoxSizer(calibration_static_box, wx.VERTICAL)
		dialog_box.Add(calibration_box, flag=wx.EXPAND|wx.ALL, border=5)

		self.calibrate_button = wx.Button(self, label='Self-calibrate')
		self.Bind(wx.EVT_BUTTON, self.OnCalibrate, self.calibrate_button)
		calibration_box.Add(self.calibrate_button, flag=wx.EXPAND)

		## Tuning.
		tuning_static_box = wx.StaticBox(self, label='Tuning')
		tuning_box = wx.StaticBoxSizer(tuning_static_box, wx.VERTICAL)
		dialog_box.Add(tuning_box, flag=wx.EXPAND)

		### Autotune.
		autotuning_static_box = wx.StaticBox(self, label='Autotuning')
		autotuning_box = wx.StaticBoxSizer(autotuning_static_box, wx.VERTICAL)
		tuning_box.Add(autotuning_box, flag=wx.EXPAND|wx.ALL, border=5)

		autotuning_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5)
		autotuning_box.Add(autotuning_sizer, flag=wx.CENTER)

		autotuning_sizer.Add(wx.StaticText(self, label='Resource name:'),
				flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		self.resource_name_input = wx.TextCtrl(self, size=(300,-1))
		autotuning_sizer.Add(self.resource_name_input)

		autotuning_sizer.Add(wx.StaticText(self, label='Max:'),
				flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		self.automax_input = FloatSpin(self, value=1, min_val=-10, max_val=10, increment=1,
				digits=5)
		autotuning_sizer.Add(self.automax_input)

		autotuning_sizer.Add(wx.StaticText(self, label='Min:'),
				flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		self.automin_input = FloatSpin(self, value=-1, min_val=-10, max_val=10, increment=1,
				digits=5)
		autotuning_sizer.Add(self.automin_input)

		self.autotune_button = wx.Button(self, label='Autotune')
		self.Bind(wx.EVT_BUTTON, self.OnAutotune, self.autotune_button)
		autotuning_box.Add(self.autotune_button, flag=wx.EXPAND)

		### Manual tune.
		tuning_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=5)
		tuning_box.Add(tuning_sizer, flag=wx.CENTER)

		tuning_sizer.Add(wx.StaticText(self, label='Gain:'),
				flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		self.gain_input = FloatSpin(self, value=0, min_val=-1e6, max_val=1e6, increment=1,
				digits=5)
		tuning_sizer.Add(self.gain_input)

		tuning_sizer.Add(wx.StaticText(self, label='Offset:'),
				flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		self.offset_input = FloatSpin(self, value=0, min_val=-1e6, max_val=1e6, increment=1,
				digits=5)
		tuning_sizer.Add(self.offset_input)

		## End buttons.
		button_box = wx.BoxSizer(wx.HORIZONTAL)
		dialog_box.Add(button_box, flag=wx.CENTER|wx.ALL, border=5)

		ok_button = wx.Button(self, wx.ID_OK)
		self.Bind(wx.EVT_BUTTON, self.OnOk, ok_button)
		button_box.Add(ok_button)

		cancel_button = wx.Button(self, wx.ID_CANCEL)
		button_box.Add(cancel_button)

		self.SetSizerAndFit(dialog_box)
Example #6
0
    def __init__(self, parent, global_store, ok_callback, port, *args,
                 **kwargs):
        Dialog.__init__(self, parent, title='Port {0} tuning'.format(port.num))

        self.global_store = global_store
        self.ok_callback = ok_callback
        self.port = port

        # Dialog.
        dialog_box = wx.BoxSizer(wx.VERTICAL)

        ## Self-calibration.
        calibration_static_box = wx.StaticBox(self,
                                              label='DAC self-calibration')
        calibration_box = wx.StaticBoxSizer(calibration_static_box,
                                            wx.VERTICAL)
        dialog_box.Add(calibration_box, flag=wx.EXPAND | wx.ALL, border=5)

        self.calibrate_button = wx.Button(self, label='Self-calibrate')
        self.Bind(wx.EVT_BUTTON, self.OnCalibrate, self.calibrate_button)
        calibration_box.Add(self.calibrate_button, flag=wx.EXPAND)

        ## Tuning.
        tuning_static_box = wx.StaticBox(self, label='Tuning')
        tuning_box = wx.StaticBoxSizer(tuning_static_box, wx.VERTICAL)
        dialog_box.Add(tuning_box, flag=wx.EXPAND)

        ### Autotune.
        autotuning_static_box = wx.StaticBox(self, label='Autotuning')
        autotuning_box = wx.StaticBoxSizer(autotuning_static_box, wx.VERTICAL)
        tuning_box.Add(autotuning_box, flag=wx.EXPAND | wx.ALL, border=5)

        autotuning_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5)
        autotuning_box.Add(autotuning_sizer, flag=wx.CENTER)

        autotuning_sizer.Add(wx.StaticText(self, label='Resource name:'),
                             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        self.resource_name_input = wx.TextCtrl(self, size=(300, -1))
        autotuning_sizer.Add(self.resource_name_input)

        autotuning_sizer.Add(wx.StaticText(self, label='Max:'),
                             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        self.automax_input = FloatSpin(self,
                                       value=1,
                                       min_val=-10,
                                       max_val=10,
                                       increment=1,
                                       digits=5)
        autotuning_sizer.Add(self.automax_input)

        autotuning_sizer.Add(wx.StaticText(self, label='Min:'),
                             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        self.automin_input = FloatSpin(self,
                                       value=-1,
                                       min_val=-10,
                                       max_val=10,
                                       increment=1,
                                       digits=5)
        autotuning_sizer.Add(self.automin_input)

        self.autotune_button = wx.Button(self, label='Autotune')
        self.Bind(wx.EVT_BUTTON, self.OnAutotune, self.autotune_button)
        autotuning_box.Add(self.autotune_button, flag=wx.EXPAND)

        ### Manual tune.
        tuning_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=5)
        tuning_box.Add(tuning_sizer, flag=wx.CENTER)

        tuning_sizer.Add(wx.StaticText(self, label='Gain:'),
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        self.gain_input = FloatSpin(self,
                                    value=0,
                                    min_val=-1e6,
                                    max_val=1e6,
                                    increment=1,
                                    digits=5)
        tuning_sizer.Add(self.gain_input)

        tuning_sizer.Add(wx.StaticText(self, label='Offset:'),
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        self.offset_input = FloatSpin(self,
                                      value=0,
                                      min_val=-1e6,
                                      max_val=1e6,
                                      increment=1,
                                      digits=5)
        tuning_sizer.Add(self.offset_input)

        ## End buttons.
        button_box = wx.BoxSizer(wx.HORIZONTAL)
        dialog_box.Add(button_box, flag=wx.CENTER | wx.ALL, border=5)

        ok_button = wx.Button(self, wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.OnOk, ok_button)
        button_box.Add(ok_button)

        cancel_button = wx.Button(self, wx.ID_CANCEL)
        button_box.Add(cancel_button)

        self.SetSizerAndFit(dialog_box)