Beispiel #1
0
    def __init__(self, logger, app, ev_quit):
        self.logger = logger
        self.app = app
        self.ev_quit = ev_quit

        self.histlimit = 5000
        self._plot_w = None

        self.zv = ZView.ZView(logger, self)

        from ginga.gw import Widgets, GwHelp

        self.top = self.app.make_window('GView')
        self.top.add_callback('close', lambda w: self.quit())

        vbox = Widgets.VBox()
        vbox.set_border_width(2)
        vbox.set_spacing(1)
        self.top.set_widget(vbox)
        self.top.resize(800, 600)

        mbar = Widgets.Menubar()
        vbox.add_widget(mbar, stretch=0)

        filemenu = mbar.add_name("File")
        filemenu.add_separator()

        item = filemenu.add_name("Quit")
        item.add_callback('activated', lambda *args: self.quit())

        nb = Widgets.TabWidget()
        vbox.add_widget(nb, stretch=1)

        sbar = Widgets.StatusBar()
        vbox.add_widget(sbar, stretch=0)

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

        vbox.add_widget(Widgets.Label("Type command here:"))
        self.cmd_w = Widgets.TextEntry()
        # TODO: this is not fetching a fixed font
        font = GwHelp.get_font("fixed", 12)
        self.cmd_w.set_font(font)
        vbox.add_widget(self.cmd_w, stretch=0)
        self.cmd_w.add_callback('activated', self.exec_cmd_cb)

        vbox.add_widget(Widgets.Label("Output:"))
        self.hist_w = Widgets.TextArea(wrap=True, editable=True)
        self.hist_w.set_font(font)
        self.hist_w.set_limit(self.histlimit)
        vbox.add_widget(self.hist_w, stretch=1)

        nb.add_widget(vbox, "Command")

        self.top.show()
Beispiel #2
0
 def add_statusbar(self, holder):
     self.w.status = Widgets.StatusBar()
     holder.add_widget(self.w.status, stretch=1)
Beispiel #3
0
    w.set_value(4)
    vbox.add_widget(w)

elif wname == 'scrollbar':
    w = Widgets.ScrollBar(orientation='horizontal')
    w.add_callback('activated',
                   lambda w, val: logger.info("value is %d" % val))
    vbox.add_widget(w)

elif wname == 'progressbar':
    w = Widgets.ProgressBar()
    w.set_value(0.6)
    vbox.add_widget(w)

elif wname == 'statusbar':
    w = Widgets.StatusBar()
    w.set_message("Hello, World! is my status")
    vbox.add_widget(w)

elif wname == 'image':
    w = Widgets.Image()
    w.load_file(os.path.join(icondir, 'ginga-512x512.png'))
    vbox.add_widget(w)

elif wname == 'treeview':
    w = Widgets.TreeView(selection='single',
                         sortable=True,
                         use_alt_row_color=True)
    columns = [("Meal", 'meal'), ("Critic 1", 'review1'),
               ("Critic 2", 'review2'), ("Critic 3", 'review3')]
    w.setup_table(columns, 1, 'meal')
Beispiel #4
0
    def setup_ui(self):

        self.logger.debug("setting up ana menu gui")
        vbox = Widgets.VBox()

        menubar = Widgets.Menubar()
        menu = menubar.add_name('File')
        menu.add_separator()
        item = menu.add_name('Quit')
        item.add_callback('activated', lambda w: self.quit())
        vbox.add_widget(menubar, stretch=0)

        hbox = Widgets.HBox()
        hbox.set_spacing(2)
        icn = Widgets.Image()
        icn.load_file(os.path.join(icondir, 'sumo.png'))
        hbox.add_widget(icn, stretch=0)

        lbl = Widgets.Label("ANA " + self.title_suffix)
        lbl.set_font('sans', 24)
        hbox.add_widget(lbl, stretch=1)
        vbox.add_widget(hbox, stretch=0)
        self.w.title = lbl

        tb0 = Widgets.Toolbar(orientation='horizontal')
        fr = Widgets.Frame('PropID:')
        fr.set_widget(tb0)
        entry = Widgets.TextEntry()
        self.w.propid = entry
        if self.propid is not None:
            entry.set_text(self.propid)
        tb0.add_widget(entry)
        a = tb0.add_action('Set')
        a.add_callback('activated', self.set_propid_cb)
        vbox.add_widget(fr)

        # buttons for Gen2 application
        tb1 = Widgets.Toolbar(orientation='horizontal')
        fr = Widgets.Frame('Viewers:')
        fr.set_widget(tb1)
        vbox.add_widget(fr)

        tb2 = Widgets.Toolbar(orientation='horizontal')
        fr = Widgets.Frame('Instrument:')
        fr.set_widget(tb2)
        vbox.add_widget(fr)

        tb3 = Widgets.Toolbar(orientation='horizontal')
        fr = Widgets.Frame('Etc:')
        fr.set_widget(tb3)
        vbox.add_widget(fr)

        status = Widgets.StatusBar()
        vbox.add_widget(status)
        self.w.msgbar = status

        # Add some buttons to the tool bars.
        a = tb1.add_action('Ginga',
                           toggle=False,
                           iconpath=os.path.join(icondir, 'view-file.png'),
                           iconsize=(24, 24))
        a.add_callback('activated', lambda w: self.launch_fits_viewer())
        a.set_tooltip("Start ginga FITS viewer")
        a = tb1.add_action('Ds9',
                           toggle=False,
                           iconpath=os.path.join(icondir, 'view-file.png'),
                           iconsize=(24, 24))
        a.add_callback('activated', lambda w: self.launch_ds9())
        a.set_tooltip("Start ds9 FITS viewer")

        for name, action in self.action_list:
            a = tb2.add_action(name,
                               toggle=False,
                               iconpath=os.path.join(icondir, 'camera.png'),
                               iconsize=(24, 24))
            a.add_callback('activated', action)
            a.set_tooltip("Start data analysis package for %s" % (name))

        a = tb3.add_action('Terminal',
                           toggle=False,
                           iconpath=os.path.join(icondir, 'terminal.png'),
                           iconsize=(24, 24))
        a.add_callback('activated', lambda w: self.launch_terminal())
        a.set_tooltip("Start a terminal on analysis server")
        a = tb3.add_action('StatMon',
                           toggle=False,
                           iconpath=os.path.join(icondir, 'statmon.png'),
                           iconsize=(28, 24))
        a.add_callback('activated', lambda w: self.launch_statmon())
        a.set_tooltip("Start Gen2 status monitor")

        self.w.root.set_widget(vbox)
        self.w.root.add_callback('close', lambda w: self.quit())

        self.__init_propid_entry()
        #self.__set_propfile()
        self.logger.debug("ana menu gui done")