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


Python gtkw.GtkHelp类代码示例

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


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

示例1: get_rgb_image_as_pixbuf

    def get_rgb_image_as_pixbuf(self):
        arr8 = self.renderer.get_surface_as_array(order='RGB')
        daht, dawd = arr8.shape[:2]
        rgb_buf = arr8.tobytes(order='C')
        pixbuf = GtkHelp.pixbuf_new_from_data(rgb_buf, gtk.gdk.COLORSPACE_RGB,
                                              False, 8, dawd, daht, dawd * 3)

        return pixbuf
开发者ID:,项目名称:,代码行数:8,代码来源:

示例2: get_plain_image_as_pixbuf

    def get_plain_image_as_pixbuf(self):
        #arr = self.getwin_array(order=self._rgb_order)
        arr = self.getwin_array(order='RGB')

        try:
            pixbuf = GtkHelp.pixbuf_new_from_array(arr, gtk.gdk.COLORSPACE_RGB,
                                                  8)
        except Exception as e:
            self.logger.warning("Error making pixbuf: %s" % (str(e)))
            # pygtk might have been compiled without numpy support
            daht, dawd, depth = arr.shape
            rgb_buf = self._get_rgbbuf(arr)
            pixbuf = GtkHelp.pixbuf_new_from_data(rgb_buf,
                                                  gtk.gdk.COLORSPACE_RGB,
                                                  False, 8, dawd, daht, dawd*3)

        return pixbuf
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: build_gui

    def build_gui(self, container):
        vbox1 = gtk.VBox()

        self.msgFont = self.fv.getFont("sansFont", 14)
        tw = gtk.TextView()
        tw.set_wrap_mode(gtk.WRAP_WORD)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.set_editable(False)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.modify_font(self.msgFont)
        self.tw = tw

        fr = gtk.Frame(label=" Instructions ")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        fr.set_label_align(0.1, 0.5)
        fr.add(tw)
        fr.show_all()
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)
        
        fr = gtk.Frame(label="HDU")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        fr.set_label_align(0.5, 0.5)

        captions = [("Num HDUs", 'label'), ("Choose HDU", 'spinbutton')]
        w, b = GtkHelp.build_info(captions)
        self.w.update(b)
        self.w.numhdu = b.num_hdus
        self.w.hdu = b.choose_hdu
        self.w.hdu.set_tooltip_text("Choose which HDU to view")
        if not gtksel.have_gtk3:
            self.w.hdu.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
        self.w.hdu.connect('value-changed', self.set_hdu_cb)
        
        fr.add(w)
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        fr = gtk.Frame(label="NAXIS")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        fr.set_label_align(0.5, 0.5)

        self.naxisfr = fr
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        btns = gtk.HButtonBox()
        btns.set_layout(gtk.BUTTONBOX_START)
        btns.set_spacing(3)

        btn = gtk.Button("Close")
        btn.connect('clicked', lambda w: self.close())
        btns.add(btn)
        vbox1.pack_start(btns, padding=4, fill=True, expand=False)

        vbox1.show_all()
        container.pack_start(vbox1, padding=0, fill=True, expand=False)
开发者ID:PaulPrice,项目名称:ginga,代码行数:56,代码来源:MultiDim.py

示例4: build_gui

    def build_gui(self, container):
        vbox1 = gtk.VBox()

        self.msgFont = self.fv.getFont("sansFont", 14)
        tw = gtk.TextView()
        tw.set_wrap_mode(gtk.WRAP_WORD)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.set_editable(False)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.modify_font(self.msgFont)
        self.tw = tw

        fr = gtk.Frame(" Instructions ")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        fr.set_label_align(0.1, 0.5)
        fr.add(tw)
        fr.show_all()
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        fr = gtk.Frame("Ruler")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        fr.set_label_align(0.5, 0.5)

        captions = (("Units", "combobox"),)
        w, b = GtkHelp.build_info(captions)
        self.w = b

        combobox = b.units
        index = 0
        for name in self.unittypes:
            combobox.insert_text(index, name)
            index += 1
        index = self.unittypes.index(self.units)
        combobox.set_active(index)
        combobox.sconnect("changed", lambda w: self.set_units())

        fr.add(w)
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        btns = gtk.HButtonBox()
        btns.set_layout(gtk.BUTTONBOX_START)
        btns.set_spacing(3)
        btns.set_child_size(15, -1)

        btn = gtk.Button("Close")
        btn.connect("clicked", lambda w: self.close())
        btns.add(btn)
        vbox1.pack_start(btns, padding=4, fill=True, expand=False)

        vbox1.show_all()
        container.pack_start(vbox1, padding=0, fill=True, expand=False)
