当前位置: 首页>>代码示例>>Python>>正文


Python misc.Widgets类代码示例

本文整理汇总了Python中ginga.misc.Widgets的典型用法代码示例。如果您正苦于以下问题:Python Widgets类的具体用法?Python Widgets怎么用?Python Widgets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Widgets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_gui

    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)

        self.msgFont = self.fv.getFont("sansFont", 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(self.msgFont)
        self.tw = tw

        fr = Widgets.Frame("Instructions")
        vbox2 = Widgets.VBox()
        vbox2.add_widget(tw)
        vbox2.add_widget(Widgets.Label(''), stretch=1)
        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

        fr = Widgets.Frame("Blink")

        captions = (("Interval:", 'label', 'Interval', 'entry',
                     "Start Blink", 'button', "Stop Blink", 'button'),
                    )
        w, b = Widgets.build_info(captions, orientation=orientation)
        self.w = b

        b.interval.set_text(str(self.interval))
        b.interval.add_callback('activated', lambda w: self._set_interval_cb())
        b.interval.set_tooltip("Interval in seconds between changing images")

        b.start_blink.add_callback('activated',
                                   lambda w: self._start_blink_cb())
        b.stop_blink.add_callback('activated',
                                  lambda w: self._stop_blink_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)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
开发者ID:sosey,项目名称:ginga,代码行数:55,代码来源:Blink.py

示例2: build_gui

    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)

        self.msgFont = self.fv.getFont("sansFont", 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(self.msgFont)
        self.tw = tw

        fr = Widgets.Frame("Instructions")
        vbox2 = Widgets.VBox()
        vbox2.add_widget(tw)
        vbox2.add_widget(Widgets.Label(''), stretch=1)
        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

        fr = Widgets.Frame("Ruler")

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

        combobox = b.units
        for name in self.unittypes:
            combobox.append_text(name)
        index = self.unittypes.index(self.units)
        combobox.set_index(index)
        combobox.add_callback('activated', lambda w, idx: self.set_units())

        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)
        btns.add_widget(Widgets.Label(''), stretch=1)
        top.add_widget(btns, stretch=0)

        container.add_widget(top, stretch=1)
开发者ID:sosey,项目名称:ginga,代码行数:51,代码来源:Ruler.py

