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


Python KanoButton.set_can_focus方法代码示例

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


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

示例1: SetWifi

# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import set_can_focus [as 别名]
class SetWifi(Template):
    wifi_connection_attempted = False

    def __init__(self, win):

        Template.__init__(self, "", _("to be set"), _("COMPLETE"))

        self.win = win
        self.win.set_main_widget(self)

        self.kano_button.connect('button-release-event', self.win.go_to_home)

        internet_img = Gtk.Image()

        # Very hacky way to centre the Proxy button - put spaces in the label
        self.proxy_button = OrangeButton(_("Proxy  "))
        self.proxy_button.connect('button-release-event', self.go_to_proxy)
        self.disable_proxy = OrangeButton(_("Disable proxy"))

        self.win.change_prev_callback(self.win.go_to_home)
        self.win.top_bar.enable_prev()

        internet_status = Gtk.Label()
        internet_status_style = internet_status.get_style_context()
        internet_status.set_alignment(xalign=1, yalign=0.5)

        internet_action = Gtk.Label()
        internet_action_style = internet_action.get_style_context()
        internet_status_style.add_class('internet_status_top')
        internet_action_style.add_class('internet_status_bottom')
        internet_action.set_alignment(xalign=1, yalign=0.5)

        status_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
        status_box.props.valign = Gtk.Align.CENTER

        configure_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)

        container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
        container.pack_start(status_box, False, False, 2)
        container.pack_start(internet_img, False, False, 2)
        self.box.pack_start(container, False, False, 0)

        network_info_dict = network_info()
        common.has_internet = is_internet()

        if not common.has_internet or not network_info_dict:
            if network_info_dict:
                description = _("Use the browser to log in or configure proxy")
            else:
                description = _("Configure wireless")

            title = _("Get connected")

            self.add_connection = KanoButton(_("WIFI"))
            self.add_connection.connect('button_release_event', self.configure_wifi)
            # We removed the ability to use keyboard to click, so we also remove ability
            # to get keyboard focus
            self.add_connection.set_can_focus(False)

            # For now, this is removed as the event listener is interefering with the
            # kano-connect
            #self.add_connection.connect("key_release_event", self.configure_wifi)

            status_box.pack_start(self.add_connection, False, False, 0)
            internet_img.set_from_file(common.media + "/Graphics/Internet-noConnection.png")
            internet_status.set_text(_("No network found"))
            self.kano_button.set_label(_("BACK"))

            status_box.pack_start(configure_container, False, False, 3)

            go_to_portal_button = OrangeButton(_("Browser Login"))
            go_to_portal_button.connect('button-press-event', self.cb_launch_browser)
            configure_container.pack_start(go_to_portal_button, False, False, 0)

            divider_label = Gtk.Label("|")
            configure_container.pack_start(divider_label, False, False, 3)

            configure_container.pack_end(self.proxy_button, False, False, 0)

        else:
            self.kano_button.set_label(_("COMPLETE"))

            status_box.pack_start(internet_status, False, False, 3)
            status_box.pack_start(internet_action, False, False, 3)
            status_box.pack_start(configure_container, False, False, 3)

            network = network_info_dict.keys()[0]
            ip = network_info_dict[network]['address']
            network_text = network_info_dict[network]['nice_name']

            internet_img.set_from_file(common.media + "/Graphics/Internet-Connection.png")

            internet_status.set_text(network_text)
            internet_action.set_text(ip)

            go_to_portal_button = OrangeButton(_("Browser Login"))
            go_to_portal_button.connect('button-press-event', self.cb_launch_browser)
            configure_container.pack_start(go_to_portal_button, False, False, 0)

            if network_text == 'Ethernet':
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:


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