def _create_layout(self): self._option_frame = gtk.Frame() self._option_frame.set_label(_L('Options')) self._option_vbox = gtk.VBox() self._option_frame.add(self._option_vbox) self._name_entry = gtk.Entry() self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Name')), self._name_entry]), False, False) self._delay = gtk.SpinButton(climb_rate=0.1, digits=0) self._delay.set_range(0, 100000) self._delay.set_increments(1, 2) self._delay.set_value(100) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Delay (ms)')), self._delay]), False, False) self._plot_type_combo = gtk.combo_box_new_text() self._plot_type_combo.append_text(_L('Image')) self._plot_type_combo.append_text(_L('Line')) self._plot_type_combo.connect('changed', self._plot_type_changed_cb) self._plot_type_combo.set_active(0) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Plot type')), self._plot_type_combo])) self._hold_check = gtk.CheckButton() self._hold_check.connect('toggled', self._hold_toggled_cb) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Hold')), self._hold_check])) self._sweep_z = QTSweepVarSettings('Z loop') self._sweep_y = QTSweepVarSettings('Y loop') self._sweep_x = QTSweepVarSettings('X loop') self._measure_1 = QTMeasureVarSettings('Measurement 1') self._measure_2 = QTMeasureVarSettings('Measurement 2') self._start_but = gtk.Button(_L('Start')) self._start_but.connect('clicked', self._start_clicked_cb) self._stop_but = StopButton() self._stop_but.set_sensitive(False) self._status_label = gtk.Label(_L('Idle')) self._vbox = gtk.VBox() self._vbox.pack_start(self._option_frame, False, False) self._vbox.pack_start(self._sweep_z.get_layout(), False, False) self._vbox.pack_start(self._sweep_y.get_layout(), False, False) self._vbox.pack_start(self._sweep_x.get_layout(), False, False) self._vbox.pack_start(self._measure_1.get_layout(), False, False) self._vbox.pack_start(self._measure_2.get_layout(), False, False) self._vbox.pack_start(gui.pack_hbox([self._start_but, self._stop_but]), False, False) self._vbox.pack_start(self._status_label) self.add(self._vbox) self._vbox.show_all()
def _create_layout(self): self._option_frame = gtk.Frame() self._option_frame.set_label(_L('Options')) self._option_vbox = gtk.VBox() self._option_frame.add(self._option_vbox) self._name_entry = gtk.Entry() self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Name')), self._name_entry]), False, False) self._delay = gtk.SpinButton(climb_rate=0.1, digits=0) self._delay.set_range(0, 100000) self._delay.set_increments(1, 2) self._delay.set_value(100) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Delay (ms)')), self._delay]), False, False) self._plot_type_combo = gtk.combo_box_new_text() self._plot_type_combo.append_text(_L('Image')) self._plot_type_combo.append_text(_L('Line')) self._plot_type_combo.connect('changed', self._plot_type_changed_cb) self._plot_type_combo.set_active(0) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Plot type')), self._plot_type_combo])) self._hold_check = gtk.CheckButton() self._hold_check.connect('toggled', self._hold_toggled_cb) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Hold')), self._hold_check])) self._sweep_z = QTSweepVarSettings('Z loop') self._sweep_y = QTSweepVarSettings('Y loop') self._sweep_x = QTSweepVarSettings('X loop') self._measure_1 = QTMeasureVarSettings('Measurement 1') self._measure_2 = QTMeasureVarSettings('Measurement 2') self._start_but = gtk.Button(_L('Start')) self._start_but.connect('clicked', self._start_clicked_cb) self._stop_but = StopButton() self._stop_but.set_sensitive(False) self._status_label = gtk.Label(_L('Idle')) self._vbox = gtk.VBox() self._vbox.pack_start(self._option_frame, False, False) self._vbox.pack_start(self._sweep_z.get_layout(), False, False) self._vbox.pack_start(self._sweep_y.get_layout(), False, False) self._vbox.pack_start(self._sweep_x.get_layout(), False, False) self._vbox.pack_start(self._measure_1.get_layout(), False, False) self._vbox.pack_start(self._measure_2.get_layout(), False, False) self._vbox.pack_start(gui.pack_hbox([ self._start_but, self._stop_but]), False, False) self._vbox.pack_start(self._status_label) self.add(self._vbox) self._vbox.show_all()
class MeasurementWindow(QTWindow): PLOT_IMAGE = 1 PLOT_LINE = 2 def __init__(self): QTWindow.__init__(self, 'measure', 'Measure') self.connect("delete-event", self._delete_event_cb) self._create_layout() self._plot_type = self.PLOT_IMAGE self._hold = False self._measurement_id = 1 self._measurement_start = 0 qt.flow.connect('measurement-end', self._measurement_finished_cb) def _create_layout(self): self._option_frame = gtk.Frame() self._option_frame.set_label(_L('Options')) self._option_vbox = gtk.VBox() self._option_frame.add(self._option_vbox) self._name_entry = gtk.Entry() self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Name')), self._name_entry]), False, False) self._delay = gtk.SpinButton(climb_rate=0.1, digits=0) self._delay.set_range(0, 100000) self._delay.set_increments(1, 2) self._delay.set_value(100) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Delay (ms)')), self._delay]), False, False) self._plot_type_combo = gtk.combo_box_new_text() self._plot_type_combo.append_text(_L('Image')) self._plot_type_combo.append_text(_L('Line')) self._plot_type_combo.connect('changed', self._plot_type_changed_cb) self._plot_type_combo.set_active(0) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Plot type')), self._plot_type_combo])) self._hold_check = gtk.CheckButton() self._hold_check.connect('toggled', self._hold_toggled_cb) self._option_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Hold')), self._hold_check])) self._sweep_z = QTSweepVarSettings('Z loop') self._sweep_y = QTSweepVarSettings('Y loop') self._sweep_x = QTSweepVarSettings('X loop') self._measure_1 = QTMeasureVarSettings('Measurement 1') self._measure_2 = QTMeasureVarSettings('Measurement 2') self._start_but = gtk.Button(_L('Start')) self._start_but.connect('clicked', self._start_clicked_cb) self._stop_but = StopButton() self._stop_but.set_sensitive(False) self._status_label = gtk.Label(_L('Idle')) self._vbox = gtk.VBox() self._vbox.pack_start(self._option_frame, False, False) self._vbox.pack_start(self._sweep_z.get_layout(), False, False) self._vbox.pack_start(self._sweep_y.get_layout(), False, False) self._vbox.pack_start(self._sweep_x.get_layout(), False, False) self._vbox.pack_start(self._measure_1.get_layout(), False, False) self._vbox.pack_start(self._measure_2.get_layout(), False, False) self._vbox.pack_start(gui.pack_hbox([self._start_but, self._stop_but]), False, False) self._vbox.pack_start(self._status_label) self.add(self._vbox) self._vbox.show_all() def _delete_event_cb(self, widget, event, data=None): self.hide() return True def _add_loop_var(self, s, var, sweep): try: ins, insvar = sweep.get_instrument_var() start, end = sweep.get_sweep_range() steps = sweep.get_steps() except Exception, e: return if steps == 0: logging.warning('Not adding sweep variable with 0 steps') return units = sweep.get_units() s.add_loop(var, ins.get_name(), insvar, start, end, steps=steps)
class MeasurementWindow(QTWindow): PLOT_IMAGE = 1 PLOT_LINE = 2 def __init__(self): QTWindow.__init__(self, 'measure', 'Measure') self.connect("delete-event", self._delete_event_cb) self._create_layout() self._plot_type = self.PLOT_IMAGE self._hold = False self._measurement_id = 1 self._measurement_start = 0 qt.flow.connect('measurement-end', self._measurement_finished_cb) def _create_layout(self): self._option_frame = gtk.Frame() self._option_frame.set_label(_L('Options')) self._option_vbox = gtk.VBox() self._option_frame.add(self._option_vbox) self._name_entry = gtk.Entry() self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Name')), self._name_entry]), False, False) self._delay = gtk.SpinButton(climb_rate=0.1, digits=0) self._delay.set_range(0, 100000) self._delay.set_increments(1, 2) self._delay.set_value(100) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Delay (ms)')), self._delay]), False, False) self._plot_type_combo = gtk.combo_box_new_text() self._plot_type_combo.append_text(_L('Image')) self._plot_type_combo.append_text(_L('Line')) self._plot_type_combo.connect('changed', self._plot_type_changed_cb) self._plot_type_combo.set_active(0) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Plot type')), self._plot_type_combo])) self._hold_check = gtk.CheckButton() self._hold_check.connect('toggled', self._hold_toggled_cb) self._option_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Hold')), self._hold_check])) self._sweep_z = QTSweepVarSettings('Z loop') self._sweep_y = QTSweepVarSettings('Y loop') self._sweep_x = QTSweepVarSettings('X loop') self._measure_1 = QTMeasureVarSettings('Measurement 1') self._measure_2 = QTMeasureVarSettings('Measurement 2') self._start_but = gtk.Button(_L('Start')) self._start_but.connect('clicked', self._start_clicked_cb) self._stop_but = StopButton() self._stop_but.set_sensitive(False) self._status_label = gtk.Label(_L('Idle')) self._vbox = gtk.VBox() self._vbox.pack_start(self._option_frame, False, False) self._vbox.pack_start(self._sweep_z.get_layout(), False, False) self._vbox.pack_start(self._sweep_y.get_layout(), False, False) self._vbox.pack_start(self._sweep_x.get_layout(), False, False) self._vbox.pack_start(self._measure_1.get_layout(), False, False) self._vbox.pack_start(self._measure_2.get_layout(), False, False) self._vbox.pack_start(gui.pack_hbox([ self._start_but, self._stop_but]), False, False) self._vbox.pack_start(self._status_label) self.add(self._vbox) self._vbox.show_all() def _delete_event_cb(self, widget, event, data=None): self.hide() return True def _add_loop_var(self, s, var, sweep): try: ins, insvar = sweep.get_instrument_var() start, end = sweep.get_sweep_range() steps = sweep.get_steps() except Exception, e: return if steps == 0: logging.warning('Not adding sweep variable with 0 steps') return units = sweep.get_units() s.add_loop(var, ins.get_name(), insvar, start, end, steps=steps)