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 __init__(self, win): Template.__init__( self, _("Locale"), _("Set your locale (Changing this requires a reboot)"), _("APPLY CHANGES") ) dropdown_container = Gtk.Box( orientation=Gtk.Orientation.HORIZONTAL, spacing=20 ) self.box.pack_start(dropdown_container, False, False, 0) self._language_combo = self._create_language_combo() dropdown_container.pack_start(self._language_combo, False, False, 0) self._region_combo = self._create_region_combo() dropdown_container.pack_start(self._region_combo, False, False, 0) self._load_saved_settings() self.win = win self.win.set_main_widget(self) self.win.change_prev_callback(self.win.go_to_home) self.win.top_bar.enable_prev() self.kano_button.connect('clicked', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.show_all()
def __init__(self, win): Template.__init__(self, _("Bluetooth"), _("Connect to bluetooth devices"), _("APPLY CHANGES"), win.is_plug(), back_btn=True) 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._overlay = BlurOverlay() self.box.pack_start(self._overlay, False, False, 0) self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.fill_contents() self._overlay.add(self._contents) self._refresh_btn = None self._done_btn = None self._arrange_buttons() self.show_all() self.dev_list.refresh()
def __init__(self, win): Template.__init__( self, _("Locale"), _("Set your locale (Changing this requires a reboot)"), _("APPLY CHANGES")) dropdown_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20) self.box.pack_start(dropdown_container, False, False, 0) self._language_combo = self._create_language_combo() dropdown_container.pack_start(self._language_combo, False, False, 0) self._region_combo = self._create_region_combo() dropdown_container.pack_start(self._region_combo, False, False, 0) self._load_saved_settings() self.win = win self.win.set_main_widget(self) self.win.change_prev_callback(self.win.go_to_home) self.win.top_bar.enable_prev() self.kano_button.connect('clicked', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.show_all()
def __init__(self, win): Template.__init__( self, _("Bluetooth"), _("Connect to bluetooth devices"), _("APPLY CHANGES"), win.is_plug(), back_btn=True ) 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._overlay = BlurOverlay() self.box.pack_start(self._overlay, False, False, 0) self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.fill_contents() self._overlay.add(self._contents) self._refresh_btn = None self._done_btn = None self._arrange_buttons() self.show_all() self.dev_list.refresh()
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 __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 __init__(self, win): title = _("Screensaver - advanced") description = '' kano_label = _("APPLY CHANGES") Template.__init__(self, title, description, kano_label) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_set_style) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) # Want a label to the left, so we need to pack it separately checkbutton_box = Gtk.Box( orientation=Gtk.Orientation.HORIZONTAL, spacing=35 ) self.checkbutton = Gtk.CheckButton() label = Gtk.Label(_("Turn on screensaver")) label.get_style_context().add_class('checkbutton_label') checkbutton_box.pack_start(label, False, False, 0) checkbutton_box.pack_start(self.checkbutton, False, False, 0) self.checkbutton.connect('toggled', self.enable_screensaver_scale) scalebox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20) label = Gtk.Label(_("Length of time in minutes\nbefore screensaver launches")) label.get_style_context().add_class('checkbutton_label') label.set_margin_top(25) self.scale = Gtk.Scale.new_with_range( orientation=Gtk.Orientation.HORIZONTAL, min=1, max=60, step=1 ) self.scale.get_style_context().add_class('normal_label') self.scale.set_size_request(200, 1) scalebox.pack_start(label, False, False, 0) scalebox.pack_start(self.scale, False, False, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.pack_start(checkbutton_box, True, True, 0) vbox.pack_start(scalebox, True, True, 0) vbox.set_margin_top(20) self.box.pack_start(vbox, True, True, 0) self.scale.set_sensitive(False) self.show_config_on_loading_page() self.win.show_all()
def __init__(self, win): Template.__init__(self, _("Change your password"), "", _("CHANGE PASSWORD")) self.labelled_entries = LabelledEntries([{ 'heading': _("Old password"), 'subheading': _("\"kano\" is default") }, { 'heading': _("New password"), 'subheading': "" }, { 'heading': _("Repeat new password"), 'subheading': "" }]) self.entry1 = self.labelled_entries.get_entry(0) self.entry1.set_size_request(300, 44) self.entry1.set_visibility(False) self.entry1.props.placeholder_text = _("Old password") self.entry2 = self.labelled_entries.get_entry(1) self.entry2.set_size_request(300, 44) self.entry2.set_visibility(False) self.entry2.props.placeholder_text = _("New password") self.entry3 = self.labelled_entries.get_entry(2) self.entry3.set_size_request(300, 44) self.entry3.set_visibility(False) self.entry3.props.placeholder_text = _("Repeat new password") self.entry1.connect('key_release_event', self.enable_button) self.entry2.connect('key_release_event', self.enable_button) self.entry3.connect('key_release_event', self.enable_button) self.entry1.grab_focus() self.win = win self.win.set_main_widget(self) self.box.pack_start(self.labelled_entries, False, False, 0) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_accounts) 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.win.show_all()
def __init__(self, win): Template.__init__( self, "Allow and Block Sites", "Add extra sites to block or allow", "APPLY CHANGES", win.is_plug(), True ) self.win = win blacklist, whitelist = read_listed_sites() self.blacklist = SiteList(size_x=250, size_y=25) self.whitelist = SiteList(size_x=250, size_y=25) if whitelist: for site in whitelist: self.whitelist.edit_list_store.append([site]) if blacklist: for site in blacklist: self.blacklist.edit_list_store.append([site]) grid = Gtk.Grid() grid.set_column_spacing(40) add_label = Gtk.Label("Add extra sites to block") add_label.get_style_context().add_class('normal_label') grid.attach(add_label, 0, 0, 1, 1) grid.attach(self.blacklist, 0, 1, 1, 1) remove_label = Gtk.Label("Something blocked that shouldn't be?") remove_label.get_style_context().add_class('normal_label') grid.attach(remove_label, 1, 0, 1, 1) grid.attach(self.whitelist, 1, 1, 1, 1) self.box.pack_start(grid, False, False, 0) self.box.pack_start(Gtk.Label(''), False, False, 0) self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_parental_config) self.set_prev_callback(self.go_to_parental_config) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.show_all() self.win.show_all()
def __init__(self, win): Template.__init__( self, _("Allow and Block Sites"), _("Add extra sites to block or allow"), _("APPLY CHANGES"), win.is_plug(), True ) self.win = win blacklist, whitelist = read_listed_sites() self.blacklist = SiteList(size_x=250, size_y=25) self.whitelist = SiteList(size_x=250, size_y=25) if whitelist: for site in whitelist: self.whitelist.edit_list_store.append([site]) if blacklist: for site in blacklist: self.blacklist.edit_list_store.append([site]) grid = Gtk.Grid() grid.set_column_spacing(40) add_label = Gtk.Label(_("Add extra sites to block")) add_label.get_style_context().add_class('normal_label') grid.attach(add_label, 0, 0, 1, 1) grid.attach(self.blacklist, 0, 1, 1, 1) remove_label = Gtk.Label(_("Something blocked that shouldn't be?")) remove_label.get_style_context().add_class('normal_label') grid.attach(remove_label, 1, 0, 1, 1) grid.attach(self.whitelist, 1, 1, 1, 1) self.box.pack_start(grid, False, False, 0) self.box.pack_start(Gtk.Label(''), False, False, 0) self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_parental_config) self.set_prev_callback(self.go_to_parental_config) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.show_all() self.win.show_all()
def __init__(self, win): title = _("Screensaver - advanced") description = '' kano_label = _("APPLY CHANGES") Template.__init__(self, title, description, kano_label) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_set_style) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) # Want a label to the left, so we need to pack it separately checkbutton_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=35) self.checkbutton = Gtk.CheckButton() label = Gtk.Label(_("Turn on screensaver")) label.get_style_context().add_class('checkbutton_label') checkbutton_box.pack_start(label, False, False, 0) checkbutton_box.pack_start(self.checkbutton, False, False, 0) self.checkbutton.connect('toggled', self.enable_screensaver_scale) scalebox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20) label = Gtk.Label( _("Length of time in minutes\nbefore screensaver launches")) label.get_style_context().add_class('checkbutton_label') label.set_margin_top(25) self.scale = Gtk.Scale.new_with_range( orientation=Gtk.Orientation.HORIZONTAL, min=1, max=60, step=1) self.scale.get_style_context().add_class('normal_label') self.scale.set_size_request(200, 1) scalebox.pack_start(label, False, False, 0) scalebox.pack_start(self.scale, False, False, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.pack_start(checkbutton_box, True, True, 0) vbox.pack_start(scalebox, True, True, 0) vbox.set_margin_top(20) self.box.pack_start(vbox, True, True, 0) self.scale.set_sensitive(False) self.show_config_on_loading_page() self.win.show_all()
def __init__(self, win): Template.__init__( self, _("Change your password"), "", _("CHANGE PASSWORD") ) self.labelled_entries = LabelledEntries( [{'heading': _("Old password"), 'subheading': _("\"kano\" is default")}, {'heading': _("New password"), 'subheading': ""}, {'heading': _("Repeat new password"), 'subheading': ""}] ) self.entry1 = self.labelled_entries.get_entry(0) self.entry1.set_size_request(300, 44) self.entry1.set_visibility(False) self.entry1.props.placeholder_text = _("Old password") self.entry2 = self.labelled_entries.get_entry(1) self.entry2.set_size_request(300, 44) self.entry2.set_visibility(False) self.entry2.props.placeholder_text = _("New password") self.entry3 = self.labelled_entries.get_entry(2) self.entry3.set_size_request(300, 44) self.entry3.set_visibility(False) self.entry3.props.placeholder_text = _("Repeat new password") self.entry1.connect('key_release_event', self.enable_button) self.entry2.connect('key_release_event', self.enable_button) self.entry3.connect('key_release_event', self.enable_button) self.entry1.grab_focus() self.win = win self.win.set_main_widget(self) self.box.pack_start(self.labelled_entries, False, False, 0) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_accounts) 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.win.show_all()
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 __init__(self, win): Template.__init__( self, _("Audio"), _("Get sound from your speaker or your TV"), _("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) # Analog radio button self.analog_button = Gtk.RadioButton.new_with_label_from_widget(None, _("Speaker")) # HDMI radio button self.hdmi_button = Gtk.RadioButton.new_from_widget(self.analog_button) self.hdmi_button.set_label(_("TV ")) self.hdmi_button.connect('toggled', self.on_button_toggled) # height is 106px self.current_img = Gtk.Image() self.current_img.set_from_file(common.media + "/Graphics/Audio-jack.png") self.horizontal_box = Gtk.Box() self.horizontal_box.pack_start(self.hdmi_button, False, False, 10) self.horizontal_box.pack_start(self.current_img, False, False, 10) self.horizontal_box.pack_start(self.analog_button, False, False, 10) self.box.add(self.horizontal_box) self.align.set_padding(0, 0, 25, 0) # Show the current setting by electing the appropriate radio button self.current_setting() self.win.show_all()
def __init__(self, win): Template.__init__( self, _("Keyboard"), _("Where do you live? So I can set your keyboard."), _("APPLY CHANGES") ) self.win = win self.win.set_main_widget(self) self.read_config() kano_keyboard = detect_kano_keyboard() self.win.top_bar.enable_prev() if kano_keyboard: self.win.change_prev_callback(self.go_to_kano_screen) else: self.win.change_prev_callback(self.win.go_to_home) self.kano_button.connect('button-release-event', self.apply_changes) # Make sure continue button is enabled self.kano_button.set_sensitive(False) # Create Continents Combo box self.continents_combo = KanoComboBox(max_display_items=7) for c in self.continents: self.continents_combo.append(c) self.continents_combo.connect('changed', self.on_continent_changed) # Create Countries Combo box self.countries_combo = KanoComboBox(max_display_items=7) self.countries_combo.connect('changed', self.on_country_changed) self.countries_combo.props.valign = Gtk.Align.CENTER # Create Advance mode checkbox advance_button = Gtk.CheckButton(_("Advanced options")) advance_button.set_can_focus(False) advance_button.props.valign = Gtk.Align.CENTER advance_button.connect('clicked', self.on_advance_mode) advance_button.set_active(False) # Create Variants Combo box self.variants_combo = KanoComboBox(max_display_items=7) self.variants_combo.connect('changed', self.on_variants_changed) self.variants_combo.props.valign = Gtk.Align.CENTER # Set up default values in dropdown lists self.set_defaults('continent') self.fill_countries_combo(self.continents_combo.get_selected_item_text()) self.set_defaults('country') self.on_country_changed(self.countries_combo) self.set_defaults('variant') # Ceate various dropdown boxes so we can resize the dropdown lists appropriately # We create two boxes side by side, and then stack the country dropdow lists in one, and one by itself in the other # dropdown_box_countries dropdown_box_keys # | | | # |-------continents-------| Advance option | # | | | # | | | # |-------countries -------|--------variants--------| # | | | dropdown_box_countries = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) dropdown_box_countries.set_size_request(230, 30) dropdown_box_countries.props.valign = Gtk.Align.CENTER dropdown_box_keys = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) dropdown_box_keys.set_size_request(230, 30) dropdown_box_countries.pack_start(self.continents_combo, False, False, 0) dropdown_box_countries.pack_start(self.countries_combo, False, False, 0) dropdown_box_keys.pack_start(advance_button, False, False, 0) dropdown_box_keys.pack_start(self.variants_combo, False, False, 0) dropdown_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20) dropdown_container.pack_start(dropdown_box_countries, False, False, 0) dropdown_container.pack_start(dropdown_box_keys, False, False, 0) self.box.pack_start(dropdown_container, False, False, 0) # show all elements except the advanced mode self.refresh_window()
def __init__(self, win): Template.__init__( self, _("Audio"), _("Get sound from your speaker or your TV"), _("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) # Analog radio button self.analog_button = Gtk.RadioButton.new_with_label_from_widget(None, _("Speaker")) # TODO: This message should come from is_analogue_audio_supported() and in # turn from whomever disabled it. This is the only case we have for now. self.disabled_analogue_label = Gtk.Label(_( "To play sound through a\n" "speaker, remove your kit's light\n" "hat and re-open this menu" )) # HDMI radio button self.hdmi_button = Gtk.RadioButton.new_from_widget(self.analog_button) self.hdmi_button.set_label(_("TV ")) self.hdmi_button.connect('toggled', self.on_button_toggled) hdmi_button_align = Gtk.Alignment(xalign=1, xscale=0, yalign=0, yscale=0) hdmi_button_align.add(self.hdmi_button) # TODO: This message should come from is_hdmi_audio_supported() and in # turn from whomever disabled it. This is the only case we have for now. self.disabled_hdmi_label = Gtk.Label(_( "To play sound through HDMI,\n" "connect to a screen with\n" "speakers" )) disabled_hdmi_label_align = Gtk.Alignment(xalign=1, xscale=0, yalign=0, yscale=0) disabled_hdmi_label_align.add(self.disabled_hdmi_label) # height is 106px self.current_img = Gtk.Image() self.current_img.set_from_file(common.media + "/Graphics/Audio-jack.png") self.hdmi_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.hdmi_box.pack_start(Gtk.Label(_("\n\n")), False, False, 10) self.hdmi_box.pack_start(hdmi_button_align, False, False, 10) self.hdmi_box.pack_start(disabled_hdmi_label_align, False, False, 10) self.analogue_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.analogue_box.pack_start(Gtk.Label(_("\n\n")), False, False, 10) self.analogue_box.pack_start(self.analog_button, False, False, 10) self.analogue_box.pack_start(self.disabled_analogue_label, False, False, 10) self.horizontal_box = Gtk.Box() self.horizontal_box.pack_start(self.hdmi_box, False, False, 10) self.horizontal_box.pack_start(self.current_img, False, False, 10) self.horizontal_box.pack_start(self.analogue_box, False, False, 10) audio_overdrive_box = Gtk.Box() audio_overdrive_box.set_halign(Gtk.Align.CENTER) self.audio_overdrive_checkbutton = Gtk.CheckButton() self.audio_overdrive_checkbutton.set_label(_("Boost Volume")) self.audio_overdrive_checkbutton.get_style_context().add_class('bold_toggle') audio_overdrive_desc_label = Gtk.Label(_("Make your kit even louder")) audio_overdrive_desc_label.get_style_context().add_class('normal_label') audio_overdrive_box.pack_start(self.audio_overdrive_checkbutton, False, False, 10) audio_overdrive_box.pack_start(audio_overdrive_desc_label, False, False, 0) self.vertical_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.vertical_box.pack_start(self.horizontal_box, False, False, 0) if self._show_audio_overdrive(): self.vertical_box.pack_start(audio_overdrive_box, False, False, 10) self.box.add(self.vertical_box) self.align.set_padding(0, 0, 25, 0) # Show the current setting by electing the appropriate radio button self.current_setting() self.win.show_all()
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 __init__(self, win): Template.__init__(self, "", _("to be set"), _("COMPLETE")) self.win = win self.win.set_main_widget(self) self.kano_button.connect('button-release-event', self.win.go_to_home) internet_img = Gtk.Image() # Very hacky way to centre the Proxy button - put spaces in the label self.proxy_button = OrangeButton(_("Proxy ")) self.proxy_button.connect('button-release-event', self.go_to_proxy) self.disable_proxy = OrangeButton(_("Disable proxy")) self.win.change_prev_callback(self.win.go_to_home) self.win.top_bar.enable_prev() internet_status = Gtk.Label() internet_status_style = internet_status.get_style_context() internet_status.set_alignment(xalign=1, yalign=0.5) internet_action = Gtk.Label() internet_action_style = internet_action.get_style_context() internet_status_style.add_class('internet_status_top') internet_action_style.add_class('internet_status_bottom') internet_action.set_alignment(xalign=1, yalign=0.5) status_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) status_box.props.valign = Gtk.Align.CENTER configure_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) container.pack_start(status_box, False, False, 2) container.pack_start(internet_img, False, False, 2) self.box.pack_start(container, False, False, 0) network_info_dict = network_info() common.has_internet = is_internet() if not common.has_internet or not network_info_dict: if network_info_dict: description = _("Use the browser to log in or configure proxy") else: description = _("Configure wireless") title = _("Get connected") self.add_connection = KanoButton(_("WIFI")) self.add_connection.connect('button_release_event', self.configure_wifi) # We removed the ability to use keyboard to click, so we also remove ability # to get keyboard focus self.add_connection.set_can_focus(False) # For now, this is removed as the event listener is interefering with the # kano-connect #self.add_connection.connect("key_release_event", self.configure_wifi) status_box.pack_start(self.add_connection, False, False, 0) internet_img.set_from_file(common.media + "/Graphics/Internet-noConnection.png") internet_status.set_text(_("No network found")) self.kano_button.set_label(_("BACK")) status_box.pack_start(configure_container, False, False, 3) go_to_portal_button = OrangeButton(_("Browser Login")) go_to_portal_button.connect('button-press-event', self.cb_launch_browser) configure_container.pack_start(go_to_portal_button, False, False, 0) divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_container.pack_end(self.proxy_button, False, False, 0) else: self.kano_button.set_label(_("COMPLETE")) status_box.pack_start(internet_status, False, False, 3) status_box.pack_start(internet_action, False, False, 3) status_box.pack_start(configure_container, False, False, 3) network = network_info_dict.keys()[0] ip = network_info_dict[network]['address'] network_text = network_info_dict[network]['nice_name'] internet_img.set_from_file(common.media + "/Graphics/Internet-Connection.png") internet_status.set_text(network_text) internet_action.set_text(ip) go_to_portal_button = OrangeButton(_("Browser Login")) go_to_portal_button.connect('button-press-event', self.cb_launch_browser) configure_container.pack_start(go_to_portal_button, False, False, 0) if network_text == 'Ethernet': title = _("Connection found!") description = _("You're on a wired network") # Change to ethernet image here internet_img.set_from_file( common.media + "/Graphics/Internet-ethernetConnection.png") else: title = _("Connection found!") description = _("You're on a wireless network") divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_button = OrangeButton(_("Configure")) configure_button.connect('button_press_event', self.configure_wifi) configure_container.pack_start(configure_button, False, False, 0) divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_container.pack_end(self.proxy_button, False, False, 0) self.title.title.set_text(title) self.title.description.set_text(description) self.win.show_all()
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 __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()
def __init__(self, win): # Show the Display brand and model self.model = get_edid_name() info_message = _("\nScreen Model: {}".format(self.model)) # And the current display resolution try: current_resolution = get_status()['resolution'] info_message += _("\nCurrent Resolution: {}").format(_(current_resolution)) except: pass Template.__init__( self, _("Display"), 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') mode_string = '{hdmi_group}:{hdmi_mode} {width}x{height} {refresh_rate}Hz {aspect_ratio}' if modes: for mode in modes: self.mode_combo.append(mode_string.format( hdmi_group=mode['group'], hdmi_mode=mode['mode'], width=mode['width'], height=mode['height'], refresh_rate=mode['rate'], aspect_ratio=mode['aspect_ratio'] )) 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_screen_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()
def __init__(self, win): Template.__init__(self, "", _("to be set"), _("COMPLETE")) self.win = win self.win.set_main_widget(self) self.kano_button.connect('button-release-event', self.win.go_to_home) internet_img = Gtk.Image() # Very hacky way to centre the Proxy button - put spaces in the label self.proxy_button = OrangeButton(_("Proxy ")) self.proxy_button.connect('button-release-event', self.go_to_proxy) self.disable_proxy = OrangeButton(_("Disable proxy")) self.win.change_prev_callback(self.win.go_to_home) self.win.top_bar.enable_prev() internet_status = Gtk.Label() internet_status_style = internet_status.get_style_context() internet_status.set_alignment(xalign=1, yalign=0.5) internet_action = Gtk.Label() internet_action_style = internet_action.get_style_context() internet_status_style.add_class('internet_status_top') internet_action_style.add_class('internet_status_bottom') internet_action.set_alignment(xalign=1, yalign=0.5) status_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) status_box.props.valign = Gtk.Align.CENTER configure_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) container.pack_start(status_box, False, False, 2) container.pack_start(internet_img, False, False, 2) self.box.pack_start(container, False, False, 0) network_info_dict = network_info() common.has_internet = is_internet() if not common.has_internet or not network_info_dict: if network_info_dict: description = _("Use the browser to log in or configure proxy") else: description = _("Configure wireless") title = _("Get connected") self.add_connection = KanoButton(_("WIFI")) self.add_connection.connect('button_release_event', self.configure_wifi) # We removed the ability to use keyboard to click, so we also remove ability # to get keyboard focus self.add_connection.set_can_focus(False) # For now, this is removed as the event listener is interefering with the # kano-connect #self.add_connection.connect("key_release_event", self.configure_wifi) status_box.pack_start(self.add_connection, False, False, 0) internet_img.set_from_file(common.media + "/Graphics/Internet-noConnection.png") internet_status.set_text(_("No network found")) self.kano_button.set_label(_("BACK")) status_box.pack_start(configure_container, False, False, 3) go_to_portal_button = OrangeButton(_("Browser Login")) go_to_portal_button.connect('button-press-event', self.cb_launch_browser) configure_container.pack_start(go_to_portal_button, False, False, 0) divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_container.pack_end(self.proxy_button, False, False, 0) else: self.kano_button.set_label(_("COMPLETE")) status_box.pack_start(internet_status, False, False, 3) status_box.pack_start(internet_action, False, False, 3) status_box.pack_start(configure_container, False, False, 3) network = network_info_dict.keys()[0] ip = network_info_dict[network]['address'] network_text = network_info_dict[network]['nice_name'] internet_img.set_from_file(common.media + "/Graphics/Internet-Connection.png") internet_status.set_text(network_text) internet_action.set_text(ip) go_to_portal_button = OrangeButton(_("Browser Login")) go_to_portal_button.connect('button-press-event', self.cb_launch_browser) configure_container.pack_start(go_to_portal_button, False, False, 0) if network_text == 'Ethernet': title = _("Connection found!") description = _("You're on a wired network") # Change to ethernet image here internet_img.set_from_file(common.media + "/Graphics/Internet-ethernetConnection.png") else: title = _("Connection found!") description = _("You're on a wireless network") divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_button = OrangeButton(_("Configure")) configure_button.connect('button_press_event', self.configure_wifi) configure_container.pack_start(configure_button, False, False, 0) divider_label = Gtk.Label("|") configure_container.pack_start(divider_label, False, False, 3) configure_container.pack_end(self.proxy_button, False, False, 0) self.title.title.set_text(title) self.title.description.set_text(description) self.win.show_all()
def __init__(self, win): # Show the Display brand and model self.model = get_edid_name() info_message = _("\nScreen Model: {}".format(self.model)) # And the current display resolution try: current_resolution = get_status()['resolution'] info_message += _("\nCurrent Resolution: {}").format(_(current_resolution)) except: pass Template.__init__( self, _("Display"), 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') mode_string = '{hdmi_group}:{hdmi_mode} {width}x{height} {refresh_rate}Hz {aspect_ratio}' if modes: for mode in modes: self.mode_combo.append(mode_string.format( hdmi_group=mode['group'], hdmi_mode=mode['mode'], width=mode['width'], height=mode['height'], refresh_rate=mode['rate'], aspect_ratio=mode['aspect_ratio'] )) 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 self.flip_preference_start = (get_screen_value('display_rotate') == 2) self.flip_preference_end = self.flip_preference_start flip_button.set_active(self.flip_preference_start) flip_button.connect('clicked', self.on_flip_screen_clicked) 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()