コード例 #1
0
    def add_error(self, errmsg):
        vbox = QtHelp.VBox()
        tw = QtGui.QTextEdit()
        tw.setReadOnly(True)
        tw.setCurrentFont(self.msgFont)

        tw.setText(errmsg)
        vbox.addWidget(tw, stretch=1)

        hbox = QtHelp.HBox()
        btn = QtGui.QPushButton("Remove")
        btn.clicked.connect(lambda: self.remove_error(vbox))
        hbox.addWidget(btn, stretch=0)
        # Add the time the error occurred
        ts = time.strftime("%m/%d %H:%M:%S", time.localtime())
        lbl = QtGui.QLabel(ts)
        hbox.addWidget(lbl, stretch=0)
        vbox.addWidget(hbox, stretch=0)

        layout = self.msgList.layout()
        layout.addWidget(vbox,
                         layout.rowCount(),
                         0,
                         alignment=QtCore.Qt.AlignTop)
        self.widgetList.append(vbox)
コード例 #2
0
ファイル: GingaQt.py プロジェクト: aaronroodman/ginga
    def gui_add_channels(self):
        captions = (
            ('Prefix', 'entry'),
            ('Number', 'spinbutton'),
            ('Workspace', 'combobox'),
        )
        w, b = QtHelp.build_info(captions)
        b.prefix.setText("Image")
        b.number.setRange(1, 12)
        b.number.setSingleStep(1)
        b.number.setValue(1)

        cbox = b.workspace
        names = self.ds.get_wsnames()
        try:
            idx = names.index('channels')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        dialog = QtHelp.Dialog(
            "Add Channels", 0, [['Cancel', 0], ['Ok', 1]],
            lambda w, rsp: self.add_channels_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()
コード例 #3
0
ファイル: GingaQt.py プロジェクト: aaronroodman/ginga
    def gui_add_channel(self, chname=None):
        if not chname:
            self.chncnt += 1
            chname = "Image%d" % self.chncnt
        lbl = QtGui.QLabel('New channel name:')
        ent = QtGui.QLineEdit()
        ent.setText(chname)
        lbl2 = QtGui.QLabel('Workspace:')
        cbox = QtHelp.ComboBox()
        names = self.ds.get_wsnames()
        try:
            idx = names.index(self._lastwsname)
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)
        dialog = QtHelp.Dialog(
            "Add Channel", 0, [['Cancel', 0], ['Ok', 1]],
            lambda w, rsp: self.add_channel_cb(w, rsp, ent, cbox, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(lbl, stretch=0)
        layout.addWidget(ent, stretch=0)
        layout.addWidget(lbl2, stretch=0)
        layout.addWidget(cbox, stretch=0)
        dialog.show()
コード例 #4
0
ファイル: Widgets.py プロジェクト: stscieisenhamer/ginga
    def __init__(self, title=''):
        super(Expander, self).__init__()

        # Qt doesn't seem to like it (segfault) if we actually construct
        # these icons in the class variable declarations
        if Expander.r_arrow is None:
            Expander.r_arrow = QtHelp.get_icon(os.path.join(icondir,
                                                            'triangle-right-48.png'),
                                               size=(12, 12))
        if Expander.d_arrow is None:
            Expander.d_arrow = QtHelp.get_icon(os.path.join(icondir,
                                                            'triangle-down-48.png'),
                                               size=(12, 12))

        self.widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.layout = vbox

        self.toggle = QtGui.QPushButton(Expander.r_arrow, title)
        self.toggle.setStyleSheet(Expander.widget_style)
        #self.toggle.setCheckable(True)
        self.toggle.clicked.connect(self._toggle_widget)

        vbox.addWidget(self.toggle, stretch=0)
        self.widget.setLayout(vbox)
コード例 #5
0
    def build_gui(self, container):

        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        widget.setLayout(vbox)

        # create the table
        #table = QtGui.QTableWidget()
        #table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        #table.setDragEnabled(True)
        table = DragTable(plugin=self)
        table.setShowGrid(False)
        table.verticalHeader().hide()
        table.setColumnCount(len(self.columns))
        col = 0
        for hdr, kwd in self.columns:
            item = QtGui.QTableWidgetItem(hdr)
            table.setHorizontalHeaderItem(col, item)
            col += 1

        vbox.addWidget(table, stretch=1)
        table.itemDoubleClicked.connect(self.itemclicked_cb)
        self.treeview = table

        self.entry = QtGui.QLineEdit()
        vbox.addWidget(self.entry, stretch=0, alignment=QtCore.Qt.AlignTop)
        self.entry.returnPressed.connect(self.browse_cb)

        hbox = QtHelp.HBox()
        btn = QtGui.QPushButton("Load")
        btn.clicked.connect(lambda w: self.load_cb())
        hbox.addWidget(btn, stretch=0)
        btn = QtGui.QPushButton("Save Image As")
        hbox.addWidget(btn, stretch=0)
        self.entry2 = QtGui.QLineEdit()
        hbox.addWidget(self.entry2, stretch=1)
        vbox.addWidget(hbox, stretch=0, alignment=QtCore.Qt.AlignTop)
        self.entry2.returnPressed.connect(self.save_as_cb)
        btn.clicked.connect(lambda w: self.save_as_cb())

        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)
        btn = QtGui.QPushButton("Refresh")
        btn.clicked.connect(self.refresh)
        layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
        btn = QtGui.QPushButton("Make Thumbs")
        btn.clicked.connect(self.make_thumbs)
        layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)

        vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)

        cw = container.get_widget()
        cw.addWidget(widget, stretch=1)
コード例 #6
0
ファイル: Widgets.py プロジェクト: aaronroodman/ginga
    def __init__(self, orientation='horizontal'):
        super(Box, self).__init__()

        self.orientation = orientation
        if orientation == 'horizontal':
            self.widget = QtHelp.HBox()
        else:
            self.widget = QtHelp.VBox()
コード例 #7
0
ファイル: Ruler.py プロジェクト: astrofrog/ginga
    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)
コード例 #8
0
    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)
コード例 #9
0
ファイル: SunPy.py プロジェクト: rajul/ginga-sunpy
    def view_database(self, selected_entries=None):
        '''
    		Logic for creating and viewing of a tab with the database table
    	'''
        print "Viewing"

        table_headers = [
            'id', 'File', 'Observation Time Start', 'Observation Time End',
            'Instrument', 'Min Wavelength', 'Max Wavelength', 'Starred'
        ]
        self.table_headers = table_headers

        vbox = QtHelp.VBox()

        filter_label = QtGui.QLabel("Filter")
        self.filter_label = filter_label
        filter_select = QtGui.QComboBox()

        search_box = QtGui.QLineEdit()
        search_box.textChanged.connect(self.query)
        self.search_box = search_box

        if selected_entries == None:
            selected_entries = database

        queries = self.get_data_from_selected_entries(selected_entries)

        wtable = QtGui.QTableWidget(len(queries), len(table_headers))

        for i, row in enumerate(queries):
            for j, col in enumerate(row):
                item = QtGui.QTableWidgetItem(str(col))
                wtable.setItem(i, j, item)

        wtable.itemClicked.connect(self.on_table_row_click)
        wtable.setHorizontalHeaderLabels(table_headers)
        wtable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)

        self.wtable = wtable

        if 'sunpydb' in self.fv.ds.get_tabnames():
            self.fv.ds.remove_tab("sunpydb")

        filter_select.addItems(self.table_headers[:-1])
        self.filter_select = filter_select

        vbox.addWidget(filter_label, stretch=0)
        vbox.addWidget(filter_select, stretch=0)
        vbox.addWidget(search_box)
        vbox.addWidget(wtable, stretch=0)

        starred_entries_box = QtGui.QCheckBox("Show starred entries only")
        self.starred_entries_box = starred_entries_box
        starred_entries_box.stateChanged.connect(self.starred_entries_only)

        vbox.addWidget(starred_entries_box)

        self.fv.ds.add_tab("right", vbox, 1, "SunPyDB", tabname="sunpydb")
        self.fv.ds.raise_tab("sunpydb")
