diff --git a/panels/bed_mesh.py b/panels/bed_mesh.py index bb32186e..e34b3642 100644 --- a/panels/bed_mesh.py +++ b/panels/bed_mesh.py @@ -237,8 +237,7 @@ class BedMeshPanel(ScreenPanel): self.labels['profile_name'].set_text('') self.labels['profile_name'].set_hexpand(True) self.labels['profile_name'].connect("activate", self.create_profile) - self.labels['profile_name'].connect("focus-in-event", self._show_keyboard) - self.labels['profile_name'].grab_focus_without_selecting() + self.labels['profile_name'].connect("focus-in-event", self._screen.show_keyboard) save = self._gtk.Button("complete", _("Save"), "color3") save.set_hexpand(False) @@ -256,12 +255,9 @@ class BedMeshPanel(ScreenPanel): self.labels['create_profile'].pack_start(box, True, True, 5) self.content.add(self.labels['create_profile']) - self._show_keyboard() + self.labels['profile_name'].grab_focus_without_selecting() self.show_create = True - def _show_keyboard(self, widget=None, event=None): - self._screen.show_keyboard(entry=self.labels['profile_name']) - def create_profile(self, widget): name = self.labels['profile_name'].get_text() if self.active_mesh is None: diff --git a/panels/console.py b/panels/console.py index 05537660..666a8d39 100644 --- a/panels/console.py +++ b/panels/console.py @@ -84,7 +84,7 @@ class ConsolePanel(ScreenPanel): entry = Gtk.Entry() entry.set_hexpand(True) entry.set_vexpand(False) - entry.connect("button-press-event", self._show_keyboard) + entry.connect("button-press-event", self._screen.show_keyboard) entry.connect("focus-in-event", self._screen.show_keyboard) entry.connect("activate", self._send_command) entry.grab_focus_without_selecting() @@ -109,9 +109,6 @@ class ConsolePanel(ScreenPanel): content_box.pack_end(ebox, False, False, 0) self.content.add(content_box) - def _show_keyboard(self, widget=None, event=None): - self._screen.show_keyboard(entry=self.labels['entry']) - def clear(self, widget=None): self.labels['tb'].set_text("") diff --git a/panels/gcode_macros.py b/panels/gcode_macros.py index 8bd2de45..c8e12edd 100644 --- a/panels/gcode_macros.py +++ b/panels/gcode_macros.py @@ -97,13 +97,10 @@ class MacroPanel(ScreenPanel): for param in self.macros[macro]["params"]: labels.add(Gtk.Label(param)) - self.macros[macro]["params"][param].connect("focus-in-event", self._show_keyboard) + self.macros[macro]["params"][param].connect("focus-in-event", self._screen.show_keyboard) self.macros[macro]["params"][param].connect("focus-out-event", self._screen.remove_keyboard) labels.add(self.macros[macro]["params"][param]) - def _show_keyboard(self, widget=None, event=None): - self._screen.show_keyboard(entry=widget) - def run_gcode_macro(self, widget, macro): params = "" for param in self.macros[macro]["params"]: diff --git a/panels/network.py b/panels/network.py index efc72eb5..3b760c5e 100644 --- a/panels/network.py +++ b/panels/network.py @@ -341,8 +341,7 @@ class NetworkPanel(ScreenPanel): self.labels['network_psk'].set_text('') self.labels['network_psk'].set_hexpand(True) self.labels['network_psk'].connect("activate", self.add_new_network, ssid, True) - self.labels['network_psk'].connect("focus-in-event", self._show_keyboard) - self.labels['network_psk'].grab_focus_without_selecting() + self.labels['network_psk'].connect("focus-in-event", self._screen.show_keyboard) save = self._gtk.Button("sd", _("Save"), "color3") save.set_hexpand(False) @@ -360,13 +359,10 @@ class NetworkPanel(ScreenPanel): self.labels['add_network'].pack_start(box, True, True, 5) self.content.add(self.labels['add_network']) - self._screen.show_keyboard() + self.labels['network_psk'].grab_focus_without_selecting() self.content.show_all() self.show_add = True - def _show_keyboard(self, widget=None, event=None): - self._screen.show_keyboard(entry=self.labels['network_psk']) - def update_all_networks(self): for network in list(self.networks): self.update_network_info(network) diff --git a/screen.py b/screen.py index 393a7dfa..b0168e39 100755 --- a/screen.py +++ b/screen.py @@ -889,7 +889,7 @@ class KlipperScreen(Gtk.Window): self.gtk.remove_dialog(dialog) self.show_panel('job_status', "job_status", _("Printing"), 2) - def show_keyboard(self, widget=None, event=None, entry=None): + def show_keyboard(self, entry=None, event=None): if self.keyboard is not None: return @@ -928,17 +928,13 @@ class KlipperScreen(Gtk.Window): return box.get_style_context().add_class("keyboard_box") box.add(Keyboard(self, self.remove_keyboard, entry=entry)) - self.keyboard = { - "entry": entry, - "box": box - } + self.keyboard = {"box": box} self.base_panel.content.pack_end(box, False, False, 0) self.base_panel.content.show_all() def remove_keyboard(self, widget=None, event=None): if self.keyboard is None: return - if 'process' in self.keyboard: os.kill(self.keyboard['process'].pid, SIGTERM) self.base_panel.content.remove(self.keyboard['box'])