Beispiel #1
0
    def build_gui(self, container):
        self.msg_font = self.fv.get_font('fixed', 10)

        vbox = Widgets.VBox()

        mlst = Widgets.VBox()
        mlst.set_spacing(2)
        self.msg_list = mlst

        sw = Widgets.ScrollArea()
        sw.set_widget(self.msg_list)

        vbox.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(4)

        if self.settings.get('closeable', False):
            btn = Widgets.Button("Close")
            btn.add_callback('activated', lambda w: self.close())
            btns.add_widget(btn)
            btn = Widgets.Button("Help")
            btn.add_callback('activated', lambda w: self.help())
            btns.add_widget(btn, stretch=0)

        btn = Widgets.Button("Remove All")
        btn.add_callback('activated', lambda w: self.remove_all())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)

        vbox.add_widget(btns, stretch=0)
        container.add_widget(vbox, stretch=1)

        self.gui_up = True
Beispiel #2
0
    def build_gui(self, container, future=None):
        vbox1 = Widgets.VBox()
        vbox = Widgets.VBox()

        fr = Widgets.Frame()
        fr.set_widget(vbox)

        self.lbl = Widgets.Label()
        vbox.add_widget(self.lbl, stretch=0)

        vbox2 = Widgets.VBox()
        self.entries = vbox2
        vbox.add_widget(vbox2, stretch=1)

        vbox1.add_widget(fr, stretch=0)

        btns = Widgets.HBox()
        btns.set_spacing(4)
        btns.set_border_width(4)

        btn = Widgets.Button("Ok")
        btn.add_callback('activated', lambda w: self.ok())
        btns.add_widget(btn)
        btn = Widgets.Button("Cancel")
        btn.add_callback('activated', lambda w: self.cancel())
        btns.add_widget(btn)
        vbox1.add_widget(btns, stretch=0)

        # stretch/spacer
        vbox1.add_widget(Widgets.Label(""), stretch=1)

        container.add_widget(vbox1, stretch=0)
Beispiel #3
0
    def build_gui(self, container):

        hbox = Widgets.HBox()
        hbox.set_border_width(0)
        hbox.set_spacing(2)

        cbox1 = Widgets.ComboBox()
        self.w.channel = cbox1
        cbox1.set_tooltip("Select a channel")
        cbox1.add_callback('activated', self.channel_select_cb)
        if self.settings.get('show_channel_control', True):
            hbox.add_widget(cbox1, stretch=0)

        self.use_popup = self.settings.get('use_popup_menu', True)
        if self.use_popup:
            opmenu = Widgets.Menu()
            btn = Widgets.Button("Operation")
        else:
            opmenu = Widgets.ComboBox()
            opmenu.set_tooltip("Select an operation")
            hbox.add_widget(opmenu, stretch=0)
            btn = Widgets.Button("Go")

        self.w.operation = opmenu
        btn.add_callback('activated', self.invoke_op_cb)
        btn.set_tooltip("Invoke operation")
        self.w.opbtn = btn
        hbox.add_widget(btn, stretch=0)

        self.w.optray = Widgets.HBox()
        self.w.optray.set_border_width(0)
        self.w.optray.set_spacing(2)
        hbox.add_widget(self.w.optray, stretch=1)

        container.add_widget(hbox, stretch=0)