コード例 #10
0
ファイル: GingaQt.py プロジェクト: fred3m/ginga
    def gui_add_channels(self):
        captions = (('Prefix', 'entry'),
                    ('Number', 'spinbutton'),
                    ('Workspace', 'combobox'),
                    )
        w, b = QtHelp.build_info(captions)
        b.prefix.setText("Image")
        b.number.setRange(1, 12)
        b.number.setSingleStep(1)
        b.number.setValue(1)

        cbox = b.workspace
        names = self.ds.get_wsnames()
        try:
            idx = names.index('channels')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        dialog = QtHelp.Dialog("Add Channels",
                               0,
                               [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.add_channels_cb(w, rsp,
                                                                   b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()
コード例 #11
0
ファイル: Header.py プロジェクト: godber/ginga
    def _create_header_window(self, info):
        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        widget.setLayout(vbox)

        table = QtGui.QTableView()
        self.table = table
        table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        table.setShowGrid(False)
        vh = table.verticalHeader()
        # Hack to make the rows in a TableView all have a
        # reasonable height for the data
        if QtHelp.have_pyqt5:
            vh.setSectionResizeMode(QtGui.QHeaderView.ResizeToContents)
        else:
            vh.setResizeMode(QtGui.QHeaderView.ResizeToContents)
        # Hide vertical header
        vh.setVisible(False)

        vbox.addWidget(table, stretch=1)

        # create sort toggle
        cb = QtGui.QCheckBox("Sortable")
        cb.stateChanged.connect(lambda tf: self.set_sortable_cb(info))
        hbox = QtHelp.HBox()
        hbox.addWidget(cb, stretch=0)
        vbox.addWidget(hbox, stretch=0)

        info.setvals(widget=widget, table=table, sortw=cb)
        return widget
コード例 #12
0
ファイル: Spherical.py プロジェクト: Rbeaty88/ginga
    def create_info_window(self):
        sw = QtGui.QScrollArea()

        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        widget.setLayout(vbox)
        
        captions = (
                    ('X', 'xlabel', '@X', 'entry'),
                    ('Y', 'xlabel', '@Y', 'entry'),
                    ('Z', 'xlabel', '@Z', 'entry'),
                    ('Radius','label'),('Theta','label'),('Phi','label'),
                    ('RA', 'label'), ('DEC', 'label'),
                    ('Radius2','label'),('Theta2','label'),('Phi2','label'),
                    )

        w, b = QtHelp.build_info(captions)

        
        b.x.setToolTip("Set X value (press Enter)")
        b.y.setToolTip("Set Y value (press Enter)")
        b.z.setToolTip('Set Z value (press Enter)')


        vbox.addWidget(w, stretch=0)

        #widget.show()
        sw.setWidget(widget)
        return sw, b
コード例 #13
0
ファイル: WBrowser.py プロジェクト: teuben/ginga
    def build_gui(self, container):
        if not has_webkit:
            self.browser = QtGui.QLabel("Please install the python-webkit package to enable this plugin")
        else:
            self.browser = QWebView()

        sw = QtGui.QScrollArea()
        sw.setWidgetResizable(True)
        #sw.set_border_width(2)
        sw.setWidget(self.browser)

        cw = container.get_widget()
        cw.layout().addWidget(sw, stretch=1)
        sw.show()

        self.entry = QtGui.QLineEdit()
        cw.layout().addWidget(self.entry, stretch=0)
        self.entry.returnPressed.connect(self.browse_cb)

        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)
        cw.layout().addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)

        if has_webkit:
            helpfile = os.path.abspath(os.path.join(packageHome,
                                                    "doc", "help.html"))
            helpurl = "file://%s" % (helpfile)
            self.browse(helpurl)
コード例 #14
0
ファイル: Widgets.py プロジェクト: aaronroodman/ginga
    def __init__(self):
        super(ComboBox, self).__init__()

        self.widget = QtHelp.ComboBox()
        self.widget.activated.connect(self._cb_redirect)

        self.enable_callback('activated')
コード例 #15
0
    def build_toplevel(self, layout):
        # Create root window and add delete/destroy callbacks
        root = QtGui.QWidget()
        root.connect(root, QtCore.SIGNAL('closed()'), 
                     self.quit)
        root.resize(self.default_width, self.default_height)
        
        self.w.root = root

        # access main frame
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        vbox.setSpacing(2)
        root.setLayout(vbox)
        self.w.mframe = vbox

        # Add menubar and menus, if desired
        self.add_menus()

        # Dynamically create the desktop layout
        self.ds = QtHelp.Desktop()
        self.w.mvbox = self.ds.make_desktop(layout, widgetDict=self.w)
        self.w.mframe.addWidget(self.w.mvbox, stretch=1)

        # Add popup dialogs
        self.add_dialogs()

        # Add status bar, if desired
        self.add_statusbar()

        return root
コード例 #16
0
ファイル: GingaQt.py プロジェクト: godber/ginga
    def gui_add_ws(self):
        captions = (('Workspace name', 'entry'), ('Workspace type',
                                                  'combobox'),
                    ('In workspace', 'combobox'), ('Channel prefix', 'entry'),
                    ('Number of channels', 'spinbutton'))
        w, b = QtHelp.build_info(captions)

        self.wscount += 1
        wsname = "ws%d" % (self.wscount)
        b.workspace_name.setText(wsname)

        cbox = b.workspace_type
        cbox.append_text("Tabs")
        cbox.append_text("Grid")
        cbox.append_text("MDI")
        cbox.setCurrentIndex(0)

        cbox = b.in_workspace
        names = self.ds.get_wsnames()
        names.insert(0, 'top level')
        try:
            idx = names.index('top level')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        b.channel_prefix.setText("Image")
        spnbtn = b.number_of_channels
        spnbtn.setRange(0, 12)
        spnbtn.setSingleStep(1)
        spnbtn.setValue(1)

        dialog = QtHelp.Dialog("Add Workspace", 0, [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()
コード例 #17
0
ファイル: MultiDim.py プロジェクト: albertoconti/ginga
    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)
コード例 #18
0
 def gui_delete_channel(self):
     chinfo = self.get_channelInfo()
     chname = chinfo.name
     lbl = QtGui.QLabel("Really delete channel '%s' ?" % (chname))
     dialog = QtHelp.Dialog(
         "Delete Channel", 0, [['Cancel', 0], ['Ok', 1]],
         lambda w, rsp: self.delete_channel_cb(w, rsp, chname))
     box = dialog.get_content_area()
     layout = QtGui.QVBoxLayout()
     box.setLayout(layout)
     layout.addWidget(lbl, stretch=0)
     dialog.show()
コード例 #19
0
ファイル: MultiDim.py プロジェクト: astrofrog/ginga
    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)
コード例 #20
0
class Brightness(PlBase.Plugin):
    def build_gui(self, container):
        self.root = container
        #self.root.setStyleSheet("QWidget { background: lightblue }")

        self.statusDict = {}

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(4, 4, 4, 4)
        layout.setSpacing(4)
        container.setLayout(layout)

        split = QtGui.QSplitter()
        split.setOrientation(QtCore.Qt.Vertical)
        ## split.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored,
        ##                                       QtGui.QSizePolicy.Ignored))

        #self.w = Bunch.Bunch()

        envi_file = os.path.join(os.environ['GEN2COMMON'], 'db', 'test.shelve')
        key = 'brightness'

        try:
            load_data(envi_file, key, 3600, self.logger)
        except Exception, e:
            self.logger.error("Error loading persistent data: %s" % (str(e)))

        self.sc = timeValueGraph.TVCoordinator(self.statusDict, 10, envi_file,
                                               key, self.logger)
        coordinator = self.sc

        vbox = QtHelp.VBox()

        # Brightness
        b = StatusGraph.StatusGraph(title="Brightness",
                                    key="brightness",
                                    size=(350, 150),
                                    statusKeys=(al_ag_bright, al_sv_bright),
                                    statusFormats=("AG: %0.0f", "SV: %0.0f"),
                                    alarmValues=(0, 999999),
                                    warningValues=(0, 0),
                                    displayTime=True,
                                    backgroundColor=QtGui.QColor(
                                        245, 255, 252),
                                    logger=self.logger)

        coordinator.addGraph(b)
        vbox.addWidget(b, stretch=1)
        split.addWidget(vbox)

        #layout.addWidget(split, stretch=1, alignment=QtCore.Qt.AlignTop)
        layout.addWidget(split, stretch=1)
コード例 #21
0
    def build_gui(self, container):
        #self.msgFont = QtGui.QFont("Fixed", 10)
        tw = QtGui.QPlainTextEdit()
        tw.setReadOnly(True)
        #tw.setCurrentFont(self.msgFont)
        tw.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap)
        tw.setMaximumBlockCount(self.histlimit)
        self.tw = tw

        sw = QtGui.QScrollArea()
        sw.setWidgetResizable(True)
        sw.setWidget(self.tw)

        container.addWidget(sw, stretch=1)
        sw.show()

        hbox = QtHelp.HBox()

        lbl = QtGui.QLabel('Level:')
        hbox.addWidget(lbl, stretch=0)
        combobox = QtHelp.ComboBox()
        for (name, level) in self.levels:
            combobox.addItem(name)
        combobox.setCurrentIndex(1)
        combobox.activated.connect(self.set_loglevel_cb)
        hbox.addWidget(combobox, stretch=0)

        lbl = QtGui.QLabel('History:')
        hbox.addWidget(lbl, stretch=0)
        spinbox = QtGui.QSpinBox()
        spinbox.setRange(100, self.histmax)
        spinbox.setSingleStep(10)
        spinbox.valueChanged.connect(self.set_history_cb)
        hbox.addWidget(spinbox, stretch=0)

        btn = QtGui.QPushButton("Clear")
        btn.clicked.connect(self.clear)
        hbox.addWidget(btn, stretch=0)
        container.addWidget(hbox, stretch=0)