开发者ID:RayPlante,项目名称:ginga,代码行数:53,代码来源:Ruler.py

示例5: gui_add_channels

    def gui_add_channels(self):
        captions = (('Prefix', 'entry'),
                    ('Number', 'spinbutton'),
                    ('Workspace', 'combobox'),
                    #('Base on Channel', 'combobox'),
                    #('Copy Settings', 'button'),
                    #'Share Settings', 'button'),
                    #('Cancel', 'button', 'Ok', 'button')
                    )
        w, b = GtkHelp.build_info(captions)
        b.prefix.set_text("Image")
        adj = b.number.get_adjustment()
        lower = 1
        upper = 12
        adj.configure(lower, lower, upper, 1, 1, 0)
        adj.set_value(lower)

        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.set_active(idx)

        ## cbox = b.base_on_channel
        ## names = self.get_channelNames()
        ## for name in names:
        ##     cbox.append_text(name)

        ## prefs = self.prefs.getSettings('channel_Image')
        ## d = prefs.getDict()

        ## cbox = b.copy_settings
        ## for name in d.keys():
        ##     cbox.append_text(name)

        ## cbox = b.share_settings
        ## for name in d.keys():
        ##     cbox.append_text(name)

        dialog = GtkHelp.Dialog("Add Channels",
                                gtk.DIALOG_DESTROY_WITH_PARENT,
                                [['Cancel', 0], ['Ok', 1]],
                                lambda w, rsp: self.add_channels_cb(w, rsp,
                                                                    b, names))
        box = dialog.get_content_area()
        box.pack_start(w, True, True, 0)
        dialog.show_all()
        self._cur_dialogs.append(dialog)
开发者ID:jochym,项目名称:ginga,代码行数:52,代码来源:GingaGtk.py

示例6: scroll_event

    def scroll_event(self, widget, event):
        # event.button, event.x, event.y
        x = event.x; y = event.y

        degrees, direction = GtkHelp.get_scroll_info(event)
        self.logger.debug("scroll deg=%f direction=%f" % (
            degrees, direction))

        data_x, data_y = self.get_data_xy(x, y)
        self.last_data_x, self.last_data_y = data_x, data_y

        return self.make_ui_callback('scroll', direction, degrees,
                                  data_x, data_y)
开发者ID:saimn,项目名称:ginga,代码行数:13,代码来源:ImageViewGtk.py

