def ui_content(self): kbd = system.Keyboard() c = kbd.get_current() self.logger.debug("Current layout: %s" % c) ws = [ui.Header("header[0]", "Keyboard Layout Selection"), ui.Table("keyboard.layout", "", "Available Keyboard Layouts", kbd.available_layouts(), c), ui.Label("label[0]", "(Hit Enter to select a layout)") ] self.widgets.add(ws) page = ui.Page("keyboard", ws) page.buttons = [ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Continue")] return page
def on_merge(self, effective_changes): changes = self.pending_changes(False) if changes.contains_any(["button.back"]): self.application.ui.navigate.to_previous_plugin() elif changes.contains_any(["keyboard.layout", "button.next"]): # Apply kbd layout directly so it takes affect on the password page kbd = system.Keyboard() self.dry_or(lambda: kbd.set_layout(changes["keyboard.layout"])) app = self.application welcome = app.get_plugin(welcome_page.Plugin) method = welcome.model()["method"] nav = self.application.ui.navigate if method in ["upgrade", "downgrade", "reinstall"]: nav.to_plugin(upgrade_page.Plugin) else: nav.to_next_plugin()