本文整理汇总了Python中kano.gtk3.buttons.KanoButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python KanoButton.connect方法的具体用法?Python KanoButton.connect怎么用?Python KanoButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.buttons.KanoButton
的用法示例。
在下文中一共展示了KanoButton.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: second_scroll
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def second_scroll(self):
self._clear()
ticks = Gtk.Image.new_from_file(self._stage.media_path('ticks.png'))
copy = [
"Complete all of the ticks in a",
"quest to unlock rewards."
]
text_widgets = self._get_text_widgets(copy)
chest = Gtk.Image.new_from_file(self._stage.media_path('chest-open.png'))
button = KanoButton('NEXT', color='orange')
button.connect('clicked', cb_wrapper, self.third_scroll)
ticks.set_margin_top(20)
self._vbox.pack_start(ticks, False, False, 0)
text_widgets[0].set_margin_top(40)
for w in text_widgets:
self._vbox.pack_start(w, False, False, 0)
chest.set_margin_top(35)
self._vbox.pack_start(chest, False, False, 0)
button.set_margin_top(40)
button.set_margin_left(80)
button.set_margin_right(80)
self._vbox.pack_start(button, False, False, 0)
self.show_all()
示例2: third_scroll
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def third_scroll(self):
self._clear()
heading = Gtk.Label('New quest')
add_class(heading, 'scroll-heading')
world = Gtk.Image.new_from_file(self._stage.media_path('world.png'))
copy = [
"Journey to Kano World",
]
text_widgets = self._get_text_widgets(copy)
button = KanoButton('OK', color='orange')
button.connect('clicked', cb_wrapper, self._stage._ctl.next_stage)
heading.set_margin_top(35)
self._vbox.pack_start(heading, False, False, 0)
world.set_margin_top(35)
self._vbox.pack_start(world, False, False, 0)
text_widgets[0].set_margin_top(40)
for w in text_widgets:
self._vbox.pack_start(w, False, False, 0)
button.set_margin_top(40)
button.set_margin_left(80)
button.set_margin_right(80)
self._vbox.pack_start(button, False, False, 0)
self.show_all()
示例3: first_scroll
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def first_scroll(self):
self._clear()
copy = [
"Quests are a series of tasks that you",
"can complete on your Kano to get",
"great rewards."
]
text_widgets = self._get_text_widgets(copy)
img_path = self._stage.media_path('chest-closed.png')
chest = Gtk.Image.new_from_file(img_path)
button = KanoButton('NEXT', color='orange')
button.connect('clicked', cb_wrapper, self.second_scroll)
text_widgets[0].set_margin_top(30)
for w in text_widgets:
self._vbox.pack_start(w, False, False, 0)
chest.set_margin_top(60)
self._vbox.pack_start(chest, False, False, 0)
button.set_margin_top(70)
button.set_margin_left(80)
button.set_margin_right(80)
self._vbox.pack_start(button, False, False, 0)
self.show_all()
示例4: __init__
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __init__(self, stage, overscan_ctl, next_cb):
super(Window2, self).__init__()
add_class(self, 'overscan-window')
head_img = Gtk.Image.new_from_file(stage.media_path('hint2.png'))
box = Gtk.VBox()
self.add(box)
box.pack_start(head_img, False, False, 0)
heading = Gtk.Label('Use UP and DOWN keys')
heading.set_margin_top(25)
heading.set_margin_bottom(25)
add_class(heading, 'notebook-heading')
box.pack_start(heading, False, False, 0)
label_copy = 'Stretch or shrink your screen, until the white lines'
text1 = Gtk.Label(label_copy)
text1.set_margin_bottom(5)
add_class(text1, 'notebook-text')
box.pack_start(text1, False, False, 0)
text2 = Gtk.Label('are lined up with the edges')
text2.set_margin_bottom(25)
add_class(text2, 'notebook-text')
box.pack_start(text2, False, False, 0)
buttons = Gtk.HBox(halign=Gtk.Align.CENTER)
buttons.set_margin_bottom(25)
done = KanoButton('DONE', color='green')
buttons.pack_start(done, False, False, 0)
done.connect('clicked', cb_wrapper, next_cb)
box.pack_start(buttons, False, False, 0)
示例5: __generate_buttons
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __generate_buttons(self):
self.buttons = []
kano_button_box = Gtk.Box()
for button in self.button_info:
for argument, value in button_defaults.iteritems():
# Use default info if not provided
if argument not in button:
button[argument] = value
# Create default return values for OK and CANCEL buttons
if argument == "return_value":
if hasattr(button, "label"):
if button["label"] == _("OK"):
button["return_value"] = 0
elif button["label"] == _("CANCEL"):
button["return_value"] = 1
if argument == "color":
if button["label"] == _("CANCEL"):
button["color"] = "red"
color = button["color"]
return_value = button["return_value"]
button_name = button["label"]
button = KanoButton(button_name)
button.set_color(color)
button.connect("button-release-event", self.exit_dialog, return_value)
button.connect("key-release-event", self.exit_dialog, return_value)
self.buttons.append(button)
kano_button_box.pack_start(button, False, False, 6)
return kano_button_box
示例6: slide1
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def slide1(self):
fixed = Gtk.Fixed()
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
self.media_path("apps-slide.png"),
1000,
678
)
image = Gtk.Image.new_from_pixbuf(pixbuf)
title1 = Gtk.Label("Get Started")
title1.get_style_context().add_class("title")
title2 = Gtk.Label("Apps")
title2.get_style_context().add_class("title")
desc = Gtk.Label(
"Create and play with\n" +
"Kano's Apps to make and save your\n" +
"own code masterpieces, from games\n" +
"and minecraft world, to art and music pieces..."
)
desc.get_style_context().add_class("description")
next_button = KanoButton("NEXT")
next_button.connect("clicked", self.slide2_wrapper)
fixed.put(image, 0, 0)
fixed.put(title1, 460, 40)
fixed.put(title2, 60, 400)
fixed.put(desc, 60, 450)
fixed.put(next_button, 460, 580)
self.add(fixed)
self.show_all()
示例7: __init__
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __init__(self, win, char_creator):
Gtk.EventBox.__init__(self)
self._win = win
# Should this be inherited, passed as a variable, or global?
# Could be a member variable in window.
# self.char_creator = self._win.get_char_creator()
self.char_creator = char_creator
self._win.pack_in_main_content(self.char_creator)
self.char_creator.reset_selected_menu_items()
save_changes_button = KanoButton(_("Save changes").upper())
save_changes_button.connect("clicked", self.save_changes)
discard_changes_button = OrangeButton(_("Discard").upper())
discard_changes_button.connect("clicked", self.discard)
discard_changes_button.set_margin_left(100)
empty_label = Gtk.Label("")
button_box = Gtk.ButtonBox()
button_box.pack_start(discard_changes_button, False, False, 0)
button_box.pack_start(save_changes_button, False, False, 0)
button_box.pack_start(empty_label, False, False, 0)
self._win.pack_in_bottom_bar(button_box)
self._win.show_all()
# Hide all the pop ups
self.char_creator._hide_pop_ups()
示例8: slide2
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def slide2(self):
self.clear_window()
fixed = Gtk.Fixed()
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
self.media_path("world-slide.png"),
1000,
678
)
image = Gtk.Image.new_from_pixbuf(pixbuf)
title = Gtk.Label("Kano World")
title.get_style_context().add_class("title")
desc = Gtk.Label(
"Show off and share your creations to friends\n" +
"family and other Kano users on Kano World.\n\n" +
"Why not check it out now by clicking on the\n" +
"icon to see what people have made today."
)
desc.get_style_context().add_class("description")
next_button = KanoButton("LET'S GO")
next_button.connect("clicked", Gtk.main_quit)
fixed.put(image, 0, 0)
fixed.put(title, 415, 370)
fixed.put(desc, 310, 420)
fixed.put(next_button, 440, 580)
self.add(fixed)
self.show_all()
示例9: KanoButtonBox
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
class KanoButtonBox(Gtk.Box):
def __init__(self, kano_button_text, orange_text="", orange_text_2=""):
Gtk.Box.__init__(self)
self.kano_button = KanoButton(kano_button_text)
if not orange_text == "":
self.orange_button = OrangeButton(orange_text)
self.pack_start(self.orange_button, False, False, 0)
self.pack_start(self.kano_button, False, False, 0)
if orange_text_2 == "":
# The empty label is to centre the kano_button
label = Gtk.Label(" ")
self.pack_start(label, False, False, 0)
else:
self.orange_button2 = OrangeButton(orange_text_2)
self.pack_start(self.orange_button2, False, False, 0)
else:
self.pack_start(self.kano_button, False, False, 0)
def get_kano_button(self):
return self.kano_button
def set_kano_button_cb(self, cb, args=[]):
self.kano_button.connect('button-release-event', cb, args)
def set_orange_button_cb(self, cb, args=[]):
self.orange_button.connect('button-release-event', cb, args)
def set_orange_button2_cb(self, cb, args=None):
self.orange_button2.connect('button-release-event', cb, args)
示例10: CharacterEdit
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
class CharacterEdit(Gtk.EventBox):
'''Offer the user the option to modify their avatar
'''
def __init__(self, win, char_creator):
Gtk.EventBox.__init__(self)
self._win = win
# Should this be inherited, passed as a variable, or global?
# Could be a member variable in window.
# self.char_creator = self._win.get_char_creator()
self.char_creator = char_creator
self._win.pack_in_main_content(self.char_creator)
self.char_creator.reset_selected_menu_items()
self._save_changes_button = KanoButton(_("Save changes").upper())
self._save_changes_button.connect('clicked', self.save_changes)
self._save_changes_button.set_sensitive(False)
self.char_creator.connect(
'character_changed',
self._make_button_sensitive
)
discard_changes_button = OrangeButton(_("Discard").upper())
discard_changes_button.connect('clicked', self.discard)
discard_changes_button.set_margin_left(100)
empty_label = Gtk.Label("")
button_box = Gtk.ButtonBox()
button_box.pack_start(discard_changes_button, False, False, 0)
button_box.pack_start(self._save_changes_button, False, False, 0)
button_box.pack_start(empty_label, False, False, 0)
self._win.pack_in_bottom_bar(button_box)
self._win.show_all()
# Hide all the pop ups
self.char_creator._hide_pop_ups()
def save_changes(self, widget):
self.char_creator.save()
self._go_back_to_display_screen()
def discard(self, widget):
self.char_creator.update_from_saved_image()
self._go_back_to_display_screen()
def _go_back_to_display_screen(self):
'''Don't save, just go back to the edit character screen
'''
self._win.empty_main_content()
self._win.empty_bottom_bar()
self._win.menu_bar.enable_buttons()
CharacterDisplay(self._win)
def _make_button_sensitive(self, widget=None):
self._save_changes_button.set_sensitive(True)
示例11: __init__
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __init__(self, title, description, buttons, is_plug=False, img_path=None):
super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL)
self._focus_widget = None
heading = Heading(
title,
description,
is_plug,
back_btn=False
)
bbox = Gtk.ButtonBox()
bbox.set_spacing(20)
bbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
bbox.set_margin_right(10)
bbox.set_margin_left(10)
for b in buttons:
label = b["label"]
if not label:
gtk_button = Gtk.Label()
else:
button_type = b["type"]
callback = b["callback"]
if button_type == "KanoButton":
color = b["color"]
gtk_button = KanoButton(label, color=color)
elif button_type == "OrangeButton":
gtk_button = OrangeButton(label)
gtk_button.connect("clicked", callback)
bbox.pack_start(gtk_button, False, False, 0)
if "focus" in b:
self._focus_widget = gtk_button
self.pack_start(heading.container, False, False, 0)
heading.container.set_margin_right(15)
heading.container.set_margin_left(15)
if img_path:
image = Gtk.Image.new_from_file(img_path)
if is_plug:
self.pack_start(image, False, False, 10)
self.pack_start(bbox, False, False, 30)
else:
self.pack_start(image, False, False, 20)
self.pack_end(bbox, False, False, 30)
self.show_all()
示例12: __init__
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __init__(self, win):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.win = win
reset_button = KanoButton(text='RESET YOUR DESKTOP', color='orange')
reset_button.connect('button-release-event', self.reset_button_cb)
reset_button.connect('key-release-event', self.reset_button_cb)
reset_button.pack_and_align()
reset_button.align.set(0.5, 0.5, 0, 0)
self.pack_start(reset_button.align, True, True, 0)
示例13: NewUserView
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
class NewUserView(Gtk.Grid):
def __init__(self, greeter):
Gtk.Grid.__init__(self)
self.get_style_context().add_class('password')
self.set_row_spacing(12)
self.greeter = greeter
title = Heading(_('Add new account'),
_('Login with Kano World\n'
'or create a new account.'))
self.attach(title.container, 0, 0, 1, 1)
# the 2 push buttons
self.login_btn = KanoButton(_('Kano World'))
self.login_btn.connect('clicked', self._login_button_pressed)
self.attach(self.login_btn, 0, 1, 1, 1)
self.newuser_btn = KanoButton(_('New Account'))
self.newuser_btn.connect('clicked', self._new_user_reboot)
self.attach(self.newuser_btn, 0, 2, 1, 1)
def _login_button_pressed(self, event=None, button=None):
win = self.get_toplevel()
win.go_to_login_with_kw()
def _new_user_reboot(self, event=None, button=None):
'''
Schedules kano-init to create a new user from scratch on next reboot,
then performs the actual reboot
'''
confirm = KanoDialog(
title_text=_('Are you sure you want to create a new account?'),
description_text=_('A reboot will be required'),
button_dict=[
{
'label': _('Cancel').upper(),
'color': 'red',
'return_value': False
},
{
'label': _('Create').upper(),
'color': 'green',
'return_value': True
}
])
confirm.dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
if confirm.run():
os.system("sudo kano-init schedule add-user")
LightDM.restart()
示例14: __init__
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
def __init__(self, win):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.win = win
self.get_style_context().add_class('notebook_page')
reset_button = KanoButton(text=_("RESET YOUR DESKTOP"), color='orange')
reset_button.connect('button-release-event', self.reset_button_cb)
reset_button.connect('key-release-event', self.reset_button_cb)
reset_button.pack_and_align()
reset_button.align.set(0.5, 0.5, 0, 0)
self.pack_start(reset_button.align, True, True, 0)
示例15: KanoButtonBox
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import connect [as 别名]
class KanoButtonBox(Gtk.Box):
def __init__(self, kano_button_text, orange_text="", orange_text_2="", orange_text_3=""):
Gtk.Box.__init__(self)
self.kano_button = KanoButton(kano_button_text)
if orange_text != "":
self.orange_button = OrangeButton(orange_text)
self.pack_start(self.orange_button, False, False, 0)
self.pack_start(self.kano_button, False, False, 0)
if orange_text_2 == "":
# The empty label is to centre the kano_button
label = Gtk.Label(" ")
self.pack_start(label, False, False, 0)
else:
self.orange_button2 = OrangeButton(orange_text_2)
if orange_text_3 == "":
self.pack_start(self.orange_button2, False, False, 0)
else:
# If two orange button texts, we align them vertically
self.vertbox=Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.add(self.vertbox)
self.orange_button3 = OrangeButton(orange_text_3)
self.vertbox.pack_start(self.orange_button2, False, False, 0)
self.vertbox.pack_start(self.orange_button3, False, False, 0)
else:
self.pack_start(self.kano_button, False, False, 0)
def get_kano_button(self):
return self.kano_button
def set_kano_button_cb(self, cb, args=[]):
self.kano_button.connect('button-release-event', cb, args)
def set_orange_button_cb(self, cb, args=[]):
self.orange_button.connect('button-release-event', cb, args)
def set_orange_button2_cb(self, cb, args=None):
self.orange_button2.connect('button-release-event', cb, args)
def set_orange_button3_cb(self, cb, args=None):
self.orange_button3.connect('button-release-event', cb, args)