示例7: scroll_event

    def scroll_event(self, widget, event):
        # event.button, event.x, event.y
        x = event.x
        y = event.y
        self.last_win_x, self.last_win_y = x, y

        degrees, direction = GtkHelp.get_scroll_info(event)
        self.logger.debug("scroll deg=%f direction=%f" % (
            degrees, direction))

        data_x, data_y = self.check_cursor_location()

        return self.make_ui_callback('scroll', direction, degrees,
                                     data_x, data_y)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例8: gui_add_ws

    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 = GtkHelp.build_info(captions)

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

        cbox = b.workspace_type
        cbox.append_text("Tabs")
        cbox.append_text("Grid")
        #cbox.append_text("MDI")
        cbox.set_active(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.set_active(idx)

        b.channel_prefix.set_text("Image")
        adj = b.number_of_channels.get_adjustment()
        lower = 0
        upper = 12
        adj.configure(lower, lower, upper, 1, 1, 0)
        adj.set_value(4)

        dialog = GtkHelp.Dialog("Add Workspace",
                                gtk.DIALOG_DESTROY_WITH_PARENT,
                                [['Cancel', 0], ['Ok', 1]],
                                lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        box.pack_start(w, expand=True, fill=True)
        dialog.show_all()
        self._cur_dialogs.append(dialog)
开发者ID:jochym,项目名称:ginga,代码行数:47,代码来源:GingaGtk.py

示例9: build_gui

    def build_gui(self, container):
        self.msgFont = pango.FontDescription("Fixed 10")
        tw = gtk.TextView()
        tw.set_wrap_mode(gtk.WRAP_NONE)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.set_editable(False)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.modify_font(self.msgFont)
        self.tw = tw
        self.buf = self.tw.get_buffer()
         
        sw = gtk.ScrolledWindow()
        sw.set_border_width(2)
        sw.set_policy(gtk.POLICY_AUTOMATIC,
                      gtk.POLICY_AUTOMATIC)
        sw.add(self.tw)

        container.pack_start(sw, fill=True, expand=True)

        hbox = gtk.HBox()

        lbl = gtk.Label('Level:')
        hbox.pack_start(lbl, fill=False, expand=False)
        combobox = GtkHelp.combo_box_new_text()
        for (name, level) in self.levels:
            combobox.append_text(name)
        combobox.set_active(1)
        combobox.sconnect('changed', self.set_loglevel_cb)
        hbox.pack_start(combobox, fill=False, expand=False,
                        padding=4)
        
        lbl = gtk.Label('History:')
        hbox.pack_start(lbl, fill=False, expand=False)
        spinbox = GtkHelp.SpinButton()
        adj = spinbox.get_adjustment()
        adj.configure(self.histlimit, 100, self.histmax, 10, 100, 0)
        spinbox.sconnect('value-changed', self.set_history_cb)
        hbox.pack_start(spinbox, fill=False, expand=False,
                        padding=4)
        
        btn = gtk.Button("Clear")
        btn.connect('clicked', lambda w: self.clear())
        hbox.pack_end(btn, fill=False, expand=False)
        container.pack_end(hbox, fill=False, expand=False)
开发者ID:adrn,项目名称:ginga,代码行数:46,代码来源:Log.py

示例10: build_naxis

    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 = GtkHelp.build_info(captions)
        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]
                adj = slider.get_adjustment()
                lower = 1
                upper = maxn
                adj.configure(lower, lower, upper, 1, 1, 0)
                adj.set_value(lower)
                slider.set_digits(0)
                slider.set_wrap(True)
                slider.set_snap_to_ticks(True)
                slider.connect('value-changed', self.set_naxis_cb, n)
                if not gtksel.have_gtk3:
                    slider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)

        # Add vbox of naxis controls to gui
        try:
            oldv = self.naxisfr.get_child()
            self.naxisfr.remove(oldv)
        except:
            pass
        self.naxisfr.add(w)
        self.naxisfr.show_all()
开发者ID:PaulPrice,项目名称:ginga,代码行数:46,代码来源:MultiDim.py

示例11: build_gui

    def build_gui(self, container):
        self.msgFont = self.fv.getFont("fixedFont", 10)
        tw = gtk.TextView()
        tw.set_wrap_mode(gtk.WRAP_NONE)
        tw.set_left_margin(4)
        tw.set_right_margin(4)
        tw.set_editable(False)
        tw.modify_font(self.msgFont)
        self.tw = tw
        self.buf = self.tw.get_buffer()
         
        sw = gtk.ScrolledWindow()
        sw.set_border_width(2)
        sw.set_policy(gtk.POLICY_AUTOMATIC,
                      gtk.POLICY_AUTOMATIC)
        sw.add(self.tw)

        container.pack_start(sw, fill=True, expand=True)

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

        combobox = b.level
        for (name, level) in self.levels:
            combobox.append_text(name)
        combobox.set_active(1)
        combobox.sconnect('changed', self.set_loglevel_cb)
        combobox.set_tooltip_text("Set the logging level")
        
        spinbox = b.history
        adj = spinbox.get_adjustment()
        adj.configure(self.histlimit, 100, self.histmax, 10, 100, 0)
        spinbox.sconnect('value-changed', self.set_history_cb)
        spinbox.set_tooltip_text("Set the logging history line limit")
        
        btn = b.auto_scroll
        btn.set_tooltip_text("Scroll the log window automatically")

        btn = b.clear
        btn.connect('clicked', lambda w: self.clear())
        btn.set_tooltip_text("Clear the log history")
        container.pack_end(w, fill=False, expand=False)
开发者ID:Rbeaty88,项目名称:ginga,代码行数:45,代码来源:Log.py

