def panset(self, fitsimage, chinfo, paninfo): x, y = fitsimage.get_pan() points = fitsimage.get_pan_rect() # calculate pan position point radius image = paninfo.panimage.get_image() width, height = image.get_size() edgew = math.sqrt(width**2 + height**2) radius = int(0.015 * edgew) # Mark pan rectangle and pan position try: obj = paninfo.panimage.getObjectByTag(paninfo.panrect) if obj.kind != 'compound': return True point, bbox = obj.objects self.logger.debug("starting panset") point.x, point.y = x, y point.radius = radius bbox.points = points paninfo.panimage.redraw(whence=3) except KeyError: paninfo.panrect = paninfo.panimage.add( CanvasTypes.CompoundObject( CanvasTypes.Point(x, y, radius=radius), CanvasTypes.Polygon(points)))
def add_mark(self, data_x, data_y, radius=None, color=None, style=None): if not radius: radius = self.mark_radius if not color: color = self.mark_color if not style: style = self.mark_style self.logger.debug("Setting mark at %d,%d" % (data_x, data_y)) self.mark_index += 1 tag = 'mark%d' % (self.mark_index) tag = self.canvas.add(CanvasTypes.CompoundObject( CanvasTypes.Point(data_x, data_y, self.mark_radius, style=style, color=color, linestyle='solid'), CanvasTypes.Text(data_x + 10, data_y, "%d" % (self.mark_index), color=color)), tag=tag) self.marks.append(tag) self.w.marks.append_text(tag) self.select_mark(tag, pan=False)
def _create_pan_image(self): width, height = 300, 300 sfi = CanvasTypes.ImageViewCanvas(logger=self.logger) sfi.enable_autozoom('on') sfi.enable_autocuts('off') sfi.enable_draw(True) sfi.set_drawtype('rectangle', linestyle='dash') sfi.set_drawcolor('green') sfi.set_callback('draw-event', self.draw_cb) hand = sfi.get_cursor('pan') sfi.define_cursor('pick', hand) ## sfi.enable_cuts(False) sfi.set_bg(0.4, 0.4, 0.4) sfi.set_desired_size(width, height) sfi.set_callback('cursor-down', self.btndown) sfi.set_callback('cursor-move', self.drag_cb) sfi.set_callback('none-move', self.motion_cb) sfi.set_callback('scroll', self.zoom) sfi.set_callback('configure', self.reconfigure) # for debugging sfi.set_name('panimage') bd = sfi.get_bindings() bd.enable_pan(False) bd.enable_zoom(False) #iw = sfi.get_widget() sfi.set_desired_size(width, height) return sfi
def __init__(self, fv, fitsimage): # superclass defines some variables for us, like logger super(PixTable, self).__init__(fv, fitsimage) self.layertag = 'pixtable-canvas' self.pan2mark = False canvas = CanvasTypes.DrawingCanvas() ## canvas.enable_draw(True) ## canvas.set_drawtype('point', color='pink') ## canvas.set_callback('draw-event', self.draw_cb) canvas.set_callback('cursor-down', self.btndown_cb) canvas.set_callback('none-move', self.motion_cb) canvas.setSurface(self.fitsimage) self.canvas = canvas # For pixel table self.pixtbl_radius = 2 self.sizes = [1, 2, 3, 4] self.lastx = 0 self.lasty = 0 # For "marks" feature self.mark_radius = 10 self.mark_style = 'cross' self.mark_color = 'purple' self.select_color = 'cyan' self.marks = ['None'] self.mark_index = 0 self.mark_selected = None self.tw = None
def __init__(self, fv, fitsimage): # superclass defines some variables for us, like logger super(Drawing, self).__init__(fv, fitsimage) self.layertag = 'drawing-canvas' canvas = CanvasTypes.DrawingCanvas() canvas.enable_draw(True) canvas.set_drawtype('point', color='cyan') canvas.set_callback('draw-event', self.draw_cb) canvas.setSurface(self.fitsimage) self.canvas = canvas self.w = None self.drawtypes = canvas.get_drawtypes() self.drawcolors = draw_colors
def set_image(self, chinfo, paninfo, image): paninfo.panimage.set_image(image) # remove old compass try: paninfo.panimage.deleteObjectByTag(paninfo.pancompass, redraw=False) except Exception: pass # create compass try: (x, y, xn, yn, xe, ye) = image.calc_compass_center() self.logger.debug("x=%d y=%d xn=%d yn=%d xe=%d ye=%d" % (x, y, xn, yn, xe, ye)) radius = abs(xe - x) paninfo.pancompass = paninfo.panimage.add(CanvasTypes.Compass( x, y, radius, color='skyblue', fontsize=14), redraw=True) except Exception as e: self.logger.warn("Can't calculate compass: %s" % (str(e))) self.panset(chinfo.fitsimage, chinfo, paninfo)
def build_gui(self, container): assert iqcalc.have_scipy == True, \ Exception("Please install python-scipy to use this plugin") self.pickcenter = None vtop = Widgets.VBox() vtop.set_border_width(4) vbox, sw, orientation = Widgets.get_oriented_box(container) vbox.set_border_width(4) vbox.set_spacing(2) vpaned = Widgets.Splitter(orientation=orientation) nb = Widgets.TabWidget(tabpos='bottom') #nb.set_scrollable(True) self.w.nb1 = nb vpaned.add_widget(nb) cm, im = self.fv.cm, self.fv.im di = CanvasTypes.ImageViewCanvas(logger=self.logger) width, height = 200, 200 di.set_desired_size(width, height) di.enable_autozoom('off') di.enable_autocuts('off') di.zoom_to(3, redraw=False) settings = di.get_settings() settings.getSetting('zoomlevel').add_callback('set', self.zoomset, di) di.set_cmap(cm, redraw=False) di.set_imap(im, redraw=False) di.set_callback('none-move', self.detailxy) di.set_bg(0.4, 0.4, 0.4) # for debugging di.set_name('pickimage') self.pickimage = di bd = di.get_bindings() bd.enable_pan(True) bd.enable_zoom(True) bd.enable_cuts(True) iw = Widgets.wrap(di.get_widget()) nb.add_widget(iw, title="Image") if have_mpl: self.plot1 = Plot.Plot(logger=self.logger, width=2, height=3, dpi=72) self.w.canvas = self.plot1.canvas self.w.fig = self.plot1.fig self.w.ax = self.w.fig.add_subplot(111, axisbg='black') self.w.ax.set_aspect('equal', adjustable='box') self.w.ax.set_title('Contours') #self.w.ax.grid(True) canvas = self.w.canvas connect = canvas.mpl_connect # These are not ready for prime time... # connect("motion_notify_event", self.plot_motion_notify) # connect("button_press_event", self.plot_button_press) connect("scroll_event", self.plot_scroll) nb.add_widget(Widgets.wrap(canvas), title="Contour") self.plot2 = Plot.Plot(logger=self.logger, width=2, height=3, dpi=72) self.w.canvas2 = self.plot2.canvas self.w.fig2 = self.plot2.fig self.w.ax2 = self.w.fig2.add_subplot(111, axisbg='white') #self.w.ax2.set_aspect('equal', adjustable='box') self.w.ax2.set_ylabel('brightness') self.w.ax2.set_xlabel('pixels') self.w.ax2.set_title('FWHM') self.w.ax.grid(True) canvas = self.w.canvas2 nb.add_widget(Widgets.wrap(canvas), title="FWHM") ## self.msgFont = self.fv.getFont("sansFont", 12) ## tw = Widgets.TextArea(wrap=True, editable=False) ## tw.set_font(self.msgFont) ## self.tw = tw ## fr = Widgets.Frame("Instructions") ## vbox2 = Widgets.VBox() ## vbox2.add_widget(tw) ## vbox2.add_widget(Widgets.Label(''), stretch=1) ## fr.set_widget(vbox2) ## vbox.add_widget(fr, stretch=0) vpaned.add_widget(Widgets.Label('')) vbox.add_widget(vpaned, stretch=1) fr = Widgets.Frame("Pick") nb = Widgets.TabWidget(tabpos='bottom') self.w.nb2 = nb # Build report panel captions = ( ('Zoom:', 'label', 'Zoom', 'llabel', 'Contour Zoom:', 'label', 'Contour Zoom', 'llabel'), ('Object_X', 'label', 'Object_X', 'llabel', 'Object_Y', 'label', 'Object_Y', 'llabel'), ('RA:', 'label', 'RA', 'llabel', 'DEC:', 'label', 'DEC', 'llabel'), ('Equinox:', 'label', 'Equinox', 'llabel', 'Background:', 'label', 'Background', 'llabel'), ('Sky Level:', 'label', 'Sky Level', 'llabel', 'Brightness:', 'label', 'Brightness', 'llabel'), ('FWHM X:', 'label', 'FWHM X', 'llabel', 'FWHM Y:', 'label', 'FWHM Y', 'llabel'), ('FWHM:', 'label', 'FWHM', 'llabel', 'Star Size:', 'label', 'Star Size', 'llabel'), ('Sample Area:', 'label', 'Sample Area', 'llabel', 'Default Region', 'button'), ) w, b = Widgets.build_info(captions, orientation=orientation) self.w.update(b) b.zoom.set_text(self.fv.scale2text(di.get_scale())) self.wdetail = b b.default_region.add_callback('activated', lambda w: self.reset_region()) b.default_region.set_tooltip("Reset region size to default") vbox1 = Widgets.VBox() vbox1.add_widget(w, stretch=0) # spacer vbox1.add_widget(Widgets.Label(''), stretch=0) # Pick field evaluation status hbox = Widgets.HBox() hbox.set_spacing(4) hbox.set_border_width(4) label = Widgets.Label() #label.set_alignment(0.05, 0.5) self.w.eval_status = label hbox.add_widget(self.w.eval_status, stretch=0) hbox.add_widget(Widgets.Label(''), stretch=1) vbox1.add_widget(hbox, stretch=0) # Pick field evaluation progress bar and stop button hbox = Widgets.HBox() hbox.set_spacing(4) hbox.set_border_width(4) btn = Widgets.Button("Stop") btn.add_callback('activated', lambda w: self.eval_intr()) btn.set_enabled(False) self.w.btn_intr_eval = btn hbox.add_widget(btn, stretch=0) self.w.eval_pgs = Widgets.ProgressBar() hbox.add_widget(self.w.eval_pgs, stretch=1) vbox1.add_widget(hbox, stretch=0) nb.add_widget(vbox1, title="Readout") # Build settings panel captions = ( ('Show Candidates', 'checkbutton'), ('Radius:', 'label', 'xlbl_radius', 'label', 'Radius', 'spinbutton'), ('Threshold:', 'label', 'xlbl_threshold', 'label', 'Threshold', 'entry'), ('Min FWHM:', 'label', 'xlbl_min_fwhm', 'label', 'Min FWHM', 'spinbutton'), ('Max FWHM:', 'label', 'xlbl_max_fwhm', 'label', 'Max FWHM', 'spinbutton'), ('Ellipticity:', 'label', 'xlbl_ellipticity', 'label', 'Ellipticity', 'entry'), ('Edge:', 'label', 'xlbl_edge', 'label', 'Edge', 'entry'), ('Max side:', 'label', 'xlbl_max_side', 'label', 'Max side', 'spinbutton'), ('Redo Pick', 'button'), ) w, b = Widgets.build_info(captions, orientation=orientation) self.w.update(b) b.radius.set_tooltip("Radius for peak detection") b.threshold.set_tooltip("Threshold for peak detection (blank=default)") b.min_fwhm.set_tooltip("Minimum FWHM for selection") b.max_fwhm.set_tooltip("Maximum FWHM for selection") b.ellipticity.set_tooltip("Minimum ellipticity for selection") b.edge.set_tooltip("Minimum edge distance for selection") b.show_candidates.set_tooltip("Show all peak candidates") # radius control #b.radius.set_digits(2) #b.radius.set_numeric(True) b.radius.set_limits(5.0, 200.0, incr_value=1.0) b.radius.set_value(self.radius) def chg_radius(w, val): self.radius = float(val) self.w.xlbl_radius.set_text(str(self.radius)) return True b.xlbl_radius.set_text(str(self.radius)) b.radius.add_callback('value-changed', chg_radius) # threshold control def chg_threshold(w): threshold = None ths = w.get_text().strip() if len(ths) > 0: threshold = float(ths) self.threshold = threshold self.w.xlbl_threshold.set_text(str(self.threshold)) return True b.xlbl_threshold.set_text(str(self.threshold)) b.threshold.add_callback('activated', chg_threshold) # min fwhm #b.min_fwhm.set_digits(2) #b.min_fwhm.set_numeric(True) b.min_fwhm.set_limits(0.1, 200.0, incr_value=0.1) b.min_fwhm.set_value(self.min_fwhm) def chg_min(w, val): self.min_fwhm = float(val) self.w.xlbl_min_fwhm.set_text(str(self.min_fwhm)) return True b.xlbl_min_fwhm.set_text(str(self.min_fwhm)) b.min_fwhm.add_callback('value-changed', chg_min) # max fwhm #b.max_fwhm.set_digits(2) #b.max_fwhm.set_numeric(True) b.max_fwhm.set_limits(0.1, 200.0, incr_value=0.1) b.max_fwhm.set_value(self.max_fwhm) def chg_max(w, val): self.max_fwhm = float(val) self.w.xlbl_max_fwhm.set_text(str(self.max_fwhm)) return True b.xlbl_max_fwhm.set_text(str(self.max_fwhm)) b.max_fwhm.add_callback('value-changed', chg_max) # Ellipticity control def chg_ellipticity(w): minellipse = None val = w.get_text().strip() if len(val) > 0: minellipse = float(val) self.min_ellipse = minellipse self.w.xlbl_ellipticity.set_text(str(self.min_ellipse)) return True b.xlbl_ellipticity.set_text(str(self.min_ellipse)) b.ellipticity.add_callback('activated', chg_ellipticity) # Edge control def chg_edgew(w): edgew = None val = w.get_text().strip() if len(val) > 0: edgew = float(val) self.edgew = edgew self.w.xlbl_edge.set_text(str(self.edgew)) return True b.xlbl_edge.set_text(str(self.edgew)) b.edge.add_callback('activated', chg_edgew) #b.max_side.set_digits(0) #b.max_side.set_numeric(True) b.max_side.set_limits(5, 10000, incr_value=10) b.max_side.set_value(self.max_side) def chg_max_side(w, val): self.max_side = int(val) self.w.xlbl_max_side.set_text(str(self.max_side)) return True b.xlbl_max_side.set_text(str(self.max_side)) b.max_side.add_callback('value-changed', chg_max_side) b.redo_pick.add_callback('activated', lambda w: self.redo()) b.show_candidates.set_state(self.show_candidates) b.show_candidates.add_callback('activated', self.show_candidates_cb) nb.add_widget(w, title="Settings") # Build controls panel captions = ( ('Sky cut', 'button', 'Delta sky:', 'label', 'xlbl_delta_sky', 'label', 'Delta sky', 'entry'), ('Bright cut', 'button', 'Delta bright:', 'label', 'xlbl_delta_bright', 'label', 'Delta bright', 'entry'), ) w, b = Widgets.build_info(captions, orientation=orientation) self.w.update(b) b.sky_cut.set_tooltip("Set image low cut to Sky Level") b.delta_sky.set_tooltip("Delta to apply to low cut") b.bright_cut.set_tooltip("Set image high cut to Sky Level+Brightness") b.delta_bright.set_tooltip("Delta to apply to high cut") b.sky_cut.set_enabled(False) self.w.btn_sky_cut = b.sky_cut self.w.btn_sky_cut.add_callback('activated', lambda w: self.sky_cut()) self.w.sky_cut_delta = b.delta_sky b.xlbl_delta_sky.set_text(str(self.delta_sky)) b.delta_sky.set_text(str(self.delta_sky)) def chg_delta_sky(w): delta_sky = 0.0 val = w.get_text().strip() if len(val) > 0: delta_sky = float(val) self.delta_sky = delta_sky self.w.xlbl_delta_sky.set_text(str(self.delta_sky)) return True b.delta_sky.add_callback('activated', chg_delta_sky) b.bright_cut.set_enabled(False) self.w.btn_bright_cut = b.bright_cut self.w.btn_bright_cut.add_callback('activated', lambda w: self.bright_cut()) self.w.bright_cut_delta = b.delta_bright b.xlbl_delta_bright.set_text(str(self.delta_bright)) b.delta_bright.set_text(str(self.delta_bright)) def chg_delta_bright(w): delta_bright = 0.0 val = w.get_text().strip() if len(val) > 0: delta_bright = float(val) self.delta_bright = delta_bright self.w.xlbl_delta_bright.set_text(str(self.delta_bright)) return True b.delta_bright.add_callback('activated', chg_delta_bright) nb.add_widget(w, title="Controls") vbox3 = Widgets.VBox() msgFont = self.fv.getFont("fixedFont", 10) tw = Widgets.TextArea(wrap=False, editable=True) tw.set_font(msgFont) self.w.report = tw sw1 = Widgets.ScrollArea() sw1.set_widget(tw) vbox3.add_widget(sw1, stretch=1) tw.append_text(self._mkreport_header()) btns = Widgets.HBox() btns.set_spacing(4) btn = Widgets.Button("Add Pick") btn.add_callback('activated', lambda w: self.add_pick_cb()) btns.add_widget(btn) btn = Widgets.CheckBox("Record Picks") btn.set_state(self.do_record) btn.add_callback('activated', self.record_cb) btns.add_widget(btn) btns.add_widget(Widgets.Label(''), stretch=1) vbox3.add_widget(btns, stretch=0) nb.add_widget(vbox3, title="Report") ## vbox4 = Widgets.VBox() ## tw = Widgets.TextArea(wrap=False, editable=True) ## tw.set_font(msgFont) ## self.w.correct = tw ## sw1 = Widgets.ScrollArea() ## sw1.set_widget(tw) ## vbox4.add_widget(sw1, stretch=1) ## tw.append_text("# paste a reference report here") ## btns = Widgets.HBox() ## btns.set_spacing(4) ## btn = Widgets.Button("Correct WCS") ## btn.add_callback('activated', lambda w: self.correct_wcs()) ## btns.add_widget(btn) ## vbox4.add_widget(btns, stretch=0) ## nb.add_widget(vbox4, title="Correct") fr.set_widget(nb) vbox.add_widget(fr, stretch=0) ## spacer = Widgets.Label('') ## vbox.add_widget(spacer, stretch=1) vtop.add_widget(sw, stretch=1) btns = Widgets.HBox() btns.set_spacing(4) btn = Widgets.Button("Close") btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn) btns.add_widget(Widgets.Label(''), stretch=1) vtop.add_widget(btns, stretch=0) container.add_widget(vtop, stretch=1)
def redo(self): hi_value_s = self.w.hi_value.get_text().strip() if len(hi_value_s) > 0: self.hi_value = float(hi_value_s) else: self.hi_value = None lo_value_s = self.w.lo_value.get_text().strip() if len(lo_value_s) > 0: self.lo_value = float(lo_value_s) else: self.lo_value = None self.logger.debug("set lo=%s hi=%s" % (self.lo_value, self.hi_value)) self.opacity = self.w.opacity.get_value() self.logger.debug("set alpha to %f" % (self.opacity)) # look up the colors self.hi_color = self.colornames[self.w.hi_color.get_index()] try: rh, gh, bh = colors.lookup_color(self.hi_color) except KeyError: self.fv.show_error("No such color found: '%s'" % (self.hi_color)) self.lo_color = self.colornames[self.w.lo_color.get_index()] try: rl, gl, bl = colors.lookup_color(self.lo_color) except KeyError: self.fv.show_error("No such color found: '%s'" % (self.lo_color)) image = self.fitsimage.get_image() if image == None: return self.logger.debug("preparing RGB image") wd, ht = image.get_size() if (wd, ht) != self.arrsize: rgbarr = numpy.zeros((ht, wd, 4), dtype=numpy.uint8) self.arrsize = (wd, ht) self.rgbobj.set_data(rgbarr) else: rgbarr = self.rgbobj.get_data() # Set array to the desired saturation color rc = self.rgbobj.get_slice('R') gc = self.rgbobj.get_slice('G') bc = self.rgbobj.get_slice('B') ac = self.rgbobj.get_slice('A') self.logger.debug("Calculating alpha channel") # set alpha channel according to saturation limit try: data = image.get_data() ac[:] = 0 if self.hi_value != None: idx = data >= self.hi_value rc[idx] = int(rh * 255) gc[idx] = int(gh * 255) bc[idx] = int(bh * 255) ac[idx] = int(self.opacity * 255) if self.lo_value != None: idx = data <= self.lo_value rc[idx] = int(rl * 255) gc[idx] = int(gl * 255) bc[idx] = int(bl * 255) ac[idx] = int(self.opacity * 255) except Exception as e: self.logger.error("Error setting alpha channel: %s" % (str(e))) if self.canvas_img == None: self.logger.debug("Adding image to canvas") self.canvas_img = CanvasTypes.Image(0, 0, self.rgbobj) self.canvas.add(self.canvas_img, redraw=False) else: self.logger.debug("Updating canvas image") self.canvas_img.set_image(self.rgbobj) self.logger.debug("redrawing canvas") self.fitsimage.redraw(whence=2) self.logger.debug("redo completed")
def build_gui(self, container): canvas = CanvasTypes.DrawingCanvas() canvas.enable_draw(False) canvas.set_callback('none-move', self.cursormotion) canvas.add_callback('key-press', self.window_key_press) canvas.add_callback('key-release', self.window_key_release) self.canvas = canvas vbox = Widgets.VBox() fr = Widgets.Frame("IRAF") captions = [ ("Addr:", 'label', "Addr", 'llabel', 'Restart', 'button'), ("Set Addr:", 'label', "Set Addr", 'entry'), ("Control", 'hbox'), ("Channel:", 'label', 'Channel', 'llabel'), ] w, b = Widgets.build_info(captions) self.w.update(b) addr = str(self.addr.name) b.addr.set_text(addr) b.restart.set_tooltip("Restart the server") b.restart.add_callback('activated', self.restart_cb) b.set_addr.set_length(100) b.addr.set_text(addr) b.set_addr.set_tooltip("Set address to run remote control server") b.set_addr.add_callback('activated', self.set_addr_cb) self.w.mode_d = {} btn1 = Widgets.RadioButton("Ginga") btn1.set_state(True) btn1.add_callback('activated', lambda w, val: self.switchMode('ginga')) self.w.mode_d['ginga'] = btn1 self.w.control.add_widget(btn1) btn2 = Widgets.RadioButton("IRAF", group=btn1) btn2.add_callback('activated', lambda w: self.switchMode('iraf')) self.w.mode_d['iraf'] = btn2 self.w.control.add_widget(btn2) fr.set_widget(w) vbox.add_widget(fr, stretch=0) fr = Widgets.Frame("Frame/Channel") lbl = Widgets.Label("") self.w.frch = lbl fr.set_widget(lbl) vbox.add_widget(fr, stretch=0) # stretch vbox.add_widget(Widgets.Label(''), stretch=1) btns = Widgets.HBox() btns.set_spacing(4) btns.set_border_width(4) btn = Widgets.Button("Close") btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn) btns.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(btns) container.add_widget(vbox, stretch=1) self.gui_up = True fmap = self.get_channel_frame_mapping() self.update_chinfo(fmap)
def build_gui(self, container): vbox, sw, orientation = Widgets.get_oriented_box(container, scrolled=False) vbox.set_border_width(4) vbox.set_spacing(2) width, height = 300, 300 # Uncomment to debug; passing parent logger generates too # much noise in the main logger #zi = CanvasTypes.ImageViewCanvas(logger=self.logger) zi = CanvasTypes.ImageViewCanvas(logger=None) zi.set_desired_size(width, height) zi.enable_autozoom('off') zi.enable_autocuts('off') #zi.set_scale_limits(0.001, 1000.0) zi.zoom_to(self.default_zoom, redraw=False) settings = zi.get_settings() settings.getSetting('zoomlevel').add_callback('set', self.zoomset, zi) zi.set_bg(0.4, 0.4, 0.4) zi.show_pan_mark(True, redraw=False) # for debugging zi.set_name('zoomimage') self.zoomimage = zi bd = zi.get_bindings() bd.enable_zoom(False) bd.enable_pan(False) bd.enable_cmap(False) iw = Widgets.wrap(zi.get_widget()) vpaned = Widgets.Splitter(orientation=orientation) vpaned.add_widget(iw) vpaned.add_widget(Widgets.Label('')) vbox.add_widget(vpaned, stretch=1) vbox2 = Widgets.VBox() captions = ( ("Zoom Radius:", 'label', 'Zoom Radius', 'hscale'), ("Zoom Amount:", 'label', 'Zoom Amount', 'hscale'), ) w, b = Widgets.build_info(captions, orientation=orientation) self.w.update(b) vbox2.add_widget(w, stretch=0) self.w.zoom_radius.set_limits(1, 300, incr_value=1) self.w.zoom_radius.set_value(self.zoom_radius) self.w.zoom_radius.add_callback('value-changed', self.set_radius_cb) self.w.zoom_radius.set_tracking(True) self.w.zoom_amount.set_limits(-20, 30, incr_value=1) self.w.zoom_amount.set_value(self.zoom_amount) self.w.zoom_amount.add_callback('value-changed', self.set_amount_cb) self.w.zoom_amount.set_tracking(True) captions = ( ("Zoom:", 'label', 'Zoom', 'label'), ("Relative Zoom", 'checkbutton'), ("Refresh Interval", 'label', 'Refresh Interval', 'spinbutton'), ("Defaults", 'button'), ) w, b = Widgets.build_info(captions, orientation=orientation) self.w.update(b) b.zoom.set_text(self.fv.scale2text(zi.get_scale())) b.relative_zoom.set_state(not self.t_abszoom) b.relative_zoom.add_callback("activated", self.set_absrel_cb) b.defaults.add_callback("activated", lambda w: self.set_defaults()) b.refresh_interval.set_limits(0, 200, incr_value=1) b.refresh_interval.set_value(int(self.refresh_interval * 1000)) b.refresh_interval.add_callback('value-changed', self.set_refresh_cb) row = Widgets.HBox() row.add_widget(w, stretch=0) row.add_widget(Widgets.Label(''), stretch=1) vbox2.add_widget(row, stretch=0) # stretch spacer = Widgets.Label('') vbox2.add_widget(spacer, stretch=1) vbox.add_widget(vbox2, stretch=0) vbox.add_widget(Widgets.Label(''), stretch=1) container.add_widget(sw, stretch=1)