コード例 #22
0
ファイル: PluginManagerQt.py プロジェクト: PaulPrice/ginga
 def deactivate(self, name):
     self.logger.debug("deactivating %s" % (name))
     lname = name.lower()
     if lname in self.focus:
         self.clear_focus(lname)
         
     if self.active.has_key(lname):
         bnch = self.active[lname]
         self.logger.debug("stopping plugin")
         self.stop_plugin(bnch.pInfo)
         self.logger.debug("removing from tray")
         QtHelp.removeWidget(self.hbox, bnch.widget)
         bnch.widget = None
         bnch.label = None
         self.logger.debug("removing from dict")
         del self.active[lname]
         
     # Set focus to another plugin if one is running
     active = self.active.keys()
     if len(active) > 0:
         name = active[0]
         self.set_focus(name)
コード例 #23
0
ファイル: Ruler.py プロジェクト: adrn/ginga
    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)
コード例 #24
0
    def _build_cluster(self):
        vbox = QtHelp.VBox()
        layout = vbox.layout()
        lt = QtGui.QLabel()
        lt.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
        layout.addWidget(lt, stretch=0, alignment=QtCore.Qt.AlignTop)
        lm = QtGui.QLabel()
        lm.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
        layout.addWidget(lm, stretch=0, alignment=QtCore.Qt.AlignTop)
        lb = QtGui.QLabel()
        lb.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
        layout.addWidget(lb, stretch=0, alignment=QtCore.Qt.AlignTop)

        return Bunch.Bunch(box=vbox, lt=lt, lm=lm, lb=lb)
コード例 #25
0
ファイル: Preferences.py プロジェクト: PaulPrice/ginga
    def config_autocut_params(self, method):
        index = self.autocut_methods.index(method)
        self.w.auto_method.setCurrentIndex(index)
        
        # remove old params
        layout = self.w.acvbox.layout()
        for child in QtHelp.children(layout):
            QtHelp.removeWidget(layout, child)

        # Create new autocuts object of the right kind
        ac = AutoCuts.get_autocuts(method)(self.logger)

        # Build up a set of control widgets for the autocuts
        # algorithm tweakable parameters
        paramlst = ac.get_params_metadata()

        params = self.autocuts_cache.setdefault(method, {})
        self.ac_params = QtHelp.ParamSet(self.logger, params)

        w = self.ac_params.build_params(paramlst)
        self.ac_params.add_callback('changed', self.autocut_params_changed_cb)

        self.w.acvbox.layout().addWidget(w, stretch=1)
