main and temp: fix keypad with the new vertical layout

This commit is contained in:
Alfredo Monclus
2024-05-24 15:42:14 -03:00
parent 564db518da
commit 5eb268b220
3 changed files with 39 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ class Panel(MenuPanel):
self.main_menu.attach(scroll, 1, 0, 1, 1)
self.content.add(self.main_menu)
def update_graph_visibility(self):
def update_graph_visibility(self, force_hide=False):
if self.left_panel is None:
logging.info("No left panel")
return
@@ -52,7 +52,7 @@ class Panel(MenuPanel):
self.devices[device]['name'].get_style_context().add_class("graph_label")
else:
self.devices[device]['name'].get_style_context().remove_class("graph_label")
if count > 0:
if count > 0 and not force_hide:
if self.labels['da'] not in self.left_panel:
self.left_panel.add(self.labels['da'])
self.labels['da'].queue_draw()
@@ -243,11 +243,17 @@ class Panel(MenuPanel):
self.active_heater = None
if self._screen.vertical_mode:
self.main_menu.remove_row(1)
self.main_menu.attach(self.labels['menu'], 0, 1, 1, 1)
if not self._gtk.ultra_tall:
self.update_graph_visibility(force_hide=False)
top = self.main_menu.get_child_at(0, 0)
bottom = self.main_menu.get_child_at(0, 2)
self.main_menu.remove(top)
self.main_menu.remove(bottom)
self.main_menu.attach(top, 0, 0, 1, 3)
self.main_menu.attach(self.labels["menu"], 0, 3, 1, 2)
else:
self.main_menu.remove_column(1)
self.main_menu.attach(self.labels['menu'], 1, 0, 1, 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.set_control_sensitive(False, control='back')
@@ -279,8 +285,14 @@ class Panel(MenuPanel):
self.labels["keypad"].clear()
if self._screen.vertical_mode:
self.main_menu.remove_row(1)
self.main_menu.attach(self.labels["keypad"], 0, 1, 1, 1)
if not self._gtk.ultra_tall:
self.update_graph_visibility(force_hide=True)
top = self.main_menu.get_child_at(0, 0)
bottom = self.main_menu.get_child_at(0, 3)
self.main_menu.remove(top)
self.main_menu.remove(bottom)
self.main_menu.attach(top, 0, 0, 1, 2)
self.main_menu.attach(self.labels["keypad"], 0, 2, 1, 2)
else:
self.main_menu.remove_column(1)
self.main_menu.attach(self.labels["keypad"], 1, 0, 1, 1)