本文整理汇总了Python中kano.gtk3.buttons.KanoButton.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python KanoButton.disconnect方法的具体用法?Python KanoButton.disconnect怎么用?Python KanoButton.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.buttons.KanoButton
的用法示例。
在下文中一共展示了KanoButton.disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NetworkScreen
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import disconnect [as 别名]
#.........这里部分代码省略.........
self._connect_btn = KanoButton(_("CONNECT"))
self._connect_btn.pack_and_align()
self.connect_handler = self._connect_btn.connect(
'clicked', self._first_time_connect
)
self._connect_btn.set_sensitive(False)
self._refresh_btn = self._create_refresh_button()
# For now, show both connect and refresh buttons
buttonbox = Gtk.ButtonBox()
buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
buttonbox.set_spacing(10)
buttonbox.pack_start(self._refresh_btn, False, False, 0)
buttonbox.pack_start(self._connect_btn.align, False, False, 0)
if self._win.is_plug():
self._skip_btn = WhiteButton(_("Skip"))
buttonbox.pack_start(self._skip_btn, False, False, 0)
self._skip_btn.connect('clicked', self.skip)
else:
blank_label = Gtk.Label("")
buttonbox.pack_start(blank_label, False, False, 0)
return buttonbox
# Attached to a callback, hence the extra argument
def skip(self, skip_btn=None):
# Exit with an extreme exit code so the init-flow knows the user
# pressed SKIP
sys.exit(100)
def _set_connect_btn_status(self, connect=True):
self._connect_btn.disconnect(self.connect_handler)
if connect:
self.connect_handler = self._connect_btn.connect(
'clicked', self._first_time_connect
)
self._connect_btn.set_color('green')
self._connect_btn.set_label(_("CONNECT"))
else:
self.connect_handler = self._connect_btn.connect(
'clicked', self._launch_disconnect_thread
)
self._connect_btn.set_color('red')
self._connect_btn.set_label(_("DISCONNECT"))
def _launch_disconnect_thread(self, widget=None):
watch_cursor = Gdk.Cursor(Gdk.CursorType.WATCH)
self._win.get_window().set_cursor(watch_cursor)
self._connect_btn.start_spinner()
self._connect_btn.set_sensitive(False)
# Force the spinner to show on the window.
while Gtk.events_pending():
Gtk.main_iteration()
t = threading.Thread(target=self._threaded_disconnect)
t.start()
def _disconnect_screen(self):
self._win.remove_main_widget()
title = _("Disconnect complete.")
description = _("You're now offline")