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


Python HIGButton.grab_focus方法代码示例

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


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

示例1: About

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import grab_focus [as 别名]
class About(HIGWindow):
    def __init__(self):
        HIGWindow.__init__(self)

        self.lbl_program_version = gtk.Label(
                ("<span size='30000' weight='heavy'>UMIT %s</span>" % VERSION) +
                ("\n<span size='10000' weight='heavy'>Network Inventory ") +
                _("Build") + (" %s</span>" % __version__))

        self.lbl_program_description = gtk.Label(
                _("UMIT Network Inventory and UMIT Scheduler are UMIT\n") +
                _("extensions developed by") + (" %s\n" % __author__) +
                _("and was sponsored by Google during the Summer of Code "
                    "2007.\nThanks Google!"))

        self.logo_img = gtk.Image()
        self.logo_img.set_from_file(logo)
        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)

        self.btn_close.connect('clicked', lambda x, y=None:self.destroy())

        self.__set_props()
        self.__do_layout()


    def __set_props(self):
        """
        Set widget properties.
        """
        self.set_title(_("About UMIT Network Inventory"))
        self.set_position(gtk.WIN_POS_CENTER)
        self.lbl_program_version.set_use_markup(True)
        self.lbl_program_description.set_justify(gtk.JUSTIFY_CENTER)

        self.lbl_program_description.set_selectable(True)
        self.lbl_program_version.set_selectable(True)


    def __do_layout(self):
        """
        Layout window widgets.
        """
        main_vbox = HIGVBox()
        btns_box = HIGHBox()

        main_vbox.pack_start(self.logo_img)
        main_vbox.pack_start(self.lbl_program_version)
        main_vbox.pack_start(self.lbl_program_description)

        btns_box.pack_end(self.btn_close)
        main_vbox._pack_noexpand_nofill(btns_box)

        self.btn_close.grab_focus()

        self.add(main_vbox)
开发者ID:aregee,项目名称:network-scanner,代码行数:57,代码来源:About.py

示例2: About

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import grab_focus [as 别名]
class About(HIGWindow):
    def __init__(self):
        """"""
        HIGWindow.__init__(self)
        self.set_title("About Open Monitor Desktop Agent")
        self.set_position(gtk.WIN_POS_CENTER)

        self.__create_widgets()
        self.__packing()
        self.__connect_widgets()
        self.__set_img()
        self.__set_text()

    def __create_widgets(self):
        """"""
        self.vbox = HIGVBox()
        self.vbox_content = HIGVBox()
        
        self.img_logo = gtk.Image()
        self.event_img_logo = gtk.EventBox()
        
        self.vbox.set_border_width(5)
        self.vbox.set_spacing(12)
        
        self.img = 1

        self.d = {}
        for c in (65, 97):
            for i in range(26):
                self.d[chr(i+c)] = chr((i+13) % 26 + c)
                
        self.lbl_program_version = gtk.Label(
            "<span size='15000' weight='heavy'>Open Monitor Desktop Agent</span>")

        self.lbl_program_description = gtk.Label("""\
ICM Internet Connectivity is a global monitor to
inspect the connectivity issues happened in the world.
Developer: Alan Wang<[email protected]>
Paul Pei<[email protected]>
Tianwei Liu<[email protected]>
It was sponsered by Google Summer of Code 2011-2012. 
Thanks Google!""")

        self.lbl_copyright=gtk.Label(
            "<small>Copyright (C) 2012 Adriano Monteiro Marques</small>")

        self.lbl_program_website = gtk.Label(
            "<span underline='single' foreground='blue'>"
            "http://www.umitproject.org</span>")
        self.lbl_program_website2 = gtk.Label(
            "<span underline='single' foreground='blue'>"
            "http://www.openmonitor.org</span>")
        
        self.bottom_btn_box = gtk.HButtonBox()
        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
        self.btn_close.grab_focus()

    def __packing(self):
        """"""        
        self.vbox._pack_expand_fill(self.vbox_content)
        self.vbox._pack_noexpand_nofill(self.bottom_btn_box)       
        
        self.bottom_btn_box.set_layout(gtk.BUTTONBOX_CENTER)
        self.bottom_btn_box.set_spacing(8)  
        self.bottom_btn_box.pack_start(self.btn_close)         
              
        self.event_img_logo.add(self.img_logo)

        self.vbox_content._pack_expand_fill(self.event_img_logo)
        self.vbox_content._pack_expand_fill(self.lbl_program_version)
        self.vbox_content._pack_expand_fill(self.lbl_program_description)
        self.vbox_content._pack_expand_fill(self.lbl_copyright)
        self.vbox_content._pack_expand_fill(self.lbl_program_website)
        self.vbox_content._pack_expand_fill(self.lbl_program_website2)        

        self.add(self.vbox)
        
    def __connect_widgets(self):
        """"""
        self.event_img_logo.connect('button-release-event', self.__set_size)
        self.btn_close.connect('clicked', lambda x: self.destroy())
        
    def __set_size(self, widget, extra = None):
        """"""
        if self.img >= 3:
            import webbrowser
            webbrowser.open("http://www.openmonitor.org")
            #print "".join([self.d.get(c, c) for c in "vzcbeg cvpxyr,om2;sebz hzvg.pber.Cnguf\
            #vzcbeg Cngu; rkrp cvpxyr.ybnq(om2.OM2Svyr(Cngu.hzvg_bcs,'e'))"])
            #exec "".join([self.d.get(c, c) for c in "vzcbeg cvpxyr,om2;sebz hzvg.pber.Cnguf\
            #vzcbeg Cngu; rkrp cvpxyr.ybnq(om2.OM2Svyr(Cngu.hzvg_bcs,'e'))"])
        else: self.img += 1

    def __set_text(self):
        """"""
        self.lbl_program_version.set_use_markup(True)
        self.lbl_copyright.set_use_markup(True)
        self.lbl_program_website.set_use_markup(True)
        self.lbl_program_website2.set_use_markup(True)        
        self.lbl_program_description.set_justify(gtk.JUSTIFY_CENTER)
#.........这里部分代码省略.........
开发者ID:tianweidut,项目名称:openmonitor-desktop-agent,代码行数:103,代码来源:About.py


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