本文整理汇总了Python中kano.gtk3.buttons.KanoButton.set_margin_bottom方法的典型用法代码示例。如果您正苦于以下问题:Python KanoButton.set_margin_bottom方法的具体用法?Python KanoButton.set_margin_bottom怎么用?Python KanoButton.set_margin_bottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.buttons.KanoButton
的用法示例。
在下文中一共展示了KanoButton.set_margin_bottom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AudioHintTemplate
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import set_margin_bottom [as 别名]
class AudioHintTemplate(TopImageTemplate):
"""
Template for hints for audio setup
"""
def __init__(self, img_path, title, description, kano_button_text,
hint_text=""):
TopImageTemplate.__init__(self, img_path)
self.heading = HintHeading(title, description, hint_text)
self.pack_start(self.heading.container, False, False, 0)
self.heading.description.set_margin_bottom(0)
self.heading.container.set_margin_bottom(0)
self.heading.container.set_size_request(590, -1)
self.heading.container.set_spacing(0)
self.kano_button = KanoButton(kano_button_text)
self.kano_button.set_margin_top(30)
self.kano_button.set_margin_bottom(30)
self.kano_button.pack_and_align()
self.pack_start(self.kano_button.align, False, False, 0)
示例2: RegistrationScreen
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import set_margin_bottom [as 别名]
class RegistrationScreen(Gtk.Box):
"""
"""
def __init__(self, win):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.win = win
self.win.set_main_widget(self)
self.win.set_decorated(True)
title = Heading(
_("Kano World"),
_("Choose a cool name and secure password")
)
self.pack_start(title.container, False, False, 0)
self.data_screen = GetData() # TODO: refactor this
self.data_screen.connect('widgets-filled', self._enable_register_button)
self.data_screen.connect('widgets-empty', self._disable_register_button)
self.add(self.data_screen)
self.register_button = KanoButton(_("JOIN KANO WORLD"))
self.register_button.set_sensitive(False)
self.register_button.set_margin_top(10)
self.register_button.set_margin_left(30)
self.register_button.set_margin_right(30)
self.register_button.set_margin_bottom(30)
self.register_button.connect('clicked', self._on_register_button)
self.pack_end(self.register_button, False, False, 0)
self.win.show_all()
def _enable_register_button(self, widget=None):
"""
"""
self.register_button.set_sensitive(True)
def _disable_register_button(self, widget=None):
"""
"""
self.register_button.set_sensitive(False)
def _on_register_button(self, widget=None): # TODO: refactor this
"""
"""
if not is_internet():
self._show_not_internet_dialog()
return
# Get the username, password and birthday
data = self.data_screen.get_widget_data()
email = data['email']
username = data['username']
# Validate that the email address format is correct
email_error = validate_email(email)
if email_error:
self._show_error_dialog(_("Incorrect Email address"), email_error)
return
if not self._is_username_available(username):
self._show_username_taken_dialog(username)
return
# We can save the username to kano-profile
# Don't save password as this is private
self.data_screen.save_username_and_birthday() # TODO: rename this
self.data_screen.cache_emails()
data = self.data_screen.get_widget_data()
# This means no threads are needed.
while Gtk.events_pending(): # TODO: why is this needed?
Gtk.main_iteration()
# Try and register the account on the server
password = data['password']
success, text = register_(email, username, password,
marketing_enabled=True)
# This should no longer be needed, since this is checked in the first
# screen. However there is a small chance someone could take the
# username while the user is in the process of registering
if not success:
if text.strip() == _("Cannot register, problem: "
"Username already registered"):
self._show_username_taken_dialog(username)
else:
logger.info("problem with registration: {}".format(text))
return_value = 'FAIL'
self._create_dialog(
title=_("Houston, we have a problem"),
description=str(text)
)
track_data('world-registration-failed', {'reason': text})
else:
logger.info("registration successful")
#.........这里部分代码省略.........
示例3: BluetoothDeviceItem
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import set_margin_bottom [as 别名]
class BluetoothDeviceItem(Gtk.Box):
__gsignals__ = {
'pairing': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, ()),
'done-pairing': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, ()),
}
def __init__(self, device):
Gtk.Box.__init__(self, hexpand=True)
self.device = device
device_name = device.name
dev_label = Gtk.Label(device_name, hexpand=True)
dev_label.get_style_context().add_class('normal_label')
self.pack_start(dev_label, False, False, 0)
self._pair_button = KanoButton()
self._set_paired_button_state()
self._pair_button.set_margin_top(10)
self._pair_button.set_margin_bottom(10)
self._pair_button.set_margin_left(10)
self._pair_button.set_margin_right(10)
self._pair_button.connect('clicked', self.pair)
self.pack_start(self._pair_button, False, False, 0)
def _set_paired_button_state(self, *dummy_args, **dummy_kwargs):
if not self.device.connected:
label = _("PAIR")
colour = 'green'
else:
label = _("UNPAIR")
colour = 'red'
self._pair_button.set_label(label)
self._pair_button.set_color(colour)
def error(self, err_msg):
KanoDialog(err_msg).run()
def pair(self, *dummy_args, **dummy_kwargs):
def done_pairing():
self._set_paired_button_state()
self.emit('done-pairing')
@queue_cb(callback=done_pairing, gtk=True)
def do_pair():
if not self.device.fuse():
GObject.idle_add(self.error, _("Pairing failed"))
@queue_cb(callback=done_pairing, gtk=True)
def do_unpair():
if not self.device.unfuse():
GObject.idle_add(self.error, _("Unpairing failed"))
self.emit('pairing')
if self.device.connected:
pair_fn = do_unpair
logger.info("Unpairing {}".format(self.device))
else:
pair_fn = do_pair
logger.info("Pairing {}".format(self.device))
pair_thr = threading.Thread(target=pair_fn)
pair_thr.start()