コード例 #26
0
ファイル: GingaQt.py プロジェクト: jochym/ginga
    def gui_add_ws(self):
        captions = (('Workspace name', 'entry'),
                    ('Workspace type', 'combobox'),
                    ('In workspace', 'combobox'),
                    ('Channel prefix', 'entry'),
                    ('Number of channels', 'spinbutton'),
                    ('Share settings', 'entry'),
                    )
        w, b = QtHelp.build_info(captions)

        wsname = "ws%d" % (self.wscount)
        self.wscount += 1
        b.workspace_name.setText(wsname)
        b.share_settings.setMaxLength(60)

        cbox = b.workspace_type
        cbox.append_text("Tabs")
        cbox.append_text("Grid")
        cbox.append_text("MDI")
        cbox.setCurrentIndex(1)

        cbox = b.in_workspace
        names = self.ds.get_wsnames()
        names.insert(0, 'top level')
        try:
            idx = names.index('channels')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        b.channel_prefix.setText("Image")
        spnbtn = b.number_of_channels
        spnbtn.setRange(0, 12)
        spnbtn.setSingleStep(1)
        spnbtn.setValue(4)

        dialog = QtHelp.Dialog("Add Workspace",
                               0,
                               [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()
        self._cur_dialogs.append(dialog)
コード例 #27
0
ファイル: Header.py プロジェクト: godber/ginga
    def set_header(self, info, image):
        header = image.get_header()
        table = info.table

        model = HeaderTableModel(self.columns, header)
        table.setModel(model)
        selectionModel = QtHelp.QItemSelectionModel(model, table)
        table.setSelectionModel(selectionModel)

        # set column width to fit contents
        table.resizeColumnsToContents()
        table.resizeRowsToContents()

        sorted = info.sortw.isChecked()
        table.setSortingEnabled(sorted)
コード例 #28
0
ファイル: Thumbs.py プロジェクト: rcooke-ast/ginga
    def build_gui(self, container):
        width, height = 300, 300
        cm, im = self.fv.cm, self.fv.im

        tg = ImageViewCanvasQt.ImageViewCanvas(logger=self.logger)
        tg.configure_window(200, 200)
        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 = MyScrollArea()
        sw.setWidgetResizable(True)
        #sw.setEnabled(True)
        sw.thumbs_cb = self.thumbpane_resized_cb

        # Create thumbnails pane
        widget = QtGui.QWidget()
        vbox = QtGui.QGridLayout()
        vbox.setContentsMargins(4, 4, 4, 4)
        vbox.setSpacing(14)
        widget.setLayout(vbox)
        self.w.thumbs = vbox
        self.w.thumbs_w = widget
        #widget.show()
        sw.setWidget(widget)
        self.w.thumbs_scroll = sw
        #self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)

        # TODO: should this even have it's own scrolled window?
        cw = container.get_widget()
        cw.addWidget(sw, stretch=1)
        sw.show()

        captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'),)
        w, b = QtHelp.build_info(captions)
        self.w.update(b)

        b.auto_scroll.setToolTip("Scroll the thumbs window when new images arrive")
        b.clear.setToolTip("Remove all current thumbnails")
        b.clear.clicked.connect(self.clear)
        auto_scroll = self.settings.get('auto_scroll', True)
        b.auto_scroll.setChecked(auto_scroll)
        cw.addWidget(w, stretch=0)
        self.gui_up = True
コード例 #29
0
ファイル: Thumbs.py プロジェクト: aaronroodman/ginga
    def build_gui(self, container):
        width, height = 300, 300
        cm, im = self.fv.cm, self.fv.im

        tg = ImageViewQt.ImageViewQt(logger=self.logger)
        tg.configure(200, 200)
        tg.enable_autozoom('on')
        tg.set_autocut_params('zscale')
        tg.enable_autocuts('on')
        tg.enable_auto_orient(True)
        tg.set_makebg(False)
        tg.enable_overlays(False)
        self.thumb_generator = tg

        sw = MyScrollArea()
        sw.setWidgetResizable(True)
        #sw.setEnabled(True)
        sw.thumbs_cb = self.thumbpane_resized_cb

        # Create thumbnails pane
        widget = QtGui.QWidget()
        vbox = QtGui.QGridLayout()
        vbox.setContentsMargins(4, 4, 4, 4)
        vbox.setSpacing(14)
        widget.setLayout(vbox)
        self.w.thumbs = vbox
        self.w.thumbs_w = widget
        #widget.show()
        sw.setWidget(widget)
        self.w.thumbs_scroll = sw
        #self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)

        # TODO: should this even have it's own scrolled window?
        cw = container.get_widget()
        cw.addWidget(sw, stretch=1)
        sw.show()

        captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'), )
        w, b = QtHelp.build_info(captions)
        self.w.update(b)

        b.auto_scroll.setToolTip(
            "Scroll the thumbs window when new images arrive")
        b.clear.setToolTip("Remove all current thumbnails")
        b.clear.clicked.connect(self.clear)
        autoScroll = self.settings.get('autoScroll', True)
        b.auto_scroll.setChecked(autoScroll)
        cw.addWidget(w, stretch=0)
コード例 #30
0
ファイル: IRAF.py プロジェクト: adrn/ginga
    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)
コード例 #31
0
    def gui_add_channel(self, chname=None):
        if not chname:
            self.chncnt += 1
            chname = "Image%d" % self.chncnt
        lbl = QtGui.QLabel('New channel name:')

        ent = QtGui.QLineEdit()
        ent.setText(chname)
        #ent.set_activates_default(True)
        dialog = QtHelp.Dialog("New Channel", 0, [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.new_channel_cb(w, rsp, ent))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(lbl, stretch=0)
        layout.addWidget(ent, stretch=0)
        dialog.show()
コード例 #32
0
ファイル: Thumbs.py プロジェクト: RayPlante/ginga
    def build_gui(self, container):
        rvbox = container

        width, height = 300, 300
        cm, im = self.fv.cm, self.fv.im

        tg = FitsImageQt.FitsImageQt(logger=self.logger)
        tg.configure(200, 200)
        tg.enable_autozoom('on')
        tg.enable_autocuts('on')
        tg.enable_auto_orient(True)
        tg.set_makebg(False)
        self.thumb_generator = tg

        sw = MyScrollArea()
        sw.setWidgetResizable(True)
        #sw.setEnabled(True)
        sw.thumbs_cb = self.thumbpane_resized_cb

        # Create thumbnails pane
        widget = QtGui.QWidget()
        vbox = QtGui.QGridLayout()
        vbox.setContentsMargins(4, 4, 4, 4)
        vbox.setSpacing(14)
        widget.setLayout(vbox)
        self.w.thumbs = vbox
        self.w.thumbs_w = widget
        #widget.show()
        sw.setWidget(widget)
        self.w.thumbs_scroll = sw
        #self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)

        # TODO: should this even have it's own scrolled window?
        rvbox.addWidget(sw, stretch=1)
        sw.show()

        captions = (('Auto scroll', 'checkbutton'),)
        w, b = QtHelp.build_info(captions)
        self.w.update(b)

        b.auto_scroll.setToolTip("Scroll the thumbs window when new images arrive")
        autoScroll = self.settings.get('autoScroll', True)
        b.auto_scroll.setChecked(autoScroll)
        rvbox.addWidget(w, stretch=0)
コード例 #33
0
ファイル: MultiDim.py プロジェクト: astrofrog/ginga
    def build_naxis(self, dims):
        # build a vbox of NAXIS controls
        captions = [("NAXIS1", 'label'), ("NAXIS2", 'label')]

        self.naxispath = []
        for n in xrange(2, len(dims)):
            self.naxispath.append(0)
            key = 'naxis%d' % (n + 1)
            title = key.upper()
            maxn = int(dims[n])
            self.logger.debug("NAXIS%d=%d" % (n + 1, maxn))
            if maxn <= 1:
                captions.append((title, 'label'))
            else:
                captions.append(
                    (title, 'label', "Choose %s" % (title), 'spinbutton'))

        w, b = QtHelp.build_info(captions)
        for n in xrange(0, len(dims)):
            key = 'naxis%d' % (n + 1)
            lbl = b[key]
            maxn = int(dims[n])
            lbl.setText("%d" % maxn)
            slkey = 'choose_' + key
            if b.has_key(slkey):
                slider = b[slkey]
                lower = 1
                upper = maxn
                slider.setRange(lower, upper)
                slider.setSingleStep(1)
                slider.setWrapping(True)

                def make_cbfn(n):
                    return lambda idx: self.set_naxis_cb(idx - 1, n)

                slider.valueChanged.connect(make_cbfn(n))

        # Add naxis controls to gui
        try:
            oldw = self.stack.currentWidget()
            self.stack.removeWidget(oldw)
        except:
            pass
        self.stack.addWidget(w)
コード例 #34
0
    def build_gui(self, container):

        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        widget.setLayout(vbox)

        # create the table
        table = QtGui.QTableWidget()
        table.setShowGrid(False)
        table.verticalHeader().hide()
        table.setColumnCount(len(self.columns))
        col = 0
        for hdr, kwd in self.columns:
            item = QtGui.QTableWidgetItem(hdr)
            table.setHorizontalHeaderItem(col, item)
            col += 1

        vbox.addWidget(table, stretch=1)
        table.itemDoubleClicked.connect(self.itemclicked_cb)
        self.treeview = table

        self.entry = QtGui.QLineEdit()
        vbox.addWidget(self.entry, stretch=0, alignment=QtCore.Qt.AlignTop)
        self.entry.returnPressed.connect(self.browse_cb)

        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)
        btn = QtGui.QPushButton("Refresh")
        btn.clicked.connect(self.refresh)
        layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
        btn = QtGui.QPushButton("Make Thumbs")
        btn.clicked.connect(self.make_thumbs)
        layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)

        vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)

        container.addWidget(widget, stretch=1)