示例12: build_gui

    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

        vbox1 = gtk.VBox()

        fr = gtk.Frame("IRAF")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        fr.set_label_align(0.5, 0.5)

        captions = [("Control", 'hbox'),
                    ("Channel", 'label'),
                    ]
        w, b = GtkHelp.build_info(captions)
        fr.add(w)
        self.w = b
        self.w.mode_d = {}
        btn = GtkHelp.RadioButton(group=None, label="Ginga")
        btn.sconnect('toggled', lambda w: self.switchMode('ginga'))
        self.w.mode_d['ginga'] = btn
        self.w.control.pack_start(btn, padding=4, fill=False, expand=False)
        btn = GtkHelp.RadioButton(group=btn, label="IRAF")
        btn.sconnect('toggled', lambda w: self.switchMode('iraf'))
        self.w.mode_d['iraf'] = btn
        self.w.control.pack_start(btn, padding=4, fill=False, expand=False)
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        fr = gtk.Frame("Frame/Channel")
        fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        fr.set_label_align(0.5, 0.5)

        lbl = gtk.Label("")
        self.w.frch = lbl
        fr.add(lbl)
        vbox1.pack_start(fr, padding=4, fill=True, expand=False)

        vbox1.show_all()
        container.pack_start(vbox1, padding=0, fill=True, expand=False)
开发者ID:adrn,项目名称:ginga,代码行数:45,代码来源:IRAF.py

示例13: build_gui

    def build_gui(self, container):
        width, height = 300, 300
        cm, im = self.fv.cm, self.fv.im

        tg = ImageViewCanvasGtk.ImageViewCanvas(logger=self.logger)
        tg.configure(200, 200)
        tg.enable_autozoom('on')
        tg.enable_autocuts('override')
        tg.enable_auto_orient(True)
        tg.set_bg(0.7, 0.7, 0.7)
        tg.defer_redraw = False
        self.thumb_generator = tg

        sw = gtk.ScrolledWindow()
        sw.set_border_width(2)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        # Create thumbnails pane
        vbox = gtk.VBox(spacing=14)
        vbox.set_border_width(4)
        self.w.thumbs = vbox
        sw.add_with_viewport(vbox)
        sw.show_all()
        self.w.thumbs_scroll = sw
        self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)
        #nb.connect("size_allocate", self.thumbpane_resized_cb)

        # TODO: should this even have it's own scrolled window?
        cw = container.get_widget()
        cw.pack_start(sw, fill=True, expand=True)

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

        b.auto_scroll.set_tooltip_text(
            "Scroll the thumbs window when new images arrive")
        b.clear.set_tooltip_text("Remove all current thumbnails")
        b.clear.connect("clicked", lambda w: self.clear())
        auto_scroll = self.settings.get('auto_scroll', True)
        b.auto_scroll.set_active(auto_scroll)

        cw.pack_start(w, fill=True, expand=False)
        self.gui_up = True
开发者ID:AlexaVillaume,项目名称:ginga,代码行数:44,代码来源:Thumbs.py

示例14: _setup_params

    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 = GtkHelp.build_info(captions)

        # remove old widgets
        children = container.get_children()
        for child in children:
            container.remove(child)

        # add new widgets
        container.pack_start(w, fill=False, expand=False)
        container.show_all()
        return b
开发者ID:adrn,项目名称:ginga,代码行数:21,代码来源:Catalogs.py

示例15: build_gui

    def build_gui(self, container):
        width, height = 300, 300
        cm, im = self.fv.cm, self.fv.im

        tg = FitsImageGtk.FitsImageGtk(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 = gtk.ScrolledWindow()
        sw.set_border_width(2)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        # Create thumbnails pane
        vbox = gtk.VBox(spacing=14)
        vbox.set_border_width(4)
        self.w.thumbs = vbox
        sw.add_with_viewport(vbox)
        sw.show_all()
        self.w.thumbs_scroll = sw
        self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized)
        #nb.connect("size_allocate", self.thumbpane_resized)

        # TODO: should this even have it's own scrolled window?
        container.pack_start(sw, fill=True, expand=True)

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

        self.w.tooltips.set_tip(b.auto_scroll,
                                "Scroll the thumbs window when new images arrive")
        autoScroll = self.settings.get('autoScroll', True)
        b.auto_scroll.set_active(autoScroll)

        container.pack_start(w, fill=True, expand=False)
开发者ID:albertoconti,项目名称:ginga,代码行数:39,代码来源:Thumbs.py


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