예제 #1
0
    def start(self, future=None):
        self.callerInfo = future
        # Gather parameters
        p = future.get_data()

        self.lbl.set_text(p.title)

        # Remove previous entries
        self.entries.remove_all()

        p.resDict = {}

        tbl = Widgets.GridBox(rows=len(p.itemlist), columns=2)
        tbl.set_row_spacing(2)
        tbl.set_column_spacing(2)

        row = 0
        for name, val in p.itemlist:
            lbl = Widgets.Label(name)
            #lbl.set_alignment(1.0, 0.5)
            ent = Widgets.TextEntry()
            #ent.set_length(100)
            val_s = str(val)
            ent.set_text(val_s)
            p.resDict[name] = ent

            tbl.add_widget(lbl, 0, row, stretch=0)
            tbl.add_widget(ent, 1, row, stretch=1)
            row += 1

        self.entries.add_widget(tbl, stretch=0)
예제 #2
0
파일: Thumbs.py 프로젝트: teuben/ginga
    def build_gui(self, container):
        # width, height = 300, 300
        # cm, im = self.fv.cm, self.fv.im

        thumb_len = self.settings.get('thumb_length', 192)

        tg = Viewers.ImageViewCanvas(logger=self.logger)
        tg.configure_window(thumb_len, thumb_len)
        tg.enable_autozoom('on')
        tg.set_autocut_params('zscale')
        tg.enable_autocuts('override')
        tg.enable_auto_orient(True)
        tg.defer_redraw = False
        tg.set_bg(0.7, 0.7, 0.7)
        self.thumb_generator = tg

        sw = Widgets.ScrollArea()
        sw.add_callback('configure', self.thumbpane_resized_cb)

        # Create thumbnails pane
        vbox = Widgets.GridBox()
        vbox.set_margins(4, 4, 4, 4)
        vbox.set_column_spacing(14)
        self.w.thumbs = vbox

        sw.set_widget(vbox)
        self.w.thumbs_scroll = sw

        container.add_widget(sw, stretch=1)

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

        b.auto_scroll.set_tooltip(
            "Scroll the thumbs window when new images arrive")
        b.clear.set_tooltip("Remove all current thumbnails")
        b.clear.add_callback('activated', lambda w: self.clear())
        auto_scroll = self.settings.get('auto_scroll', True)
        b.auto_scroll.set_state(auto_scroll)
        container.add_widget(w, stretch=0)

        self.gui_up = True
