def send_frequency_value(self, value): """Gets the value from the spinbox in the gui and sends it to the device """ freq = Q_(value, self.gui.doubleSpinBox_frequency.suffix()) self.logger.debug('Frequency to set: {}'.format(freq)) if freq.m_as('Hz') != self.variable_waveplate_ins._freq.m_as('Hz'): self.variable_waveplate_ins.freq = freq
def step_changed(self): self.actiondict['step'] = str( spin_combo_to_pint_apply_limits(self.step_value, self.step_units, Q_(self.actiondict['step_min']), Q_(self.actiondict['step_max']))) if hasattr(self,'measurement_gui_parent'): self.measurement_gui_parent.update_from_guis()
def start_changed(self): self.actiondict['start'] = str( spin_combo_to_pint_apply_limits(self.start_value, self.start_units, Q_(self.actiondict['start_min']), Q_(self.actiondict['start_max']))) # If this action gui has gotten his parent measurement gui as input, this will update his parents gui, # for instance the expected scan time if hasattr(self,'measurement_gui_parent'): self.measurement_gui_parent.update_from_guis()
def set_parameters_for_osa_machine(self, end_wav, optical_resolution, sample_points, start_wav): #print(self.instr.start_wav) #print(self.instr.end_wav) #print(self.instr.optical_resolution) #print(self.instr.sample_points) self.instr.start_wav = Q_(start_wav) self.instr.end_wav = Q_(end_wav) self.instr.optical_resolution = float(optical_resolution) self.instr.sample_points = int(sample_points)
def expo_changed(self): """This method is the one that makes sure of updating the actiondict if the exposure time is changed by the user. """ self.actiondict['exposuretime'] = str( spin_combo_to_pint_apply_limits( self.expo_value, self.expo_units, Q_(self.actiondict['exposuretime_min']), Q_(self.actiondict['exposuretime_max']))) self.logger.debug('Changing winspec exposuretime') if hasattr(self, 'measurement_gui_parent'): self.logger.debug( 'winspec action gui can find his parent master gui') self.measurement_gui_parent.update_from_guis()
def array_from_string_quantities(start, stop, step=None, num=None): """ Wrapper around array_from_pint_quantities() that converts string arguments to pint quantities. Arguments start, stop and step should be strings, num could be integer (or string of integer). See array_from_pint_quantities() for further details. """ sta = Q_(start) sto = Q_(stop) if step == None: ste = None else: ste = Q_(step) return array_from_pint_quantities(sta, sto, ste, num)
def exposure_time_alt(self, value): if type(value) is not type(Q_('s')): self.logger.error('exposure_time should be Pint quantity') if value.dimensionality != Q_('s').dimensionality: self.logger.error('exposure_time should be Pint quantity with unit of time') else: if value.units == 'millisecond': exp_value = value.m / 1000 elif value.units == 'second': exp_value = value.m elif value.units == 'minute': exp_value = value.m * 60 self.controller.exp_set('EXPOSURE', exp_value)
def change_wavelength(self): """ Gui method to set the wavelength to the device """ w = Q_(self.doubleSpinBox_wavelength.value(), self.doubleSpinBox_wavelength.suffix()) self.logger.info('Setting the wavelength: {}'.format(w)) self.polarimeter_ins.change_wavelength(w)
def initUI(self): self.layout = QHBoxLayout() self.expo_value = QDoubleSpinBox() self.expo_units = QComboBox() display_units = ['us', 'ms', 's', 'min', 'hr'] self.expo_units.addItems(display_units) add_pint_to_combo(self.expo_units) if 'exposuretime' in self.actiondict and self.actiondict['exposuretime'] is not None: self.logger.debug('Applying config value to exposuretime in gui') pint_to_spin_combo(Q_(self.actiondict['exposuretime']), self.expo_value, self.expo_units) # After setting initial values, connect changes to the function that tries to apply them: self.expo_value.valueChanged.connect(self.expo_changed) self.expo_units.currentIndexChanged.connect(self.expo_changed) filter_a = QCheckBox('Filter A') filter_b = QCheckBox('Filter B') if 'filter_a' in self.actiondict: filter_a.setChecked(self.actiondict['filter_a']) if 'filter_b' in self.actiondict: filter_b.setChecked(self.actiondict['filter_b']) # Two ways of updating the dictionary when the checkbox is modified. # One readable way using a function. And one direct way without a function. Here are both: filter_a.stateChanged.connect(self.set_filter_a) filter_b.stateChanged.connect(lambda state: self.actiondict.__setitem__('filter_b', state)) self.layout.addWidget(self.expo_value) self.layout.addWidget(self.expo_units) self.layout.addWidget(QLabel(' ')) # spacer self.layout.addWidget(filter_a) self.layout.addWidget(filter_b)
def test_power_setpoint(self): """ Test the set and get for the power setpoint value """ print('Curent power {}'.format(self.inst.power_sp)) power_to_set = Q_(110, 'mW') self.inst.power_sp = power_to_set assert power_to_set == self.inst.power_sp self.logger.info('Power setpoint assertion passed')
def make_fields(self): """| In this method, the possible user input spinboxes and comboboxes are made. | For the exposure time, the value and unit are combined with Arons add_pint_to_combo methods. | The gratings are numbered and added. | The central wavelength is a spinbox and the suffix nm is always added. """ self.expo_value = QDoubleSpinBox() self.expo_value.setMaximum(99999) self.expo_units = QComboBox() display_units = ['us', 'ms', 's', 'min', 'hr'] self.expo_units.addItems(display_units) add_pint_to_combo(self.expo_units) if 'exposuretime' in self.actiondict and self.actiondict[ 'exposuretime'] is not None: self.logger.debug('Applying config value to exposuretime in gui') pint_to_spin_combo(Q_(self.actiondict['exposuretime']), self.expo_value, self.expo_units) # After setting initial values, connect changes to the function that tries to apply them: self.expo_value.valueChanged.connect(self.expo_changed) self.expo_units.currentIndexChanged.connect(self.expo_changed) self.grating = QComboBox() possible_gratings = ['1', '2', '3'] self.grating.addItems(possible_gratings) if 'grating' in self.actiondict and self.actiondict[ 'grating'] is not None: self.logger.debug('Choosing grating as in config file') self.grating.setCurrentText(str(self.actiondict['grating'])) self.grating.currentIndexChanged.connect(self.grating_changed) self.central_nm = QDoubleSpinBox() self.central_nm.setMaximum(2000) if 'central_nm' in self.actiondict and self.actiondict[ 'central_nm'] is not None: self.logger.debug('Putting the central wavelength in gui') self.central_nm.setValue(self.actiondict['central_nm']) self.central_nm.setSuffix('nm') self.central_nm.valueChanged.connect(self.central_nm_changed) if 'accumulations' in self.actiondict and self.actiondict[ 'accumulations'] is not None: self.accumulations = QSpinBox() self.accumulations.setValue(self.actiondict['accumulations']) self.accumulations.valueChanged.connect(self.accum_changed) if 'avalanche_gain' in self.actiondict and self.actiondict[ 'avalanche_gain'] is not None: self.avalanche_gain = QSpinBox() self.avalanche_gain.setValue(self.actiondict['avalanche_gain']) self.avalanche_gain.valueChanged.connect(self.avgain_changed) self.progress_label = QLabel() self.progress_label.setText('') self.progress_label.setObjectName('progress_label') self.progress_label.setStyleSheet( 'QLabel#progress_label {color: magenta}')
def pint_to_spin_combo(pint_quantity, doubleSpinBox, comboBox_units): """ When a GUI has a combination of a Q(Double)SpinBox and a QComboBox that hold the numeric value and the unit respectively, this function can be used to easily put a pint quantity into that combination. It is strongly recommended to use add_pint_to_combo(comboBox_units) before using this function! Complementary function is spin_combo_to_pint_apply_limits() :param pint_quantity: the pint quantity to write into the gui objects :type pint_quantity: pint quantity :param doubleSpinBox: the QDoubleSpinBox (or QSpinBox?) that holds the numeric value :type doubleSpinBox: QDoubleSpinBox (Maybe QSpinBox also works. Not tested) :param comboBox_units: the QComboBox that holds the units :type comboBox_units: QComboBox """ logger = logging.getLogger(__name__) if hasattr(comboBox_units, 'pint_units'): pint_units = comboBox_units.pint_units else: # otherwise try to create it on the fly: pint_units = [ Q_(comboBox_units.itemText(i)).units for i in range(comboBox_units.count()) ] # Try to convert the pint quantity to one of the units in the comboBox. # If that succeeds set the combobox unit and the value in the doubleSpinBox try: # First try to match the combo unit to the one of pint_quantity: combo_index = pint_units.index(pint_quantity.units) value = pint_quantity.m_as(pint_units[combo_index]) except ValueError: # If that fails find the unit that comes closest: v = list(log10([pint_quantity.m_as(un) for un in pint_units ])) # log10 of values converted to the combo units vp = [n for n in v if n >= 0 ] # only the positive ones (i.e. prefer 200ms over 0.2s ) if len(vp) == 0: # if there are none, add the largest negative one vp = max(v) combo_index = v.index(min(vp)) # get the corresponding index # If that fails try to convert to one of the units in the middle of the list: # combo_index = int((len(combo_index) - 1) / 2) # OLD CODE try: value = pint_quantity.m_as( pint_units[combo_index] ) # this will raise an error if the pint quantity is different dimensionality except ValueError: logger.error('Could not convert {} to one of: {}'.format( pint_quantity, units_pint)) raise ValueError doubleSpinBox.setValue(value) comboBox_units.setCurrentIndex(combo_index)
def spin_combo_to_pint_apply_limits(doubleSpinBox, comboBox_units, pint_lower_limit=None, pint_upper_limit=None): """ When a GUI has a combination of a Q(Double)SpinBox and a QComboBox that hold the numeric value and the unit respectively, this function can be used to convert the combined values to a pint quantity. In addition it applies limits if they are specified. Typically you'll make one function limit_and_apply_X in your gui code, and connect both >>> doubleSpinBox.valueChanged.connect(limit_and_apply_X) >>> comboBox_units.currentIndexChanged.connect(limit_and_apply_X) to this function. Inside limit_and_apply_X() you would use this function spin_combo_to_pint_apply_limits() to apply limits and convert it to a pint quantity It is strongly recommended to use add_pint_to_combo(comboBox_units) before using this function! Complementary function is pint_to_spin_combo() :param doubleSpinBox: Q(Double)SpinBox that holds the numeric value :param comboBox_units: QComboBox that holds the units :param pint_lower_limit: OPTIONAL pint quantity for the lower limit to apply :param pint_upper_limit: OPTIONAL pint quantity for the upper limit to apply :returns: pint quantity """ logger = logging.getLogger(__name__) value = doubleSpinBox.value() combo_index = comboBox_units.currentIndex() # If available use the units_pint stored inside comboBox_units object (by pint_to_doubleSpin_plus_unit_combo) if hasattr(comboBox_units, 'pint_units'): pint_units = comboBox_units.pint_units else: # otherwise try to create it on the fly: pint_units = [ Q_(comboBox_units.itemText(i)).units for i in range(comboBox_units.count()) ] new_quantity = value * pint_units[combo_index] logger.debug('new pint quantity: {}'.format(new_quantity)) if pint_upper_limit is not None and new_quantity > pint_upper_limit: new_quantity = pint_upper_limit pint_to_spin_combo(new_quantity, doubleSpinBox, comboBox_units) if pint_lower_limit is not None and new_quantity < pint_lower_limit: new_quantity = pint_lower_limit pint_to_spin_combo(new_quantity, doubleSpinBox, comboBox_units) return new_quantity
def add_pint_to_combo(comboBox_units, manual_list=None): """ When GUI has a QComboBox with units, this function can convert the display texts of the units to pint units and stores them inside the combobox object. (Run this function once). It is possible to manually specify the list to store, but it's safer to try automatic conversion. :param comboBox_units: :type comboBox_units: QComboBox :param manual_list: OPTIONAL list of pint units corresponding to the display units :type manual_list: list of pint units """ logger = logging.getLogger(__name__) if manual_list is not None: comboBox_units.pint_units = manual_list else: # List of strings used in the combo box: units_combo = [ comboBox_units.itemText(i) for i in range(comboBox_units.count()) ] # Try to convert the strings of the combo box to pint units: # If this fails user needs to fix it. try: # convert to pint units: pint_units = [Q_(un).units for un in units_combo] # logger.debug('{}'.format(units_pint)) except: logger.error('Failed to convert units in combobox to pint units') raise ValueError try: # Try to convert all strings to the first unit. This will raise an error if it fails [Q_(un).m_as(pint_units[0]) for un in units_combo] except: logger.error( 'Combobox units appear not to be of the same dimensionality') raise ValueError comboBox_units.pint_units = pint_units
def exposure_time(self, value,alt=False): if type(value) is not type(Q_('s')): self.logger.error('exposure_time should be Pint quantity') if value.dimensionality != Q_('s').dimensionality: self.logger.error('exposure_time should be Pint quantity with unit of time') else: if value.m_as('us') < 1: # remove this if necessary self.logger.warning('WinSpec will not accept exposuretime smaller than 1 us') if value != self._exposure_time or value.m != self._exposure_time.m: if value.units == 'microsecond': exp_unit = 1 exp_value = value.m_as('microsecond') elif value.units == 'millisecond': exp_unit = 2 exp_value = value.m_as('millisecond') elif value.units == 'second': exp_unit = 3 exp_value = value.m_as('second') elif value.units == 'minute': exp_unit = 4 exp_value = value.m_as('minute') elif value > 10*ur('minute'): exp_unit= 4 exp_value = value.m_as('minute') elif value < 1*ur('microsecond'): exp_unit = 1 exp_value = value.m_as('microsecond') else: exp_unit = 3 exp_value = value.m_as('second') self.controller.exp_set('EXPOSURETIME_UNITS',exp_unit) self.controller.exp_set('EXPOSURETIME',exp_value) if self.exposure_time != value: # this line also makes sure self._exposuretime gets the real Winspec value self.logger.warning('attempted to set exposure time to {}, but Winspec is at {}'.format(value, self._exposure_time))
def __init__(self, polarimeter_ins, plot_window, also_close_output=False): super().__init__() self.logger = logging.getLogger(__name__) # to load from the UI file gui_file = os.path.join(package_path,'view', 'polarization','polarimeter.ui') self.logger.info('Loading the GUI file: {}'.format(gui_file)) self.gui = uic.loadUi(gui_file, self) # set location in screen self.left = 700 self.top = 100 # change location self.gui.move(self.left, self.top) # get the inputs self.plot_window = plot_window # window self.polarimeter_ins = polarimeter_ins # instrument # setup the gui self.customize_gui() #self.get_device_state() #self.set_device_state_to_gui() self.show() # set the right wavelength self.polarimeter_ins.change_wavelength( Q_(self.gui.doubleSpinBox_wavelength.value(), self.gui.doubleSpinBox_wavelength.suffix())) # self._is_measuring = False # data vector creation self._buffer_size_factor = 20 self.data = np.zeros((len(self.polarimeter_ins.DATA_TYPES_NAME), int(self.gui.doubleSpinBox_measurement_length.value()*self._buffer_size_factor))) # length of the buffer self.data_time = np.zeros((int(self.gui.doubleSpinBox_measurement_length.value()*self._buffer_size_factor))) # length of the buffer # to handle the update of the plot we use a timer self.timer = QTimer() self.timer.timeout.connect(self.update_plot) # to be able to plot only the ticked fields self.index_to_plot = [] self.Plots = [] self.Plots.append(self.plot_window.pg_plot)
def send_voltage_v2(self, value): """ Sets the voltage 2 to the device""" self.variable_waveplate_ins.set_analog_value( 2, Q_(value, self.gui.doubleSpinBox_v2.suffix()))
def send_qwp(self, value): """ Sets the QWP wavelength to the device""" self.variable_waveplate_ins.set_quarter_waveplate_voltage( Q_(value, self.gui.doubleSpinBox_wavelength.suffix())) self._analog_value_1 = self.variable_waveplate_ins.get_analog_value(1) self.gui.doubleSpinBox_v1.setValue(self._analog_value_1.m_as('volt'))
Sets the power setpoint :param value: power to set :type value: pint Quantity """ return self.controller.power_sp @power_sp.setter def power_sp(self, value): self.controller.power_sp = value if __name__ == '__main__': import lantz.log lantz.log.log_to_screen(lantz.log.INFO) with CoboltLaser( settings={ 'dummy': False, 'controller': 'hyperion.controller.cobolt.cobolt08NLD/Cobolt08NLD', 'via_serial': 'COM5' }) as d: # #### test idn print('Identification = {}.'.format(d.idn())) print('power {}'.format(d.power_sp)) d.power_sp = Q_(110, 'mW') print('power {}'.format(d.controller.power_sp))
'Aborted': '6' }) def mod_mode(self): """Returns the current operating mode """ return self.query('gom?')[1:] if __name__ == '__main__': lantz.log.log_to_screen(lantz.log.DEBUG) from hyperion import Q_ from lantz.qt import start_test_app with Cobolt08NLD.via_serial('5') as inst: print('Identification: {}'.format(inst.idn)) print('Enabled = {}'.format(inst.enabled)) print('used hours = {} hs'.format(inst.operating_hours)) print('Laser mode: {}'.format(inst.ctl_mode)) print('Laser interlock state: {}'.format(inst.interlock)) print('Autostart status: {}'.format(inst.autostart)) print('Power setpoint: {}'.format(inst.power_sp)) inst.power_sp = Q_(150, 'milliwatt') print('Power setpoint: {}'.format(inst.power_sp)) inst.power_sp = 200 print('Power setpoint: {}'.format(inst.power_sp)) print('Output power now: {}'.format(inst.power)) # this is to get an automatic GUI to test the code start_test_app(inst)
def get_recommended_sample_points(self): self.textbox_sample_points.setText( str(int(1 + (2 * (Q_(self.textbox_end_wav.text()) - Q_(self.textbox_start_wav.text())).m_as('nm') / float( self.dropdown_optical_resolution.currentText())))))
def get_start_wav(self): start_wav = self.textbox_start_wav.text() return Q_(start_wav)
def get_end_wav(self): end_wav = self.textbox_end_wav.text() return Q_(end_wav)
settings = {'port': 'None', 'dummy': False, 'controller': 'hyperion.controller.princeton.winspec_contr/WinspecContr'} settings_irina = {'port': 'None', 'dummy': False, 'controller': 'hyperion.controller.princeton.winspec_contr/WinspecContr', 'config':'D:/LabSoftware/hyperion/hyperion/instrument/spectrum/winspec_config_irina.yml', 'shutter_controls': ['Closed', 'Opened'], 'horz_width_multiple': 4} ws = WinspecInstr(settings) #ws.setROI(top = 470, bottom = 500, left = 400, right = 599) print('\nROI = ', ws.getROI()) ws.exposure_time = 2*Q_('s') #ws.accumulations = 3 print('time: {}'.format(ws.exposure_time)) ws.accumulations = 3 print('accumulations: {}'.format(ws.accumulations)) print('spec mode? {}'.format(ws.spec_mode)) ws.spec_mode = False print('spec mode? {}'.format(ws.spec_mode)) print('Taking spectrum ...') counts = ws.take_spectrum('image') nm = ws.nm_axis()
if __name__ == "__main__": dummy_mode = [ False ] # add false here to also unit_test the real device with connection true_port = 'COM5' for dummy in dummy_mode: print('Running dummy={} tests.'.format(dummy)) # run the tests with UTestCobolt08NLD(settings={ 'port': true_port, 'dummy': dummy }) as t: print('Identification: {}'.format(t.dev.idn)) print('Enabled = {}'.format(t.dev.enabled)) print('used hours = {} hs'.format(t.dev.operating_hours)) print('Laser mode: {}'.format(t.dev.ctl_mode)) print('Laser interlock state: {}'.format(t.dev.interlock)) print('Autostart status: {}'.format(t.dev.autostart)) print('Power setpoint: {}'.format(t.dev.power_sp)) t.devpower_sp = Q_(150, 'milliwatt') print('Power setpoint: {}'.format(t.dev.power_sp)) t.devpower_sp = 200 print('Power setpoint: {}'.format(t.dev.power_sp)) print('Output power now: {}'.format(t.dev.power)) print( '\n\n\n Done with dummy={} tests. \n\n\n NO PROBLEM, you are great!!!! \n\n\n ' .format(dummy))
def initUI(self): # Create layout of your choice: self.layout = QHBoxLayout() self.layout.setSpacing(3) right = Qt.AlignRight + Qt.AlignVCenter # create shorthand for right Label alignment if 'actuator_units' in self.actiondict: actuator_units = self.actiondict['actuator_units'] else: self.logger.warning('No actuator_units key found in actiondict, trying to deduce units from start, stop, step') pint_values = [] pint_values.append(Q_(self.actiondict['start'])) pint_values.append(Q_(self.actiondict['stop'])) pint_values.append(Q_(self.actiondict['step'])) pint_values.append(Q_(self.actiondict['start_min'])) pint_values.append(Q_(self.actiondict['stop_min'])) pint_values.append(Q_(self.actiondict['step_min'])) pint_values.append(Q_(self.actiondict['start_max'])) pint_values.append(Q_(self.actiondict['stop_max'])) pint_values.append(Q_(self.actiondict['step_max'])) pint_units = {} for v in pint_values: if v is not None and v.u not in pint_units: pint_units[v.u] = ''.join([c for c in str(v.u) if c.isalpha()]) actuator_units = [pint_units[key] for key in sorted(pint_units.keys())] if len(actuator_units) == 0: self.logger.error("Could not deduce a range of units from start/stop values. It's best to specify a list of actuator_units in the config file.") # # Incomplete attempt to add units between, but instead I decided should just specify them in the config # elif len(actuator_units) > 1: # # Fill in large gaps (i.e. add V between mV and kV) # add_units = [] # for i in range(len(actuator_units)-1): # if Q_(actuator_units[i+1])/Q_(actuator_units[i]) > 1000: # add_units.append( ((1000*Q_(actuator_units[i])).to_compact()).u ) # # if actuator_units[i + 1] / actuator_units[i] > 1000000: # # add_units.append(((1000000 * actuator_units[i]).to_compact()).u) # actuator_units = sorted([*actuator_units, *add_units]) self.start_value = QDoubleSpinBox() self.start_value.setDecimals(3) self.start_value.setMaximum(999.999) #the standard Qt maximum is 99, so if you would want to put 500um, thats already too much... self.start_value.setMinimum(-999.999) self.start_units = QComboBox() self.start_units.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.start_units.addItems(actuator_units) add_pint_to_combo(self.start_units) if 'start' in self.actiondict: self.logger.debug('Applying config value to start in gui') pint_to_spin_combo(Q_(self.actiondict['start']), self.start_value, self.start_units) self.start_value.valueChanged.connect(self.start_changed) self.start_units.currentIndexChanged.connect(self.start_changed) self.stop_value = QDoubleSpinBox() self.stop_value.setMaximum(999.999) #the standard Qt maximum is 99, so if you would want to put 500um, thats already too much... self.stop_value.setMinimum(-999.999) self.stop_units = QComboBox() self.stop_units.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.stop_units.addItems(actuator_units) add_pint_to_combo(self.stop_units) if 'stop' in self.actiondict: self.logger.debug('Applying config value to stop in gui') pint_to_spin_combo(Q_(self.actiondict['stop']), self.stop_value, self.stop_units) self.stop_value.valueChanged.connect(self.stop_changed) self.stop_units.currentIndexChanged.connect(self.stop_changed) self.step_value = QDoubleSpinBox() self.step_value.setMaximum(999.999) #the standard Qt maximum is 99, so if you would want to put 500um, thats already too much... # self.step_value.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.step_units = QComboBox() self.step_units.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.step_units.addItems(actuator_units) add_pint_to_combo(self.step_units) if 'step' in self.actiondict: self.logger.debug('Applying config value to step in gui') pint_to_spin_combo(Q_(self.actiondict['step']), self.step_value, self.step_units) elif 'num' in self.actiondict: self.logger.debug('Calculating step from num in config value and apply it to step in gui') step = ( spin_combo_to_pint_apply_limits(self.stop_value, self.stop_units) - spin_combo_to_pint_apply_limits(self.start_value, self.start_units) ) / (self.actiondict['num']-1) self.actiondict['step'] = str(step) pint_to_spin_combo( step, self.step_value, self.step_units) self.step_value.valueChanged.connect(self.step_changed) self.step_units.currentIndexChanged.connect(self.step_changed) self.stop_um = QDoubleSpinBox() self.step_um = QDoubleSpinBox() spacer = QWidget() spacer.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Maximum) self.layout.addWidget(spacer) # adding this empty widget helps with aligning the layout in a prettier way self.layout.addWidget(QLabel('start', alignment=right)) self.layout.addWidget(self.start_value) self.layout.addWidget(self.start_units) self.layout.addWidget(QLabel(' stop', alignment=right)) self.layout.addWidget(self.stop_value) self.layout.addWidget(self.stop_units) self.layout.addWidget(QLabel(' step', alignment=right)) self.layout.addWidget(self.step_value) self.layout.addWidget(self.step_units)
def expo_changed(self): self.actiondict['exposuretime'] = str(spin_combo_to_pint_apply_limits(self.expo_value, self.expo_units, Q_(self.actiondict['exposuretime_min']), Q_(self.actiondict['exposuretime_max'])))