From dabc1a84e46816331aba5b9c564045c7f07e1483 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 28 May 2020 17:09:55 +0200 Subject: [PATCH 1/2] fix(linux): Disable buttons if no keyboard installed This change disables the uninstall, about, and help buttons in km-config if the list of installed keyboards is empty. This fixes #3181. --- .../keyman_config/view_installed.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/linux/keyman-config/keyman_config/view_installed.py b/linux/keyman-config/keyman_config/view_installed.py index e1eb7f5d87..48d3b3b534 100755 --- a/linux/keyman-config/keyman_config/view_installed.py +++ b/linux/keyman-config/keyman_config/view_installed.py @@ -126,16 +126,19 @@ class ViewInstalledWindow(ViewInstalledWindowBase): self.uninstall_button = Gtk.Button.new_with_mnemonic("_Uninstall") self.uninstall_button.set_tooltip_text("Uninstall keyboard package") self.uninstall_button.connect("clicked", self.on_uninstall_clicked) + self.uninstall_button.set_sensitive(False) bbox_top.add(self.uninstall_button) self.about_button = Gtk.Button.new_with_mnemonic("_About") self.about_button.set_tooltip_text("About keyboard package") self.about_button.connect("clicked", self.on_about_clicked) + self.about_button.set_sensitive(False) bbox_top.add(self.about_button) self.help_button = Gtk.Button.new_with_mnemonic("_Help") self.help_button.set_tooltip_text("Help for keyboard package") self.help_button.connect("clicked", self.on_help_clicked) + self.help_button.set_sensitive(False) bbox_top.add(self.help_button) self.options_button = Gtk.Button.new_with_mnemonic("_Options") @@ -246,12 +249,13 @@ class ViewInstalledWindow(ViewInstalledWindowBase): self.about_button.set_tooltip_text("About keyboard package " + model[treeiter][1]) self.options_button.set_tooltip_text("Settings for keyboard package " + model[treeiter][1]) logging.debug("You selected %s version %s", model[treeiter][1], model[treeiter][2]) + self.about_button.set_sensitive(True) if model[treeiter][4] == InstallArea.IA_USER: logging.debug("Enabling uninstall button for %s in %s", model[treeiter][3], model[treeiter][4]) self.uninstall_button.set_sensitive(True) else: self.uninstall_button.set_sensitive(False) - logging.debug("Disabling uninstall button for %s in %s ", model[treeiter][3], model[treeiter][4]) + logging.debug("Disabling uninstall button for %s in %s", model[treeiter][3], model[treeiter][4]) # welcome file if it exists if model[treeiter][5]: self.help_button.set_sensitive(True) @@ -262,6 +266,15 @@ class ViewInstalledWindow(ViewInstalledWindowBase): self.options_button.set_sensitive(True) else: self.options_button.set_sensitive(False) + else: + self.uninstall_button.set_tooltip_text("Uninstall keyboard package") + self.help_button.set_tooltip_text("Help for keyboard package") + self.about_button.set_tooltip_text("About keyboard package") + self.options_button.set_tooltip_text("Settings for keyboard package") + self.uninstall_button.set_sensitive(False) + self.about_button.set_sensitive(False) + self.help_button.set_sensitive(False) + self.options_button.set_sensitive(False) def on_help_clicked(self, button): model, treeiter = self.tree.get_selection().get_selected() @@ -270,7 +283,7 @@ class ViewInstalledWindow(ViewInstalledWindowBase): 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) + logging.info("opening " + uri_path) w = WelcomeView(uri_path, model[treeiter][3]) w.resize(800, 600) w.show_all() @@ -284,7 +297,7 @@ class ViewInstalledWindow(ViewInstalledWindowBase): options_file = model[treeiter][6] if options_file and os.path.isfile(options_file): uri_path = pathlib.Path(options_file).as_uri() - logging.info("opening" + uri_path) + logging.info("opening " + uri_path) # TODO: Determine keyboardID info = { "optionurl": uri_path, "packageID": model[treeiter][3], "keyboardID": model[treeiter][3] } w = OptionsView(info) From bfd60e582920e6576c4c4fa8210c91495a72c687 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 28 May 2020 17:11:51 +0200 Subject: [PATCH 2/2] feat(linux): Increase margin in About dialog of km-config This change increases the padding on the inside of the About window so that there is more whitespace between the UI elements and the window border. --- linux/keyman-config/keyman_config/keyboard_details.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/linux/keyman-config/keyman_config/keyboard_details.py b/linux/keyman-config/keyman_config/keyboard_details.py index f7af4adf48..25983b5266 100644 --- a/linux/keyman-config/keyman_config/keyboard_details.py +++ b/linux/keyman-config/keyman_config/keyboard_details.py @@ -37,6 +37,7 @@ class KeyboardDetailsView(Gtk.Window): Gtk.Window.__init__(self, title=wintitle) init_accel(self) + hbox_outer = Gtk.Box(spacing = 12) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12) packageDir = os.path.join(kmp['areapath'], kmp['packageID']) @@ -288,10 +289,10 @@ class KeyboardDetailsView(Gtk.Window): # label.set_halign(Gtk.Align.START) # label.set_selectable(True) # grid.attach_next_to(label, label9, Gtk.PositionType.RIGHT, 1, 1) - vbox.pack_start(box, True, True, 0) + vbox.pack_start(box, True, True, 12) - hbox = Gtk.Box(spacing=6) - vbox.pack_start(hbox, False, False, 0) + hbox = Gtk.Box(spacing = 6) + vbox.pack_start(hbox, False, False, 12) # Add an entire row of padding lbl_pad = Gtk.Label() @@ -335,7 +336,8 @@ class KeyboardDetailsView(Gtk.Window): hbox.pack_end(button, False, False, 0) bind_accelerator(self.accelerators, button, 'w') - self.add(vbox) + hbox_outer.pack_start(vbox, True, True, 12) + self.add(hbox_outer) self.resize(635, 270) def on_close_clicked(self, button):