示例3: build_naxis

    def build_naxis(self, dims):
        # build a vbox of NAXIS controls
        captions = [("NAXIS1:", 'label', 'NAXIS1', 'llabel'),
                    ("NAXIS2:", 'label', 'NAXIS2', 'llabel')]

        self.naxispath = []
        for n in range(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', title, 'llabel'))
            else:
                captions.append((title+':', 'label', title, 'llabel',
                                 #"Choose %s" % (title), 'spinbutton'))
                                 "Choose %s" % (title), 'hscale'))

        # Remove old naxis widgets
        for key in self.w:
            if key.startswith('choose_'):
                self.w[key] = None

        w, b = Widgets.build_info(captions, orientation=self.orientation)
        self.w.update(b)
        for n in range(0, len(dims)):
            key = 'naxis%d' % (n+1)
            lbl = b[key]
            maxn = int(dims[n])
            lbl.set_text("%d" % maxn)
            slkey = 'choose_'+key
            if slkey in b:
                slider = b[slkey]
                lower = 1
                upper = maxn
                slider.set_limits(lower, upper, incr_value=1)
                slider.set_value(lower)
                slider.set_tracking(True)
                #slider.set_digits(0)
                #slider.set_wrap(True)
                slider.add_callback('value-changed', self.set_naxis_cb, n)

        # Add vbox of naxis controls to gui
        self.naxisfr.set_widget(w)

        self.play_axis = 2
        if self.play_axis < len(dims):
            self.play_max = dims[self.play_axis]
        self.play_idx = 1

        # Enable or disable NAXIS animation controls
        is_dc = len(dims) > 2
        self.w.next.set_enabled(is_dc)
        self.w.prev.set_enabled(is_dc)
        self.w.first.set_enabled(is_dc)
        self.w.last.set_enabled(is_dc)
        self.w.play.set_enabled(is_dc)
        self.w.stop.set_enabled(is_dc)
        self.w.interval.set_enabled(is_dc)
开发者ID:sosey,项目名称:ginga,代码行数:60,代码来源:MultiDim.py

示例4: build_gui

    def build_gui(self, container):
        super(SPCAM, self).build_gui(container)

        vbox = self.w.vbox

        fr = Widgets.Frame("Flats")

        captions = [
            ("Use flats", 'checkbutton'),
            ("Flat dir:", 'label', 'flat_dir', 'entry'),
            ("Load Flats", 'button'),
            ]
        w, b = Widgets.build_info(captions)
        self.w.update(b)

        b.flat_dir.set_length(512)
        b.flat_dir.set_text(self.settings.get('flat_dir', ''))
        b.load_flats.add_callback('activated', self.load_flats_cb)
        b.use_flats.set_tooltip("Flat field tiles as they arrive")
        use_flats = self.settings.get('use_flats', False)
        b.use_flats.set_state(use_flats)
        b.flat_dir.set_tooltip("Directory containing flat field tiles")
        b.load_flats.set_tooltip("Load flat field tiles from directory")

        fr.set_widget(w)
        vbox.add_widget(fr, stretch=0)
开发者ID:naojsoft,项目名称:naojutils,代码行数:26,代码来源:SPCAM.py

示例5: build_params

    def build_params(self, paramlst):
        # construct a set of widgets for the parameters
        captions = []
        for param in paramlst:
            title = param.get('time', param.name)

            captions.append((title+':', 'label', param.name, 'entry'))

        w, b = Widgets.build_info(captions)

        # fill with default values and tool tips
        for param in paramlst:
            name = param.name

            # if we have a cached value for the parameter, use it
            if self.params.has_key(name):
                value = self.params[name]
                b[name].set_text(str(value))

            # otherwise initialize to the default value, if available
            elif param.has_key('default'):
                value = param.default
                b[name].set_text(str(value))
                self.params[name] = value

            if param.has_key('description'):
                b[name].set_tooltip(param.description)

            b[name].add_callback('activated', self._value_changed_cb)
            
        self.paramlst = paramlst
        self.widgets = b

        return w
开发者ID:kerohiko,项目名称:ginga,代码行数:34,代码来源:ParamSet.py

示例6: build_gui

    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 may be called many times as the plugin is opened and
        closed for modal operations.  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("Instructions")
        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)
开发者ID:AlexaVillaume,项目名称:ginga,代码行数:59,代码来源:MyLocalPlugin.py

示例7: build_gui

    def build_gui(self, container):
        vbox = Widgets.VBox()
        
        self.msgFont = self.fv.getFont("fixedFont", 12)
        tw = Widgets.TextArea(wrap=False, editable=False)
        tw.set_font(self.msgFont)
        tw.set_limit(self.histlimit)
        self.tw = tw
         
        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)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
开发者ID:ChrisBeaumont,项目名称:ginga,代码行数:54,代码来源:Log.py

示例8: build_gui

    def build_gui(self, container):
        if not have_samp:
            raise GingaPlugin.PluginError("To run this plugin you need to install the astropy.vo.samp module")

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

        msgFont = self.fv.getFont("sansFont", 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(msgFont)
        self.tw = tw

        fr = Widgets.Frame("Instructions")
        fr.set_widget(tw)
        vbox.add_widget(fr, stretch=0)
        
        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)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns, stretch=0)

        container.add_widget(vbox, stretch=1)
开发者ID:ChrisBeaumont,项目名称:ginga,代码行数:49,代码来源:SAMP.py

