def __init__(self, _win): self.win = _win # check for monitor if is_monitor(): self.win.exit_flow() return self.win.set_resizable(True) # Change background change_wallpaper(MEDIA_DIR, "/Display-Test") # Create UI self.template = Template( img_path=os.path.join(MEDIA_DIR, "display_test.png"), title="Can you see four white lines?", description="They should be touching each side of your screen.", button1_text="YES", button2_text="NO" ) self.template.kano_button2.set_color("red") self.template.kano_button.connect("button_release_event", self.next_screen) self.template.kano_button.connect("key_release_event", self.next_screen) self.template.kano_button2.connect("button_release_event", self.tutorial_screen) self.template.kano_button2.connect("key_release_event", self.tutorial_screen) self.win.set_main_widget(self.template) # Make the kano button grab the focus self.template.kano_button.grab_focus() self.win.show_all()
def restore_wallpaper(self): '''Restore the wallpaper to the system default. ''' kdesk_path = "/usr/share/kano-desktop/kdesk/.kdeskrc" identifier = 'Background.File-medium: ' # We split the default paths into the containing directory of the # wallpapers and the name of the file without the size. # This is so we can pass these parameters into the change_wallpaper # function, so it can decide the appropriate size to set the wallpaper. with open(kdesk_path) as f: for line in f: line = line.strip() if line.startswith(identifier): line = line.replace(identifier, '').replace('-1024.png', '') path = '/'.join(line.split('/')[:-1]) name = line.split('/')[-1] change_wallpaper(path, name) # finish once we change the wallpaper return
def set_wallpaper_by_image_name(self, image_name): path = self.table.get_path(image_name) change_wallpaper(path, image_name)
def next_screen(self, _, event): """ Move on to the next setting """ if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: # Restore background change_wallpaper(WALLPAPER_PATH, "kanux-default") self.win.exit_flow()
def go_to_next(self): """ Finish display setup """ # Restore background change_wallpaper(WALLPAPER_PATH, "kanux-default") self.win.exit_flow()