本文整理汇总了Python中kano.gtk3.buttons.OrangeButton类的典型用法代码示例。如果您正苦于以下问题:Python OrangeButton类的具体用法?Python OrangeButton怎么用?Python OrangeButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrangeButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KanoButtonBox
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)
示例2: __init__
def __init__(self, win):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.win = win
self.win.set_main_widget(self)
# Main image
image = Gtk.Image.new_from_file(media + "/Graphics/no-internet-screen.png")
# Orange button
later_button = OrangeButton(_("Later"))
later_button.connect('button-release-event', self.win.close_window)
# Green button
self.kano_button = KanoButton(_("CONNECT NOW"))
self.kano_button.pack_and_align()
self.kano_button.connect('button-release-event', self.go_to_wifi)
self.kano_button.connect('key-release-event', self.go_to_wifi)
# Text label
text_align = self.create_text_align()
# Place elements
image.set_margin_top(50)
image.set_margin_bottom(30)
self.pack_start(image, False, False, 0)
self.pack_start(text_align, False, False, 2)
self.pack_start(self.kano_button.align, False, False, 10)
self.pack_start(later_button, False, False, 3)
# Refresh window
self.win.show_all()
示例3: __init__
def __init__(self):
Gtk.Grid.__init__(self)
self.get_style_context().add_class('password')
self.set_row_spacing(10)
title = Heading(_('Select Account'),
_('Log in to which account?'))
self.attach(title.container, 0, 0, 2, 1)
self.scrolled_window = ScrolledWindow()
self.scrolled_window.set_size_request(self.WIDTH, self.HEIGHT)
self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.box.set_spacing(10)
self.box.set_margin_left(10)
self.box.set_margin_right(10)
self.scrolled_window.add(self.box)
self.attach(self.scrolled_window, 0, 1, 2, 1)
self.last_username = get_last_user()
self._populate()
self.add_account_btn = OrangeButton(_('Add Account'))
self.add_account_btn.connect('clicked', self._btn_add_account_pressed)
self.attach(self.add_account_btn, 0, 2, 1, 1)
self.shutdown_btn = OrangeButton(_('Shutdown'))
self.shutdown_btn.connect('clicked', self._btn_shutdown_pressed)
self.attach(self.shutdown_btn, 1, 2, 1, 1)
示例4: __init__
def __init__(self,
num_of_pages=3,
selected_page=1,
back_text=_("BACK"),
next_text=_("NEXT")):
Gtk.Alignment.__init__(self, xalign=0.5, xscale=0)
self.num_of_pages = num_of_pages
self.selected = selected_page
self._box = Gtk.Box()
self.add(self._box)
# The back button has subtly different styling to the next button
# When the back button is disabled, it goes invisible, while
# the NEXT button goes grey.
self._back_button = OrangeButton(back_text)
self._back_button.connect('clicked', self.back_button_clicked)
attach_cursor_events(self._back_button)
self._next_button = OrangeButton(next_text)
self._next_button.connect('clicked', self.next_button_clicked)
attach_cursor_events(self._next_button)
self.dot_box = Gtk.Box()
self._create_progress_dots(self.selected)
self._box.pack_start(self._back_button, False, False, 40)
self._box.pack_start(self.dot_box, False, False, 0)
self._box.pack_start(self._next_button, False, False, 40)
if self.selected == 1:
self._back_button.set_sensitive(False)
if self.selected == self.num_of_pages:
self._next_button.set_sensitive(False)
示例5: __init__
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)
示例6: __init__
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()
示例7: SetKanoKeyboard
class SetKanoKeyboard(Template):
def __init__(self, win):
Template.__init__(
self,
_("Keyboard"),
_("Kano keyboard detected"),
_("APPLY CHANGES")
)
self.win = win
self.win.set_main_widget(self)
self.win.top_bar.enable_prev()
# height is 106px
img = Gtk.Image()
img.set_from_file(common.media + "/Graphics/keyboard.png")
# Link to advance options
self.to_advance_button = OrangeButton(_("Layout options"))
self.to_advance_button.connect('button_press_event', self.to_advance)
self.kano_button.connect('button-release-event', self.win.go_to_home)
self.win.change_prev_callback(self.win.go_to_home)
self.box.pack_start(img, False, False, 0)
self.box.pack_start(self.to_advance_button, False, False, 0)
# Refresh window
self.win.show_all()
def to_advance(self, widget, event):
self.win.clear_win()
SetKeyboard(self.win)
示例8: create_parental_button
def create_parental_button(self):
desc = (
_("Use different levels to:\n" \
"- Block mature content in browser and YouTube\n" \
"- Or restrict internet access to only Kano World activity")
).split('\n')
self.parental_button = Gtk.CheckButton()
box = LabelledListTemplate.label_button(
self.parental_button,
_("Parental lock"),
desc[0])
grid = Gtk.Grid()
grid.attach(box, 0, 0, 1, 1)
i = 1
for text in desc[1:]:
label = Gtk.Label(text)
label.set_alignment(xalign=0, yalign=0.5)
label.set_padding(xpad=25, ypad=0)
label.get_style_context().add_class('normal_label')
grid.attach(label, 0, i, 1, 1)
i = i + 1
if get_parental_enabled():
parental_config_button = OrangeButton(_("Configure"))
parental_config_button.connect('button-press-event',
self.go_to_parental_config)
grid.attach(parental_config_button, 0, i, 1, 1)
return grid
示例9: add_button
def add_button(self, label, callback=None):
if not self._button_box:
self._button_box = Gtk.Box()
self._content.pack_start(self._button_box, False, False, 15)
button = OrangeButton(label)
if callback:
button.connect('button_release_event', callback)
button.connect('key_release_event', callback)
self._button_box.pack_start(button, False, False, 10)
self._button_box.set_halign(Gtk.Align.CENTER)
self._button_box.set_valign(Gtk.Align.CENTER)
return button
示例10: __init__
def __init__(self, win, title, description, original_overscan=None):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.kano_button = KanoButton("APPLY CHANGES")
self.kano_button.connect("button-release-event", self.apply_changes)
self.kano_button.pack_and_align()
self.heading = Heading(title, description)
self.pack_start(self.heading.container, False, False, 0)
self.win = win
self.win.set_main_widget(self)
self.win.top_bar.enable_prev()
# Launch pipe for the overscan c code
launch_pipe()
self.overscan_values = get_overscan_status()
self.original_overscan = original_overscan
# Pass original overscan values between the classes
# If original_overscan hasn't been generated yet, get it from current overscan status
# Alternatively, maybe read this from a file in future
if original_overscan is None:
self.original_overscan = get_overscan_status()
# Reset button
self.reset_button = OrangeButton()
reset_image = Gtk.Image().new_from_file(common.media + "/Icons/reset.png")
self.reset_button.set_image(reset_image)
self.reset_button.connect("button_press_event", self.reset)
示例11: __init__
def __init__(self):
Gtk.Box.__init__(self)
self.checkbutton = Gtk.CheckButton()
self.checkbutton.get_style_context().add_class('get_data_checkbutton')
self.checkbutton.set_margin_left(30)
self.tc_button = OrangeButton(_("I agree to the terms and conditions"))
self.tc_button.connect('clicked', self._emit_t_and_c_signal)
self.pack_start(self.checkbutton, False, False, 0)
self.pack_start(self.tc_button, False, False, 0)
示例12: TermsAndConditions
class TermsAndConditions(Gtk.Box):
__gsignals__ = {
't-and-cs-clicked': (GObject.SIGNAL_RUN_FIRST, None, ())
}
def __init__(self):
Gtk.Box.__init__(self)
self.checkbutton = Gtk.CheckButton()
self.checkbutton.get_style_context().add_class('get_data_checkbutton')
self.checkbutton.set_margin_left(30)
self.tc_button = OrangeButton(_("I agree to the terms and conditions"))
self.tc_button.connect('clicked', self._emit_t_and_c_signal)
self.pack_start(self.checkbutton, False, False, 0)
self.pack_start(self.tc_button, False, False, 0)
def is_checked(self):
return self.checkbutton.get_active()
def _emit_t_and_c_signal(self, widget):
self.emit('t-and-cs-clicked')
def disable_all(self):
self.checkbutton.set_sensitive(False)
self.tc_button.set_sensitive(False)
def enable_all(self):
self.checkbutton.set_sensitive(True)
self.tc_button.set_sensitive(True)
示例13: create_parental_button
def create_parental_button(self):
desc = (
_(" Use different levels to:\n"
"- Block mature content in browser and YouTube\n"
"- Or restrict internet access to only Kano World activity")
).split('\n')
self.parental_button = Gtk.CheckButton()
box = LabelledListTemplate.label_button(
self.parental_button,
_("Parental lock"),
desc[0])
grid = self._labelled_list_helper(desc, box)
if get_parental_enabled():
parental_config_button = OrangeButton(_("Configure"))
parental_config_button.connect('button-press-event',
self.go_to_parental_config)
grid.attach(parental_config_button, 0, len(desc), 1, 1)
return grid
示例14: __add_orange_button
def __add_orange_button(self, orange_info, kano_button_box):
orange_text = orange_info["name"]
orange_return_value = orange_info["return_value"]
button_container = Gtk.ButtonBox(spacing=10)
button_container.set_layout(Gtk.ButtonBoxStyle.SPREAD)
self.orange_button = OrangeButton(orange_text)
self.orange_button.connect("button-release-event", self.exit_dialog, orange_return_value)
button_container.pack_start(self.orange_button, False, False, 0)
button_container.pack_start(kano_button_box, False, False, 0)
# The empty label is to centre the kano_button
label = Gtk.Label(" ")
button_container.pack_start(label, False, False, 0)
return button_container
示例15: __init__
def __init__(self):
Gtk.Box.__init__(self)
self.checkbutton = Gtk.CheckButton()
self.checkbutton.get_style_context().add_class("get_data_checkbutton")
self.checkbutton.set_size_request(50, 50)
self.checkbutton.set_margin_left(30)
self.tc_button = OrangeButton(_("I agree to the terms and conditions"))
self.tc_button.connect("clicked", self._emit_t_and_c_signal)
tc_label = self.tc_button.label
tc_label.set_max_width_chars(20)
tc_label.set_line_wrap(True)
self.pack_start(self.checkbutton, False, False, 0)
self.pack_start(self.tc_button, False, False, 0)