예제 #3
0
파일: clocks.py 프로젝트: mfwofford/ginga
    def __init__(self, logger, settings, options):
        self.logger = logger
        self.options = options
        self.settings = settings

        colors = [
            'lightgreen', 'orange', 'cyan', 'pink', 'slateblue', 'yellow',
            'maroon', 'brown'
        ]
        self.color_index = 0

        cols = 3
        if options.num_cols is not None:
            cols = options.num_cols

        self.settings.add_defaults(columns=cols, zones=['UTC'], colors=colors)
        self.colors = self.settings.get('colors', colors)

        # now import our items
        from ginga.gw import Widgets, GwHelp

        self.app = Widgets.Application(logger=logger)
        self.app.add_callback('shutdown', self.quit)
        self.top = self.app.make_window("Clocks")
        self.top.add_callback('close', self.closed)

        menubar = Widgets.Menubar()
        clockmenu = menubar.add_name('Clock')
        item = clockmenu.add_name("Quit")
        item.add_callback('activated', lambda *args: self.quit())

        self.top.set_widget(menubar)

        vbox = Widgets.VBox()
        self.grid = Widgets.GridBox()
        self.grid.set_border_width(1)
        self.grid.set_spacing(2)
        vbox.add_widget(self.grid, stretch=1)
        self.top.set_widget(vbox)

        hbox = Widgets.HBox()

        self.timezone_label = Widgets.Label('TimeZone')
        self.county_timezone = Widgets.ComboBox()
        self.county_timezone.widget.setEditable(True)

        # make a giant list of time zones
        zones = [
            timezone for timezones in pytz.country_timezones.values()
            for timezone in timezones
        ]
        zones.sort()
        for timezone in zones:
            self.county_timezone.append_text(timezone)

        # also let user set timezone by UTC offset
        self.location_label = Widgets.Label('Location')
        self.location = Widgets.TextEntry()
        self.location.set_tooltip("Type a label to denote this UTC offset")
        #self.location.set_length(10)
        self.timeoffset_label = Widgets.Label('UTC Offset(hour)')
        self.time_offset = Widgets.SpinBox(dtype=float)
        self.time_offset.set_decimals(2)
        self.time_offset.set_limits(-12, 12)
        self.time_offset.set_tooltip("Time offset from UTC")
        self.timezone_button = Widgets.Button('Add by Timezone')
        self.offset_button = Widgets.Button('Add by Offset')

        self.timezone_button.widget.clicked.connect(
            self.more_clock_by_timezone)
        self.offset_button.widget.clicked.connect(self.more_clock_by_offset)

        hbox.add_widget(self.timezone_label, stretch=0)
        hbox.add_widget(self.county_timezone, stretch=0)
        hbox.add_widget(self.timezone_button, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        hbox.add_widget(self.location_label, stretch=0)
        hbox.add_widget(self.location, stretch=0)

        hbox.add_widget(self.timeoffset_label, stretch=0)
        hbox.add_widget(self.time_offset, stretch=0)
        hbox.add_widget(self.offset_button, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        self.top.set_widget(hbox)

        self.clocks = {}
        self.timer = GwHelp.Timer(1.0)
        self.timer.add_callback('expired', self.timer_cb)
        self.timer.start(1.0)
예제 #4
0
    def build_gui(self, container):
        vbox = Widgets.VBox()
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        gr = Widgets.GridBox()
        gr.set_column_spacing(4)

        i = 0
        ## self.w.observer = Widgets.TextEntry()
        ## self.w.observer.set_length(12)
        ## gr.add_widget(Widgets.Label('Observer'), 0, i)
        ## gr.add_widget(self.w.observer, 1, i)
        ## self.w.observer.set_tooltip("Name of observer doing this observation")
        ## self.w.observer.set_text("Nobody")

        ## i += 1
        self.w.date = Widgets.TextEntry()
        self.w.date.set_length(12)
        gr.add_widget(Widgets.Label('Local date'), 0, i)
        gr.add_widget(self.w.date, 1, i)
        self.w.date.set_tooltip("Local date at beginning of interval")

        i += 1
        self.w.start_time = Widgets.TextEntry()
        self.w.start_time.set_length(8)
        gr.add_widget(Widgets.Label('Start Time'), 0, i)
        gr.add_widget(self.w.start_time, 1, i)
        self.w.start_time.set_tooltip("Local time for interval")

        i += 1
        self.w.len_time = Widgets.TextEntry()
        self.w.len_time.set_length(8)
        gr.add_widget(Widgets.Label('Length (min)'), 0, i)
        gr.add_widget(self.w.len_time, 1, i)
        self.w.len_time.set_text('70')
        self.w.len_time.set_tooltip("Length of interval in MINUTES")

        i += 1
        self.w.az = Widgets.TextEntry()
        self.w.az.set_length(8)
        gr.add_widget(Widgets.Label('Az'), 0, i)
        gr.add_widget(self.w.az, 1, i)
        self.w.az.set_text('-90.0')
        self.w.az.set_tooltip("Current azimuth of telescope")

        i += 1
        self.w.el = Widgets.TextEntry()
        self.w.el.set_length(8)
        gr.add_widget(Widgets.Label('El'), 0, i)
        gr.add_widget(self.w.el, 1, i)
        self.w.el.set_text('89.9')
        self.w.el.set_tooltip("Current elevation of telescope")

        i += 1
        self.w.filter = Widgets.TextEntry()
        self.w.filter.set_length(5)
        gr.add_widget(Widgets.Label('Filter'), 0, i)
        gr.add_widget(self.w.filter, 1, i)
        self.w.filter.set_text('g')
        self.w.filter.set_tooltip("Currently installed filter for HSC")

        i += 1
        self.w.seeing = Widgets.TextEntry()
        self.w.seeing.set_length(5)
        gr.add_widget(Widgets.Label('Seeing'), 0, i)
        gr.add_widget(self.w.seeing, 1, i)
        self.w.seeing.set_text('1.0')
        self.w.seeing.set_tooltip("Current best estimate of seeing")

        i += 1
        self.w.trans = Widgets.TextEntry()
        self.w.trans.set_length(5)
        gr.add_widget(Widgets.Label('Transparency'), 0, i)
        gr.add_widget(self.w.trans, 1, i)
        self.w.trans.set_text('0.85')
        self.w.trans.set_tooltip("Current best estimate of sky transparency")

        i += 1
        btn = Widgets.Button('Update')
        btn.add_callback('activated', self.update_cb)
        btn.set_tooltip("Update time, current pointing and active filter")
        gr.add_widget(btn, 1, i)

        i += 1
        gr.add_widget(Widgets.Label(''), 1, i, stretch=4)

        vbox.add_widget(gr)

        hbox = Widgets.HBox()

        fr = Widgets.Frame("Possible OBs")

        self.tree1 = Widgets.TreeView(sortable=True,
                                      use_alt_row_color=True,
                                      selection='single')
        self.tree1.add_callback('selected', self.select_ob_cb)
        fr.set_widget(self.tree1)
        hbox.add_widget(self.tree1, stretch=1)

        vbx2 = Widgets.VBox()
        vbx2.set_border_width(4)
        vbx2.set_spacing(6)

        ## cb = Widgets.CheckBox("Show bad")
        ## cb.set_tooltip("Include OBs that cannot execute now")
        ## cb.add_callback('activated', self._toggle_show_bad)
        ## vbx2.add_widget(cb, stretch=0)

        btn = Widgets.Button("Get OBs")
        btn.set_tooltip("Find OBs that can execute within the period")
        btn.add_callback('activated', self.find_executable_obs_cb)
        vbx2.add_widget(btn, stretch=0)

        # add stretch spacer
        vbx2.add_widget(Widgets.Label(''), stretch=1)

        hbox.add_widget(vbx2, stretch=0)

        vbox.add_widget(hbox, stretch=1)
        container.add_widget(vbox, stretch=1)
예제 #5
0
파일: widgets.py 프로젝트: mfwofford/ginga
    vbox.add_widget(hbox, stretch=0)

elif wname == 'stackwidget':
    w = Widgets.StackWidget()
    w.add_widget(Widgets.Label('Content of Stack 1'))
    w.add_widget(Widgets.Label('Content of Stack 2'))
    vbox.add_widget(w, stretch=1)

elif wname == 'mdiwidget':
    w = Widgets.MDIWidget()
    w.add_widget(Widgets.Label('Content of MDI Area 1'))
    w.add_widget(Widgets.Label('Content of MDI Area 2'))
    vbox.add_widget(w, stretch=1)

elif wname == 'gridbox':
    w = Widgets.GridBox(rows=2, columns=2)
    w.add_widget(Widgets.Label('Content of Grid Area 1'), 0, 0)
    w.add_widget(Widgets.Label('Content of Grid Area 2'), 0, 1)
    w.add_widget(Widgets.Label('Content of Grid Area 3'), 1, 0)
    w.add_widget(Widgets.Label('Content of Grid Area 4'), 1, 1)
    vbox.add_widget(w, stretch=1)

elif wname == 'menubar':
    w = Widgets.Menubar()
    menu = w.add_name('Menu 1')
    menu.add_name('Larry').add_callback('activated',
                                        lambda *args: print("chose Larry"))
    menu.add_name('Curly').add_callback(
        'activated', lambda *args: logger.info("chose Curly"))
    menu.add_name('Moe').add_callback('activated',
                                      lambda *args: logger.info("chose Moe"))