コード例 #35
0
ファイル: MultiDim.py プロジェクト: sergiopasra/ginga
    def build_naxis(self, dims):
        # build a vbox of NAXIS controls
        captions = [("NAXIS1", "label"), ("NAXIS2", "label")]

        self.naxispath = []
        for n in xrange(2, len(dims)):
            self.naxispath.append(0)
            key = "naxis%d" % (n + 1)
            title = key.upper()
            maxn = int(dims[n])
            self.logger.debug("NAXIS%d=%d" % (n + 1, maxn))
            if maxn <= 1:
                captions.append((title, "label"))
            else:
                captions.append((title, "label", "Choose %s" % (title), "spinbutton"))

        w, b = QtHelp.build_info(captions)
        for n in xrange(0, len(dims)):
            key = "naxis%d" % (n + 1)
            lbl = b[key]
            maxn = int(dims[n])
            lbl.setText("%d" % maxn)
            slkey = "choose_" + key
            if b.has_key(slkey):
                slider = b[slkey]
                lower = 1
                upper = maxn
                slider.setRange(lower, upper)
                slider.setSingleStep(1)
                slider.setWrapping(True)

                def make_cbfn(n):
                    return lambda idx: self.set_naxis_cb(idx - 1, n)

                slider.valueChanged.connect(make_cbfn(n))

        # Add naxis controls to gui
        try:
            oldw = self.stack.currentWidget()
            self.stack.removeWidget(oldw)
        except:
            pass
        self.stack.addWidget(w)
コード例 #36
0
    def _setup_params(self, obj, container):
        params = obj.getParams()
        captions = []
        for key, bnch in params.items():
            text = key
            if bnch.has_key('label'):
                text = bnch.label
            captions.append((text, 'entry'))

        # TODO: put RA/DEC first, and other stuff not in random orders
        w, b = QtHelp.build_info(captions)

        # remove old widgets
        old_w = container.currentWidget()
        if old_w != None:
            container.removeWidget(old_w)

        # add new widgets
        container.insertWidget(0, w)
        return b
コード例 #37
0
ファイル: Catalogs.py プロジェクト: coleb/ginga
    def _setup_params(self, obj, container):
        params = obj.getParams()
        captions = []
        for key, bnch in params.items():
            text = key
            if bnch.has_key('label'):
                text = bnch.label
            captions.append((text, 'entry'))

        # TODO: put RA/DEC first, and other stuff not in random orders
        w, b = QtHelp.build_info(captions)

        # remove old widgets
        old_w = container.currentWidget()
        if old_w != None:
            container.removeWidget(old_w)

        # add new widgets
        container.insertWidget(0, w)
        return b
コード例 #38
0
ファイル: Log.py プロジェクト: Rbeaty88/ginga
    def build_gui(self, container):
        # self.msgFont = self.fv.getFont("fixedFont", 10)
        tw = QtGui.QPlainTextEdit()
        tw.setReadOnly(True)
        # tw.setCurrentFont(self.msgFont)
        tw.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap)
        tw.setMaximumBlockCount(self.histlimit)
        self.tw = tw

        sw = QtGui.QScrollArea()
        sw.setWidgetResizable(True)
        sw.setWidget(self.tw)

        container.addWidget(sw, stretch=1)
        # sw.show()

        captions = (("Level", "combobox", "History", "spinbutton"), ("Auto scroll", "checkbutton", "Clear", "button"))
        w, b = QtHelp.build_info(captions)
        self.w.update(b)

        combobox = b.level
        for (name, level) in self.levels:
            combobox.addItem(name)
        combobox.setCurrentIndex(1)
        combobox.activated.connect(self.set_loglevel_cb)
        combobox.setToolTip("Set the logging level")

        spinbox = b.history
        spinbox.setRange(100, self.histmax)
        spinbox.setSingleStep(10)
        spinbox.setValue(self.histlimit)
        spinbox.valueChanged.connect(self.set_history_cb)
        spinbox.setToolTip("Set the logging history line limit")

        btn = b.auto_scroll
        btn.setToolTip("Scroll the log window automatically")

        btn = b.clear
        btn.clicked.connect(self.clear)
        btn.setToolTip("Clear the log history")
        container.addWidget(w, stretch=0)
コード例 #39
0
ファイル: GingaQt.py プロジェクト: aaronroodman/ginga
    def build_fullscreen(self):
        w = self.w.fscreen
        self.w.fscreen = None
        if w != None:
            w.destroy()
            return

        # Get image from current focused channel
        chinfo = self.get_channelInfo()
        fitsimage = chinfo.fitsimage
        settings = fitsimage.get_settings()
        rgbmap = fitsimage.get_rgbmap()

        root = QtHelp.TopLevel()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        root.setLayout(vbox)

        fi = self.build_viewpane(settings, rgbmap=rgbmap)
        iw = fi.get_widget()
        vbox.addWidget(iw, stretch=1)

        # Get image from current focused channel
        image = fitsimage.get_image()
        if image == None:
            return
        fi.set_image(image)

        # Copy attributes of the frame
        fitsimage.copy_attributes(
            fi,
            [  #'transforms',
                #'cutlevels',
                'rgbmap'
            ],
            redraw=False)

        root.showFullScreen()
        self.w.fscreen = root
コード例 #40
0
ファイル: Catalogs.py プロジェクト: aaronroodman/ginga
    def _setup_params(self, obj, container):
        params = obj.getParams()
        captions = []
        paramList = sorted(params.values(), key=lambda b: b.order)
        for bnch in paramList:
            text = bnch.name
            if 'label' in bnch:
                text = bnch.label
            #captions.append((text, 'entry'))
            captions.append((text, 'xlabel', '@'+bnch.name, 'entry'))

        # TODO: put RA/DEC first, and other stuff not in random orders
        w, b = QtHelp.build_info(captions)

        # remove old widgets
        old_w = container.currentWidget()
        if old_w != None:
            container.removeWidget(old_w)

        # add new widgets
        container.insertWidget(0, w)
        return b