示例9: build_gui

    def build_gui(self, container):
        assert have_pyfits == True, \
               Exception("Please install astropy/pyfits to use this plugin")

        vbox1 = Widgets.VBox()
        vbox1.set_border_width(4)
        vbox1.set_spacing(4)

        self.msgFont = self.fv.getFont("sansFont", 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(self.msgFont)
        self.tw = tw

        fr = Widgets.Frame("Instructions")
        fr.set_widget(tw)
        vbox1.add_widget(fr, stretch=0)
        
        fr = Widgets.Frame("HDU")

        captions = [("Num HDUs:", 'label', "Num HDUs", 'llabel'),
                    ("Choose HDU", 'spinbutton')]
        w, b = Widgets.build_info(captions)
        self.w.update(b)
        self.w.numhdu = b.num_hdus
        self.w.hdu = b.choose_hdu
        self.w.hdu.set_tooltip("Choose which HDU to view")
        self.w.hdu.add_callback('value-changed', self.set_hdu_cb)
        
        fr.set_widget(w)
        vbox1.add_widget(fr, stretch=0)

        fr = Widgets.Frame("NAXIS")
        self.naxisfr = fr
        vbox1.add_widget(fr, stretch=0)

        # FIX: somehow this is not working correctly with Qt 
        vbox1.add_widget(Widgets.Label(''), stretch=1)

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

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

        container.add_widget(vbox1, stretch=1)
开发者ID:kerohiko,项目名称:ginga,代码行数:48,代码来源:MultiDim.py

示例10: build_gui

    def build_gui(self, container):

        vbox = Widgets.VBox()
        
        self.msgFont = self.fv.getFont("fixedFont", 12)
        tw = Widgets.TextArea(wrap=False, editable=False)
        tw.set_font(self.msgFont)
        self.tw = tw
        self.history = []
        self.histmax = 10
         
        sw = Widgets.ScrollArea()
        sw.set_widget(self.tw)

        vbox.add_widget(sw, stretch=1)

        captions = (('Local plugin:', 'label', 'Local plugin', 'entry',
                     'Reload', 'button'),
                    ('Global plugin:', 'label', 'Global plugin', 'entry',
                     'ReloadG', 'button'),
                    )
        w, b = Widgets.build_info(captions)
        self.w.update(b)
        b.local_plugin.set_tooltip("Name of a local plugin to reload")
        b.local_plugin.set_length(14)
        b.reload.add_callback('activated', self.reload_local_cb)
        b.global_plugin.set_tooltip("Name of a global plugin to reload")
        b.global_plugin.set_length(14)
        b.reloadg.add_callback('activated', self.reload_global_cb)
        vbox.add_widget(w, stretch=1)
        
        self.entry = Widgets.TextEntry()
        vbox.add_widget(self.entry, stretch=0)
        self.entry.add_callback('activated', self.command_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)
开发者ID:jeanconn,项目名称:ginga,代码行数:46,代码来源:Debug.py

示例11: add_channel

    def add_channel(self, viewer, chinfo):
        panimage = self._create_pan_image()
        chname = chinfo.name
        
        iw = panimage.get_widget()
        # wrap widget
        iw = Widgets.wrap(iw)
        self.nb.add_widget(iw)
        index = self.nb.index_of(iw)
        paninfo = Bunch.Bunch(panimage=panimage, widget=iw,
                              pancompass=None, panrect=None,
                              nbindex=index)
        self.channel[chname] = paninfo

        # Extract RGBMap object from main image and attach it to this
        # pan image
        fitsimage = chinfo.fitsimage
        rgbmap = fitsimage.get_rgbmap()
        panimage.set_rgbmap(rgbmap, redraw=False)
        rgbmap.add_callback('changed', self.rgbmap_cb, panimage)
        
        fitsimage.copy_attributes(panimage, ['cutlevels'])
        fitsimage.add_callback('image-set', self.new_image_cb, chinfo, paninfo)
        fitsimage.add_callback('redraw', self.panset, chinfo, paninfo)

        fitssettings = fitsimage.get_settings()
        pansettings = panimage.get_settings()
        
        zoomsettings = ['zoom_algorithm', 'zoom_rate',
                        'scale_x_base', 'scale_y_base']
        fitssettings.shareSettings(pansettings, zoomsettings)
        for key in zoomsettings:
            pansettings.getSetting(key).add_callback('set', self.zoom_cb,
                                                     fitsimage, chinfo, paninfo)

        xfrmsettings = ['flip_x', 'flip_y', 'swap_xy', 'rot_deg']
        fitssettings.shareSettings(pansettings, xfrmsettings)
        for key in xfrmsettings:
            pansettings.getSetting(key).add_callback('set', self.redraw_cb,
                                                     fitsimage, chinfo, paninfo, 0)
            
        fitssettings.shareSettings(pansettings, ['cuts'])
        pansettings.getSetting('cuts').add_callback('set', self.redraw_cb,
                                                    fitsimage, chinfo, paninfo, 1)
        self.logger.debug("channel %s added." % (chinfo.name))
开发者ID:glue-viz,项目名称:ginga,代码行数:45,代码来源:Pan.py

示例12: build_gui

    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)
        btns.add_widget(Widgets.Label(''), stretch=1)
        vbox.add_widget(btns)

        container.add_widget(vbox, stretch=1)
