main_menu: allow closing the keypad with the back button
This commit is contained in:
parent
189df7921f
commit
5fa1e44f16
@ -63,6 +63,7 @@ class BasePanel(ScreenPanel):
|
||||
self.action_bar.add(self.control['back'])
|
||||
self.action_bar.add(self.control['home'])
|
||||
self.show_back(False)
|
||||
self.show_home(False)
|
||||
if self.buttons_showing['printer_select']:
|
||||
self.action_bar.add(self.control['printer_select'])
|
||||
self.show_macro_shortcut(self._config.get_main_config().getboolean('side_macro_shortcut', True))
|
||||
@ -255,12 +256,10 @@ class BasePanel(ScreenPanel):
|
||||
self.content.remove(widget)
|
||||
|
||||
def show_back(self, show=True):
|
||||
if show:
|
||||
self.control['back'].set_sensitive(True)
|
||||
self.control['home'].set_sensitive(True)
|
||||
return
|
||||
self.control['back'].set_sensitive(False)
|
||||
self.control['home'].set_sensitive(False)
|
||||
self.control['back'].set_sensitive(show)
|
||||
|
||||
def show_home(self, show=True):
|
||||
self.control['home'].set_sensitive(show)
|
||||
|
||||
def show_macro_shortcut(self, show=True):
|
||||
if show is True and self.buttons_showing['macros_shortcut'] is False:
|
||||
|
@ -22,6 +22,7 @@ class Panel(MenuPanel):
|
||||
self.main_menu.set_vexpand(True)
|
||||
self.graph_retry = 0
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
self.numpad_visible = False
|
||||
|
||||
logging.info("### Making MainMenu")
|
||||
|
||||
@ -263,6 +264,8 @@ class Panel(MenuPanel):
|
||||
self.main_menu.remove_column(1)
|
||||
self.main_menu.attach(self.labels['menu'], 1, 0, 1, 1)
|
||||
self.main_menu.show_all()
|
||||
self.numpad_visible = False
|
||||
self._screen.base_panel.show_back(False)
|
||||
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
@ -297,7 +300,15 @@ class Panel(MenuPanel):
|
||||
self.main_menu.remove_column(1)
|
||||
self.main_menu.attach(self.labels["keypad"], 1, 0, 1, 1)
|
||||
self.main_menu.show_all()
|
||||
self.numpad_visible = True
|
||||
self._screen.base_panel.show_back(True)
|
||||
|
||||
def update_graph(self):
|
||||
self.labels['da'].queue_draw()
|
||||
return True
|
||||
|
||||
def back(self):
|
||||
if self.numpad_visible:
|
||||
self.hide_numpad()
|
||||
return True
|
||||
return False
|
||||
|
@ -300,6 +300,7 @@ class KlipperScreen(Gtk.Window):
|
||||
self.base_panel.add_content(self.panels[panel])
|
||||
logging.debug(f"Current panel hierarchy: {' > '.join(self._cur_panels)}")
|
||||
self.base_panel.show_back(len(self._cur_panels) > 1)
|
||||
self.base_panel.show_home(len(self._cur_panels) > 1)
|
||||
if hasattr(self.panels[panel], "process_update"):
|
||||
self.process_update("notify_status_update", self.printer.data)
|
||||
self.process_update("notify_busy", self.printer.busy)
|
||||
|
Loading…
x
Reference in New Issue
Block a user