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


Python GtkHelp._name_mangle方法代码示例

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


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

示例1: _create_info_window

# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import _name_mangle [as 别名]
    def _create_info_window(self):
        sw = gtk.ScrolledWindow()
        sw.set_border_width(2)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        vbox = gtk.VBox()
        captions = (('Name', 'label'), ('Object', 'label'),
                    ('X', 'label'), ('Y', 'label'), ('Value', 'label'),
                    ('RA', 'label'), ('DEC', 'label'),
                    ('Equinox', 'label'), ('Dimensions', 'label'),
                    #('Slices', 'label', 'MultiDim', 'button'),
                    ('Min', 'label'), ('Max', 'label'),
                    ('Zoom', 'label'), 
                    ('Cut Low', 'xlabel', '@Cut Low', 'entry'),
                    ('Cut High', 'xlabel', '@Cut High', 'entry'),
                    ('Auto Levels', 'button', 'Cut Levels', 'button'), 
                    ('Cut New', 'label'), ('Zoom New', 'label'), 
                    ('Preferences', 'button'), 
                    )

        w, b = GtkHelp.build_info(captions)
        # TODO: need a more general solution to gtk labels resizing their
        # parent window
        b.object.set_width_chars(12)
        b.cut_levels.set_tooltip_text("Set cut levels manually")
        b.auto_levels.set_tooltip_text("Set cut levels by algorithm")
        b.cut_low.set_tooltip_text("Set low cut level (press Enter)")
        b.cut_high.set_tooltip_text("Set high cut level (press Enter)")
        b.preferences.set_tooltip_text("Set preferences for this channel")
        #b.multidim.set_tooltip_text("View other HDUs or slices")
        vbox.pack_start(w, padding=0, fill=True, expand=True)

        # Convenience navigation buttons
        btns = gtk.HButtonBox()
        btns.set_layout(gtk.BUTTONBOX_CENTER)
        btns.set_spacing(3)
        if not gtksel.have_gtk3:
            btns.set_child_size(15, -1)

        bw = Bunch.Bunch()
        for tup in (
            #("Load", 'button', 'fits_open_48', "Open an image file"),
            ("Prev", 'button', 'prev_48', "Go to previous image"),
            ("Next", 'button', 'next_48', "Go to next image"),
            ("Zoom In", 'button', 'zoom_in_48', "Zoom in"),
            ("Zoom Out", 'button', 'zoom_out_48', "Zoom out"),
            ("Zoom Fit", 'button', 'zoom_fit_48', "Zoom to fit window size"),
            ("Zoom 1:1", 'button', 'zoom_100_48', "Zoom to 100% (1:1)"),
            #("Quit", 'button', 'exit_48', "Quit the program"),
            ):

            btn = self.fv.make_button(*tup)
            name = tup[0]
            if tup[3]:
                btn.set_tooltip_text(tup[3])
                
            bw[GtkHelp._name_mangle(name, pfx='btn_')] = btn
            btns.pack_end(btn, padding=4)

        #self.w.btn_load.connect("clicked", lambda w: self.gui_load_file())
        bw.btn_prev.connect("clicked", lambda w: self.fv.prev_img())
        bw.btn_next.connect("clicked", lambda w: self.fv.next_img())
        bw.btn_zoom_in.connect("clicked", lambda w: self.fv.zoom_in())
        bw.btn_zoom_out.connect("clicked", lambda w: self.fv.zoom_out())
        bw.btn_zoom_fit.connect("clicked", lambda w: self.fv.zoom_fit())
        bw.btn_zoom_1_1.connect("clicked", lambda w: self.fv.zoom_1_to_1())

        vbox.pack_start(btns, padding=4, fill=True, expand=False)
        vbox.show_all()

        sw.add_with_viewport(vbox)
        #sw.set_size_request(-1, 420)
        sw.show_all()
        return sw, b
开发者ID:PaulPrice,项目名称:ginga,代码行数:76,代码来源:Info.py


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