开发者ID:AlexaVillaume,项目名称:ginga,代码行数:39,代码来源:RC.py

示例13: build_naxis

    def build_naxis(self, dims):
        # build a vbox of NAXIS controls
        captions = [("NAXIS1:", 'label', 'NAXIS1', 'llabel'),
                    ("NAXIS2:", 'label', 'NAXIS2', 'llabel')]

        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', title, 'llabel'))
            else:
                captions.append((title+':', 'label', title, 'llabel',
                                 "Choose %s" % (title), 'spinbutton'))

        w, b = Widgets.build_info(captions)
        self.w.update(b)
        for n in xrange(0, len(dims)):
            key = 'naxis%d' % (n+1)
            lbl = b[key]
            maxn = int(dims[n])
            lbl.set_text("%d" % maxn)
            slkey = 'choose_'+key
            if b.has_key(slkey):
                slider = b[slkey]
                lower = 1
                upper = maxn
                slider.set_limits(lower, upper, incr_value=1)
                slider.set_value(lower)
                #slider.set_digits(0)
                #slider.set_wrap(True)
                slider.add_callback('value-changed', self.set_naxis_cb, n)

        # Add vbox of naxis controls to gui
        self.naxisfr.set_widget(w)
开发者ID:kerohiko,项目名称:ginga,代码行数:38,代码来源:MultiDim.py

示例14: build_gui

    def build_gui(self, container):
        # Create a scrollable area
        sw = Widgets.ScrollArea()

        # Create a vertical box into which our widgets will be placed
        vbox = Widgets.VBox()
        vbox.set_border_width(4)
        vbox.set_spacing(2)

        # Place the vertical box inside the scrollable area
        sw.set_widget(vbox)

        # Create a frame for the program name and the OB ID.
        prog_ob_frame = Widgets.Frame()
        # Create some label widgets to display the program and the OB
        # ID
        captions = (('Program:', 'label', 'Program', 'label',
                     'OB ID:', 'label', 'OB ID', 'label',
                     'Dup All OB', 'checkbutton'),)
        w, b = Widgets.build_info(captions, orientation='vertical')
        self.w_prog_ob = b
        # Set the inital text for the program and OB ID to N/A
        b.program.set_text('N/A')
        b.ob_id.set_text('N/A')
        b.dup_all_ob.set_state(False)

        # Place the label widgets into the frame
        prog_ob_frame.set_widget(w)
        # Add the frame to the vertical box
        vbox.add_widget(prog_ob_frame, stretch=0)

        # Create a frame for the resolution comments
        comment_frame = Widgets.Frame('OB Comments')

        # Create a text area into which comments can be entered
        captions = (('Comment entry', 'textarea'),)
        w, b = Widgets.build_info(captions, orientation='vertical')
        self.w_comments = b

        # Place the text area into the frame
        comment_frame.set_widget(w)
        # Add the frame to the vertical box
        vbox.add_widget(comment_frame, stretch=0)

        # Create a frame for the data quality buttons
        data_button_frame = Widgets.Frame()
        # Create some radio buttons to describe the data quality
        buttonList = []
        self.qualityButtonVals = {}
        for i, name in enumerate(self.qualityButtons):
            buttonList.append(name)
            buttonList.append('radiobutton')
            self.qualityButtonVals[name] = len(self.qualityButtons) - i
        captions = (('Data Quality:', 'label'), buttonList)
        w, b = Widgets.build_info(captions, orientation='vertical')
        self.w_data_buttons = b

        # Set the callback method for the data quality radio buttons
        for name in self.qualityButtons:
            b[name.lower()].add_callback('activated', self.rate_cb, self.qualityButtonVals[name]);

        # Put the quality buttons into a QButtonGroup so that we set
        # up the buttons as "exclusive", i.e., only one button can be
        # selected at a time.
        self.data_bg = QtGui.QButtonGroup()
        for name in self.qualityButtons:
            self.data_bg.addButton(self.w_data_buttons[name.lower()].get_widget())

        # Place the radio buttons into the frame
        data_button_frame.set_widget(w)
        # Add the frame to the vertical box
        vbox.add_widget(data_button_frame, stretch=0)

        # Create a frame for the clear button
        clear_button_frame = Widgets.Frame()
        # Create the Clear button
        captions = (('Clear', 'button'),)
        w, b = Widgets.build_info(captions, orientation='vertical')
        self.w_clear = b

        # Connect the button-click event to the callback method
        b.clear.add_callback('activated', self.clear_cb)

        # Place the radio buttons into the frame
        clear_button_frame.set_widget(w)
        # Add the frame to the vertical box
        vbox.add_widget(clear_button_frame, stretch=0)

        # Create a frame for the slider bar
        slider_frame = Widgets.Frame()
        captions = (('ob list index', 'hscale'),)
        w, b = Widgets.build_info(captions, orientation='vertical')
        self.w_slider = b
        b.ob_list_index.set_limits(0, 1)
        b.ob_list_index.set_tracking(True)
        b.ob_list_index.add_callback('value-changed', self.ob_list_index_cb)
        # Place the slider bar into the frame
        slider_frame.set_widget(w)
        # Add the frame to the vertical box
        vbox.add_widget(slider_frame, stretch=0)