コード例 #41
0
    def startDrag(self, event):
        indices = self.selectedIndexes()
        selected = set()
        for index in indices:
            selected.add(index.row())

        urls = []
        for row in selected:
            path = "file://" + self.plugin.get_path_at_row(row)
            url = QtCore.QUrl(path)
            urls.append(url)

        mimeData = QtCore.QMimeData()
        mimeData.setUrls(urls)
        drag = QtHelp.QDrag(self)
        drag.setMimeData(mimeData)
        ## pixmap = QPixmap(":/drag.png")
        ## drag.setHotSpot(QPoint(pixmap.width()/3, pixmap.height()/3))
        ## drag.setPixmap(pixmap)
        if QtHelp.have_pyqt5:
            result = drag.exec_(QtCore.Qt.MoveAction)
        else:
            result = drag.start(QtCore.Qt.MoveAction)
コード例 #42
0
ファイル: Catalogs.py プロジェクト: aaronroodman/ginga
    def show_table(self, catalog, info, starlist):
        self.starlist = starlist
        self.catalog = catalog
        # info is ignored, for now
        #self.info = info
        self.selected = []

        # rebuild table according to metadata
        self.build_table(info)
        
        table = self.table
        model = CatalogTableModel(info.columns, self.starlist)
        table.setModel(model)
        selectionModel = QtHelp.QItemSelectionModel(model, table)
        table.setSelectionModel(selectionModel)
        selectionModel.currentRowChanged.connect(self.select_star_cb)
        model.layoutChanged.connect(self.sort_cb)
        
        # set column width to fit contents
        table.resizeColumnsToContents()
        table.resizeRowsToContents()

        table.setSortingEnabled(True)
コード例 #43
0
    def build_gui(self, container):
        self.msgFont = self.fv.getFont("fixedFont", 12)

        self.msgList = QtGui.QWidget()
        vbox = QtGui.QGridLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.msgList.setLayout(vbox)

        sw = QtGui.QScrollArea()
        sw.setWidgetResizable(True)
        #sw.set_border_width(2)
        sw.setWidget(self.msgList)

        cw = container.get_widget()
        cw.addWidget(sw, stretch=1)

        hbox = QtHelp.HBox()
        btn = QtGui.QPushButton("Remove All")
        btn.clicked.connect(self.remove_all)
        hbox.addWidget(btn, stretch=0)
        cw.addWidget(hbox, stretch=0)

        self.widgetList = []
コード例 #44
0
ファイル: Catalogs.py プロジェクト: aaronroodman/ginga
    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)
コード例 #45
0
ファイル: Histogram.py プロジェクト: PaulPrice/ginga
    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 = self.fv.getFont("sansFont", 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
コード例 #46
0
ファイル: Preferences.py プロジェクト: adrn/ginga
    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
コード例 #47
0
ファイル: Info.py プロジェクト: albertoconti/ginga
    def _create_info_window(self):
        sw = QtGui.QScrollArea()

        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(2, 2, 2, 2)
        widget.setLayout(vbox)
        
        captions = (('Name', 'label'), ('Object', 'label'),
                    ('X', 'label'), ('Y', 'label'), ('Value', 'label'),
                    ('RA', 'label'), ('DEC', 'label'),
                    ('Equinox', 'label'), ('Dimensions', 'label'),
                    #('Slices', 'label', 'MultiDim', 'button'),
                    ('Min', 'label'), ('Max', 'label'),
                    ('Zoom', 'label'), 
                    ('Cut Low', 'xlabel', '@Cut Low', 'entry'),
                    ('Cut High', 'xlabel', '@Cut High', 'entry'),
                    ('Auto Levels', 'button', 'Cut Levels', 'button'), 
                    ('Cut New', 'label'), ('Zoom New', 'label'), 
                    ('Preferences', 'button'), 
                    )

        w, b = QtHelp.build_info(captions)

        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.preferences.setToolTip("Set preferences for this channel")
        #b.multidim.setToolTip("View other HDUs or slices")

        
        vbox.addWidget(w, stretch=0)
        
        # Convenience navigation buttons
        btns = QtGui.QWidget()
        layout = QtGui.QHBoxLayout()
        layout.setSpacing(3)
        btns.setLayout(layout)
        #btns.set_layout(gtk.BUTTONBOX_CENTER)
        #btns.set_child_size(15, -1)

        bw = Bunch.Bunch()
        for tup in (
            #("Load", 'button', 'fits_open_48', "Open an image file"),
            ("Prev", 'button', 'prev_48', "Go to previous image"),
            ("Next", 'button', 'next_48', "Go to next image"),
            ("Zoom In", 'button', 'zoom_in_48', "Zoom in"),
            ("Zoom Out", 'button', 'zoom_out_48', "Zoom out"),
            ("Zoom Fit", 'button', 'zoom_fit_48', "Zoom to fit window size"),
            ("Zoom 1:1", 'button', 'zoom_100_48', "Zoom to 100% (1:1)"),
            #("Quit", 'button', 'exit', "Quit the program"),
            ):

            btn = self.fv.make_button(*tup)
            name = tup[0]
            if tup[3]:
                btn.setToolTip(tup[3])
                
            bw[QtHelp._name_mangle(name, pfx='btn_')] = btn
            layout.addWidget(btn, stretch=0)

        #self.w.btn_load.connect("clicked", lambda w: self.gui_load_file())
        bw.btn_prev.clicked.connect(self.fv.prev_img)
        bw.btn_next.clicked.connect(self.fv.next_img)
        bw.btn_zoom_in.clicked.connect(self.fv.zoom_in)
        bw.btn_zoom_out.clicked.connect(self.fv.zoom_out)
        bw.btn_zoom_fit.clicked.connect(self.fv.zoom_fit)
        bw.btn_zoom_1_1.clicked.connect(self.fv.zoom_1_to_1)

        vbox.addWidget(btns, stretch=0)

        #widget.show()
        sw.setWidget(widget)
        return sw, b
コード例 #48
0
ファイル: Widgets.py プロジェクト: stscieisenhamer/ginga
 def get_font(self, font_family, point_size):
     font = QtHelp.get_font(font_family, point_size)
     return font
コード例 #49
0
ファイル: GingaQt.py プロジェクト: jochym/ginga
 def getFont(self, fontType, pointSize):
     font_family = self.settings.get(fontType)
     return QtHelp.get_font(font_family, pointSize)
コード例 #50
0
ファイル: Catalogs.py プロジェクト: aaronroodman/ginga
    def _build_gui(self, container):
        self.mframe = container
            
        vbox = QtHelp.VBox()

        # create the table
        table = QtGui.QTableView()
        self.table = table
        table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        table.setShowGrid(False)
        vh = table.verticalHeader()
        # Hack to make the rows in a TableView all have a
        # reasonable height for the data
        if QtHelp.have_pyqt5:
            vh.setSectionResizeMode(QtGui.QHeaderView.ResizeToContents)
        else:
            vh.setResizeMode(QtGui.QHeaderView.ResizeToContents)
        # Hide vertical header
        vh.setVisible(False)

        vbox.addWidget(table, stretch=1)

        self.cbar = ColorBar.ColorBar(self.logger)
        self.cbar.set_cmap(self.cmap)
        self.cbar.set_imap(self.imap)
        #self.cbar.set_size_request(-1, 20)
        rgbmap = self.cbar.get_rgbmap()
        rgbmap.add_callback('changed', lambda *args: self.replot_stars())

        vbox.addWidget(self.cbar, stretch=0)

        btns = QtHelp.HBox()
        btns.setSpacing(5)

        combobox = QtHelp.ComboBox()
        options = []
        index = 0
        for name in self.cmap_names:
            options.append(name)
            combobox.addItem(name)
            index += 1
        cmap_name = self.magcmap
        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)
        self.btn['cmap'] = combobox
        btns.addWidget(combobox, stretch=0, alignment=QtCore.Qt.AlignRight)

        combobox = QtHelp.ComboBox()
        options = []
        index = 0
        for name in self.imap_names:
            options.append(name)
            combobox.addItem(name)
            index += 1
        imap_name = self.magimap
        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)
        self.btn['imap'] = combobox
        btns.addWidget(combobox, stretch=0, alignment=QtCore.Qt.AlignRight)

        vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignTop)

        btns = QtHelp.HBox()
        btns.setSpacing(5)

        for name in ('Plot', 'Clear', #'Close'
                     ):
            btn = QtGui.QPushButton(name)
            btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
            self.btn[name.lower()] = btn

        self.btn.plot.clicked.connect(self.replot_stars)
        self.btn.clear.clicked.connect(self.clear)
        #self.btn.close.clicked.connect(self.close)

        combobox = QtHelp.ComboBox()
        options = []
        index = 0
        for name in ['Mag']:
            options.append(name)
            combobox.addItem(name)
            index += 1
        combobox.setCurrentIndex(0)
        combobox.activated.connect(self.set_field_cb)
        self.btn['field'] = combobox
        btns.addWidget(combobox, stretch=0, alignment=QtCore.Qt.AlignLeft)

        vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignTop)
        
        # create the table
        info = Bunch.Bunch(columns=self.columns, color='Mag')
        self.build_table(info)
        
        self.mframe.addWidget(vbox, stretch=1)
