def __init__(self, ins): gtk.Frame.__init__(self) self.set_label(_L('Bookmarks')) self._add_button = gtk.Button(_L('Add')) self._add_button.connect('clicked', self._add_clicked_cb) self._goxy_button = gtk.Button(_L('Goto XY')) self._goxy_button.connect('clicked', self._go_clicked_cb, 2) self._goxyz_button = gtk.Button(_L('Goto XYZ')) self._goxyz_button.connect('clicked', self._go_clicked_cb, 3) self._remove_button = gtk.Button(_L('Remove')) self._remove_button.connect('clicked', self._remove_clicked_cb) self._bookmark_data = {} self._tree_model = gtk.ListStore(str, str) self._tree_view = QTTable([ ('Label', {}), ('Position', {}) ], self._tree_model) self._config = qt.config self._load_bookmarks() self._label_entry = gtk.Entry() self.set_instrument(ins) vbox = pack_vbox([ pack_hbox([ gtk.Label(_L('Label')), self._label_entry], True, False), pack_hbox([ self._add_button, self._goxy_button, self._goxyz_button, self._remove_button], True, True), self._tree_view ], False, False) vbox.set_border_width(4) self.add(vbox)
def __init__(self): QTWindow.__init__(self, 'positioner', 'Positioner') self.connect("delete-event", self._delete_event_cb) self._moving = False self._controls = PositionControls(None) self._controls.connect('direction-clicked', self._direction_clicked_cb) self._controls.connect('direction-released', self._direction_released_cb) self._controls.connect('max-speed-changed', self._max_speed_changed_cb) self._controls.connect('min-speed-changed', self._min_speed_changed_cb) self._controls.connect('accel-changed', self._accel_changed_cb) self._controls.connect('decel-changed', self._decel_changed_cb) self._controls.connect('stop-request', self._stop_request_cb) self._max_speed = self._controls.get_max_speed() self._min_speed = self._controls.get_min_speed() self._accel_factor = self._controls.get_accel() self._decel_factor = self._controls.get_decel() self._bookmarks = PositionBookmarks(None) self._bookmarks.connect('go-request', self._go_request) self._ins_combo = InstrumentDropdown(types=['positioner']) self._ins_combo.connect('changed', self._instrument_changed_cb) self._instrument = None poslabel = gtk.Label() poslabel.set_markup('<big>%s</big>' % _L('Position')) self._position_label = gtk.Label() self._update_position() vbox = pack_vbox([ self._ins_combo, pack_hbox([ poslabel, self._position_label], True, True), self._controls, self._bookmarks], False, False) # Speed control variables self._direction_down = (0, 0, 0) self._step_done = False self._speed = [0, 0, 0] self._timer_hid = None self._counter = 0 self.add(vbox) vbox.show_all()