def build_gui(self, container): sw = QtGui.QScrollArea() twidget = QtHelp.VBox() sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) twidget.setSizePolicy(sp) vbox1 = twidget.layout() vbox1.setContentsMargins(4, 4, 4, 4) vbox1.setSpacing(2) sw.setWidgetResizable(True) sw.setWidget(twidget) msgFont = QtGui.QFont("Sans", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("HDU") captions = [("Num HDUs", 'label'), ("Choose HDU", 'spinbutton')] w, b = QtHelp.build_info(captions) self.w.update(b) self.w.numhdu = b.num_hdus self.w.hdu = b.choose_hdu self.w.hdu.valueChanged.connect(self.set_hdu_cb) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("NAXIS") self.stack = QtHelp.StackedWidget() self.stack.addWidget(QtGui.QLabel('')) fr.layout().addWidget(self.stack, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) btns = QtHelp.HBox() layout = btns.layout() layout.setSpacing(3) #btns.set_child_size(15, -1) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) container.addWidget(sw, stretch=1)
def build_gui(self, container): sw = QtGui.QScrollArea() twidget = QtHelp.VBox() sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) twidget.setSizePolicy(sp) vbox1 = twidget.layout() vbox1.setContentsMargins(4, 4, 4, 4) vbox1.setSpacing(2) sw.setWidgetResizable(True) sw.setWidget(twidget) msgFont = QtGui.QFont("Sans", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("Ruler") captions = (('Units', 'combobox'), ) w, b = QtHelp.build_info(captions) self.w = b combobox = b.units for name in self.unittypes: combobox.addItem(name) index = self.unittypes.index(self.units) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_units) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) btns = QtHelp.HBox() layout = btns.layout() layout.setSpacing(3) #btns.set_child_size(15, -1) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) container.addWidget(sw, stretch=1)
def build_gui(self, container): canvas = CanvasTypes.DrawingCanvas() canvas.enable_draw(False) #canvas.set_callback('button-press', self.btndown) canvas.set_callback('motion', self.cursormotion) #canvas.set_callback('button-release', self.update) canvas.add_callback('key-press', self.window_key_press) canvas.add_callback('key-release', self.window_key_release) self.canvas = canvas vbox = QtHelp.VBox() sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) vbox.setSizePolicy(sp) fr = QtHelp.Frame("IRAF") captions = [ ("Control", 'hbox'), ("Channel", 'label'), ] w, b = QtHelp.build_info(captions) self.w = b self.w.mode_d = {} btn = QtGui.QRadioButton("Ginga") btn.toggled.connect(lambda w: self.switchMode('ginga')) self.w.mode_d['ginga'] = btn self.w.control.layout().addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QRadioButton("IRAF") btn.toggled.connect(lambda w: self.switchMode('iraf')) self.w.mode_d['iraf'] = btn self.w.control.layout().addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("Frame/Channel") lbl = QtGui.QLabel("") self.w.frch = lbl fr.layout().addWidget(lbl, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) container.addWidget(vbox, stretch=0, alignment=QtCore.Qt.AlignTop)
def build_gui(self, container, future=None): vbox1 = QtHelp.VBox() msgFont = self.fv.getFont("sansFont", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) nb = QtHelp.TabWidget() nb.setTabPosition(QtGui.QTabWidget.South) nb.setUsesScrollButtons(True) self.w.nb = nb #vbox1.addWidget(nb, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(nb, stretch=1) vbox0 = QtHelp.VBox() hbox = QtHelp.HBox() hbox.setSpacing(4) vbox0.addWidget(hbox, stretch=1, alignment=QtCore.Qt.AlignTop) vbox = QtHelp.VBox() fr = QtHelp.Frame(" Image Server ") fr.addWidget(vbox, stretch=1, alignment=QtCore.Qt.AlignTop) hbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignLeft) captions = (('Server', 'xlabel'), ('@Server', 'combobox'), ('Use DSS channel', 'checkbutton'), ('Get Image', 'button')) w, b = QtHelp.build_info(captions) self.w.update(b) self.w.get_image.clicked.connect(self.getimage_cb) self.w.use_dss_channel.setChecked(self.use_dss_channel) self.w.use_dss_channel.stateChanged.connect(self.use_dss_channel_cb) vbox.addWidget(w, stretch=0, alignment=QtCore.Qt.AlignTop) self.w.img_params = QtHelp.StackedWidget() vbox.addWidget(self.w.img_params, stretch=1, alignment=QtCore.Qt.AlignTop) combobox = self.w.server index = 0 self.image_server_options = self.fv.imgsrv.getServerNames(kind='image') for name in self.image_server_options: combobox.addItem(name) index += 1 index = 0 combobox.setCurrentIndex(index) combobox.activated.connect(self.setup_params_image) if len(self.image_server_options) > 0: self.setup_params_image(index, redo=False) vbox = QtHelp.VBox() fr = QtHelp.Frame(" Catalog Server ") fr.addWidget(vbox, stretch=1, alignment=QtCore.Qt.AlignTop) hbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignLeft) captions = (('Server', 'xlabel'), ('@Server', 'combobox'), ('Limit stars to area', 'checkbutton'), ('Search', 'button')) w, self.w2 = QtHelp.build_info(captions) self.w2.search.clicked.connect(self.getcatalog_cb) self.w2.limit_stars_to_area.setChecked(self.limit_stars_to_area) self.w2.limit_stars_to_area.stateChanged.connect(self.limit_area_cb) vbox.addWidget(w, stretch=0, alignment=QtCore.Qt.AlignTop) self.w2.cat_params = QtHelp.StackedWidget() vbox.addWidget(self.w2.cat_params, stretch=1, alignment=QtCore.Qt.AlignTop) combobox = self.w2.server index = 0 self.catalog_server_options = self.fv.imgsrv.getServerNames(kind='catalog') for name in self.catalog_server_options: combobox.addItem(name) index += 1 index = 0 combobox.setCurrentIndex(index) combobox.activated.connect(self.setup_params_catalog) if len(self.catalog_server_options) > 0: self.setup_params_catalog(index, redo=False) btns = QtHelp.HBox() btns.setSpacing(5) btn = QtGui.QRadioButton("Rectangle") if self.drawtype == 'rectangle': btn.setChecked(True) btn.toggled.connect(lambda tf: self.set_drawtype_cb(tf, 'rectangle')) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QRadioButton("Circle") if self.drawtype == 'circle': btn.setChecked(True) btn.toggled.connect(lambda tf: self.set_drawtype_cb(tf, 'circle')) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QPushButton("Entire image") btn.clicked.connect(self.setfromimage) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox0.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignTop) self.w.params = vbox0 sw = QtGui.QScrollArea() sw.setWidgetResizable(True) sw.setWidget(vbox0) nb.addTab(sw, "Params") vbox = QtHelp.VBox() self.table = CatalogListing(self.logger, vbox) hbox = QtHelp.HBox() adj = QtGui.QScrollBar(QtCore.Qt.Horizontal) adj.setRange(0, 1000) adj.setSingleStep(1) adj.setPageStep(10) #adj.setMaximum(1000) adj.setValue(0) #adj.resize(200, -1) adj.setTracking(True) adj.setToolTip("Choose subset of stars plotted") self.w.plotgrp = adj adj.valueChanged.connect(self.plot_pct_cb) hbox.addWidget(adj, stretch=1) sb = QtGui.QSpinBox() sb.setRange(10, self.plot_max) sb.setValue(self.plot_limit) sb.setSingleStep(10) adj.setPageStep(100) sb.setWrapping(False) self.w.plotnum = sb sb.setToolTip("Adjust size of subset of stars plotted") sb.valueChanged.connect(self.plot_limit_cb) hbox.addWidget(sb, stretch=0) vbox.addWidget(hbox, stretch=0) self.w.listing = vbox nb.addTab(vbox, "Listing") btns = QtHelp.HBox() btns.setSpacing(3) #btns.set_child_size(15, -1) self.w.buttons = btns btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) if future: btn = QtGui.QPushButton('Ok') btn.clicked.connect(lambda w: self.ok()) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QPushButton('Cancel') btn.clicked.connect(lambda w: self.cancel()) btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0) cw = container.get_widget() cw.addWidget(vbox1, stretch=1)
def build_gui(self, container): # Splitter is just to provide a way to size the graph # to a reasonable size vpaned = QtGui.QSplitter() vpaned.setOrientation(QtCore.Qt.Vertical) # Make the cuts plot twidget = QtHelp.VBox() vbox1 = twidget.layout() vbox1.setContentsMargins(4, 4, 4, 4) vbox1.setSpacing(2) msgFont = QtGui.QFont("Sans", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) self.plot = Plot.Cuts(self.logger) w = self.plot.get_widget() vbox1.addWidget(w, stretch=1, alignment=QtCore.Qt.AlignTop) hbox = QtHelp.HBox() hbox.setSpacing(4) # control for selecting a cut combobox = QtHelp.ComboBox() for tag in self.tags: combobox.append_text(tag) if self.cutstag == None: combobox.setCurrentIndex(0) else: combobox.show_text(self.cutstag) combobox.activated.connect(self.cut_select_cb) self.w.cuts = combobox combobox.setToolTip("Select a cut") hbox.addWidget(combobox) btn = QtGui.QPushButton("Delete") btn.clicked.connect(self.delete_cut_cb) btn.setToolTip("Delete selected cut") hbox.addWidget(btn) btn = QtGui.QPushButton("Delete All") btn.clicked.connect(self.delete_all) btn.setToolTip("Clear all cuts") hbox.addWidget(btn) ## btn = QtGui.CheckBox("Move together") ## #btn.stateChanged.connect(self.movetogether_cb) ## btn.setChecked(self.move_together) ## btn.setToolTip("Move cuts as a group") ## hbox.addWidget(btn) vbox1.addWidget(hbox, stretch=0, alignment=QtCore.Qt.AlignLeft) btns = QtHelp.HBox() layout = btns.layout() layout.setSpacing(3) #btns.set_child_size(15, -1) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) vpaned.addWidget(twidget) vpaned.addWidget(QtGui.QLabel('')) container.addWidget(vpaned, stretch=1)
def build_gui(self, container): sw = QtGui.QScrollArea() twidget = QtHelp.VBox() sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) twidget.setSizePolicy(sp) vbox1 = twidget.layout() vbox1.setContentsMargins(4, 4, 4, 4) vbox1.setSpacing(2) sw.setWidgetResizable(True) sw.setWidget(twidget) msgFont = QtGui.QFont("Sans", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("Drawing") captions = (('Draw type', 'combobox'), ('Draw color', 'combobox'), ('Clear canvas', 'button')) w, b = QtHelp.build_info(captions) self.w = b combobox = b.draw_type options = [] index = 0 for name in self.drawtypes: options.append(name) combobox.addItem(name) index += 1 index = self.drawtypes.index(default_drawtype) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_drawparams) self.w.draw_color = b.draw_color combobox = b.draw_color options = [] index = 0 self.drawcolors = draw_colors for name in self.drawcolors: options.append(name) combobox.addItem(name) index += 1 index = self.drawcolors.index(default_drawcolor) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_drawparams) b.clear_canvas.clicked.connect(self.clear_canvas) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) btns = QtHelp.HBox() layout = btns.layout() layout.setSpacing(3) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) container.addWidget(sw, stretch=1)
def build_gui(self, container): # Splitter is just to provide a way to size the graph # to a reasonable size vpaned = QtGui.QSplitter() vpaned.setOrientation(QtCore.Qt.Vertical) # Make the cuts plot twidget = QtHelp.VBox() vbox1 = twidget.layout() vbox1.setContentsMargins(4, 4, 4, 4) vbox1.setSpacing(2) msgFont = QtGui.QFont("Sans", 14) tw = QtGui.QLabel() tw.setFont(msgFont) tw.setWordWrap(True) self.tw = tw fr = QtHelp.Frame("Instructions") fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop) vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) self.plot = Plot.Plot(self.logger) w = self.plot.get_widget() vbox1.addWidget(w, stretch=1, alignment=QtCore.Qt.AlignTop) captions = (('Cut Low', 'xlabel', '@Cut Low', 'entry'), ('Cut High', 'xlabel', '@Cut High', 'entry', 'Cut Levels', 'button'), ('Auto Levels', 'button'), ) w, b = QtHelp.build_info(captions) self.w.update(b) b.cut_levels.setToolTip("Set cut levels manually") b.auto_levels.setToolTip("Set cut levels by algorithm") b.cut_low.setToolTip("Set low cut level (press Enter)") b.cut_high.setToolTip("Set high cut level (press Enter)") b.cut_low.returnPressed.connect(self.cut_levels) b.cut_high.returnPressed.connect(self.cut_levels) b.cut_levels.clicked.connect(self.cut_levels) b.auto_levels.clicked.connect(self.auto_levels) vbox1.addWidget(w, stretch=0, alignment=QtCore.Qt.AlignLeft) btns = QtHelp.HBox() layout= btns.layout() layout.setSpacing(3) #btns.set_child_size(15, -1) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QPushButton("Full Image") btn.clicked.connect(self.full_image) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) vpaned.addWidget(twidget) vpaned.addWidget(QtGui.QLabel('')) container.addWidget(vpaned, stretch=1) self.gui_up = True
def build_gui(self, container): sw = QtGui.QScrollArea() twidget = QtHelp.VBox() sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) twidget.setSizePolicy(sp) vbox = twidget.layout() vbox.setContentsMargins(4, 4, 4, 4) vbox.setSpacing(2) sw.setWidgetResizable(True) sw.setWidget(twidget) # COLOR MAPPING OPTIONS fr = QtHelp.Frame("Colors") captions = (('Colormap', 'combobox', 'Intensity', 'combobox'), ('Algorithm', 'combobox', 'Table Size', 'entry'), ('Color Defaults', 'button')) w, b = QtHelp.build_info(captions) self.w.cmap_choice = b.colormap self.w.imap_choice = b.intensity self.w.calg_choice = b.algorithm self.w.table_size = b.table_size b.color_defaults.clicked.connect(self.set_default_maps) b.colormap.setToolTip("Choose a color map for this image") b.intensity.setToolTip("Choose an intensity map for this image") b.algorithm.setToolTip("Choose a color mapping algorithm") b.table_size.setToolTip("Set size of the color mapping table") b.color_defaults.setToolTip("Restore default color and intensity maps") fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) combobox = b.colormap options = [] index = 0 for name in self.cmap_names: options.append(name) combobox.addItem(name) index += 1 cmap_name = self.t_.get('color_map', "ramp") try: index = self.cmap_names.index(cmap_name) except Exception: index = self.cmap_names.index('ramp') combobox.setCurrentIndex(index) combobox.activated.connect(self.set_cmap_cb) combobox = b.intensity options = [] index = 0 for name in self.imap_names: options.append(name) combobox.addItem(name) index += 1 imap_name = self.t_.get('intensity_map', "ramp") try: index = self.imap_names.index(imap_name) except Exception: index = self.imap_names.index('ramp') combobox.setCurrentIndex(index) combobox.activated.connect(self.set_imap_cb) combobox = b.algorithm options = [] index = 0 for name in self.calg_names: options.append(name) combobox.addItem(name) index += 1 index = self.calg_names.index(self.t_.get('color_algorithm', "linear")) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_calg_cb) entry = b.table_size entry.setText(str(self.t_.get('color_hashsize', 65535))) entry.returnPressed.connect(lambda: self.set_tablesize_cb(entry)) # ZOOM OPTIONS fr = QtHelp.Frame("Zoom") captions = (('Zoom Alg', 'combobox', 'Zoom Rate', 'spinfloat'), ('Stretch XY', 'combobox', 'Stretch Factor', 'spinfloat'), ('Scale X', 'entry', 'Scale Y', 'entry'), ('Scale Min', 'spinfloat', 'Scale Max', 'spinfloat'), ('Zoom Defaults', 'button')) w, b = QtHelp.build_info(captions) self.w.update(b) index = 0 for name in self.zoomalg_names: b.zoom_alg.addItem(name.capitalize()) index += 1 zoomalg = self.t_.get('zoom_algorithm', "step") index = self.zoomalg_names.index(zoomalg) b.zoom_alg.setCurrentIndex(index) b.zoom_alg.setToolTip("Choose Zoom algorithm") b.zoom_alg.activated.connect(self.set_zoomalg_cb) index = 0 for name in ('X', 'Y'): b.stretch_xy.addItem(name) index += 1 b.stretch_xy.setCurrentIndex(0) b.stretch_xy.setToolTip("Stretch pixels in X or Y") b.stretch_xy.activated.connect(lambda v: self.set_stretch_cb()) b.stretch_factor.setRange(1.0, 10.0) b.stretch_factor.setValue(1.0) b.stretch_factor.setSingleStep(0.10) b.stretch_factor.setDecimals(8) b.stretch_factor.valueChanged.connect(lambda v: self.set_stretch_cb()) b.stretch_factor.setToolTip( "Length of pixel relative to 1 on other side") b.stretch_factor.setEnabled(zoomalg != 'step') zoomrate = self.t_.get('zoom_rate', math.sqrt(2.0)) b.zoom_rate.setRange(1.1, 3.0) b.zoom_rate.setValue(zoomrate) b.zoom_rate.setSingleStep(0.1) b.zoom_rate.setDecimals(8) b.zoom_rate.setEnabled(zoomalg != 'step') b.zoom_rate.setToolTip("Step rate of increase/decrease per zoom level") b.zoom_rate.valueChanged.connect(self.set_zoomrate_cb) b.zoom_defaults.clicked.connect(self.set_zoom_defaults_cb) scale_x, scale_y = self.fitsimage.get_scale_xy() b.scale_x.setToolTip("Set the scale in X axis") b.scale_x.setText(str(scale_x)) b.scale_x.returnPressed.connect(self.set_scale_cb) b.scale_y.setToolTip("Set the scale in Y axis") b.scale_y.setText(str(scale_y)) b.scale_y.returnPressed.connect(self.set_scale_cb) scale_min, scale_max = self.t_['scale_min'], self.t_['scale_max'] b.scale_min.setRange(0.00001, 1.0) b.scale_min.setValue(scale_min) b.scale_min.setDecimals(8) b.scale_min.setSingleStep(1.0) b.scale_min.valueChanged.connect(lambda w: self.set_scale_limit_cb()) b.scale_min.setToolTip("Set the minimum allowed scale in any axis") b.scale_max.setRange(1.0, 10000.0) b.scale_max.setValue(scale_max) b.scale_max.setSingleStep(1.0) b.scale_max.setDecimals(8) b.scale_max.valueChanged.connect(lambda w: self.set_scale_limit_cb()) b.scale_min.setToolTip("Set the maximum allowed scale in any axis") fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) # PAN OPTIONS fr = QtHelp.Frame("Panning") captions = (('Pan X', 'entry'), ('Pan Y', 'entry', 'Center Image', 'button'), ('Reverse Pan', 'checkbutton', 'Mark Center', 'checkbutton')) w, b = QtHelp.build_info(captions) self.w.update(b) pan_x, pan_y = self.fitsimage.get_pan() b.pan_x.setToolTip("Set the pan position in X axis") b.pan_x.setText(str(pan_x + 0.5)) b.pan_x.returnPressed.connect(self.set_pan_cb) b.pan_y.setToolTip("Set the pan position in Y axis") b.pan_y.setText(str(pan_y + 0.5)) b.pan_y.returnPressed.connect(self.set_pan_cb) b.center_image.setToolTip( "Set the pan position to center of the image") b.center_image.clicked.connect(self.center_image_cb) b.reverse_pan.setToolTip("Reverse the pan direction") b.reverse_pan.stateChanged.connect(self.set_misc_cb) b.mark_center.setToolTip("Mark the center (pan locator)") b.mark_center.stateChanged.connect(self.set_misc_cb) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) # TRANSFORM OPTIONS fr = QtHelp.Frame("Transform") captions = ( ('Flip X', 'checkbutton', 'Flip Y', 'checkbutton', 'Swap XY', 'checkbutton'), ('Rotate', 'spinfloat'), ('Restore', 'button'), ) w, b = QtHelp.build_info(captions) self.w.update(b) for name in ('flip_x', 'flip_y', 'swap_xy'): btn = b[name] btn.setChecked(self.t_.get(name, False)) btn.stateChanged.connect(lambda w: self.set_transforms_cb()) b.flip_x.setToolTip("Flip the image around the X axis") b.flip_y.setToolTip("Flip the image around the Y axis") b.swap_xy.setToolTip("Swap the X and Y axes in the image") b.rotate.setToolTip("Rotate the image around the pan position") b.restore.setToolTip("Clear any transforms and center image") b.restore.clicked.connect(self.restore_cb) b.rotate.setRange(0.00, 359.99999999) b.rotate.setValue(0.00) b.rotate.setSingleStep(10.0) b.rotate.setDecimals(8) b.rotate.valueChanged.connect(lambda w: self.rotate_cb()) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) # AUTOCUTS OPTIONS fr = QtHelp.Frame("Auto Cuts") captions = (('Auto Method', 'combobox'), ('Hist Pct', 'spinfloat')) w, b = QtHelp.build_info(captions) self.w.update(b) b.auto_method.setToolTip("Choose algorithm for auto levels") b.hist_pct.setToolTip( "Percentage of image to save for Histogram algorithm") # Setup auto cuts method choice combobox = b.auto_method index = 0 method = self.t_.get('autocut_method', "histogram") for name in self.autocut_methods: combobox.addItem(name) index += 1 index = self.autocut_methods.index(method) combobox.setCurrentIndex(index) combobox.activated.connect(lambda w: self.set_autocut_params()) b.hist_pct.setRange(0.90, 1.0) b.hist_pct.setValue(0.995) b.hist_pct.setSingleStep(0.001) b.hist_pct.setDecimals(5) b.hist_pct.valueChanged.connect(lambda w: self.set_autocut_params()) b.hist_pct.setEnabled(method == 'histogram') fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) fr = QtHelp.Frame("New Images") captions = ( ('Cut New', 'combobox', 'Zoom New', 'combobox'), ('Center New', 'checkbutton', 'Follow New', 'checkbutton'), ('Raise New', 'checkbutton', 'Create thumbnail', 'checkbutton'), ) w, b = QtHelp.build_info(captions) self.w.update(b) combobox = b.cut_new index = 0 for name in self.autocut_options: combobox.addItem(name) index += 1 option = self.t_.get('autocuts', "off") index = self.autocut_options.index(option) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_autocuts_cb) b.cut_new.setToolTip("Automatically set cut levels for new images") combobox = b.zoom_new index = 0 for name in self.autozoom_options: combobox.addItem(name) index += 1 option = self.t_.get('autozoom', "off") index = self.autozoom_options.index(option) combobox.setCurrentIndex(index) combobox.activated.connect(self.set_autozoom_cb) b.zoom_new.setToolTip("Automatically fit new images to window") b.center_new.setToolTip("Automatically center new images") b.follow_new.setToolTip("View new images as they arrive") b.raise_new.setToolTip("Raise and focus tab for new images") b.create_thumbnail.setToolTip("Create thumbnail for new images") self.w.center_new.setChecked(True) self.w.center_new.stateChanged.connect(lambda w: self.set_chprefs_cb()) self.w.follow_new.setChecked(True) self.w.follow_new.stateChanged.connect(lambda w: self.set_chprefs_cb()) self.w.raise_new.setChecked(True) self.w.raise_new.stateChanged.connect(lambda w: self.set_chprefs_cb()) self.w.create_thumbnail.setChecked(True) self.w.create_thumbnail.stateChanged.connect( lambda w: self.set_chprefs_cb()) fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop) btns = QtHelp.HBox() layout = btns.layout() layout.setSpacing(3) #layout.set_child_size(15, -1) btn = QtGui.QPushButton("Save Settings") btn.clicked.connect(self.save_preferences) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) btn = QtGui.QPushButton("Close") btn.clicked.connect(self.close) layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft) vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft) #container.addWidget(sw, stretch=1, alignment=QtCore.Qt.AlignTop) container.addWidget(sw, stretch=1) self.gui_up = True