def on_help_clicked(self, button): model, treeiter = self.tree.get_selection().get_selected() if treeiter is not None: logging.info("Open welcome.htm for %s if available", model[treeiter][1]) welcome_file = model[treeiter][5] if welcome_file and os.path.isfile(welcome_file): uri_path = pathlib.Path(welcome_file).as_uri() logging.info("opening" + uri_path) w = WelcomeView(uri_path, model[treeiter][3]) w.resize(800, 600) w.show_all() else: logging.info("welcome.htm not available")
def on_install_clicked(self, button): logging.info("Installing keyboard") try: install_kmp(self.kmpfile, self.online) if self.viewwindow: self.viewwindow.refresh_installed_kmp() if self.download: self.download.close() keyboardid = os.path.basename(os.path.splitext(self.kmpfile)[0]) welcome_file = os.path.join(user_keyboard_dir(keyboardid), "welcome.htm") if os.path.isfile(welcome_file): uri_path = pathlib.Path(welcome_file).as_uri() logging.debug(uri_path) w = WelcomeView(uri_path, self.kbname) w.resize(800, 600) w.show_all() else: dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, "Keyboard " + self.kbname + " installed") dialog.run() dialog.destroy() except InstallError as e: if e.status == InstallStatus.Abort: message = "Keyboard " + self.kbname + " could not be installed.\n\nError Message:\n%s" % (e.message) logging.error(message) message_type = Gtk.MessageType.ERROR else: message = "Keyboard " + self.kbname + " could not be installed fully.\n\nWarning Message:\n%s" % (e.message) logging.warning(message) message_type = Gtk.MessageType.WARNING dialog = Gtk.MessageDialog(self, 0, message_type, Gtk.ButtonsType.OK, message) dialog.run() dialog.destroy() if not self.endonclose: self.close()