#.........这里部分代码省略.........
开发者ID:jkunimune15,项目名称:qplan,代码行数:101,代码来源:Resolution.py

示例15: build_gui

    def build_gui(self, container):
        top = Widgets.VBox()
        top.set_border_width(4)

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

        msgFont = self.fv.getFont('sansFont', 12)
        tw = Widgets.TextArea(wrap=True, editable=False)
        tw.set_font(msgFont)
        self.tw = tw

        fr = Widgets.Frame('Instructions')
        vbox2 = Widgets.VBox()
        vbox2.add_widget(tw)
        vbox2.add_widget(Widgets.Label(''), stretch=1)
        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

        fr = Widgets.Frame('Background Selection')
        captions = (('Type:', 'label', 'BG type', 'combobox'), )
        w, b = Widgets.build_info(captions)
        self.w.update(b)

        combobox = b.bg_type
        for name in self._bgtype_options:
            combobox.append_text(name)
        b.bg_type.set_index(self._bgtype_options.index(self.bgtype))
        b.bg_type.widget.activated[str].connect(self.set_bgtype)

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

        fr = Widgets.Frame('Attributes')
        vbox2 = Widgets.VBox()
        self.w.bgtype_attr_vbox = Widgets.VBox()
        vbox2.add_widget(self.w.bgtype_attr_vbox, stretch=1)
        fr.set_widget(vbox2)
        vbox.add_widget(fr, stretch=0)

        captions = (('Background Value:', 'label',
                     'Background Value', 'entry'), )
        w, b = Widgets.build_info(captions, orientation=self.orientation)
        self.w.update(b)

        b.background_value.set_tooltip('Background value')
        b.background_value.set_text(str(self.bgval))
        b.background_value.widget.editingFinished.connect(self.set_constant_bg)
        b.background_value.widget.setReadOnly(True)
        b.background_value.widget.setEnabled(True)
        b.background_value.widget.setStyleSheet(
            'QLineEdit{background: white;}')

        vbox.add_widget(w, stretch=0)

        captions = (('Load Parameters', 'button',
                     'Save Parameters', 'button',
                     'Subtract', 'button'), )
        w, b = Widgets.build_info(captions, orientation=self.orientation)
        self.w.update(b)

        b.load_parameters.set_tooltip('Load previously saved parameters')
        b.load_parameters.widget.clicked.connect(self.load_params)

        b.save_parameters.set_tooltip('Save background subtraction parameters')
        b.save_parameters.widget.clicked.connect(self.save_params)

        b.subtract.set_tooltip('Subtract background')
        b.subtract.widget.clicked.connect(self.sub_bg)
        b.subtract.widget.setEnabled(False)

        vbox.add_widget(w, 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)

        # Populate default attributes frame
        self.set_bgtype(self.bgtype)

        self.gui_up = True
开发者ID:stscieisenhamer,项目名称:stginga,代码行数:91,代码来源:BackgroundSub.py


注:本文中的ginga.misc.Widgets类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。