コード例 #51
0
ファイル: Zoom.py プロジェクト: PaulPrice/ginga
    def build_gui(self, container):
        vpaned = QtGui.QSplitter()
        vpaned.setOrientation(QtCore.Qt.Vertical)
        
        width, height = 300, 300

        zi = FitsImageCanvasQt.FitsImageCanvas(logger=self.logger)
        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.add_callback('none-move', self.showxy)
        zi.set_bg(0.4, 0.4, 0.4)
        zi.show_pan_mark(True, redraw=False)
        self.zoomimage = zi

        bd = zi.get_bindings()
        bd.enable_zoom(False)
        bd.enable_pan(False)
        bd.enable_cmap(False)

        iw = zi.get_widget()
        #iw.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding))
        iw.resize(width, height)
        vpaned.addWidget(iw)

        widget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        widget.setLayout(vbox)
        vbox.addWidget(QtGui.QLabel("Zoom Radius:"), stretch=0)

        adj = QtGui.QSlider(QtCore.Qt.Horizontal)
        adj.setMinimum(1)
        adj.setMaximum(100)
        adj.setValue(self.zoom_radius)
        adj.resize(200, -1)
        adj.setTracking(True)
        self.w_radius = adj
        adj.valueChanged.connect(self.set_radius_cb)
        vbox.addWidget(adj, stretch=0)

        vbox.addWidget(QtGui.QLabel("Zoom Amount:"), stretch=0)

        adj = QtGui.QSlider(QtCore.Qt.Horizontal)
        adj.setMinimum(-20)
        adj.setMaximum(30)
        adj.setValue(self.zoom_amount)
        adj.resize(200, -1)
        adj.setTracking(True)
        self.w_amount = adj
        adj.valueChanged.connect(self.set_amount_cb)
        vbox.addWidget(adj, stretch=0)

        captions = (('Zoom', 'label'),
                    ("Relative Zoom", 'checkbutton'),
                    ("Refresh Interval", 'spinbutton'),
                    ('Defaults', 'button'),
                    )

        w, b = QtHelp.build_info(captions)
        b.zoom.setText(self.fv.scale2text(zi.get_scale()))
        self.wzoom = b
        b.relative_zoom.setChecked(not self.t_abszoom)
        b.relative_zoom.stateChanged.connect(self.set_absrel_cb)
        b.defaults.clicked.connect(self.set_defaults)
        b.refresh_interval.setRange(0, 200)
        b.refresh_interval.setSingleStep(1)
        b.refresh_interval.setWrapping(True)
        b.refresh_interval.setValue(int(self.refresh_interval * 1000))
        b.refresh_interval.valueChanged.connect(self.set_refresh_cb)
        vbox.addWidget(w, stretch=0)

        sw = QtGui.QScrollArea()
        sw.setWidgetResizable(False)
        sw.setWidget(widget)

        #widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed))
        vpaned.addWidget(sw)
        sw.show()

        container.addWidget(vpaned, stretch=1)
コード例 #52
0
ファイル: PluginManagerQt.py プロジェクト: kerohiko/ginga
 def remove_taskbar(self, bnch):
     self.logger.debug("removing widget from taskbar")
     QtHelp.removeWidget(self.hbox, bnch.widget)
     bnch.widget = None
     bnch.label = None
コード例 #53
0
ファイル: Drawing.py プロジェクト: RayPlante/ginga
    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 = self.fv.getFont("sansFont", 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)
