本文整理汇总了Python中kano.gtk3.buttons.OrangeButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python OrangeButton.connect方法的具体用法?Python OrangeButton.connect怎么用?Python OrangeButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.buttons.OrangeButton
的用法示例。
在下文中一共展示了OrangeButton.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
def __init__(self, user, greeter):
Gtk.Grid.__init__(self)
self.get_style_context().add_class('password')
self.set_row_spacing(10)
self.greeter = greeter
self.user = user
self.title = self._set_title()
self.attach(self.title.container, 0, 0, 1, 1)
self.label = Gtk.Label(user)
self.label.get_style_context().add_class('login')
self.attach(self.label, 0, 1, 1, 1)
self.password = Gtk.Entry()
self.password.set_visibility(False)
self.password.set_alignment(0.5)
self.password.connect('activate', self._login_cb)
self.attach(self.password, 0, 2, 1, 1)
self.login_btn = KanoButton(_('Login').upper())
self.login_btn.connect('clicked', self._login_cb)
self.attach(self.login_btn, 0, 3, 1, 1)
# Protect against removing the last Kano user
# so you do not get locked out from logging into the Kit
system_users = KanoUserList().get_users()
if len(system_users) > 1:
delete_account_btn = OrangeButton(_('Remove Account'))
delete_account_btn.connect('clicked', self.delete_user)
self.attach(delete_account_btn, 0, 4, 1, 1)
示例2: SetKanoKeyboard
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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)
示例3: __init__
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton 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()
示例4: KanoButtonBox
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton 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)
示例5: TermsAndConditions
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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)
示例6: create_parental_button
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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
示例7: add_button
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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
示例8: create_parental_button
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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
示例9: TermsAndConditions
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
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_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)
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)
示例10: KanoButtonBox
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton 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)
示例11: OverscanTemplate
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
class OverscanTemplate(Gtk.Box):
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)
def apply_changes(self, button, event):
# Apply changes
write_overscan_values(self.overscan_values)
self.original_overscan = self.overscan_values
set_config_comment('kano_screen_used', get_model())
# Tell user to reboot to see changes
common.need_reboot = True
self.go_to_display()
def adjust(self, adj, varname):
self.overscan_values[varname] = int(adj.get_value())
set_overscan_status(self.overscan_values)
def adjust_all(self, adj):
self.overscan_values['top'] = int(adj.get_value())
self.overscan_values['bottom'] = int(adj.get_value())
self.overscan_values['left'] = int(adj.get_value())
self.overscan_values['right'] = int(adj.get_value())
set_overscan_status(self.overscan_values)
def go_to_display(self, widget=None, button=None):
self.reset()
self.win.clear_win()
SetDisplay(self.win)
def reset(self, widget=None, event=None):
pass
示例12: SetSimpleOverscan
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
class SetSimpleOverscan(OverscanTemplate):
def __init__(self, win, original_overscan=None):
OverscanTemplate.__init__(
self,
win,
"Overscan",
"This setting lets you adjust your screen's size.",
original_overscan
)
self.win.change_prev_callback(self.go_to_display)
# Listen for key events
self.key_press_handler = self.win.connect("key-press-event", self.on_key_press)
## slider
self.t_value = Gtk.Label()
self.t_value.get_style_context().add_class("slider_label")
self.t_scale = Gtk.HScale.new_with_range(0, 100, 1)
self.t_scale.set_value(self.overscan_values['top'])
self.t_scale.set_size_request(400, 30)
self.t_scale.connect('value_changed', self.adjust_all)
self.t_scale.connect('value_changed', self.update_all_values)
self.t_scale.set_draw_value(False)
self.update_all_values(self.t_scale)
box = Gtk.Box()
box.pack_start(self.t_scale, False, False, 5)
box.pack_start(self.t_value, False, False, 5)
box.pack_start(self.reset_button, False, False, 25)
align = Gtk.Alignment(xalign=0.6, xscale=0, yscale=0, yalign=0.5)
align.add(box)
# Advance button
self.advanced_button = OrangeButton()
self.advanced_button.connect("button_press_event", self.go_to_advanced)
self.advanced_button.set_label("Advanced")
button_box = Gtk.ButtonBox()
button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)
button_box.pack_start(self.advanced_button, False, False, 15)
button_box.pack_start(self.kano_button.align, False, False, 15)
empty_label = Gtk.Label(" ")
button_box.pack_start(empty_label, False, False, 0)
self.pack_start(align, True, True, 0)
self.pack_end(button_box, False, False, 30)
self.win.show_all()
def reset(self, widget=None, event=None):
# Restore overscan if any
if self.original_overscan != self.overscan_values:
set_overscan_status(self.original_overscan)
self.t_scale.set_value(self.original_overscan['top'])
def go_to_advanced(self, event=None, arg=None):
# Remove key press handler from screen
self.win.disconnect(self.key_press_handler)
self.win.clear_win()
SetAdvancedOverscan(self.win, self.original_overscan)
def on_key_press(self, widget, event):
# Right arrow (65363)
if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Right:
self.overscan_values['top'] += 1
self.overscan_values['bottom'] += 1
self.overscan_values['left'] += 1
self.overscan_values['right'] += 1
set_overscan_status(self.overscan_values)
self.t_scale.set_value(self.overscan_values['top'])
return
# Left arrow (65361)
if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Left:
self.overscan_values['top'] -= 1
self.overscan_values['bottom'] -= 1
self.overscan_values['left'] -= 1
self.overscan_values['right'] -= 1
set_overscan_status(self.overscan_values)
self.t_scale.set_value(self.overscan_values['top'])
return
def update_all_values(self, widget):
new_value = str(int(widget.get_value()))
self.t_value.set_text(new_value)
示例13: __init__
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
def __init__(self, win):
# Show the Display brand and model
self.model = get_model()
info_message = ' (Changing this requires a reboot)'
# And the current display resolution
try:
current_resolution = get_status()['resolution']
info_message += '\n\nCurrent resolution: {}'.format(current_resolution)
except:
pass
Template.__init__(
self,
"Display",
self.model + info_message,
"APPLY CHANGES"
)
self.win = win
self.win.set_main_widget(self)
self.win.top_bar.enable_prev()
self.win.change_prev_callback(self.win.go_to_home)
self.kano_button.connect("button-release-event", self.apply_changes)
self.kano_button.connect("key-release-event", self.apply_changes)
horizontal_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=40)
horizontal_container.set_valign(Gtk.Align.CENTER)
# HDMI mode combo box
self.mode_combo = KanoComboBox(max_display_items=7)
self.mode_combo.connect("changed", self.on_mode_changed)
# Fill list of modes
modes = list_supported_modes()
self.mode_combo.append("auto")
if modes:
for v in modes:
self.mode_combo.append(v)
horizontal_container.pack_start(self.mode_combo, False, False, 0)
self.mode_combo.props.valign = Gtk.Align.CENTER
# Select the current setting in the dropdown list
saved_group, saved_mode = read_hdmi_mode()
active_item = find_matching_mode(modes, saved_group, saved_mode)
self.mode_combo.set_selected_item_index(active_item)
self.init_item = active_item
self.mode_index = active_item
# Overscan button
overscan_button = OrangeButton("Overscan")
horizontal_container.pack_end(overscan_button, False, False, 0)
overscan_button.connect("button-release-event", self.go_to_overscan)
self.box.pack_start(horizontal_container, False, False, 0)
# Create Flip 180 checkbox
flip_button = Gtk.CheckButton("Flip Screen")
flip_button.set_can_focus(False)
flip_button.props.valign = Gtk.Align.CENTER
flip_button.set_active(get_config_value("display_rotate") == 2)
flip_button.connect("clicked", self.flip)
self.box.pack_start(flip_button, False, False, 0)
self.kano_button.set_sensitive(False)
# Add apply changes button under the main settings content
self.win.show_all()
示例14: __init__
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
#.........这里部分代码省略.........
if self.scrolled_text:
scrolledwindow = self.__add_scrolled_window()
content_area.pack_start(scrolledwindow, False, False, 0)
# or add widget
elif self.widget is not None:
content_area.pack_start(self.widget, False, False, 0)
# Set keyboard focus on first button if no entry
if not has_entry:
self.buttons[0].grab_focus()
def __add_scrolled_window(self):
text = Gtk.TextView()
text.get_buffer().set_text(self.scrolled_text)
text.set_wrap_mode(Gtk.WrapMode.WORD)
text.set_editable(False)
scrolledwindow = ScrolledWindow()
scrolledwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scrolledwindow.add_with_viewport(text)
scrolledwindow.set_size_request(400, 200)
scrolledwindow.apply_styling_to_widget(wide=False)
return scrolledwindow
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
def __colour_dialog_background(self):
content_area = self.dialog.get_content_area()
self.content_background = Gtk.EventBox()
self.add_style(self.content_background, "white")
self.content_background.set_size_request(140, 140)
content_area.reparent(self.content_background)
action_area = self.dialog.get_action_area()
self.action_background = Gtk.EventBox()
self.add_style(self.action_background, "white")
action_area.reparent(self.action_background)
action_area.set_layout(Gtk.ButtonBoxStyle.CENTER)
# Set area around the buttons grey by default
self.set_action_background("grey")
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container.add(self.content_background)
container.add(self.action_background)
self.dialog.add(container)
return content_area, action_area
def __convert_dict_to_list(self):
示例15: ParentalConfig
# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import connect [as 别名]
class ParentalConfig(Template):
def __init__(self, win):
Template.__init__(
self,
"Parental lock",
"Configure your parental lock settings",
"APPLY CHANGES",
win.is_plug(),
True
)
self.parental_level = Gtk.VScale(
adjustment=Gtk.Adjustment(value=0, lower=0, upper=3,
step_incr=1, page_incr=0, page_size=0))
self.parental_level.get_style_context().add_class('parental_slider')
self.parental_level.set_draw_value(False)
self.parental_level.set_round_digits(0)
self.parental_level.set_inverted(True)
self.parental_level.set_value(get_setting('Parental-level'))
self.parental_level.connect('value-changed', self._value_change_handler)
self._parental_labels = [
(
Gtk.Label("Low Settings"),
Gtk.Label("Block predefined blacklisted websites and\nactivates SafeSearch on Google and Youtube")
),
(
Gtk.Label("Medium Settings"),
Gtk.Label("Use safe DNS servers to filter all traffic")
),
(
Gtk.Label("High Settings"),
Gtk.Label("Enable all filters and restrict search engine access")
),
(
Gtk.Label("Ultimate Settings"),
Gtk.Label("Only allow access to Kano World activities")
)
]
self.blacklist_button = OrangeButton("Configure allowed/blocked")
self.blacklist_button.connect("button-press-event",
self.go_to_blacklist)
self._value_change_handler(self.parental_level)
parental_level_grid = Gtk.Grid()
parental_level_grid.attach(self.parental_level, 0, 0, 1, 7)
parental_level_grid.attach(self._parental_labels[3][0], 1, 0, 1, 1)
parental_level_grid.attach(self._parental_labels[3][1], 1, 1, 1, 1)
parental_level_grid.attach(self._parental_labels[2][0], 1, 2, 1, 1)
parental_level_grid.attach(self._parental_labels[2][1], 1, 3, 1, 1)
parental_level_grid.attach(self._parental_labels[1][0], 1, 4, 1, 1)
parental_level_grid.attach(self._parental_labels[1][1], 1, 5, 1, 1)
parental_level_grid.attach(self._parental_labels[0][0], 1, 6, 1, 1)
parental_level_grid.attach(self._parental_labels[0][1], 1, 7, 1, 1)
self.box.set_spacing(20)
self.box.pack_start(parental_level_grid, False, False, 0)
self.box.pack_start(self.blacklist_button, False, False, 0)
self.win = win
self.win.set_main_widget(self)
self.set_prev_callback(self.go_to_advanced)
self.win.change_prev_callback(self.win.go_to_home)
self.win.top_bar.enable_prev()
self.kano_button.connect('button-release-event', self.apply_changes)
self.kano_button.connect('key-release-event', self.apply_changes)
self.win.show_all()
def go_to_advanced(self, widget):
from kano_settings.set_advanced import SetAdvanced
self.win.clear_win()
SetAdvanced(self.win)
def apply_changes(self, button, event):
pw_dialog = ParentalPasswordDialog(self.win)
if not pw_dialog.verify():
return
level = self.parental_level.get_value()
set_parental_level(level)
set_setting('Parental-level', level)
# track which parental control level people use
track_data("parental-control-level-changed", {
"level": level
})
if level == 3.0:
# If on the highest parental control, prompt user to relaunch
# the browser
kdialog = KanoDialog(
title_text='Settings',
description_text=("If any browsers are open, please relaunch "
"them for this setting to take effect"),
parent_window=self.win
#.........这里部分代码省略.........