menu: fix portrait issues
This commit is contained in:
parent
d945ef8b0a
commit
2e16193292
@ -35,10 +35,11 @@ class MainPanel(MenuPanel):
|
|||||||
|
|
||||||
leftpanel = self.create_left_panel()
|
leftpanel = self.create_left_panel()
|
||||||
grid.attach(leftpanel, 0, 0, 1, 1)
|
grid.attach(leftpanel, 0, 0, 1, 1)
|
||||||
self.labels['menu'] = self.arrangeMenuItems(items, 2, True)
|
|
||||||
if self._screen.vertical_mode:
|
if self._screen.vertical_mode:
|
||||||
|
self.labels['menu'] = self.arrangeMenuItems(items, 3, True)
|
||||||
grid.attach(self.labels['menu'], 0, 1, 1, 1)
|
grid.attach(self.labels['menu'], 0, 1, 1, 1)
|
||||||
else:
|
else:
|
||||||
|
self.labels['menu'] = self.arrangeMenuItems(items, 2, True)
|
||||||
grid.attach(self.labels['menu'], 1, 0, 1, 1)
|
grid.attach(self.labels['menu'], 1, 0, 1, 1)
|
||||||
|
|
||||||
self.grid = grid
|
self.grid = grid
|
||||||
|
@ -36,6 +36,9 @@ class MenuPanel(ScreenPanel):
|
|||||||
self.j2_data.update({
|
self.j2_data.update({
|
||||||
'moonraker_connected': self._screen._ws.is_connected()
|
'moonraker_connected': self._screen._ws.is_connected()
|
||||||
})
|
})
|
||||||
|
if self._screen.vertical_mode:
|
||||||
|
self.arrangeMenuItems(self.items, 3)
|
||||||
|
else:
|
||||||
self.arrangeMenuItems(self.items, 4)
|
self.arrangeMenuItems(self.items, 4)
|
||||||
|
|
||||||
def arrangeMenuItems(self, items, columns, expandLast=False):
|
def arrangeMenuItems(self, items, columns, expandLast=False):
|
||||||
@ -58,18 +61,11 @@ class MenuPanel(ScreenPanel):
|
|||||||
# Arrange 3 x 2
|
# Arrange 3 x 2
|
||||||
columns = 3
|
columns = 3
|
||||||
|
|
||||||
if self._screen.vertical_mode:
|
|
||||||
row = i % columns
|
|
||||||
col = int(i/columns)
|
|
||||||
else:
|
|
||||||
col = i % columns
|
col = i % columns
|
||||||
row = int(i/columns)
|
row = int(i/columns)
|
||||||
|
|
||||||
width = height = 1
|
width = height = 1
|
||||||
if expandLast is True and i+1 == length and length % 2 == 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)
|
self.grid.attach(self.labels[key], col, row, width, height)
|
||||||
|
@ -130,9 +130,14 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
vbox.pack_start(Gtk.Label(_("Temperature") + " (°C)"), False, False, 8)
|
vbox.pack_start(Gtk.Label(_("Temperature") + " (°C)"), False, False, 8)
|
||||||
vbox.pack_end(tempgrid, True, True, 2)
|
vbox.pack_end(tempgrid, True, True, 2)
|
||||||
|
|
||||||
deltagrid.attach(vbox, 0, 3, 2, 2)
|
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["decrease"], 0, 0, 1, 3)
|
||||||
deltagrid.attach(self.labels["increase"], 1, 0, 1, 3)
|
deltagrid.attach(self.labels["increase"], 1, 0, 1, 3)
|
||||||
|
deltagrid.attach(vbox, 0, 3, 2, 2)
|
||||||
return deltagrid
|
return deltagrid
|
||||||
|
|
||||||
def change_temp_delta(self, widget, tempdelta):
|
def change_temp_delta(self, widget, tempdelta):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user