コード例 #54
0
ファイル: Pick.py プロジェクト: RayPlante/ginga
    def build_gui(self, container):
        assert iqcalc.have_scipy == True, \
               Exception("Please install python-scipy to use this plugin")

        self.pickcenter = None

        # Splitter is just to provide a way to size the graph
        # to a reasonable size
        vpaned = QtGui.QSplitter()
        vpaned.setOrientation(QtCore.Qt.Vertical)
        
        nb = QtHelp.TabWidget()
        nb.setTabPosition(QtGui.QTabWidget.East)
        nb.setUsesScrollButtons(True)
        self.w.nb1 = nb
        vpaned.addWidget(nb)
        
        cm, im = self.fv.cm, self.fv.im

        di = FitsImageCanvasQt.FitsImageCanvas(logger=self.logger)
        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)
        self.pickimage = di

        bd = di.get_bindings()
        bd.enable_pan(True)
        bd.enable_zoom(True)
        bd.enable_cuts(True)

        iw = di.get_widget()
        sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
                               QtGui.QSizePolicy.MinimumExpanding)
        iw.setSizePolicy(sp)
        width, height = 200, 200
        iw.resize(width, height)
        nb.addTab(iw, 'Image')

        if have_mpl:
            self.w.fig = matplotlib.figure.Figure()
            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 = MyFigureCanvas(self.w.fig)
            canvas.setDelegate(self)
            #canvas.resize(width, height)
            self.w.canvas = canvas
            nb.addTab(canvas, u"Contour")

            self.w.fig2 = matplotlib.figure.Figure()
            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 = FigureCanvas(self.w.fig2)
            self.w.canvas2 = canvas
            nb.addTab(canvas, u"FWHM")

        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)

        msgFont = self.fv.getFont('sansFont', 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)
        vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
        
        fr = QtHelp.Frame("Pick")

        nb = QtHelp.TabWidget()
        nb.setTabPosition(QtGui.QTabWidget.South)
        nb.setUsesScrollButtons(True)
        self.w.nb2 = nb

        fr.layout().addWidget(nb, stretch=1, alignment=QtCore.Qt.AlignLeft)
        vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)

        vbox2 = QtHelp.VBox()
        captions = (('Zoom', 'label', 'Contour Zoom', 'label'),
                    ('Object_X', 'label', 'Object_Y', 'label'),
                    ('RA', 'label', 'DEC', 'label'),
                    ('Equinox', 'label', 'Background', 'label'),
                    ('Sky Level', 'label', 'Brightness', 'label'), 
                    ('FWHM X', 'label', 'FWHM Y', 'label'),
                    ('FWHM', 'label', 'Star Size', 'label'),
                    ('Sample Area', 'label', 'Default Region', 'button'),
                    )

        w, b = QtHelp.build_info(captions)
        self.w.update(b)
        b.zoom.setText(self.fv.scale2text(di.get_scale()))
        self.wdetail = b
        b.default_region.clicked.connect(self.reset_region)
        b.default_region.setToolTip("Reset region size to default")

        vbox2.addWidget(w, stretch=1)
        
        # Pick field evaluation status
        label = QtGui.QLabel()
        self.w.eval_status = label
        ## w.layout().addWidget(label, stretch=0, alignment=QtCore.Qt.AlignLeft)
        vbox2.addWidget(label, stretch=0)

        # Pick field evaluation progress bar and stop button
        hbox = QtHelp.HBox()
        pgs = QtGui.QProgressBar()
        pgs.setRange(0, 100)
        pgs.setTextVisible(True)
        self.w.eval_pgs = pgs
        hbox.addWidget(pgs, stretch=0)
        btn = QtGui.QPushButton("Stop")
        btn.clicked.connect(lambda w: self.eval_intr())
        btn.setEnabled(False)
        self.w.btn_intr_eval = btn
        hbox.addWidget(btn, stretch=0)
        vbox2.addWidget(hbox, stretch=0)

        nb.addTab(vbox2, "Report")

        # Build settings panel
        captions = (('Show Candidates', 'checkbutton'),
                    ('Radius', 'xlabel', '@Radius', 'spinfloat'),
                    ('Threshold', 'xlabel', '@Threshold', 'entry'),
                    ('Min FWHM', 'xlabel', '@Min FWHM', 'spinfloat'),
                    ('Max FWHM', 'xlabel', '@Max FWHM', 'spinfloat'),
                    ('Ellipticity', 'xlabel', '@Ellipticity', 'entry'),
                    ('Edge', 'xlabel', '@Edge', 'entry'),
                    ('Max side', 'xlabel', '@Max side', 'spinbutton'),
                    ('Redo Pick', 'button'),
            )

        w, b = QtHelp.build_info(captions)
        self.w.update(b)
        b.radius.setToolTip("Radius for peak detection")
        b.threshold.setToolTip("Threshold for peak detection (blank=default)")
        b.min_fwhm.setToolTip("Minimum FWHM for selection")
        b.max_fwhm.setToolTip("Maximum FWHM for selection")
        b.ellipticity.setToolTip("Minimum ellipticity for selection")
        b.edge.setToolTip("Minimum edge distance for selection")
        b.show_candidates.setToolTip("Show all peak candidates")
        b.show_candidates.setChecked(self.show_candidates)
        b.show_candidates.stateChanged.connect(self.show_candidates_cb)

        # radius control
        adj = b.radius
        adj.setRange(5.0, 200.0)
        adj.setSingleStep(1.0)
        adj.setValue(self.radius)
        def chg_radius(val):
            self.radius = val
            self.w.xlbl_radius.setText(str(self.radius))
            return True
        b.xlbl_radius.setText(str(self.radius))
        b.radius.valueChanged.connect(chg_radius)

        # threshold control
        def chg_threshold():
            threshold = None
            ths = str(self.w.threshold.text()).strip()
            if len(ths) > 0:
                threshold = float(ths)
            self.threshold = threshold
            self.w.xlbl_threshold.setText(str(self.threshold))
            return True
        b.xlbl_threshold.setText(str(self.threshold))
        b.threshold.returnPressed.connect(chg_threshold)

        # min fwhm
        adj = b.min_fwhm
        adj.setRange(0.1, 200.0)
        adj.setSingleStep(1.0)
        adj.setValue(self.min_fwhm)
        def chg_min(val):
            self.min_fwhm = val
            self.w.xlbl_min_fwhm.setText(str(self.min_fwhm))
            return True
        b.xlbl_min_fwhm.setText(str(self.min_fwhm))
        b.min_fwhm.valueChanged.connect(chg_min)

        # max fwhm
        adj = b.max_fwhm
        adj.setRange(0.1, 200.0)
        adj.setSingleStep(1.0)
        adj.setValue(self.max_fwhm)
        def chg_max(val):
            self.max_fwhm = val
            self.w.xlbl_max_fwhm.setText(str(self.max_fwhm))
            return True
        b.xlbl_max_fwhm.setText(str(self.max_fwhm))
        b.max_fwhm.valueChanged.connect(chg_max)

        # Ellipticity control
        def chg_ellipticity():
            minellipse = None
            val = str(self.w.ellipticity.text()).strip()
            if len(val) > 0:
                minellipse = float(val)
            self.min_ellipse = minellipse
            self.w.xlbl_ellipticity.setText(str(self.min_ellipse))
            return True
        b.xlbl_ellipticity.setText(str(self.min_ellipse))
        b.ellipticity.returnPressed.connect(chg_ellipticity)

        # Edge control
        def chg_edgew():
            edgew = None
            val = str(self.w.edge.text()).strip()
            if len(val) > 0:
                edgew = float(val)
            self.edgew = edgew
            self.w.xlbl_edge.setText(str(self.edgew))
            return True
        b.xlbl_edge.setText(str(self.edgew))
        b.edge.returnPressed.connect(chg_edgew)

        adj = b.max_side
        adj.setRange(5, 10000)
        adj.setSingleStep(10)
        adj.setValue(self.max_side)
        def chg_max_side(val):
            self.max_side = val
            self.w.xlbl_max_side.setText(str(self.max_side))
            return True
        b.xlbl_max_side.setText(str(self.max_side))
        b.max_side.valueChanged.connect(chg_max_side)

        b.redo_pick.clicked.connect(self.redo)

        nb.addTab(w, "Settings")

        captions = (
            ('Sky cut', 'button', 'Delta sky', 'entry'),
            ('Bright cut', 'button', 'Delta bright', 'entry'),
            )

        w, b = QtHelp.build_info(captions)
        self.w.update(b)

        b.sky_cut.setToolTip("Set image low cut to Sky Level")
        b.delta_sky.setToolTip("Delta to apply to low cut")
        b.bright_cut.setToolTip("Set image high cut to Sky Level+Brightness")
        b.delta_bright.setToolTip("Delta to apply to high cut")

        b.sky_cut.setEnabled(False)
        self.w.btn_sky_cut = b.sky_cut
        self.w.btn_sky_cut.clicked.connect(self.sky_cut)
        self.w.sky_cut_delta = b.delta_sky
        b.delta_sky.setText(str(self.delta_sky))
        b.bright_cut.setEnabled(False)
        self.w.btn_bright_cut = b.bright_cut
        self.w.btn_bright_cut.clicked.connect(self.bright_cut)
        self.w.bright_cut_delta = b.delta_bright
        b.delta_bright.setText(str(self.delta_bright))

        nb.addTab(w, "Controls")

        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)
        vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)

        vpaned.addWidget(sw)
        
        container.addWidget(vpaned, stretch=1)