Beispiel #4
0
    def build_gui(self, container):
        vbox = Widgets.VBox()
        vbox.set_border_width(1)
        vbox.set_spacing(1)

        nb = Widgets.StackWidget()
        vbox.add_widget(nb, stretch=1)
        self.nb = nb

        # create sort toggle
        hbox = Widgets.HBox()
        cb = Widgets.CheckBox("Sortable")
        cb.set_state(self.flg_sort)
        cb.add_callback('activated', lambda w, tf: self.set_sortable_cb(tf))
        hbox.add_widget(cb, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(hbox, stretch=0)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
        self.gui_up = True
Beispiel #5
0
    def build_gui(self, container):
        vbox = Widgets.VBox()
        vbox.set_border_width(2)
        vbox.set_spacing(2)

        nb = Widgets.StackWidget()
        self.nb = nb
        vbox.add_widget(self.nb, stretch=1)

        if self.settings.get('closeable', False):
            btns = Widgets.HBox()
            btns.set_border_width(4)
            btns.set_spacing(4)

            btn = Widgets.Button("Close")
            btn.add_callback('activated', lambda w: self.close())
            btns.add_widget(btn)
            btn = Widgets.Button("Help")
            btn.add_callback('activated', lambda w: self.help())
            btns.add_widget(btn, stretch=0)
            btns.add_widget(Widgets.Label(''), stretch=1)
            vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
        self.gui_up = True
Beispiel #6
0
    def build_gui(self, container):

        self.w = Bunch.Bunch()
        self.w_track = dict()
        vbox = Widgets.VBox()

        sc = Widgets.ScrollArea()
        vbox2 = Widgets.VBox()
        fr = Widgets.Frame("Downloads")
        self.dlbox = Widgets.VBox()
        fr.set_widget(self.dlbox)
        vbox2.add_widget(fr, stretch=0)
        vbox2.add_widget(Widgets.Label(''), stretch=1)
        sc.set_widget(vbox2)
        vbox.add_widget(sc, stretch=1)
        self.w_scroll = sc

        btns = Widgets.HBox()
        btns.set_spacing(4)
        btns.set_border_width(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btn = Widgets.Button("Clear All")
        btn.add_callback('activated', lambda w: self.gui_clear_all())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)

        self.gui_up = True
Beispiel #7
0
    def build_gui(self, container):
        vbox = Widgets.VBox()

        self.msg_font = self.fv.get_font('fixed', 12)
        tw = Widgets.TextArea(wrap=False, editable=False)
        tw.set_font(self.msg_font)
        tw.set_limit(self.histlimit)
        self.tw = tw
        tw.set_text('\n'.join(self._lines))
        self._lines.clear()

        sw = Widgets.ScrollArea()
        sw.set_widget(self.tw)

        vbox.add_widget(sw, stretch=1)

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

        combobox = b.level
        for (name, level) in self.levels:
            combobox.append_text(name)
        combobox.set_index(1)
        combobox.add_callback('activated', self.set_loglevel_cb)
        combobox.set_tooltip("Set the logging level")

        spinbox = b.history
        spinbox.set_limits(100, self.histmax, incr_value=10)
        spinbox.set_value(self.histlimit)
        spinbox.add_callback('value-changed', self.set_history_cb)
        spinbox.set_tooltip("Set the logging history line limit")

        btn = b.auto_scroll
        btn.set_state(self.autoscroll)
        btn.set_tooltip("Scroll the log window automatically")
        btn.add_callback('activated', self.set_autoscroll_cb)

        btn = b.clear
        btn.add_callback('activated', lambda w: self.clear())
        btn.set_tooltip("Clear the log history")
        vbox.add_widget(w, stretch=0)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
Beispiel #8
0
    def build_gui(self, container):

        vbox = Widgets.VBox()
        vbox.set_margins(2, 2, 2, 2)

        # create the table
        color_alternate = self.settings.get('color_alternate_rows', True)
        table = Widgets.TreeView(sortable=True,
                                 selection='multiple',
                                 use_alt_row_color=color_alternate,
                                 dragable=True)
        table.add_callback('activated', self.item_dblclicked_cb)
        table.add_callback('drag-start', self.item_drag_cb)

        # set header
        col = 0
        self._name_idx = 0
        for hdr, attrname in self.columns:
            if attrname == 'name':
                self._name_idx = col
            col += 1
        table.setup_table(self.columns, 1, 'name')

        vbox.add_widget(table, stretch=1)
        self.treeview = table

        self.entry = Widgets.TextEntry()
        vbox.add_widget(self.entry, stretch=0)
        self.entry.add_callback('activated', self.browse_cb)

        hbox = Widgets.HBox()
        btn = Widgets.Button("Load")
        btn.add_callback('activated', lambda w: self.load_cb())
        hbox.add_widget(btn, stretch=0)
        btn = Widgets.Button("Save Image As")
        hbox.add_widget(btn, stretch=0)
        self.entry2 = Widgets.TextEntry()
        hbox.add_widget(self.entry2, stretch=1)
        vbox.add_widget(hbox, stretch=0)
        self.entry2.add_callback('activated', self.save_as_cb)
        btn.add_callback('activated', lambda w: self.save_as_cb())

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Refresh")
        btn.add_callback('activated', lambda w: self.refresh())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Make Thumbs")
        btn.add_callback('activated', lambda w: self.make_thumbs())
        btns.add_widget(btn, stretch=0)

        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
Beispiel #9
0
    def build_gui(self, container):

        vbox = Widgets.VBox()
        vbox.set_margins(2, 2, 2, 2)

        # create the table
        color_alternate = self.settings.get('color_alternate_rows', True)
        table = Widgets.TreeView(sortable=True,
                                 selection='multiple',
                                 use_alt_row_color=color_alternate,
                                 dragable=True)
        table.add_callback('activated', self.item_dblclicked_cb)
        table.add_callback('drag-start', self.item_drag_cb)
        table.add_callback('selected', self.item_selected_cb)

        # set header
        col = 0
        self._name_idx = 0
        for hdr, attrname in self.columns:
            if attrname == 'name':
                self._name_idx = col
            col += 1
        table.setup_table(self.columns, 1, 'name')

        vbox.add_widget(table, stretch=1)
        self.treeview = table

        self.entry = Widgets.TextEntry()
        vbox.add_widget(self.entry, stretch=0)
        self.entry.add_callback('activated', self.browse_cb)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btn.set_tooltip("Close this plugin")
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btn.set_tooltip("Show documentation for this plugin")
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Refresh")
        btn.add_callback('activated', lambda w: self.refresh())
        btn.set_tooltip("Refresh the file list from the directory")
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Load")
        btn.add_callback('activated', lambda w: self.load_cb())
        btn.set_tooltip("Load files selected in file pane")
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Make Thumbs")
        btn.add_callback('activated', lambda w: self.make_thumbs())
        btn.set_tooltip("Make thumbnails for files in directory")
        btns.add_widget(btn, stretch=0)

        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
Beispiel #10
0
    def build_gui(self, container):
        vbox = Widgets.VBox()
        vbox.set_border_width(2)
        vbox.set_spacing(4)

        # create the Treeview
        always_expand = self.settings.get('always_expand', False)
        color_alternate = self.settings.get('color_alternate_rows', True)
        treeview = Widgets.TreeView(auto_expand=always_expand,
                                    sortable=True,
                                    selection='multiple',
                                    use_alt_row_color=color_alternate)
        self.treeview = treeview
        treeview.setup_table(self.columns, 2, 'NAME')

        treeview.add_callback('activated', self.dblclick_cb)
        treeview.add_callback('selected', self.select_cb)
        vbox.add_widget(treeview, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(4)
        b1 = Widgets.Button('Display')
        b1.add_callback('activated', self.display_cb)
        b1.set_tooltip("Display the selected object in its channel viewer")
        b1.set_enabled(False)
        btns.add_widget(b1)
        b2 = Widgets.Button('Move')
        b2.add_callback('activated', lambda w: self.ask_action_images('move'))
        b2.set_tooltip("Move the selected objects to a channel")
        b2.set_enabled(False)
        btns.add_widget(b2)
        b3 = Widgets.Button('Copy')
        b3.add_callback('activated', lambda w: self.ask_action_images('copy'))
        b3.set_tooltip("Copy the selected objects to a channel")
        b3.set_enabled(False)
        btns.add_widget(b3)
        b4 = Widgets.Button('Remove')
        b4.add_callback('activated',
                        lambda w: self.ask_action_images('remove'))
        b4.set_tooltip("Remove the selected objects from a channel")
        b4.set_enabled(False)
        btns.add_widget(b4)
        btns.add_widget(Widgets.Label(''), stretch=1)
        self.btn_list = [b1, b2, b3, b4]

        self._rebuild_channels()

        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
        self.gui_up = True
Beispiel #11
0
    def build_gui(self, container):

        vbox = Widgets.VBox()
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        # construct an interactive viewer to view and scroll
        # the RGB image, and to let the user pick the cmap
        self.c_view = Viewers.CanvasView(logger=self.logger)
        c_v = self.c_view
        c_v.set_desired_size(self._wd, self._ht)
        c_v.enable_autozoom('off')
        c_v.enable_autocuts('off')
        c_v.set_pan(0, 0)
        c_v.scale_to(1, 1)
        c_v.transform(False, True, False)
        c_v.cut_levels(0, 255)
        c_v.set_bg(0.4, 0.4, 0.4)
        # for debugging
        c_v.set_name('cmimage')

        canvas = c_v.get_canvas()
        canvas.register_for_cursor_drawing(c_v)
        c_v.add_callback('cursor-down', self.select_cb)
        c_v.add_callback('scroll', self.scroll_cb)

        bd = c_v.get_bindings()
        bd.enable_pan(True)
        # disable zooming so scrolling can be used to pan up/down
        bd.enable_zoom(False)
        bd.enable_cmap(False)

        iw = Viewers.GingaScrolledViewerWidget(c_v)
        iw.resize(self._wd, self._ht)

        vbox.add_widget(iw, stretch=1)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
Beispiel #12
0
    def make_ope_cb(self, w):

        try:
            ope_buf = self.make_ope()

            top_w = Widgets.TopLevel()
            vbox = Widgets.VBox()
            vbox.set_border_width(2)
            vbox.set_spacing(2)

            tw = Widgets.TextArea(wrap=False)
            vbox.add_widget(tw, stretch=1)

            hbox = Widgets.HBox()
            btn = Widgets.Button('Close')
            hbox.add_widget(btn, stretch=0)
            save_as = Widgets.Button('Save As')
            hbox.add_widget(save_as, stretch=0)
            ope_name = "Queue-" + time.strftime("%Y%m%d-%H%M%S",
                                                time.localtime()) + ".ope"

            output_dir = self.controller.output_dir
            if output_dir is None:
                output_dir = os.path.join(os.environ['HOME'], "Procedure",
                                          "Queue")
            path = os.path.join(output_dir, ope_name)
            ent = Widgets.TextEntry('path')
            ent.set_text(path)
            hbox.add_widget(ent, stretch=1)
            vbox.add_widget(hbox, stretch=0)

            save_as.add_callback('activated',
                                 lambda w: self.save_as_cb(ope_buf, ent))

            top_w.set_widget(vbox)
            btn.add_callback('activated', lambda w: top_w.delete())
            top_w.add_callback('close', lambda *args: top_w.delete())

            tw.set_text(ope_buf)
            top_w.resize(700, 900)
            # TODO: better title
            top_w.set_title("Generated OPE file")

            top_w.show()

        except Exception as e:
            self.logger.error("Error creating OPE file: %s" % (str(e)))

        return True
Beispiel #13
0
    def build_gui(self, container):
        if not Widgets.has_webkit:
            self.browser = Widgets.Label(
                "Please install the python-webkit package to enable "
                "this plugin")
        else:
            self.browser = Widgets.WebView()

        sw = Widgets.ScrollArea()
        sw.set_widget(self.browser)

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

        self.entry = Widgets.TextEntrySet()
        container.add_widget(self.entry, stretch=0)
        self.entry.add_callback('activated', lambda w: self.browse_cb())

        tbar = Widgets.Toolbar(orientation='horizontal')
        for tt, cb, ico in (('Go back', lambda w: self.back_cb(),
                             'prev_48.png'),
                            ('Go forward', lambda w: self.forward_cb(),
                             'next_48.png'), ('Reload page',
                                              lambda w: self.reload_cb(),
                                              'rotate_48.png'),
                            ('Stop loading', lambda w: self.stop_cb(),
                             'stop_48.png'), ('Go to top of documentation',
                                              lambda w: self.show_help(),
                                              'fits.png')):
            btn = tbar.add_action(None,
                                  iconpath=os.path.join(self.fv.iconpath, ico))
            btn.add_callback('activated', cb)
            btn.set_tooltip(tt)
        container.add_widget(tbar, stretch=0)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(3)
        btn = Widgets.Button('Close')
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button('Help')
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        container.add_widget(btns, stretch=0)

        self.gui_up = True
Beispiel #14
0
    def build_gui(self, container):

        vbox = Widgets.VBox()

        self.msg_font = self.fv.get_font("fixedFont", 12)

        vbox.add_widget(Widgets.Label("Output:"))
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(self.msg_font)
        tw.set_limit(self.histlimit)
        self.hist_w = tw

        ## sw = Widgets.ScrollArea()
        ## sw.set_widget(self.hist_w)
        ## vbox.add_widget(sw, stretch=1)
        vbox.add_widget(tw, stretch=1)

        vbox.add_widget(Widgets.Label("Type command here:"))
        self.cmd_w = Widgets.TextEntry()
        self.cmd_w.set_font(self.msg_font)
        vbox.add_widget(self.cmd_w, stretch=0)
        self.cmd_w.add_callback('activated', self.exec_cmd_cb)

        btns = Widgets.HBox()
        btns.set_spacing(4)
        btns.set_border_width(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns)

        container.add_widget(vbox, stretch=1)
Beispiel #15
0
    def build_gui(self, container):

        container.set_margins(2, 2, 2, 2)
        container.set_spacing(4)

        self.tabWidget = Widgets.TabWidget()

        for name in self.tabs:
            modName = self.tabInfo[name]['mod']
            self.mm.load_module(modName)
            module = self.mm.get_module(modName)
            klass = getattr(module, modName)
            self.tabInfo[name]['obj'] = klass(self.controller)

            widget = Widgets.VBox()
            self.tabInfo[name]['obj'].build_gui(widget)
            self.tabInfo[name]['obj'].setProposal(self.proposal)
            self.tabWidget.add_widget(widget, title=name)
            self.tabInfo[name]['obj'].populate_cb(
                self.model, self.tabInfo[name]['inputDataDict'][self.proposal])

        container.add_widget(self.tabWidget)

        # Create a "Close" button so the user can easily close the
        # ProposalTab
        hbox = Widgets.HBox()
        closeTabButton = Widgets.Button('Close %s' % self.proposal)
        closeTabButton.add_callback('activated', self.close_tab_cb)
        closeTabButton.set_tooltip("Close proposal %s tab" % self.proposal)
        hbox.add_widget(closeTabButton)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        container.add_widget(hbox)
Beispiel #16
0
    def add_error(self, errmsg, ts=None):
        if ts is None:
            # Add the time the error occurred
            ts = time.strftime("%m/%d %H:%M:%S", time.localtime())

        if not self.gui_up:
            self.pending_errors.append((errmsg, ts))
            return

        vbox = Widgets.VBox()

        hbox = Widgets.HBox()
        # Add the time the error occurred
        ts = time.strftime("%m/%d %H:%M:%S", time.localtime())
        lbl = Widgets.Label(ts, halign='left')
        hbox.add_widget(lbl, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(hbox, stretch=0)

        tw = Widgets.TextArea(editable=False, wrap=False)
        tw.set_font(self.msg_font)

        tw.set_text(errmsg)
        vbox.add_widget(tw, stretch=1)

        hbox = Widgets.HBox()
        btn = Widgets.Button("Remove")
        btn.add_callback('activated', lambda w: self.remove_error(vbox))
        hbox.add_widget(btn)
        hbox.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(hbox, stretch=0)
        # special hack for Qt
        vbox.cfg_expand(horizontal='minimum')

        self.msg_list.add_widget(vbox, stretch=0)
Beispiel #17
0
    def build_gui(self, container):

        vbox = Widgets.VBox()
        vbox.set_border_width(4)
        vbox.set_spacing(2)
        self.vbox = vbox

        tw = Widgets.TextArea(wrap=False, editable=False)
        self.font = self.view.get_font('Courier', 12)
        tw.set_font(self.font)
        self.tw = tw

        vbox.add_widget(self.tw, stretch=1)

        container.add_widget(vbox, stretch=1)

        hbox = Widgets.HBox()
        btn = Widgets.Button('Make OPE')
        hbox.add_widget(btn)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        btn.add_callback('activated', self.make_ope_cb)

        self.vbox.add_widget(hbox, stretch=0)

        self.gui_up = True
Beispiel #18
0
    def gui_add_track(self, track):
        vbox = Widgets.VBox()
        fname = Widgets.TextEntry()
        fname.set_text(track.info.url)
        vbox.add_widget(fname, stretch=0)
        hbox = Widgets.HBox()
        hbox.set_spacing(2)
        time_lbl = Widgets.Label(track.elapsed)
        prog_bar = Widgets.ProgressBar()
        prog_bar.set_value(track.progress)
        hbox.add_widget(time_lbl)
        hbox.add_widget(prog_bar)
        rmv = Widgets.Button('Clear')

        def _clear_download(w):
            self.gui_rm_track(track)

        rmv.add_callback('activated', _clear_download)
        hbox.add_widget(rmv)
        vbox.add_widget(hbox, stretch=0)
        self.dlbox.add_widget(vbox)
        w_track = Bunch.Bunch(container=vbox,
                              time_lbl=time_lbl,
                              prog_bar=prog_bar,
                              track=track)
        self.w_track[track.key] = w_track
        self.w_scroll.scroll_to_end(vertical=True)
Beispiel #19
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        # Take a text widget to show version info
        msgFont = self.fv.getFont('sansFont', 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(msgFont)
        tw.set_text(self.info_string())

        vbox.add_widget(tw, stretch=0)
        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(3)

        btn = Widgets.Button('Close')
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)

        top.add_widget(btns, stretch=0)
        container.add_widget(top, stretch=1)
Beispiel #20
0
    def build_gui(self, container):
        self.msg_font = self.fv.getFont("fixedFont", 10)

        vbox = Widgets.VBox()

        mlst = Widgets.VBox()
        mlst.set_spacing(2)
        self.msgList = mlst

        sw = Widgets.ScrollArea()
        sw.set_widget(self.msgList)

        vbox.add_widget(sw, stretch=1)

        hbox = Widgets.HBox()
        btn = Widgets.Button("Remove All")
        btn.add_callback('activated', lambda w: self.remove_all())
        hbox.add_widget(btn, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        vbox.add_widget(hbox, stretch=0)
        container.add_widget(vbox, stretch=1)

        self.gui_up = True

        pending = self.pending_errors
        self.pending_errors = []

        for errmsg, ts in pending:
            self.add_error(errmsg, ts=ts)
Beispiel #21
0
    def build_gui(self, container):
        """
        This method is called when the plugin is invoked.  It builds the
        GUI used by the plugin into the widget layout passed as
        ``container``.
        This method could be called several times if the plugin is opened
        and closed.  The method may be omitted if there is no GUI for the
        plugin.

        This specific example uses the GUI widget set agnostic wrappers
        to build the GUI, but you can also just as easily use explicit
        toolkit calls here if you only want to support one widget set.
        """
        top = Widgets.VBox()
        top.set_border_width(4)

        # this is a little trick for making plugins that work either in
        # a vertical or horizontal orientation.  It returns a box container,
        # a scroll widget and an orientation ('vertical', 'horizontal')
        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        # Take a text widget to show some instructions
        self.msgFont = self.fv.getFont("sansFont", 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(self.msgFont)
        self.tw = tw

        # Frame for instructions and add the text widget with another
        # blank widget to stretch as needed to fill emp
        fr = Widgets.Frame("Status")
        vbox2 = Widgets.VBox()
        vbox2.add_widget(tw)
        vbox2.add_widget(Widgets.Label(''), stretch=1)
        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

        # Add a spacer to stretch the rest of the way to the end of the
        # plugin space
        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        # scroll bars will allow lots of content to be accessed
        top.add_widget(sw, stretch=1)

        # A button box that is always visible at the bottom
        btns = Widgets.HBox()
        btns.set_spacing(3)

        # Add a close button for the convenience of the user
        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        # Add our GUI to the container
        container.add_widget(top, stretch=1)
Beispiel #22
0
    def build_gui(self, container):
        if not have_samp:
            raise GingaPlugin.PluginError(
                "To run this plugin you need to install the "
                "astropy package")

        vbox = Widgets.VBox()
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("SAMP")

        captions = [
            ('Start hub', 'checkbutton'),
            ('Connect client', 'checkbutton'),
        ]
        w, b = Widgets.build_info(captions)
        self.w.update(b)
        b.start_hub.set_tooltip("Start a SAMP hub")
        b.start_hub.set_state(self.settings.get('start_hub', True))
        b.start_hub.add_callback('activated', self.start_hub_cb)
        b.connect_client.set_tooltip("Register with a SAMP hub")
        b.connect_client.set_state(self.settings.get('default_connect', True))
        b.connect_client.add_callback('activated', self.connect_client_cb)

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        # stretch
        vbox.add_widget(Widgets.Label(''), stretch=1)

        btns = Widgets.HBox()
        btns.set_border_width(4)
        btns.set_spacing(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
        self.gui_up = True
Beispiel #23
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)
	self.msg_font = self.fv.get_font("Courier", 12)
        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)
#Gui        

	fr = Widgets.Frame("Add or Subtract Two Images")
        vbox2 = Widgets.VBox()
        

	captions = (("Path to file 1:", 'label', 'First', 'entry'),
		    ("Path to file 2:", 'label', 'Second', 'entry'),
		    ("Add", 'button', "Subtract", 'button'),
                    )
        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w = b 
#Function callbacks
	b.first.set_text(str(self.first))
        b.first.add_callback('activated',
                                   lambda w: self.addimg())
        b.second.set_text(str(self.second))
	b.second.add_callback('activated',
                                   lambda w: self.addimg())	
        
	b.add.add_callback('activated',
                                   lambda w: self.addimg())
        b.first.add_callback('activated',
                                   lambda w: self.subimg())
        b.second.add_callback('activated',
                                   lambda w: self.subimg())     
        b.subtract.add_callback('activated',
                                   lambda w: self.subimg())

        vbox2.add_widget(w, stretch=0)

        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

	
        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
Beispiel #24
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("Bar Input")

        captions = (('Overlay', 'button'),
		    ('Clear', 'button'))
	
        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w.update(b)

	b.overlay.add_callback('activated',
			       lambda w: self.load_cb())

        b.clear.add_callback('activated', lambda w: self.clear_canvas())
	fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
	
	self.mfilesel = FileSelection(self.fv.w.root.get_widget())
Beispiel #25
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("Keck Mosaic")

        captions = (('Click Run to start the program', 'label'),
		    ('Run', 'button', 'Stop Scan', 'button'))

        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w.update(b)

        b.run.add_callback('activated',
                               lambda w: self.run_cb())

        b.stop_scan.add_callback('activated',
                               lambda w: self.stop_scan_cb())

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
Beispiel #26
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("Crosshair")

        captions = (('Format:', 'label', 'Format', 'combobox'),
                    )
        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w = b

        combobox = b.format
        for name in self.formats:
            combobox.append_text(name)
        index = self.formats.index(self.format)
        combobox.set_index(index)
        combobox.add_callback('activated', lambda w, idx: self.set_format())

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
Beispiel #27
0
    def build_gui(self, container):
        vbox = Widgets.VBox()

        fr = Widgets.Frame("Remote Control")

        captions = [
            ("Addr:", 'label', "Addr", 'llabel', 'Restart', 'button'),
            ("Set Addr:", 'label', "Set Addr", 'entry'),
        ]
        w, b = Widgets.build_info(captions)
        self.w.update(b)

        addr = self.host + ':' + str(self.port)
        b.addr.set_text(addr)
        b.restart.set_tooltip("Restart the server")
        b.restart.add_callback('activated', self.restart_cb)

        b.set_addr.set_length(100)
        b.set_addr.set_text(addr)
        b.set_addr.set_tooltip("Set address to run remote control server")
        b.set_addr.add_callback('activated', self.set_addr_cb)

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        # stretch
        vbox.add_widget(Widgets.Label(''), stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(4)
        btns.set_border_width(4)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns)

        container.add_widget(vbox, stretch=1)
Beispiel #28
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("Keck Mosaic")

        captions = (('Load a multi-extension FITS file, create a mosaic',
                     'label'), ('Load', 'button'))

        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w.update(b)

        b.load.add_callback('activated', lambda w: self.load_cb())

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)

        self.mfilesel = FileSelection(self.fv.w.root.get_widget())
Beispiel #29
0
    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

        vbox, sw, orientation = Widgets.get_oriented_box(container)
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        fr = Widgets.Frame("WCS Match")

        captions = ((' Reference Channel:', 'label', 'ref channel',
                     'combobox'), )
        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w = b

        b.ref_channel.add_callback('activated', self.set_reference_channel_cb)

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)

        spacer = Widgets.Label('')
        vbox.add_widget(spacer, stretch=1)

        top.add_widget(sw, stretch=1)

        btns = Widgets.HBox()
        btns.set_spacing(3)

        btn = Widgets.Button("Close")
        btn.add_callback('activated', lambda w: self.close())
        btns.add_widget(btn, stretch=0)
        btn = Widgets.Button("Help")
        btn.add_callback('activated', lambda w: self.help())
        btns.add_widget(btn, stretch=0)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)

        self.gui_up = True
        self._reset_channels_gui()
Beispiel #30
0
    def build_gui(self, container):

        hbox = Widgets.HBox()
        hbox.set_border_width(0)
        hbox.set_spacing(2)

        cbox1 = Widgets.ComboBox()
        self.w.channel = cbox1
        cbox1.set_tooltip("Select a channel")
        cbox1.add_callback('activated', self.channel_select_cb)
        if self.settings.get('show_channel_control', True):
            hbox.add_widget(cbox1, stretch=0)

        self.use_popup = self.settings.get('use_popup_menu', True)
        opmenu = Widgets.Menu()
        btn = Widgets.Button("Operation")
        btn.set_tooltip("Invoke operation")
        btn.add_callback('activated', self.invoke_popup_cb)
        if not self.use_popup:
            hbox.add_widget(btn, stretch=0)
            self.w.opname = Widgets.Label('')
            hbox.add_widget(self.w.opname, stretch=0)
            btn = Widgets.Button("Go")
            btn.add_callback('activated', self.invoke_op_cb)

        self.w.operation = opmenu
        self.w.opbtn = btn
        hbox.add_widget(btn, stretch=0)

        self.w.optray = Widgets.HBox()
        self.w.optray.set_border_width(0)
        self.w.optray.set_spacing(2)

        # add a spacer to keep the icons aligned to the left
        self.spacer = Widgets.Label('')
        self.w.optray.add_widget(self.spacer, stretch=1)

        hbox.add_widget(self.w.optray, stretch=1)
        container.add_widget(hbox, stretch=0)
        self.gui_up = True