def build_gui(self, container): self.msg_font = self.fv.getFont("fixedFont", 10) vbox = Widgets.VBox() mlst = Widgets.VBox() mlst.set_spacing(2) self.msgList = mlst sw = Widgets.ScrollArea() sw.set_widget(self.msgList) vbox.add_widget(sw, stretch=1) hbox = Widgets.HBox() btn = Widgets.Button("Remove All") btn.add_callback('activated', lambda w: self.remove_all()) hbox.add_widget(btn, stretch=0) hbox.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(hbox, stretch=0) container.add_widget(vbox, stretch=1) self.gui_up = True pending = self.pending_errors self.pending_errors = [] for errmsg, ts in pending: self.add_error(errmsg, ts=ts)
def build_gui(self, container): self.w = Bunch.Bunch() self.w_track = dict() vbox = Widgets.VBox() sc = Widgets.ScrollArea() vbox2 = Widgets.VBox() fr = Widgets.Frame("Downloads") self.dlbox = Widgets.VBox() fr.set_widget(self.dlbox) vbox2.add_widget(fr, stretch=0) vbox2.add_widget(Widgets.Label(''), stretch=1) sc.set_widget(vbox2) vbox.add_widget(sc, stretch=1) self.w_scroll = sc 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) btn = Widgets.Button("Clear All") btn.add_callback('activated', lambda w: self.gui_clear_all()) btns.add_widget(btn, stretch=0) btns.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(btns, stretch=0) container.add_widget(vbox, stretch=1) self.gui_up = True
def build_gui(self, container): self.msg_font = self.fv.get_font('fixed', 10) vbox = Widgets.VBox() mlst = Widgets.VBox() mlst.set_spacing(2) self.msg_list = mlst sw = Widgets.ScrollArea() sw.set_widget(self.msg_list) vbox.add_widget(sw, stretch=1) btns = Widgets.HBox() btns.set_border_width(4) btns.set_spacing(4) if self.settings.get('closeable', False): btn = Widgets.Button("Close") btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn) btn = Widgets.Button("Help") btn.add_callback('activated', lambda w: self.help()) btns.add_widget(btn, stretch=0) btn = Widgets.Button("Remove All") btn.add_callback('activated', lambda w: self.remove_all()) btns.add_widget(btn, stretch=0) btns.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(btns, stretch=0) container.add_widget(vbox, stretch=1) self.gui_up = True
def build_gui(self, container): vbox = Widgets.VBox() self.msg_font = self.fv.get_font('fixed', 12) tw = Widgets.TextArea(wrap=False, editable=False) tw.set_font(self.msg_font) tw.set_limit(self.histlimit) self.tw = tw tw.set_text('\n'.join(self._lines)) self._lines.clear() sw = Widgets.ScrollArea() sw.set_widget(self.tw) vbox.add_widget(sw, stretch=1) captions = (('Level', 'combobox', 'History', 'spinbutton'), ('Auto scroll', 'checkbutton', 'Clear', 'button')) w, b = Widgets.build_info(captions) self.w.update(b) combobox = b.level for (name, level) in self.levels: combobox.append_text(name) combobox.set_index(1) combobox.add_callback('activated', self.set_loglevel_cb) combobox.set_tooltip("Set the logging level") spinbox = b.history spinbox.set_limits(100, self.histmax, incr_value=10) spinbox.set_value(self.histlimit) spinbox.add_callback('value-changed', self.set_history_cb) spinbox.set_tooltip("Set the logging history line limit") btn = b.auto_scroll btn.set_state(self.autoscroll) btn.set_tooltip("Scroll the log window automatically") btn.add_callback('activated', self.set_autoscroll_cb) btn = b.clear btn.add_callback('activated', lambda w: self.clear()) btn.set_tooltip("Clear the log history") vbox.add_widget(w, stretch=0) btns = Widgets.HBox() btns.set_border_width(4) btns.set_spacing(4) btn = Widgets.Button("Close") btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn) btn = Widgets.Button("Help") btn.add_callback('activated', lambda w: self.help()) btns.add_widget(btn, stretch=0) btns.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(btns, stretch=0) container.add_widget(vbox, stretch=1)
def build_gui(self, container): if not Widgets.has_webkit: self.browser = Widgets.Label( "Please install the python-webkit package to enable " "this plugin") else: self.browser = Widgets.WebView() sw = Widgets.ScrollArea() sw.set_widget(self.browser) container.add_widget(sw, stretch=1) sw.show() self.entry = Widgets.TextEntrySet() container.add_widget(self.entry, stretch=0) self.entry.add_callback('activated', lambda w: self.browse_cb()) tbar = Widgets.Toolbar(orientation='horizontal') for tt, cb, ico in (('Go back', lambda w: self.back_cb(), 'prev_48.png'), ('Go forward', lambda w: self.forward_cb(), 'next_48.png'), ('Reload page', lambda w: self.reload_cb(), 'rotate_48.png'), ('Stop loading', lambda w: self.stop_cb(), 'stop_48.png'), ('Go to top of documentation', lambda w: self.show_help(), 'fits.png')): btn = tbar.add_action(None, iconpath=os.path.join(self.fv.iconpath, ico)) btn.add_callback('activated', cb) btn.set_tooltip(tt) container.add_widget(tbar, stretch=0) btns = Widgets.HBox() btns.set_border_width(4) btns.set_spacing(3) btn = Widgets.Button('Close') btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn, stretch=0) btn = Widgets.Button('Help') btn.add_callback('activated', lambda w: self.help()) btns.add_widget(btn, stretch=0) btns.add_widget(Widgets.Label(''), stretch=1) container.add_widget(btns, stretch=0) self.gui_up = True
def build_gui(self, container): vbox = Widgets.VBox() self.msgFont = self.fv.getFont("fixedFont", 12) tw = Widgets.TextArea(wrap=False, editable=False) tw.set_font(self.msgFont) self.tw = tw self.history = [] self.histmax = 10 sw = Widgets.ScrollArea() sw.set_widget(self.tw) vbox.add_widget(sw, stretch=1) captions = (('Local plugin:', 'label', 'Local plugin', 'entry', 'Reload', 'button'), ('Global plugin:', 'label', 'Global plugin', 'entry', 'ReloadG', 'button'), ) w, b = Widgets.build_info(captions) self.w.update(b) b.local_plugin.set_tooltip("Name of a local plugin to reload") b.local_plugin.set_length(14) b.reload.add_callback('activated', self.reload_local_cb) b.global_plugin.set_tooltip("Name of a global plugin to reload") b.global_plugin.set_length(14) b.reloadg.add_callback('activated', self.reload_global_cb) vbox.add_widget(w, stretch=1) self.entry = Widgets.TextEntry() vbox.add_widget(self.entry, stretch=0) self.entry.add_callback('activated', self.command_cb) 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)
def build_gui(self, container): # width, height = 300, 300 # cm, im = self.fv.cm, self.fv.im thumb_len = self.settings.get('thumb_length', 192) tg = Viewers.ImageViewCanvas(logger=self.logger) tg.configure_window(thumb_len, thumb_len) tg.enable_autozoom('on') tg.set_autocut_params('zscale') tg.enable_autocuts('override') tg.enable_auto_orient(True) tg.defer_redraw = False tg.set_bg(0.7, 0.7, 0.7) self.thumb_generator = tg sw = Widgets.ScrollArea() sw.add_callback('configure', self.thumbpane_resized_cb) # Create thumbnails pane vbox = Widgets.GridBox() vbox.set_margins(4, 4, 4, 4) vbox.set_column_spacing(14) self.w.thumbs = vbox sw.set_widget(vbox) self.w.thumbs_scroll = sw container.add_widget(sw, stretch=1) captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'), ) w, b = Widgets.build_info(captions) self.w.update(b) b.auto_scroll.set_tooltip( "Scroll the thumbs window when new images arrive") b.clear.set_tooltip("Remove all current thumbnails") b.clear.add_callback('activated', lambda w: self.clear()) auto_scroll = self.settings.get('auto_scroll', True) b.auto_scroll.set_state(auto_scroll) container.add_widget(w, stretch=0) self.gui_up = True
def build_gui(self, container): self.msgFont = self.fv.getFont("fixedFont", 10) vbox = Widgets.VBox() mlst = Widgets.VBox() mlst.set_spacing(2) self.msgList = mlst sw = Widgets.ScrollArea() sw.set_widget(self.msgList) vbox.add_widget(sw, stretch=1) hbox = Widgets.HBox() btn = Widgets.Button("Remove All") btn.add_callback('activated', lambda w: self.remove_all()) hbox.add_widget(btn, stretch=0) hbox.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(hbox, stretch=0) container.add_widget(vbox, stretch=1)
def build_gui(self, container): self.msg_font = self.view.get_font('Courier', 12) vbox = Widgets.VBox() vbox.set_border_width(4) vbox.set_spacing(2) vbox.cfg_expand(horizontal='ignored', vertical='ignored') mlst = Widgets.VBox() mlst.set_spacing(2) self.msg_list = mlst sw = Widgets.ScrollArea() sw.set_widget(self.msg_list) vbox.add_widget(sw, stretch=1) hbox = Widgets.HBox() btn = Widgets.Button("Remove All") btn.add_callback('activated', lambda w: self.remove_all()) hbox.add_widget(btn, stretch=0) hbox.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(hbox, stretch=0) container.add_widget(vbox, stretch=1) self.gui_up = True pending = self.pending_errors self.pending_errors = [] for errmsg, ts in pending: self.add_error(errmsg, ts=ts) self.sw = sw container.add_widget(sw, stretch=1)
def build_gui(self, container, future=None): vbox1 = Widgets.VBox() msg_font = self.fv.get_font("sansFont", 14) tw = Widgets.TextArea() tw.set_font(msg_font) tw.set_wrap(True) self.tw = tw fr = Widgets.Expander("Instructions") fr.set_widget(tw) vbox1.add_widget(fr, stretch=0) nb = Widgets.TabWidget(tabpos='bottom') self.w.nb = nb vbox1.add_widget(nb, stretch=1) vbox0 = Widgets.VBox() hbox = Widgets.HBox() hbox.set_spacing(4) vbox0.add_widget(hbox, stretch=1) vbox = Widgets.VBox() fr = Widgets.Frame(" Image Server ") fr.set_widget(vbox) hbox.add_widget(fr, stretch=0) captions = (('Server:', 'llabel'), ('Server', 'combobox'), ('Use DSS channel', 'checkbutton'), ('Get Image', 'button')) w, b = Widgets.build_info(captions) self.w.update(b) self.w.get_image.add_callback('activated', lambda w: self.getimage_cb()) self.w.use_dss_channel.set_state(self.use_dss_channel) self.w.use_dss_channel.add_callback('activated', self.use_dss_channel_cb) vbox.add_widget(w, stretch=0) self.w.img_params = Widgets.StackWidget() vbox.add_widget(self.w.img_params, stretch=1) combobox = self.w.server index = 0 self.image_server_options = self.fv.imgsrv.getServerNames(kind='image') for name in self.image_server_options: combobox.append_text(name) index += 1 index = 0 combobox.set_index(index) combobox.add_callback('activated', lambda w, idx: self.setup_params_image(idx)) if len(self.image_server_options) > 0: self.setup_params_image(index, redo=False) vbox = Widgets.VBox() fr = Widgets.Frame(" Catalog Server ") fr.set_widget(vbox) hbox.add_widget(fr, stretch=0) captions = (('Server:', 'llabel'), ('Server', 'combobox'), ('Limit stars to area', 'checkbutton'), ('Search', 'button')) w, self.w2 = Widgets.build_info(captions) self.w2.search.add_callback('activated', lambda w: self.getcatalog_cb()) self.w2.limit_stars_to_area.set_state(self.limit_stars_to_area) self.w2.limit_stars_to_area.add_callback('activated', self.limit_area_cb) vbox.add_widget(w, stretch=0) self.w2.cat_params = Widgets.StackWidget() vbox.add_widget(self.w2.cat_params, stretch=1) combobox = self.w2.server index = 0 self.catalog_server_options = self.fv.imgsrv.getServerNames( kind='catalog') for name in self.catalog_server_options: combobox.append_text(name) index += 1 index = 0 combobox.set_index(index) combobox.add_callback('activated', lambda w, idx: self.setup_params_catalog(idx)) if len(self.catalog_server_options) > 0: self.setup_params_catalog(index, redo=False) # stretch vbox0.add_widget(Widgets.Label(''), stretch=1) btns = Widgets.HBox() btns.set_spacing(5) btn1 = Widgets.RadioButton("Rectangle") btn1.set_state(self.drawtype == 'rectangle') btn1.add_callback('activated', lambda w, tf: self.set_drawtype_cb(tf, 'rectangle')) btns.add_widget(btn1, stretch=0) btn2 = Widgets.RadioButton("Circle", group=btn1) btn2.set_state(self.drawtype == 'circle') btn2.add_callback('activated', lambda w, tf: self.set_drawtype_cb(tf, 'circle')) btns.add_widget(btn2, stretch=0) btn = Widgets.Button("Entire image") btn.add_callback('activated', lambda w: self.setfromimage()) btns.add_widget(btn, stretch=0) vbox0.add_widget(btns, stretch=0) self.w.params = vbox0 sw = Widgets.ScrollArea() sw.set_widget(vbox0) nb.add_widget(sw, title="Params") vbox = Widgets.VBox() self.table = CatalogListing(self.logger, vbox) hbox = Widgets.HBox() adj = Widgets.Slider(orientation='horizontal') adj.set_limits(0, 1000, incr_value=1) adj.set_value(0) #adj.resize(200, -1) adj.set_tracking(True) adj.set_tooltip("Choose subset of stars plotted") self.w.plotgrp = adj adj.add_callback('value-changed', self.plot_pct_cb) hbox.add_widget(adj, stretch=1) sb = Widgets.SpinBox(dtype=int) sb.set_limits(10, self.plot_max, incr_value=10) sb.set_value(self.plot_limit) #sb.set_wrapping(False) self.w.plotnum = sb sb.set_tooltip("Adjust size of subset of stars plotted") sb.add_callback('value-changed', self.plot_limit_cb) hbox.add_widget(sb, stretch=0) vbox.add_widget(hbox, stretch=0) self.w.listing = vbox nb.add_widget(vbox, title="Listing") btns = Widgets.HBox() btns.set_spacing(3) self.w.buttons = btns btn = Widgets.Button("Close") btn.add_callback('activated', lambda w: self.close()) btns.add_widget(btn, stretch=0) if future: btn = Widgets.Button('Ok') btn.add_callback('activated', lambda w: self.ok()) btns.add_widget(btn, stretch=0) btn = Widgets.Button('Cancel') btn.add_callback('activated', lambda w: self.cancel()) btns.add_widget(btn, stretch=0) vbox1.add_widget(btns, stretch=0) container.add_widget(vbox1, stretch=1) self.gui_up = True
def build_gui(self, container): vbox = Widgets.VBox() vbox.set_border_width(4) vbox.set_spacing(2) #vbox.cfg_expand(8, 8) sw = Widgets.ScrollArea() sw.set_widget(vbox) fr = Widgets.Frame("Files") captions = (('Inputs:', 'label', 'Input dir', 'entry'), ('Load Info', 'button'), ('Update Database from Files', 'button'), ('Build Schedule', 'button', 'Use QDB', 'checkbutton'), ("Remove scheduled OBs", 'checkbutton')) w, b = Widgets.build_info(captions, orientation='vertical') self.w = b sdlr = self.model.get_scheduler() b.input_dir.set_length(128) b.input_dir.set_text(self.controller.input_dir) b.load_info.set_tooltip("Load data from phase 2 files") b.load_info.add_callback('activated', self.initialize_model_cb) b.update_database_from_files.set_tooltip( "Update Gen2 database from changes to phase 2 files") b.remove_scheduled_obs.set_state(sdlr.remove_scheduled_obs) def toggle_sdled_obs(w, tf): print(('setting sdled obs', tf)) sdlr.remove_scheduled_obs = tf b.remove_scheduled_obs.add_callback('activated', toggle_sdled_obs) if have_gen2: b.update_database_from_files.add_callback('activated', self.update_db_cb) else: b.update_database_from_files.set_enabled(False) b.build_schedule.set_tooltip( "Schedule all periods defined in schedule tab") b.build_schedule.add_callback('activated', self.build_schedule_cb) b.use_qdb.set_tooltip("Use Gen2 queue database when scheduling") if not have_qdb: b.use_qdb.set_enabled(False) else: qdb_port = self.settings.get('qdb_port') if qdb_port is not None: b.use_qdb.set_state(True) fr.set_widget(w) vbox.add_widget(fr, stretch=0) spacer = Widgets.Label('') vbox.add_widget(spacer, stretch=1) hbox = Widgets.HBox() adj = Widgets.Slider(orientation='horizontal', track=False) adj.set_limits(0, 100, incr_value=1) idx = self.controller.idx_tgt_plots adj.set_value(idx) #adj.resize(200, -1) adj.set_tooltip("Choose subset of targets plotted") #self.w.plotgrp = adj adj.add_callback('value-changed', self.set_plot_pct_cb) hbox.add_widget(adj, stretch=1) sb = Widgets.TextEntrySet() num = self.controller.num_tgt_plots sb.set_text(str(num)) sb.set_tooltip("Adjust size of subset of targets plotted") sb.add_callback('activated', self.set_plot_limit_cb) hbox.add_widget(sb, stretch=0) vbox.add_widget(hbox, stretch=0) ## btns = Widgets.HBox() ## btns.set_spacing(3) ## btn = Widgets.Button("Close") ## #btn.add_callback('activated', lambda w: self.close()) ## btns.add_widget(btn, stretch=0) ## btns.add_widget(Widgets.Label(''), stretch=1) ## vbox.add_widget(btns, stretch=0) self.sw = sw container.add_widget(sw, stretch=1)
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) box, sw, orientation = Widgets.get_oriented_box(container, fill=True) box.set_border_width(4) box.set_spacing(2) self.msg_font = self.fv.get_font("sansFont", 12) tw = Widgets.TextArea(wrap=True, editable=False) tw.set_font(self.msg_font) self.tw = tw fr = Widgets.Expander("Instructions") fr.set_widget(tw) box.add_widget(fr, stretch=0) vpaned = Widgets.Splitter(orientation=orientation) nb = Widgets.TabWidget(tabpos='bottom') self.w.nb1 = nb vpaned.add_widget(nb) cm, im = self.fv.cm, self.fv.im di = Viewers.CanvasView(logger=self.logger) width, height = 300, 300 di.set_desired_size(width, height) di.enable_autozoom('off') di.enable_autocuts('off') di.zoom_to(3) settings = di.get_settings() settings.getSetting('zoomlevel').add_callback('set', self.zoomset, di) di.set_cmap(cm) di.set_imap(im) 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) di.configure(width, height) iw = Viewers.GingaViewerWidget(viewer=di) iw.resize(300, 300) nb.add_widget(iw, title="Image") if have_mpl: # Contour plot hbox = Widgets.HBox() self.contour_plot = plots.ContourPlot(logger=self.logger, width=400, height=300) self.contour_plot.add_axis(axisbg='black') pw = Plot.PlotWidget(self.contour_plot) pw.resize(400, 300) hbox.add_widget(pw, stretch=1) zoom = Widgets.Slider(orientation='vertical', track=True) zoom.set_limits(1, 100, incr_value=1) zoom.set_value(self.contour_plot.plot_zoomlevel) def zoom_contour_cb(w, val): self.contour_plot.plot_zoom(val / 10.0) zoom.add_callback('value-changed', zoom_contour_cb) hbox.add_widget(zoom, stretch=0) nb.add_widget(hbox, title="Contour") # FWHM gaussians plot self.fwhm_plot = plots.FWHMPlot(logger=self.logger, width=400, height=300) self.fwhm_plot.add_axis(axisbg='white') pw = Plot.PlotWidget(self.fwhm_plot) pw.resize(400, 300) nb.add_widget(pw, title="FWHM") # Radial profile plot self.radial_plot = plots.RadialPlot(logger=self.logger, width=400, height=300) self.radial_plot.add_axis(axisbg='white') pw = Plot.PlotWidget(self.radial_plot) pw.resize(400, 300) nb.add_widget(pw, title="Radial") fr = Widgets.Frame(self._textlabel) nb = Widgets.TabWidget(tabpos='bottom') self.w.nb2 = nb # Build report panel captions = ( ('Zoom:', 'label', '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'), ('Pan to pick', '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") b.pan_to_pick.add_callback('activated', lambda w: self.pan_to_pick_cb()) b.pan_to_pick.set_tooltip("Pan image to pick center") 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'), ('Coordinate Base:', 'label', 'xlbl_coordinate_base', 'label', 'Coordinate Base', 'entry'), ('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") b.max_side.set_tooltip("Maximum dimension to search for peaks") b.coordinate_base.set_tooltip("Base of pixel coordinate system") # radius control #b.radius.set_digits(2) #b.radius.set_numeric(True) b.radius.set_limits(5.0, 200.0, incr_value=1.0) 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) self.w.xlbl_coordinate_base.set_text(str(self.pixel_coords_offset)) b.coordinate_base.set_text(str(self.pixel_coords_offset)) b.coordinate_base.add_callback('activated', self.coordinate_base_cb) vbox3 = Widgets.VBox() vbox3.add_widget(w, stretch=0) vbox3.add_widget(Widgets.Label(''), stretch=1) nb.add_widget(vbox3, title="Settings") # Build controls panel vbox3 = Widgets.VBox() 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) vbox3.add_widget(w, stretch=0) vbox3.add_widget(Widgets.Label(''), stretch=1) nb.add_widget(vbox3, title="Controls") vbox3 = Widgets.VBox() msg_font = self.fv.get_font("fixedFont", 10) tw = Widgets.TextArea(wrap=False, editable=True) tw.set_font(msg_font) self.w.report = tw sw1 = Widgets.ScrollArea() sw1.set_widget(tw) vbox3.add_widget(sw1, stretch=1) tw.append_text(self._make_report_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 automatically") 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) btns = Widgets.HBox() btns.set_spacing(4) btn = Widgets.CheckBox("Log Records") btn.set_state(self.do_report_log) btn.add_callback('activated', self.do_report_log_cb) btns.add_widget(btn) btns.add_widget(Widgets.Label("File:")) ent = Widgets.TextEntry() ent.set_text(self.report_log) ent.add_callback('activated', self.set_report_log_cb) btns.add_widget(ent, stretch=1) vbox3.add_widget(btns, stretch=0) nb.add_widget(vbox3, title="Report") ## sw2 = Widgets.ScrollArea() ## sw2.set_widget(nb) ## fr.set_widget(sw2) fr.set_widget(nb) vpaned.add_widget(fr) mode = self.canvas.get_draw_mode() hbox = Widgets.HBox() btn1 = Widgets.RadioButton("Move") btn1.set_state(mode == 'move') btn1.add_callback('activated', lambda w, val: self.set_mode_cb('move', val)) btn1.set_tooltip("Choose this to position pick") self.w.btn_move = btn1 hbox.add_widget(btn1) btn2 = Widgets.RadioButton("Draw", group=btn1) btn2.set_state(mode == 'draw') btn2.add_callback('activated', lambda w, val: self.set_mode_cb('draw', val)) btn2.set_tooltip("Choose this to draw a replacement pick") self.w.btn_draw = btn2 hbox.add_widget(btn2) btn3 = Widgets.RadioButton("Edit", group=btn1) btn3.set_state(mode == 'edit') btn3.add_callback('activated', lambda w, val: self.set_mode_cb('edit', val)) btn3.set_tooltip("Choose this to edit a pick") self.w.btn_edit = btn3 hbox.add_widget(btn3) hbox.add_widget(Widgets.Label(''), stretch=1) #box.add_widget(hbox, stretch=0) vpaned.add_widget(hbox) box.add_widget(vpaned, stretch=1) vtop.add_widget(sw, stretch=5) ## spacer = Widgets.Label('') ## vtop.add_widget(spacer, stretch=0) 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=5)
def _create_info_window(self): sw = Widgets.ScrollArea() vbox = Widgets.VBox() sw.set_widget(vbox) captions = ( ('Name:', 'label', 'Name', 'llabel'), ('Object:', 'label', 'Object', 'llabel'), ('X:', 'label', 'X', 'llabel'), ('Y:', 'label', 'Y', 'llabel'), ('Value:', 'label', 'Value', 'llabel'), ('RA:', 'label', 'RA', 'llabel'), ('DEC:', 'label', 'DEC', 'llabel'), ('Equinox:', 'label', 'Equinox', 'llabel'), ('Dimensions:', 'label', 'Dimensions', 'llabel'), ('Min:', 'label', 'Min', 'llabel'), ('Max:', 'label', 'Max', 'llabel'), ) w, b = Widgets.build_info(captions) col = Widgets.VBox() row = Widgets.HBox() row.set_spacing(0) row.set_border_width(0) row.add_widget(w, stretch=0) row.add_widget(Widgets.Label(''), stretch=1) col.add_widget(row, stretch=0) col.add_widget(Widgets.Label(''), stretch=1) sw2 = Widgets.ScrollArea() sw2.set_widget(col) vbox.add_widget(sw2, stretch=1) captions = ( ('Channel:', 'label', 'Channel', 'llabel'), ('Zoom:', 'label', 'Zoom', 'llabel'), ('Cut Low:', 'label', 'Cut Low Value', 'llabel', 'Cut Low', 'entry'), ('Cut High:', 'label', 'Cut High Value', 'llabel', 'Cut High', 'entry'), ('Auto Levels', 'button', 'spacer_1', 'spacer', 'Cut Levels', 'button'), ('Cut New:', 'label', 'Cut New', 'combobox'), ('Zoom New:', 'label', 'Zoom New', 'combobox', 'Follow New', 'checkbutton'), ('Center New:', 'label', 'Center New', 'combobox', 'Raise New', 'checkbutton'), ) w, b2 = Widgets.build_info(captions) b.update(b2) b.cut_levels.set_tooltip("Set cut levels manually") b.auto_levels.set_tooltip("Set cut levels by algorithm") b.cut_low.set_tooltip("Set low cut level (press Enter)") b.cut_low_value.set_text('') b.cut_high.set_tooltip("Set high cut level (press Enter)") b.cut_high_value.set_text('') combobox = b.cut_new index = 0 for name in self.autocut_options: combobox.append_text(name) index += 1 b.cut_new.set_tooltip("Automatically set cut levels for new images") combobox = b.zoom_new index = 0 for name in self.autozoom_options: combobox.append_text(name) index += 1 b.zoom_new.set_tooltip("Automatically fit new images to window") combobox = b.center_new index = 0 for name in self.autocenter_options: combobox.append_text(name) index += 1 b.center_new.set_tooltip("Automatically center new images in window") b.follow_new.set_tooltip( "Automatically switch to new images in channel") b.raise_new.set_tooltip( "Automatically raise channel viewer for new images") row = Widgets.HBox() row.set_spacing(0) row.set_border_width(0) row.add_widget(w, stretch=0) row.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(row, stretch=0) return sw, b
vbox.add_widget(w) elif wname == 'vbox': w = Widgets.VBox() w.add_widget(Widgets.Label("Item 1"), stretch=0) w.add_widget(Widgets.Label("Item 2"), stretch=1) vbox.add_widget(w) elif wname == 'splitter': w = Widgets.Splitter(orientation='horizontal') w.add_widget(Widgets.Label('Content of Pane 1')) w.add_widget(Widgets.Label('Content of Pane 2')) vbox.add_widget(w, stretch=1) elif wname == 'scrollarea': w = Widgets.ScrollArea() img = Widgets.Image() img.load_file(os.path.join(icondir, 'ginga-512x512.png')) w.set_widget(img) vbox.add_widget(w, stretch=1) elif wname == 'tabwidget': w = Widgets.TabWidget() w.add_widget(Widgets.Label('Content of Tab 1'), title='Tab 1') w.add_widget(Widgets.Label('Content of Tab 2'), title='Tab 2') hbox = Widgets.HBox() sbox = Widgets.SpinBox(dtype=int) sbox.set_limits(0, 1, incr_value=1) sbox.set_value(0) sbox.add_callback('value-changed', lambda sbx, val: w.set_index(val)) hbox.add_widget(sbox)
def _create_info_window(self): sw = Widgets.ScrollArea() vbox = Widgets.VBox() sw.set_widget(vbox) captions = ( ('Name:', 'label', 'Name', 'llabel'), ('Object:', 'label', 'Object', 'llabel'), ('X:', 'label', 'X', 'llabel'), ('Y:', 'label', 'Y', 'llabel'), ('Value:', 'label', 'Value', 'llabel'), ('RA:', 'label', 'RA', 'llabel'), ('DEC:', 'label', 'DEC', 'llabel'), ('Equinox:', 'label', 'Equinox', 'llabel'), ('Dimensions:', 'label', 'Dimensions', 'llabel'), ('Min:', 'label', 'Min', 'llabel'), ('Max:', 'label', 'Max', 'llabel'), ) w, b = Widgets.build_info(captions) col = Widgets.VBox() row = Widgets.HBox() row.set_spacing(0) row.set_border_width(0) row.add_widget(w, stretch=0) row.add_widget(Widgets.Label(''), stretch=1) col.add_widget(row, stretch=0) #col.add_widget(Widgets.Label(''), stretch=1) sw2 = Widgets.ScrollArea() sw2.set_widget(col) vbox.add_widget(sw2, stretch=2) # stretcher vbox.add_widget(Widgets.Label(''), stretch=1) captions = ( ('Zoom:', 'label', 'Zoom', 'llabel'), ('Cut Low:', 'label', 'Cut Low Value', 'llabel', 'Cut Low', 'entry'), ('Cut High:', 'label', 'Cut High Value', 'llabel', 'Cut High', 'entry'), ('Auto Levels', 'button', 'spacer1', 'spacer', 'Cut Levels', 'button'), ('Cut New:', 'label', 'Cut New', 'llabel'), ('Zoom New:', 'label', 'Zoom New', 'llabel'), ('Center New:', 'label', 'Center New', 'llabel'), ) w, b2 = Widgets.build_info(captions) b.update(b2) # TODO: need a more general solution to gtk labels resizing their # parent window #b.object.set_length(12) b.cut_levels.set_tooltip("Set cut levels manually") b.auto_levels.set_tooltip("Set cut levels by algorithm") b.cut_low.set_tooltip("Set low cut level (press Enter)") b.cut_low_value.set_text('') b.cut_high.set_tooltip("Set high cut level (press Enter)") b.cut_high_value.set_text('') b.cut_new.set_text('') b.zoom_new.set_text('') b.center_new.set_text('') row = Widgets.HBox() row.set_spacing(0) row.set_border_width(0) row.add_widget(w, stretch=0) ## row.add_widget(Widgets.Label(''), stretch=1) vbox.add_widget(row, stretch=0) return sw, b