menu: fix portrait issues

This commit is contained in:
alfrix 2022-03-25 13:41:22 -03:00
parent d945ef8b0a
commit 2e16193292
3 changed files with 17 additions and 15 deletions

View File

@ -35,10 +35,11 @@ class MainPanel(MenuPanel):
leftpanel = self.create_left_panel()
grid.attach(leftpanel, 0, 0, 1, 1)
self.labels['menu'] = self.arrangeMenuItems(items, 2, True)
if self._screen.vertical_mode:
self.labels['menu'] = self.arrangeMenuItems(items, 3, True)
grid.attach(self.labels['menu'], 0, 1, 1, 1)
else:
self.labels['menu'] = self.arrangeMenuItems(items, 2, True)
grid.attach(self.labels['menu'], 1, 0, 1, 1)
self.grid = grid

View File

@ -36,7 +36,10 @@ class MenuPanel(ScreenPanel):
self.j2_data.update({
'moonraker_connected': self._screen._ws.is_connected()
})
self.arrangeMenuItems(self.items, 4)
if self._screen.vertical_mode:
self.arrangeMenuItems(self.items, 3)
else:
self.arrangeMenuItems(self.items, 4)
def arrangeMenuItems(self, items, columns, expandLast=False):
for child in self.grid.get_children():
@ -58,19 +61,12 @@ class MenuPanel(ScreenPanel):
# Arrange 3 x 2
columns = 3
if self._screen.vertical_mode:
row = i % columns
col = int(i/columns)
else:
col = i % columns
row = int(i/columns)
col = i % columns
row = int(i/columns)
width = height = 1
if expandLast is True and i+1 == length and length % 2 == 1:
if self._screen.vertical_mode:
height = 2
else:
width = 2
width = 2
self.grid.attach(self.labels[key], col, row, width, height)
i += 1

View File

@ -130,9 +130,14 @@ class TemperaturePanel(ScreenPanel):
vbox.pack_start(Gtk.Label(_("Temperature") + " (°C)"), False, False, 8)
vbox.pack_end(tempgrid, True, True, 2)
deltagrid.attach(vbox, 0, 3, 2, 2)
deltagrid.attach(self.labels["decrease"], 0, 0, 1, 3)
deltagrid.attach(self.labels["increase"], 1, 0, 1, 3)
if self._screen.vertical_mode:
deltagrid.attach(self.labels["decrease"], 0, 0, 1, 2)
deltagrid.attach(self.labels["increase"], 1, 0, 1, 2)
deltagrid.attach(vbox, 0, 2, 2, 2)
else:
deltagrid.attach(self.labels["decrease"], 0, 0, 1, 3)
deltagrid.attach(self.labels["increase"], 1, 0, 1, 3)
deltagrid.attach(vbox, 0, 3, 2, 2)
return deltagrid
def change_temp_delta(self, widget, tempdelta):