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
def __init__(self, win): self.parental_enabled = get_parental_enabled() # Entry container entry_container = Gtk.Grid(column_homogeneous=False, column_spacing=22, row_spacing=10) # if enabled, turning off if self.parental_enabled: Template.__init__(self, _("Unlock parental lock"), _("Enter your password"), _("UNLOCK"), win.is_plug(), True) self.entry = Gtk.Entry() self.entry.set_size_request(300, 44) self.entry.props.placeholder_text = _( "Enter your selected password") self.entry.set_visibility(False) self.entry.connect('key_release_event', self.enable_button) entry_container.attach(self.entry, 0, 0, 1, 1) # if disabled, turning on else: Template.__init__(self, _("Set up parental lock"), _("Choose a password"), _("LOCK"), win.is_plug()) self.entry1 = Gtk.Entry() self.entry1.set_size_request(300, 44) self.entry1.props.placeholder_text = _("Select password") self.entry1.set_visibility(False) self.entry2 = Gtk.Entry() self.entry2.props.placeholder_text = _("Confirm password") self.entry2.set_visibility(False) self.entry1.connect('key_release_event', self.enable_button) self.entry2.connect('key_release_event', self.enable_button) entry_container.attach(self.entry1, 0, 0, 1, 1) entry_container.attach(self.entry2, 0, 1, 1, 1) self.win = win self.win.set_main_widget(self) self.set_prev_callback(self.go_to_advanced) self.win.change_prev_callback(self.go_to_advanced) self.win.top_bar.enable_prev() self.kano_button.set_sensitive(False) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.box.add(entry_container) self.win.show_all()
def update_config(self, password): if self.parental_enabled: success, msg = set_parental_enabled(False, password) self.parental_enabled = get_parental_enabled() else: success, msg = set_parental_enabled(True, password) self.parental_enabled = get_parental_enabled() if success: heading = _("Success") else: heading = _("Error") kdialog = KanoDialog(heading, msg, parent_window=self.win) kdialog.run() # If the user has just turned the parental control on, take them to # the config screen. if self.parental_enabled: self.go_to_parental_config() else: self.go_to_advanced()
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
def __init__(self, win): Template.__init__( self, _("Advanced options"), _("Toggle parental lock and debug mode"), _("APPLY CHANGES"), win.is_plug(), back_btn=False ) parental_box = self.create_parental_button() debug_box = self.create_debug_button() ssh_box = self.create_ssh_button() self.box.set_spacing(20) self.box.pack_start(parental_box, False, False, 0) self.box.pack_start(debug_box, False, False, 0) self.box.pack_start(ssh_box, False, False, 0) self.win = win debug_mode = self.get_stored_debug_mode() self.ssh_preference = is_ssh_enabled() self.parental_button.set_active(get_parental_enabled()) self.parental_button.connect('clicked', self.go_to_password) self.debug_button.set_active(debug_mode) self.debug_button.connect('clicked', self.on_debug_toggled) self.ssh_button.set_active(self.ssh_preference) self.ssh_button.connect('clicked', self.on_ssh_button_clicked) self.win.set_main_widget(self) # Add the callbacks to the top bar and to the extra back button self.set_prev_callback(self.win.go_to_home) 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 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
def __init__(self, win): self.parental_enabled = get_parental_enabled() # Entry container entry_container = Gtk.Grid(column_homogeneous=False, column_spacing=22, row_spacing=10) # if enabled, turning off if self.parental_enabled: Template.__init__( self, _("Unlock parental lock"), _("Enter your password"), _("UNLOCK"), win.is_plug(), True ) self.entry = Gtk.Entry() self.entry.set_size_request(300, 44) self.entry.props.placeholder_text = _("Enter your selected password") self.entry.set_visibility(False) self.entry.connect('key_release_event', self.enable_button) entry_container.attach(self.entry, 0, 0, 1, 1) # if disabled, turning on else: Template.__init__( self, _("Set up parental lock"), _("Choose a password"), _("LOCK"), win.is_plug() ) self.entry1 = Gtk.Entry() self.entry1.set_size_request(300, 44) self.entry1.props.placeholder_text = _("Select password") self.entry1.set_visibility(False) self.entry2 = Gtk.Entry() self.entry2.props.placeholder_text = _("Confirm password") self.entry2.set_visibility(False) self.entry1.connect('key_release_event', self.enable_button) self.entry2.connect('key_release_event', self.enable_button) entry_container.attach(self.entry1, 0, 0, 1, 1) entry_container.attach(self.entry2, 0, 1, 1, 1) self.win = win self.win.set_main_widget(self) self.set_prev_callback(self.go_to_advanced) self.win.change_prev_callback(self.go_to_advanced) self.win.top_bar.enable_prev() self.kano_button.set_sensitive(False) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.box.add(entry_container) self.win.show_all()