def create_layout(self): self._frame = gtk.Frame() if self._label is not None: self._frame.set_label(self._label) self._vbox = gtk.VBox(spacing=4) self._vbox.set_border_width(4) self._variable_dropdown = AllParametersDropdown( flags=qt.constants.FLAG_GET, types=(types.IntType, types.FloatType), tags=['measure']) self._variable_dropdown.connect('changed', self._parameter_changed_cb) self._vbox.pack_start( gui.pack_hbox([ gtk.Label(_L('Measurement variable')), self._variable_dropdown ]), False, False) self._scale = gtk.Entry() self._scale.set_width_chars(12) self._scale.set_text('1') self._units = gtk.Entry() self._units.set_width_chars(12) self._vbox.pack_start( gui.pack_hbox([ gtk.Label(_L('Scaling')), self._scale, gtk.Label(_L('Units')), self._units ])) self._frame.add(self._vbox)
def create_layout(self): self._frame = gtk.Frame() if self._label is not None: self._frame.set_label(self._label) self._vbox = gtk.VBox(spacing=4) self._vbox.set_border_width(4) self._variable_dropdown = AllParametersDropdown( flags=qt.constants.FLAG_GET, types=(types.IntType, types.FloatType), tags=['measure']) self._variable_dropdown.connect('changed', self._parameter_changed_cb) self._vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Measurement variable')), self._variable_dropdown]), False, False) self._scale = gtk.Entry() self._scale.set_width_chars(12) self._scale.set_text('1') self._units = gtk.Entry() self._units.set_width_chars(12) self._vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Scaling')), self._scale, gtk.Label(_L('Units')), self._units])) self._frame.add(self._vbox)
def create_layout(self): self._frame = gtk.Frame() if self._label is not None: self._frame.set_label(self._label) self._vbox = gtk.VBox(spacing=4) self._vbox.set_border_width(4) self._variable_dropdown = AllParametersDropdown( flags=qt.constants.FLAG_SET, types=(types.IntType, types.FloatType), tags=['sweep']) self._variable_dropdown.connect('changed', self._parameter_changed_cb) self._vbox.pack_start( gui.pack_hbox( [gtk.Label(_L('Sweep variable')), self._variable_dropdown]), False, False) self._start_val = gtk.SpinButton(climb_rate=0.1, digits=2) self._start_val.set_range(0, 0) self._start_val.set_increments(0.01, 0.1) self._end_val = gtk.SpinButton(climb_rate=0.1, digits=2) self._end_val.set_range(0, 0) self._end_val.set_increments(0.01, 0.1) self._n_steps = gtk.SpinButton(climb_rate=0.1, digits=0) self._n_steps.set_range(0, 100000) self._n_steps.set_increments(1, 2) self._steps_or_size = StepToggleButton( [_L('< Steps'), _L('Size >')], self._steps_toggle_cb, _L('Set number of steps or stepsize')) self._steps_or_size.set_size_request(100, 0) self._step_size = gtk.SpinButton(climb_rate=0.1, digits=3) self._step_size.set_range(0, 1000) self._step_size.set_increments(0.001, 0.01) self._step_size.set_sensitive(False) self._units_label = gtk.Label() self._vbox.pack_start( gui.pack_hbox([ gtk.Label(_L('Start')), self._start_val, gtk.Label(_L('End')), self._end_val, self._units_label ])) self._vbox.pack_start( gui.pack_hbox([ gtk.Label(_L('Nr of steps')), self._n_steps, self._steps_or_size, gtk.Label(_L('Step size')), self._step_size ])) self._frame.add(self._vbox)
def create_layout(self): self._frame = gtk.Frame() if self._label is not None: self._frame.set_label(self._label) self._vbox = gtk.VBox(spacing=4) self._vbox.set_border_width(4) self._variable_dropdown = AllParametersDropdown( flags=qt.constants.FLAG_SET, types=(types.IntType, types.FloatType), tags=['sweep']) self._variable_dropdown.connect('changed', self._parameter_changed_cb) self._vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Sweep variable')), self._variable_dropdown]), False, False) self._start_val = gtk.SpinButton(climb_rate=0.1, digits=2) self._start_val.set_range(0, 0) self._start_val.set_increments(0.01, 0.1) self._end_val = gtk.SpinButton(climb_rate=0.1, digits=2) self._end_val.set_range(0, 0) self._end_val.set_increments(0.01, 0.1) self._n_steps = gtk.SpinButton(climb_rate=0.1, digits=0) self._n_steps.set_range(0, 100000) self._n_steps.set_increments(1, 2) self._steps_or_size = StepToggleButton([_L('< Steps'), _L('Size >')], self._steps_toggle_cb, _L('Set number of steps or stepsize')) self._steps_or_size.set_size_request(100, 0) self._step_size = gtk.SpinButton(climb_rate=0.1, digits=3) self._step_size.set_range(0, 1000) self._step_size.set_increments(0.001, 0.01) self._step_size.set_sensitive(False) self._units_label = gtk.Label() self._vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Start')), self._start_val, gtk.Label(_L('End')), self._end_val, self._units_label])) self._vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Nr of steps')), self._n_steps, self._steps_or_size, gtk.Label(_L('Step size')), self._step_size])) self._frame.add(self._vbox)
def __init__(self, **kwargs): gtk.VBox.__init__(self, **kwargs) self._frontpanels = qt.frontpanels self._sliders = qt.sliders self._ins = None self._ins_combo = dropdowns.InstrumentDropdown() self._ins_combo.connect('changed', self._instrument_changed_cb) self._param_combo = dropdowns.InstrumentParameterDropdown() self._param_combo.connect('changed', self._parameter_changed_cb) self._get_but = gtk.Button('Get') self._get_but.connect('clicked', self._get_param_clicked_cb) self._param_edit = gtk.Entry() self._param_edit.set_alignment(0.93) self._set_but = gtk.Button('Set') self._set_but.connect('clicked', self._set_param_clicked_cb) param_getset = gui.pack_hbox([self._get_but, \ self._set_but]) self._function_frame = FunctionFrame() self._make_fp = gtk.Button('Frontpanel') self._make_fp.connect('clicked', self._fp_clicked_cb) self._make_sl = gtk.Button('Slider') self._make_sl.connect('clicked', self._slider_clicked_cb) h1 = gui.pack_hbox([ gtk.Label(_L('Instrument')), self._ins_combo]) h2 = gui.pack_hbox([ gtk.Label(_L('Parameter')), self._param_combo]) self._table = gtk.Table(4, 2, True) self._table.set_homogeneous(False) self._table.attach(h1, 0, 1, 0, 1) self._table.attach(h2, 0, 1, 1, 2) self._table.attach(self._param_edit, 0, 1, 2, 3) self._table.attach(self._function_frame, 0, 2, 3, 4) self._table.attach(self._make_fp, 1, 2, 0, 1) self._table.attach(self._make_sl, 1, 2, 1, 2) self._table.attach(param_getset, 1, 2, 2, 3) self._table.set_border_width(4) self.add(self._table) self._parameter_changed_cb(None) self.show_all()
def __init__(self): qtwindow.QTWindow.__init__(self, 'instruments', 'Instrument View') self.connect("delete-event", self._delete_event_cb) self._instruments = qt.instruments qt.instruments.connect('instrument-added', self._instrument_added_cb) qt.instruments.connect('instrument-removed', \ self._instrument_removed_cb) qt.instruments.connect('instrument-changed', \ self._instrument_changed_cb) self._tags_dropdown = dropdowns.TagsDropdown() self._tags_dropdown.connect('changed', self._tag_changed_cb) self._outer_vbox = gtk.VBox() self._outer_vbox.set_border_width(4) self._vbox = gtk.VBox() self._vbox.set_border_width(4) self._outer_vbox.pack_start( gui.pack_hbox([gtk.Label(_L('Types')), self._tags_dropdown]), False, False) self._range_toggle = gtk.ToggleButton(_L('Range')) self._range_toggle.set_active( qt.config.get('Instrument View_show_range', True)) self._range_toggle.connect('toggled', self._range_toggled_cb) self._rate_toggle = gtk.ToggleButton(_L('Rate')) self._rate_toggle.set_active( qt.config.get('Instrument View_show_rate', True)) self._rate_toggle.connect('toggled', self._rate_toggled_cb) self._outer_vbox.pack_start( gui.pack_hbox([self._range_toggle, self._rate_toggle], True, True), False, False) self._ins_widgets = {} self._add_instruments() self._scrolled_win = gtk.ScrolledWindow() self._scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, \ gtk.POLICY_AUTOMATIC) self._scrolled_win.add_with_viewport(self._vbox) self._outer_vbox.pack_start(self._scrolled_win, True, True) self._outer_vbox.show_all() self._range_toggle.emit('toggled') self._rate_toggle.emit('toggled') self.add(self._outer_vbox)
def __init__(self, **kwargs): gtk.VBox.__init__(self, **kwargs) self._frontpanels = qt.frontpanels self._sliders = qt.sliders self._ins = None self._ins_combo = dropdowns.InstrumentDropdown() self._ins_combo.connect('changed', self._instrument_changed_cb) self._param_combo = dropdowns.InstrumentParameterDropdown() self._param_combo.connect('changed', self._parameter_changed_cb) self._get_but = gtk.Button('Get') self._get_but.connect('clicked', self._get_param_clicked_cb) self._param_edit = gtk.Entry() self._param_edit.set_alignment(0.93) self._set_but = gtk.Button('Set') self._set_but.connect('clicked', self._set_param_clicked_cb) param_getset = gui.pack_hbox([self._get_but, \ self._set_but]) self._function_frame = FunctionFrame() self._make_fp = gtk.Button('Frontpanel') self._make_fp.connect('clicked', self._fp_clicked_cb) self._make_sl = gtk.Button('Slider') self._make_sl.connect('clicked', self._slider_clicked_cb) h1 = gui.pack_hbox([gtk.Label(_L('Instrument')), self._ins_combo]) h2 = gui.pack_hbox([gtk.Label(_L('Parameter')), self._param_combo]) self._table = gtk.Table(4, 2, True) self._table.set_homogeneous(False) self._table.attach(h1, 0, 1, 0, 1) self._table.attach(h2, 0, 1, 1, 2) self._table.attach(self._param_edit, 0, 1, 2, 3) self._table.attach(self._function_frame, 0, 2, 3, 4) self._table.attach(self._make_fp, 1, 2, 0, 1) self._table.attach(self._make_sl, 1, 2, 1, 2) self._table.attach(param_getset, 1, 2, 2, 3) self._table.set_border_width(4) self.add(self._table) self._parameter_changed_cb(None) self.show_all()
def __init__(self): qtwindow.QTWindow.__init__(self, 'instruments', 'Instrument View') self.connect("delete-event", self._delete_event_cb) self._instruments = qt.instruments qt.instruments.connect('instrument-added', self._instrument_added_cb) qt.instruments.connect('instrument-removed', \ self._instrument_removed_cb) qt.instruments.connect('instrument-changed', \ self._instrument_changed_cb) self._tags_dropdown = dropdowns.TagsDropdown() self._tags_dropdown.connect('changed', self._tag_changed_cb) self._outer_vbox = gtk.VBox() self._outer_vbox.set_border_width(4) self._vbox = gtk.VBox() self._vbox.set_border_width(4) self._outer_vbox.pack_start(gui.pack_hbox([ gtk.Label(_L('Types')), self._tags_dropdown]), False, False) self._range_toggle = gtk.ToggleButton(_L('Range')) self._range_toggle.set_active(qt.config.get('Instrument View_show_range', True)) self._range_toggle.connect('toggled', self._range_toggled_cb) self._rate_toggle = gtk.ToggleButton(_L('Rate')) self._rate_toggle.set_active(qt.config.get('Instrument View_show_rate', True)) self._rate_toggle.connect('toggled', self._rate_toggled_cb) self._outer_vbox.pack_start(gui.pack_hbox([ self._range_toggle, self._rate_toggle], True, True), False, False) self._ins_widgets = {} self._add_instruments() self._scrolled_win = gtk.ScrolledWindow() self._scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, \ gtk.POLICY_AUTOMATIC) self._scrolled_win.add_with_viewport(self._vbox) self._outer_vbox.pack_start(self._scrolled_win, True, True) self._outer_vbox.show_all() self._range_toggle.emit('toggled') self._rate_toggle.emit('toggled') self.add(self._outer_vbox)
def __init__(self): gtk.VBox.__init__(self) self.entry = gtk.Entry() self.pack_start(gui.pack_hbox( [gtk.Label('Root dir'), self.entry], False, False), False, False) self.entry.connect('activate', self._entry_activated_cb) self.dir_browser = dirtree.DirectoryTree('.') self.dir_browser.set_size_request(200, -1) self.add(self.dir_browser)
def __init__(self, axis): gtk.Frame.__init__(self, 'Axis %s' % axis) self._axis = axis self._plot = None self._ignore_changes = False self._label_entry = gtk.Entry() self._label_but = gtk.Button(_L('Set')) self._label_but.connect('clicked', self._label_clicked_cb) self._label_entry.connect('activate', self._label_clicked_cb) self._min_range = gtk.Entry() self._min_range.set_width_chars(10) self._max_range = gtk.Entry() self._max_range.set_width_chars(10) self._range_but = gtk.Button(_L('Set')) self._range_but.connect('clicked', self._range_clicked_cb) self._min_range.connect('activate', self._range_clicked_cb) self._max_range.connect('activate', self._range_clicked_cb) self._logcheck = gtk.CheckButton('Log') self._logcheck.set_active(False) self._logcheck.connect('toggled', self._log_toggled_cb) vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Label')), self._label_entry, self._label_but], True, True), gui.pack_hbox([ self._logcheck, gtk.Label(_L('Range')), self._min_range, self._max_range, self._range_but], True, True), ], False, False) self.add(vbox)
def __init__(self, axis): gtk.Frame.__init__(self, 'Axis %s' % axis) self._axis = axis self._plot = None self._ignore_changes = False self._label_entry = gtk.Entry() self._label_but = gtk.Button(_L('Set')) self._label_but.connect('clicked', self._label_clicked_cb) self._label_entry.connect('activate', self._label_clicked_cb) self._min_range = gtk.Entry() self._min_range.set_width_chars(10) self._max_range = gtk.Entry() self._max_range.set_width_chars(10) self._range_but = gtk.Button(_L('Set')) self._range_but.connect('clicked', self._range_clicked_cb) self._min_range.connect('activate', self._range_clicked_cb) self._max_range.connect('activate', self._range_clicked_cb) self._logcheck = gtk.CheckButton('Log') self._logcheck.set_active(False) self._logcheck.connect('toggled', self._log_toggled_cb) vbox = gui.pack_vbox([ gui.pack_hbox( [gtk.Label(_L('Label')), self._label_entry, self._label_but], True, True), gui.pack_hbox([ self._logcheck, gtk.Label(_L('Range')), self._min_range, self._max_range, self._range_but ], True, True), ], False, False) self.add(vbox)
def __init__(self, **kwargs): gtk.VBox.__init__(self, **kwargs) self._instruments = qt.instruments self._frontpanels = qt.frontpanels self._action_frame = gtk.Frame() self._action_frame.set_label(_L('Manage')) self._ins_dropdown = dropdowns.InstrumentDropdown() self._frontpanel_button = gtk.Button(_L('Frontpanel')) self._frontpanel_button.connect('clicked', self._fp_clicked_cb) self._reload_button = gtk.Button(_L('Reload')) self._reload_button.connect('clicked', self._reload_clicked_cb) self._remove_button = gtk.Button(_L('Remove')) self._remove_button.connect('clicked', self._remove_clicked_cb) vbox = gui.pack_vbox([ self._ins_dropdown, gui.pack_hbox([ self._frontpanel_button, self._reload_button, self._remove_button ], True, True) ], False, False) vbox.set_border_width(4) self._action_frame.add(vbox) vbox = gui.pack_vbox([ self._action_frame ], False,False) vbox.set_border_width(4) self.add(vbox) self.show_all()
def __init__(self, **kwargs): gtk.VBox.__init__(self, **kwargs) self._instruments = qt.instruments self._frontpanels = qt.frontpanels self._action_frame = gtk.Frame() self._action_frame.set_label(_L('Manage')) self._ins_dropdown = dropdowns.InstrumentDropdown() self._frontpanel_button = gtk.Button(_L('Frontpanel')) self._frontpanel_button.connect('clicked', self._fp_clicked_cb) self._reload_button = gtk.Button(_L('Reload')) self._reload_button.connect('clicked', self._reload_clicked_cb) self._remove_button = gtk.Button(_L('Remove')) self._remove_button.connect('clicked', self._remove_clicked_cb) vbox = gui.pack_vbox([ self._ins_dropdown, gui.pack_hbox([ self._frontpanel_button, self._reload_button, self._remove_button ], True, True) ], False, False) vbox.set_border_width(4) self._action_frame.add(vbox) vbox = gui.pack_vbox([self._action_frame], False, False) vbox.set_border_width(4) self.add(vbox) self.show_all()
def __init__(self): ''' Initialization of main window ''' # Default parameters self._nfig = 1 self._hid = 0 # Proxy connect hid self._plottype = 'none' self._data_obj = None self._operations = ['None', 'Plot 2D', 'Plot 3D', 'Plot 2D Difference', 'Plot 3D - horizontal offset', 'Plot 3D - vertical offset', 'Plot 3D - horizontal difference', 'Plot 3D - vertical difference', 'Close all'] self._cid = 0 # Connect ID for crosshair self._xdata = None self._ydata = None self._x = None self._y = None self._z = None self._offset = None # Create a new window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Set title self.window.set_title("QTLab Analysis") # Handler for delete_event self.window.connect("delete_event", self._delete_event) # Border for the window self.window.set_border_width(10) # Button # self.plot2d_button = gtk.Button("Plot XY") # self.plot2d_button.connect("clicked", self._plot2d_cb) # self.plot3d_button = gtk.Button("Plot XYZ") # self.plot3d_button.connect("clicked", self._plot3d_cb) self.go_button = gtk.Button("Go") self.go_button.connect("clicked", self._go_cb) self._dir_entry = gtk.Entry() self._dir_entry.connect('activate', self._dir_activate_cb) self._dir_button = gtk.Button(_L('Browse')) self._dir_button.connect('clicked', self._dir_button_clicked_cb) self._dir_hbox = gui.pack_hbox( (gtk.Label('Choose filename (*.dat): '), self._dir_entry, self._dir_button), True, True) # Dropdowns self._data_dropdown = dropdowns.NamedListDropdown(qt.data) self._data_dropdown.connect('changed', self._data_dropdown_changed_cb) self._colnames_dropdown_x = dropdowns.StringListDropdown([]) self._colnames_dropdown_y = dropdowns.StringListDropdown([]) self._colnames_dropdown_z = dropdowns.StringListDropdown([]) self._operations_dropdown = dropdowns.StringListDropdown(self._operations) self._operations_dropdown.connect('changed', self._operations_dropdown_changed_cb) # Checkboxes self._hold_check = gtk.CheckButton('Hold on') self._hold_check.set_active(False) self._newfig_check = gtk.CheckButton('New figure') self._newfig_check.set_active(False) self._liveplot_check = gtk.CheckButton('Live plot') self._liveplot_check.set_active(False) self._liveplot_check.connect("clicked", self._liveplot_cb) # Pack vbox self.vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Choose data: ')), self._data_dropdown], True, True), self._dir_hbox, gui.pack_hbox([ gtk.Label(_L('X: ')), self._colnames_dropdown_x], True, True), gui.pack_hbox([ gtk.Label(_L('Y: ')), self._colnames_dropdown_y], True, True), gui.pack_hbox([ gtk.Label(_L('Z: ')), self._colnames_dropdown_z], True, True), gui.pack_hbox([ gtk.Label(_L('Operations: ')), self._operations_dropdown], True, True), self.go_button, gui.pack_hbox([self._hold_check, self._newfig_check, self._liveplot_check], True,True), ], False, False) self.window.add(self.vbox) self._data_dropdown.show() self._colnames_dropdown_x.show() self._colnames_dropdown_y.show() self._colnames_dropdown_z.show() self._operations_dropdown.show() self.go_button.show() self.vbox.show_all() self.window.show()
def __init__(self): ''' Initialization of main window ''' self._plottype = 'none' # Create a new window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Set title self.window.set_title("QTLab Analysis") # Handler for delete_event self.window.connect("delete_event", self.delete_event) # Border for the window self.window.set_border_width(10) # Buttons self.plot2d_button = gtk.Button("Plot XY") self.plot2d_button.connect("clicked", self.plot2d_cb) self.plot3d_button = gtk.Button("Plot XYZ") self.plot3d_button.connect("clicked", self.plot3d_cb) # Dropdowns self._data_dropdown = dropdowns.NamedListDropdown(qt.data) self._data_dropdown.connect('changed', self._data_dropdown_changed_cb) self._colnames_dropdown_x = dropdowns.StringListDropdown([]) self._colnames_dropdown_y = dropdowns.StringListDropdown([]) self._colnames_dropdown_z = dropdowns.StringListDropdown([]) # Checkboxes self._hold_check = gtk.CheckButton('Hold on') self._hold_check.set_active(False) self._newfig_check = gtk.CheckButton('New figure') self._newfig_check.set_active(False) self._nfig = 1 self._liveplot_check = gtk.CheckButton('Live plot') self._liveplot_check.set_active(False) self._liveplot_check.connect("clicked", self._liveplot_cb) self._hid = 0 # Proxy connect hid # Pack vbox self.vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Choose data: ')), self._data_dropdown], True, True), gui.pack_hbox([ gtk.Label(_L('X: ')), self._colnames_dropdown_x], True, True), gui.pack_hbox([ gtk.Label(_L('Y: ')), self._colnames_dropdown_y], True, True), gui.pack_hbox([ gtk.Label(_L('Z: ')), self._colnames_dropdown_z], True, True), self.plot2d_button, self.plot3d_button, gui.pack_hbox([self._hold_check, self._newfig_check, self._liveplot_check], True,True), ], False, False) self.window.add(self.vbox) self._data_dropdown.show() self._colnames_dropdown_x.show() self._colnames_dropdown_y.show() self._colnames_dropdown_z.show() self.plot2d_button.show() self.plot3d_button.show() self.vbox.show_all() self.window.show()
def __init__(self): qtwindow.QTWindow.__init__(self, 'gnuplot', 'Gnuplot Tweak') self.connect("delete-event", self._delete_event_cb) self._ignore_changes = False self._current_plot = None self._plot_state = {} self._plot_dropdown = dropdowns.NamedListDropdown(qt.plots) self._plot_dropdown.connect('changed', self._plot_changed_cb) self._styles_dropdown = dropdowns.StringListDropdown([]) self._styles_dropdown.connect('changed', self._style_changed_cb) self._maxpoints_entry = gtk.Entry() self._maxpoints_but = gtk.Button(_L('Set')) self._maxpoints_but.connect('clicked', self._maxpoints_clicked_cb) self._maxpoints_entry.connect('activate', self._maxpoints_clicked_cb) self._maxtraces_entry = gtk.Entry() self._maxtraces_but = gtk.Button(_L('Set')) self._maxtraces_but.connect('clicked', self._maxtraces_clicked_cb) self._maxtraces_entry.connect('activate', self._maxtraces_clicked_cb) self._mintime_entry = gtk.Entry() self._mintime_but = gtk.Button(_L('Set')) self._mintime_but.connect('clicked', self._mintime_clicked_cb) self._mintime_entry.connect('activate', self._mintime_clicked_cb) self._legend_check = gtk.CheckButton('Legend') self._legend_check.set_active(False) self._legend_check.connect('toggled', self._legend_toggled_cb) self._legendpos_dropdown = dropdowns.StringListDropdown([]) self._legendpos_dropdown.connect('changed', self._legendpos_changed_cb) self._palette_dropdown = dropdowns.StringListDropdown([]) self._palette_dropdown.connect('changed', self._palette_changed_cb) self._gamma_hid = None self._gamma_spin = gtk.SpinButton() self._gamma_spin.set_range(0.0, 5.0) self._gamma_spin.set_digits(2) self._gamma_spin.set_increments(0.01, 0.1) self._gamma_spin.set_value(1) self._gamma_spin.connect('changed', self._gamma_changed_cb) self._save_as_frame = gtk.Frame(_L('Save as')) list = [''] self._save_as_dropdown = dropdowns.StringListDropdown(list) self._filename_entry = gtk.Entry() self._save_button = gtk.Button(_L('Save')) self._save_button.connect('clicked', self._save_clicked_cb) vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Filename')), self._filename_entry, self._save_as_dropdown, self._save_button], True, True), ], False, False) self._save_as_frame.add(vbox) self._axis_x = AxisSettings('x') self._axis_y = AxisSettings('y') self._axis_z = AxisSettings('z') self._axis_cb = AxisSettings('cb') self._autorange_xy = gtk.Button(_L('Autorange XY')) self._autorange_xy.connect('clicked', self._autorange_xyz_cb, False) self._autorange_xyz = gtk.Button(_L('Autorange XYZ')) self._autorange_xyz.connect('clicked', self._autorange_xyz_cb, True) self._clear_button = gtk.Button(_L('Clear')) self._clear_button.connect('clicked', self._clear_clicked_cb) self._del_button = gtk.Button(_L('Delete')) self._del_button.connect('clicked', self._del_clicked_cb) vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Plot')), self._plot_dropdown, self._clear_button, self._del_button], True, True), gui.pack_hbox([ gtk.Label(_L('Style')), self._styles_dropdown], True, True), gui.pack_hbox([ self._legend_check, self._legendpos_dropdown], True, True), gui.pack_hbox([ gtk.Label(_L('Max Points')), self._maxpoints_entry, self._maxpoints_but], True, True), gui.pack_hbox([ gtk.Label(_L('Max Traces')), self._maxtraces_entry, self._maxtraces_but], True, True), gui.pack_hbox([ gtk.Label(_L('Min Time')), self._mintime_entry, self._mintime_but], True, True), gui.pack_hbox([ gtk.Label(_L('Palette')), self._palette_dropdown, gtk.Label(_L('Gamma')), self._gamma_spin], True, True), self._save_as_frame, self._axis_x, self._axis_y, self._axis_z, self._axis_cb, gui.pack_hbox([ self._autorange_xy, self._autorange_xyz], True, True), ], False, False) vbox.set_border_width(4) self.add(vbox) vbox.show_all()
def __init__(self): QTWindow.__init__(self, 'source', 'Source') self.connect("delete-event", self._delete_event_cb) self._find_string = '' self._find_ofs = 0 menu = [ {'name': _L('File'), 'submenu': [ {'name': _L('Open'), 'action': self._open_cb, 'accel': '<Control>o'}, {'name': _L('Close'), 'action': self._close_cb, 'accel': '<Control>x'}, {'name': _L('Save'), 'action': self._save_cb, 'accel': '<Control>s'}, {'name': _L('Save as'), 'action': self._save_as_cb}, {'name': _L('Run'), 'action': self._run_clicked_cb, 'accel': '<Control>r'} ] }, {'name': _L('Edit'), 'submenu': [ {'name': _L('Find'), 'action': self._find_cb, 'accel': '<Control>f'}, {'name': _L('Find next'), 'action': self._find_next_cb, 'accel': '<Control>n'}, {'name': _L('Find previous'), 'action': self._find_prev_cb, 'accel': '<Control>p'}, ] } ] self._accel_group = gtk.AccelGroup() self.add_accel_group(self._accel_group) self._menu = gui.build_menu(menu, accelgroup=self._accel_group) # Run menu self._name = gtk.Entry() self._run_button = gtk.Button(_L('Run')) self._run_button.connect('clicked', self._run_clicked_cb) self._options = gui.pack_hbox([ gtk.Label(_L('Name')), self._name, self._run_button ]) # Directory and edit panes self._file_info = {} self._notebook = gtk.Notebook() self._dir_pane = DirPane() self._dir_pane.dir_browser.connect('file-activated', self._file_activated_cb) self._panes = gtk.HPaned() self._panes.add1(self._dir_pane) self._panes.add2(self._notebook) # Put everything together self._vbox = gtk.VBox() self._vbox.pack_start(self._menu, False, False) self._vbox.pack_start(self._options, False, False) self._vbox.pack_start(self._panes, True, True) 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 = gtk.Button(_L('Stop')) self._stop_but.connect('clicked', self._stop_clicked_cb) 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 __init__(self): qtwindow.QTWindow.__init__(self, 'watch', 'Watch') self.connect("delete-event", self._delete_event_cb) qt.flow.connect('measurement-start', self._mstart_cb) qt.flow.connect('measurement-end', self._mend_cb) self._watch = {} self._paused = False self._frame = gtk.Frame() self._frame.set_label(_L('Add variable')) self._ins_combo = dropdowns.InstrumentDropdown() self._ins_combo.connect('changed', self._instrument_changed_cb) self._param_combo = dropdowns.InstrumentParameterDropdown() self._param_combo.connect('changed', self._parameter_changed_cb) label = gtk.Label(_L('Interval')) self._interval = gtk.SpinButton(climb_rate=1, digits=0) self._interval.set_range(0, 100000) self._interval.set_value(500) interval = gui.pack_hbox([label, self._interval, gtk.Label('ms')], False, False) self._graph_check = gtk.CheckButton('Graph') self._graph_check.set_active(True) self._graph_check.connect('toggled', self._graph_toggled_cb) label = gtk.Label('Data points') self._npoints = gtk.SpinButton(climb_rate=1, digits=0) self._npoints.set_range(10, 1000) self._npoints.set_value(100) self._npoints.set_increments(1, 10) graph = gui.pack_hbox([self._graph_check, label, self._npoints], True, False) self._ma_check = gtk.CheckButton('Moving average') self._ma_check.set_active(False) self._ma_check.connect('toggled', self._ma_toggled_cb) label = gtk.Label('Constant') self._ma_const = gtk.SpinButton(climb_rate=0.01, digits=2) self._ma_const.set_sensitive(False) self._ma_const.set_range(0, 1.0) self._ma_const.set_increments(0.01, 0.1) self._ma_const.set_value(0.95) ma = gui.pack_hbox([self._ma_check, label, self._ma_const], True, False) self._add_button = gtk.Button(_L('Add')) self._add_button.connect('clicked', self._add_clicked_cb) self._remove_button = gtk.Button(_L('Remove')) self._remove_button.connect('clicked', self._remove_clicked_cb) self._pause_button = gtk.ToggleButton(_L('Pause')) self._pause_button.set_active(False) self._pause_button.connect('clicked', self._toggle_pause_cb) buttons = gui.pack_hbox([self._add_button, self._remove_button, self._pause_button], False, False) self._tree_model = gtk.ListStore(str, str, str) self._tree_view = QTTable([ (_L('Parameter'), {}), (_L('Delay'), {}), (_L('Value'), {'scale': 3.0}), ], self._tree_model) vbox = gui.pack_vbox([ self._ins_combo, self._param_combo, interval, graph, ma, buttons, ], False, False) vbox.set_border_width(4) self._frame.add(vbox) vbox = gui.pack_vbox([ self._frame, self._tree_view, ], False, False) self.add(vbox) vbox.show_all()
def __init__(self): qtwindow.QTWindow.__init__(self, 'gnuplot', 'Gnuplot Tweak') self.connect("delete-event", self._delete_event_cb) self._ignore_changes = False self._current_plot = None self._plot_state = {} self._plot_dropdown = dropdowns.NamedListDropdown(qt.plots) self._plot_dropdown.connect('changed', self._plot_changed_cb) self._styles_dropdown = dropdowns.StringListDropdown([]) self._styles_dropdown.connect('changed', self._style_changed_cb) self._maxpoints_entry = gtk.Entry() self._maxpoints_but = gtk.Button(_L('Set')) self._maxpoints_but.connect('clicked', self._maxpoints_clicked_cb) self._maxpoints_entry.connect('activate', self._maxpoints_clicked_cb) self._maxtraces_entry = gtk.Entry() self._maxtraces_but = gtk.Button(_L('Set')) self._maxtraces_but.connect('clicked', self._maxtraces_clicked_cb) self._maxtraces_entry.connect('activate', self._maxtraces_clicked_cb) self._mintime_entry = gtk.Entry() self._mintime_but = gtk.Button(_L('Set')) self._mintime_but.connect('clicked', self._mintime_clicked_cb) self._mintime_entry.connect('activate', self._mintime_clicked_cb) self._legend_check = gtk.CheckButton('Legend') self._legend_check.set_active(False) self._legend_check.connect('toggled', self._legend_toggled_cb) self._legendpos_dropdown = dropdowns.StringListDropdown([]) self._legendpos_dropdown.connect('changed', self._legendpos_changed_cb) self._palette_dropdown = dropdowns.StringListDropdown([]) self._palette_dropdown.connect('changed', self._palette_changed_cb) self._gamma_hid = None self._gamma_spin = gtk.SpinButton() self._gamma_spin.set_range(0.0, 5.0) self._gamma_spin.set_digits(2) self._gamma_spin.set_increments(0.01, 0.1) self._gamma_spin.set_value(1) self._gamma_spin.connect('changed', self._gamma_changed_cb) self._save_as_frame = gtk.Frame(_L('Save as')) list = [''] self._save_as_dropdown = dropdowns.StringListDropdown(list) self._filename_entry = gtk.Entry() self._save_button = gtk.Button(_L('Save')) self._save_button.connect('clicked', self._save_clicked_cb) vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Filename')), self._filename_entry, self._save_as_dropdown, self._save_button ], True, True), ], False, False) self._save_as_frame.add(vbox) self._axis_x = AxisSettings('x') self._axis_y = AxisSettings('y') self._axis_z = AxisSettings('z') self._axis_cb = AxisSettings('cb') self._autorange_xy = gtk.Button(_L('Autorange XY')) self._autorange_xy.connect('clicked', self._autorange_xyz_cb, False) self._autorange_xyz = gtk.Button(_L('Autorange XYZ')) self._autorange_xyz.connect('clicked', self._autorange_xyz_cb, True) self._clear_button = gtk.Button(_L('Clear')) self._clear_button.connect('clicked', self._clear_clicked_cb) self._del_button = gtk.Button(_L('Delete')) self._del_button.connect('clicked', self._del_clicked_cb) vbox = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Plot')), self._plot_dropdown, self._clear_button, self._del_button ], True, True), gui.pack_hbox([gtk.Label(_L('Style')), self._styles_dropdown], True, True), gui.pack_hbox([self._legend_check, self._legendpos_dropdown], True, True), gui.pack_hbox([ gtk.Label(_L('Max Points')), self._maxpoints_entry, self._maxpoints_but ], True, True), gui.pack_hbox([ gtk.Label(_L('Max Traces')), self._maxtraces_entry, self._maxtraces_but ], True, True), gui.pack_hbox([ gtk.Label(_L('Min Time')), self._mintime_entry, self._mintime_but ], True, True), gui.pack_hbox([ gtk.Label(_L('Palette')), self._palette_dropdown, gtk.Label(_L('Gamma')), self._gamma_spin ], True, True), self._save_as_frame, self._axis_x, self._axis_y, self._axis_z, self._axis_cb, gui.pack_hbox([self._autorange_xy, self._autorange_xyz], True, True), ], False, False) vbox.set_border_width(4) self.add(vbox) vbox.show_all()
def __init__(self): qtwindow.QTWindow.__init__(self, 'data', _L('Data Browser')) self.connect("delete-event", self._delete_event_cb) self._browser = None self._meta_tags = set([]) self._meta_tag = 'header' self._cur_path = None self._dir_entry = gtk.Entry() self._dir_entry.connect('activate', self._dir_activate_cb) self._dir_button = gtk.Button(_L('Browse')) self._dir_button.connect('clicked', self._dir_button_clicked_cb) self._dir_hbox = gui.pack_hbox( (gtk.Label('Directory'), self._dir_entry, self._dir_button), True, True) self._plot2d_button = gtk.Button(_L('Plot2D')) self._plot2d_button.connect('clicked', self._plot2d_clicked_cb) self._plot3d_button = gtk.Button(_L('Plot3D')) self._plot3d_button.connect('clicked', self._plot3d_clicked_cb) self._plot_name = gtk.Entry() self._plot_name.set_text('databrowser') self._plot_style = gtk.Entry() self._columns = gtk.Entry() self._clear_check = gtk.CheckButton() self._clear_check.set_active(True) self._clear_button = gtk.Button(_L('Clear')) self._clear_button.connect('clicked', self._clear_clicked_cb) self._ofs_entry = gtk.Entry() self._traceofs_entry = gtk.Entry() vbox1 = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Name')), self._plot_name], False, False), gui.pack_hbox([ gtk.Label(_L('Clear')), self._clear_check], False, False), gui.pack_hbox([ gtk.Label(_L('Style')), self._plot_style], False, False), gui.pack_hbox([ gtk.Label(_L('Columns')), self._columns], False, False), ], False, False) vbox2 = gui.pack_vbox([ gui.pack_hbox([ gtk.Label(_L('Offset')), self._ofs_entry], False, False), gui.pack_hbox([ gtk.Label(_L('Trace offset')), self._traceofs_entry], False, False), ], False, False) self._plot_box = gui.pack_vbox([ gui.pack_hbox([vbox1, vbox2], True, True), gui.pack_hbox([self._plot2d_button, self._plot3d_button, self._clear_button], True, True), ], True, True) self._plot_box.set_border_width(4) self._plot_frame = gtk.Frame('Plot') self._plot_frame.add(self._plot_box) self._entries_model = gtk.ListStore(str) self._entries_model.set_sort_column_id(0, gtk.SORT_ASCENDING) self._entry_map = {} self._entries_view = qttable.QTTable([(_L('Filename'), {})], \ self._entries_model) self._entries_view.connect('row-activated', self._row_activated_cb) self._entries_scroll = gtk.ScrolledWindow() self._entries_scroll.set_policy(gtk.POLICY_AUTOMATIC, \ gtk.POLICY_AUTOMATIC) self._entries_scroll.add_with_viewport(self._entries_view) self._info_view = gtk.TextView() self._info_view.set_border_width(4) self._meta_dropdown = dropdowns.StringListDropdown([]) self._meta_dropdown.connect('changed', self._meta_drop_changed_cb) self._info_box = gui.pack_vbox([ self._meta_dropdown, self._info_view], False, False) self._info_box.set_border_width(4) self._views_hbox = gui.pack_hbox( (self._entries_scroll, self._info_box), True, True) vbox = gtk.VBox() vbox.pack_start(self._dir_hbox, False, False) vbox.pack_start(self._plot_frame, False, False) vbox.pack_start(self._views_hbox, True, True) self.add(vbox) vbox.show_all()
def __init__(self): ''' Initialization of main window ''' # Default parameters self._nfig = 1 self._hid = 0 # Proxy connect hid self._plottype = 'none' self._data_obj = None self._operations = [ 'None', 'Plot 2D', 'Plot 3D', 'Plot 2D Difference', 'Plot 3D - horizontal offset', 'Plot 3D - vertical offset', 'Plot 3D - horizontal difference', 'Plot 3D - vertical difference', 'Close all' ] self._cid = 0 # Connect ID for crosshair self._xdata = None self._ydata = None self._x = None self._y = None self._z = None self._offset = None # Create a new window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Set title self.window.set_title("QTLab Analysis") # Handler for delete_event self.window.connect("delete_event", self._delete_event) # Border for the window self.window.set_border_width(10) # Button # self.plot2d_button = gtk.Button("Plot XY") # self.plot2d_button.connect("clicked", self._plot2d_cb) # self.plot3d_button = gtk.Button("Plot XYZ") # self.plot3d_button.connect("clicked", self._plot3d_cb) self.go_button = gtk.Button("Go") self.go_button.connect("clicked", self._go_cb) self._dir_entry = gtk.Entry() self._dir_entry.connect('activate', self._dir_activate_cb) self._dir_button = gtk.Button(_L('Browse')) self._dir_button.connect('clicked', self._dir_button_clicked_cb) self._dir_hbox = gui.pack_hbox((gtk.Label('Choose filename (*.dat): '), self._dir_entry, self._dir_button), True, True) # Dropdowns self._data_dropdown = dropdowns.NamedListDropdown(qt.data) self._data_dropdown.connect('changed', self._data_dropdown_changed_cb) self._colnames_dropdown_x = dropdowns.StringListDropdown([]) self._colnames_dropdown_y = dropdowns.StringListDropdown([]) self._colnames_dropdown_z = dropdowns.StringListDropdown([]) self._operations_dropdown = dropdowns.StringListDropdown( self._operations) self._operations_dropdown.connect('changed', self._operations_dropdown_changed_cb) # Checkboxes self._hold_check = gtk.CheckButton('Hold on') self._hold_check.set_active(False) self._newfig_check = gtk.CheckButton('New figure') self._newfig_check.set_active(False) self._liveplot_check = gtk.CheckButton('Live plot') self._liveplot_check.set_active(False) self._liveplot_check.connect("clicked", self._liveplot_cb) # Pack vbox self.vbox = gui.pack_vbox([ gui.pack_hbox( [gtk.Label(_L('Choose data: ')), self._data_dropdown], True, True), self._dir_hbox, gui.pack_hbox([gtk.Label(_L('X: ')), self._colnames_dropdown_x], True, True), gui.pack_hbox([gtk.Label(_L('Y: ')), self._colnames_dropdown_y], True, True), gui.pack_hbox([gtk.Label(_L('Z: ')), self._colnames_dropdown_z], True, True), gui.pack_hbox( [gtk.Label(_L('Operations: ')), self._operations_dropdown], True, True), self.go_button, gui.pack_hbox( [self._hold_check, self._newfig_check, self._liveplot_check], True, True), ], False, False) self.window.add(self.vbox) self._data_dropdown.show() self._colnames_dropdown_x.show() self._colnames_dropdown_y.show() self._colnames_dropdown_z.show() self._operations_dropdown.show() self.go_button.show() self.vbox.show_all() self.window.show()
def __init__(self, ins, param, delay=50): if type(ins) is types.StringType: ins = qt.get_instrument_proxy(ins) self._instrument = ins self._parameter = param self._parameter_options = self._instrument.get_shared_parameter_options( param) if ins is not None and param in ins.get_parameter_names(): name = '%s.%s' % (ins.get_name(), param) else: name = 'Paramter undefined' title = _L('Parameter: %s') % name qtwindow.QTWindow.__init__(self, name, title, add_to_main=False) self.connect('delete-event', self._delete_event_cb) self._delay = delay self._value_to_set = None self._set_hid = None if self._parameter_options.has_key('minval'): self._insmin = self._parameter_options['minval'] self._min = self._insmin else: logging.warning('Be careful! Parameter has no \ minimum defined!') self._insmin = -1e20 self._min = self._instrument.get(param) if self._parameter_options.has_key('maxval'): self._insmax = self._parameter_options['maxval'] self._max = self._insmax else: logging.warning('Be careful! Parameter has no \ maximum defined!') self._insmax = 1e20 self._max = self._instrument.get(param) self._range = self._max - self._min self._value = self._instrument.get(param) self._get_after_set = True ### start of gui init ### sliders frame slider = gtk.VScale() slider.set_inverted(True) slider.set_size_request(50, -1) slider.set_range(self._min, self._max) slider.set_digits(2) slider.set_draw_value(False) slider.connect('change-value', self._change_value_cb) self._main_slider = slider self._main_slider_label = gtk.Label('x1') vbox = gtk.VBox() vbox.pack_start(self._main_slider_label, False, False) vbox.pack_start(slider, True, True) self._main_slider_vbox = vbox self._fine_sliders = [] self._fine_slider_vboxes = [] self._fine_slider_labels = [] for i in range(3): slider = gtk.VScale() slider.set_inverted(True) slider.set_size_request(50, -1) slider.set_range(-1, 1) slider.set_digits(2) slider.set_draw_value(False) slider.connect('change-value', self._change_value_cb) self._fine_sliders.append(slider) label = gtk.Label('x0.%s1' % (i * '0')) self._fine_slider_labels.append(label) vbox = gtk.VBox() vbox.pack_start(label, False, False) vbox.pack_start(slider, True, True) self._fine_slider_vboxes.append(vbox) self._slider_hbox = gui.pack_hbox([ self._main_slider_vbox, self._fine_slider_vboxes[0], self._fine_slider_vboxes[1], self._fine_slider_vboxes[2], ]) self._slframe = gtk.Frame() self._slframe.add(self._slider_hbox) ### controls frame self._max_label = gtk.Label('max:') self._max_value = gtk.Label('%e' % self._max) self._max_entry = gtk.Entry() self._max_but = gtk.Button('Set') self._max_but.connect('clicked', self._set_max_clicked_cb) self._min_label = gtk.Label('min:') self._min_value = gtk.Label('%e' % self._min) self._min_entry = gtk.Entry() self._min_but = gtk.Button('Set') self._min_but.connect('clicked', self._set_min_clicked_cb) self._delay_label = gtk.Label('delay:') self._delay_value = gtk.Label('%d' % self._delay) self._delay_entry = gtk.Entry() self._delay_but = gtk.Button('Set') self._delay_but.connect('clicked', self._set_delay_clicked_cb) self._value_label = gtk.Label('value:') self._value_getbut = gtk.Button('Get') self._value_getbut.connect('clicked', self._get_value_clicked_cb) self._value_entry = gtk.Entry() self._value_but = gtk.Button('Set') self._value_but.connect('clicked', self._set_value_clicked_cb) self._ctable = gtk.Table(4, 4, True) self._ctable.set_homogeneous(False) self._ctable.attach(self._max_label, 0, 1, 0, 1) self._ctable.attach(self._max_value, 1, 2, 0, 1) self._ctable.attach(self._max_entry, 2, 3, 0, 1) self._ctable.attach(self._max_but, 3, 4, 0, 1) self._ctable.attach(self._min_label, 0, 1, 1, 2) self._ctable.attach(self._min_value, 1, 2, 1, 2) self._ctable.attach(self._min_entry, 2, 3, 1, 2) self._ctable.attach(self._min_but, 3, 4, 1, 2) self._ctable.attach(self._delay_label, 0, 1, 2, 3) self._ctable.attach(self._delay_value, 1, 2, 2, 3) self._ctable.attach(self._delay_entry, 2, 3, 2, 3) self._ctable.attach(self._delay_but, 3, 4, 2, 3) self._ctable.attach(self._value_label, 0, 1, 3, 4) self._ctable.attach(self._value_getbut, 1, 2, 3, 4) self._ctable.attach(self._value_entry, 2, 3, 3, 4) self._ctable.attach(self._value_but, 3, 4, 3, 4) self._cframe = gtk.Frame() self._cframe.add(self._ctable) self._max_value.set_size_request(100, 1) ### value frame self._vallabel = gtk.Label('') self._vallabel.set_markup('<span size="xx-large">%e</span>' % self._value) self._valframe = gtk.Frame() self._valframe.add(self._vallabel) ### put together self._alltable = gtk.Table(2, 2, True) self._alltable.set_homogeneous(False) self._alltable.attach(self._cframe, 0, 1, 0, 1) self._alltable.attach(self._valframe, 0, 1, 1, 2) self._alltable.attach(self._slframe, 1, 2, 0, 2) ### end of gui init self._set_sliders() self.add(self._alltable) self.show_all()
def __init__(self): ''' Initialization of main window ''' self._plottype = 'none' # Create a new window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Set title self.window.set_title("QTLab Analysis") # Handler for delete_event self.window.connect("delete_event", self.delete_event) # Border for the window self.window.set_border_width(10) # Buttons self.plot2d_button = gtk.Button("Plot XY") self.plot2d_button.connect("clicked", self.plot2d_cb) self.plot3d_button = gtk.Button("Plot XYZ") self.plot3d_button.connect("clicked", self.plot3d_cb) # Dropdowns self._data_dropdown = dropdowns.NamedListDropdown(qt.data) self._data_dropdown.connect('changed', self._data_dropdown_changed_cb) self._colnames_dropdown_x = dropdowns.StringListDropdown([]) self._colnames_dropdown_y = dropdowns.StringListDropdown([]) self._colnames_dropdown_z = dropdowns.StringListDropdown([]) # Checkboxes self._hold_check = gtk.CheckButton('Hold on') self._hold_check.set_active(False) self._newfig_check = gtk.CheckButton('New figure') self._newfig_check.set_active(False) self._nfig = 1 self._liveplot_check = gtk.CheckButton('Live plot') self._liveplot_check.set_active(False) self._liveplot_check.connect("clicked", self._liveplot_cb) self._hid = 0 # Proxy connect hid # Pack vbox self.vbox = gui.pack_vbox([ gui.pack_hbox( [gtk.Label(_L('Choose data: ')), self._data_dropdown], True, True), gui.pack_hbox([gtk.Label(_L('X: ')), self._colnames_dropdown_x], True, True), gui.pack_hbox([gtk.Label(_L('Y: ')), self._colnames_dropdown_y], True, True), gui.pack_hbox([gtk.Label(_L('Z: ')), self._colnames_dropdown_z], True, True), self.plot2d_button, self.plot3d_button, gui.pack_hbox( [self._hold_check, self._newfig_check, self._liveplot_check], True, True), ], False, False) self.window.add(self.vbox) self._data_dropdown.show() self._colnames_dropdown_x.show() self._colnames_dropdown_y.show() self._colnames_dropdown_z.show() self.plot2d_button.show() self.plot3d_button.show() self.vbox.show_all() self.window.show()
def __init__(self): qtwindow.QTWindow.__init__(self, 'watch', 'Watch') self.connect("delete-event", self._delete_event_cb) qt.flow.connect('measurement-start', self._mstart_cb) qt.flow.connect('measurement-end', self._mend_cb) self._watch = {} self._paused = False self._frame = gtk.Frame() self._frame.set_label(_L('Add variable')) self._ins_combo = dropdowns.InstrumentDropdown() self._ins_combo.connect('changed', self._instrument_changed_cb) self._param_combo = dropdowns.InstrumentParameterDropdown() self._param_combo.connect('changed', self._parameter_changed_cb) label = gtk.Label(_L('Interval')) self._interval = gtk.SpinButton(climb_rate=1, digits=0) self._interval.set_range(0, 100000) self._interval.set_value(500) interval = gui.pack_hbox( [label, self._interval, gtk.Label('ms')], False, False) self._graph_check = gtk.CheckButton('Graph') self._graph_check.set_active(True) self._graph_check.connect('toggled', self._graph_toggled_cb) label = gtk.Label('Data points') self._npoints = gtk.SpinButton(climb_rate=1, digits=0) self._npoints.set_range(10, 1000) self._npoints.set_value(100) self._npoints.set_increments(1, 10) graph = gui.pack_hbox([self._graph_check, label, self._npoints], True, False) self._ma_check = gtk.CheckButton('Moving average') self._ma_check.set_active(False) self._ma_check.connect('toggled', self._ma_toggled_cb) label = gtk.Label('Constant') self._ma_const = gtk.SpinButton(climb_rate=0.01, digits=2) self._ma_const.set_sensitive(False) self._ma_const.set_range(0, 1.0) self._ma_const.set_increments(0.01, 0.1) self._ma_const.set_value(0.95) ma = gui.pack_hbox([self._ma_check, label, self._ma_const], True, False) self._add_button = gtk.Button(_L('Add')) self._add_button.connect('clicked', self._add_clicked_cb) self._remove_button = gtk.Button(_L('Remove')) self._remove_button.connect('clicked', self._remove_clicked_cb) self._pause_button = gtk.ToggleButton(_L('Pause')) self._pause_button.set_active(False) self._pause_button.connect('clicked', self._toggle_pause_cb) buttons = gui.pack_hbox( [self._add_button, self._remove_button, self._pause_button], False, False) self._tree_model = gtk.ListStore(str, str, str) self._tree_view = QTTable([ (_L('Parameter'), {}), (_L('Delay'), {}), (_L('Value'), { 'scale': 3.0 }), ], self._tree_model) vbox = gui.pack_vbox([ self._ins_combo, self._param_combo, interval, graph, ma, buttons, ], False, False) vbox.set_border_width(4) self._frame.add(vbox) vbox = gui.pack_vbox([ self._frame, self._tree_view, ], False, False) self.add(vbox) vbox.show_all()
def __init__(self, ins, param, delay=50): if type(ins) is types.StringType: ins = qt.get_instrument_proxy(ins) self._instrument = ins self._parameter = param self._parameter_options = self._instrument.get_shared_parameter_options(param) if ins is not None and param in ins.get_parameter_names(): name = '%s.%s' % (ins.get_name(), param) else: name = 'Paramter undefined' title = _L('Parameter: %s') % name qtwindow.QTWindow.__init__(self, name, title, add_to_main=False) self.connect('delete-event', self._delete_event_cb) self._delay = delay self._value_to_set = None self._set_hid = None if self._parameter_options.has_key('minval'): self._insmin = self._parameter_options['minval'] self._min = self._insmin else: logging.warning('Be careful! Parameter has no \ minimum defined!') self._insmin = -1e20 self._min = self._instrument.get(param) if self._parameter_options.has_key('maxval'): self._insmax = self._parameter_options['maxval'] self._max = self._insmax else: logging.warning('Be careful! Parameter has no \ maximum defined!') self._insmax = 1e20 self._max = self._instrument.get(param) self._range = self._max - self._min self._value = self._instrument.get(param) self._get_after_set = True ### start of gui init ### sliders frame slider = gtk.VScale() slider.set_inverted(True) slider.set_size_request(50, -1) slider.set_range(self._min, self._max) slider.set_digits(2) slider.set_draw_value(False) slider.connect('change-value', self._change_value_cb) self._main_slider = slider self._main_slider_label = gtk.Label('x1') vbox = gtk.VBox() vbox.pack_start(self._main_slider_label, False, False) vbox.pack_start(slider, True, True) self._main_slider_vbox = vbox self._fine_sliders = [] self._fine_slider_vboxes = [] self._fine_slider_labels = [] for i in range(3): slider = gtk.VScale() slider.set_inverted(True) slider.set_size_request(50, -1) slider.set_range(-1, 1) slider.set_digits(2) slider.set_draw_value(False) slider.connect('change-value', self._change_value_cb) self._fine_sliders.append(slider) label = gtk.Label('x0.%s1' % (i*'0')) self._fine_slider_labels.append(label) vbox = gtk.VBox() vbox.pack_start(label, False, False) vbox.pack_start(slider, True, True) self._fine_slider_vboxes.append(vbox) self._slider_hbox = gui.pack_hbox([ self._main_slider_vbox, self._fine_slider_vboxes[0], self._fine_slider_vboxes[1], self._fine_slider_vboxes[2], ]) self._slframe = gtk.Frame() self._slframe.add(self._slider_hbox) ### controls frame self._max_label = gtk.Label('max:') self._max_value = gtk.Label('%e' % self._max) self._max_entry = gtk.Entry() self._max_but = gtk.Button('Set') self._max_but.connect('clicked', self._set_max_clicked_cb) self._min_label = gtk.Label('min:') self._min_value = gtk.Label('%e' % self._min) self._min_entry = gtk.Entry() self._min_but = gtk.Button('Set') self._min_but.connect('clicked', self._set_min_clicked_cb) self._delay_label = gtk.Label('delay:') self._delay_value = gtk.Label('%d' % self._delay) self._delay_entry = gtk.Entry() self._delay_but = gtk.Button('Set') self._delay_but.connect('clicked', self._set_delay_clicked_cb) self._value_label = gtk.Label('value:') self._value_getbut = gtk.Button('Get') self._value_getbut.connect('clicked', self._get_value_clicked_cb) self._value_entry = gtk.Entry() self._value_but = gtk.Button('Set') self._value_but.connect('clicked', self._set_value_clicked_cb) self._ctable = gtk.Table(4, 4, True) self._ctable.set_homogeneous(False) self._ctable.attach(self._max_label, 0, 1, 0, 1) self._ctable.attach(self._max_value, 1, 2, 0, 1) self._ctable.attach(self._max_entry, 2, 3, 0, 1) self._ctable.attach(self._max_but, 3, 4, 0, 1) self._ctable.attach(self._min_label, 0, 1, 1, 2) self._ctable.attach(self._min_value, 1, 2, 1, 2) self._ctable.attach(self._min_entry, 2, 3, 1, 2) self._ctable.attach(self._min_but, 3, 4, 1, 2) self._ctable.attach(self._delay_label, 0, 1, 2, 3) self._ctable.attach(self._delay_value, 1, 2, 2, 3) self._ctable.attach(self._delay_entry, 2, 3, 2, 3) self._ctable.attach(self._delay_but, 3, 4, 2, 3) self._ctable.attach(self._value_label, 0, 1, 3, 4) self._ctable.attach(self._value_getbut, 1, 2, 3, 4) self._ctable.attach(self._value_entry, 2, 3, 3, 4) self._ctable.attach(self._value_but, 3, 4, 3, 4) self._cframe = gtk.Frame() self._cframe.add(self._ctable) self._max_value.set_size_request(100, 1) ### value frame self._vallabel = gtk.Label('') self._vallabel.set_markup('<span size="xx-large">%e</span>' % self._value) self._valframe = gtk.Frame() self._valframe.add(self._vallabel) ### put together self._alltable = gtk.Table(2, 2, True) self._alltable.set_homogeneous(False) self._alltable.attach(self._cframe, 0, 1, 0, 1) self._alltable.attach(self._valframe, 0, 1, 1, 2) self._alltable.attach(self._slframe, 1, 2, 0, 2) ### end of gui init self._set_sliders() self.add(self._alltable) self.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()