main_menu and temp: change layout to accomodate a bigger graph and list in vertical mode
close #1372
This commit is contained in:
parent
32ba2099cb
commit
3fee9cbb70
@ -25,12 +25,13 @@ class Panel(MenuPanel):
|
||||
stats = self._printer.get_printer_status_data()["printer"]
|
||||
if stats["temperature_devices"]["count"] > 0 or stats["extruders"]["count"] > 0:
|
||||
self._gtk.reset_temp_color()
|
||||
self.main_menu.attach(self.create_left_panel(), 0, 0, 1, 1)
|
||||
if self._screen.vertical_mode:
|
||||
self.main_menu.attach(self.create_left_panel(), 0, 0, 1, 3)
|
||||
self.labels['menu'] = self.arrangeMenuItems(items, 3, True)
|
||||
scroll.add(self.labels['menu'])
|
||||
self.main_menu.attach(scroll, 0, 1, 1, 1)
|
||||
self.main_menu.attach(scroll, 0, 3, 1, 2)
|
||||
else:
|
||||
self.main_menu.attach(self.create_left_panel(), 0, 0, 1, 1)
|
||||
self.labels['menu'] = self.arrangeMenuItems(items, 2, True)
|
||||
scroll.add(self.labels['menu'])
|
||||
self.main_menu.attach(scroll, 1, 0, 1, 1)
|
||||
|
@ -29,7 +29,6 @@ class Panel(ScreenPanel):
|
||||
self.preheat_options = self._screen._config.get_preheat_options()
|
||||
self.grid = Gtk.Grid(row_homogeneous=True, column_homogeneous=True)
|
||||
self._gtk.reset_temp_color()
|
||||
self.grid.attach(self.create_left_panel(), 0, 0, 1, 1)
|
||||
|
||||
# When printing start in temp_delta mode and only select tools
|
||||
selection = []
|
||||
@ -51,8 +50,10 @@ class Panel(ScreenPanel):
|
||||
self.select_heater(None, h)
|
||||
|
||||
if self._screen.vertical_mode:
|
||||
self.grid.attach(self.create_right_panel(), 0, 1, 1, 1)
|
||||
self.grid.attach(self.create_left_panel(), 0, 0, 1, 3)
|
||||
self.grid.attach(self.create_right_panel(), 0, 3, 1, 2)
|
||||
else:
|
||||
self.grid.attach(self.create_left_panel(), 0, 0, 1, 1)
|
||||
self.grid.attach(self.create_right_panel(), 1, 0, 1, 1)
|
||||
|
||||
self.content.add(self.grid)
|
||||
@ -71,16 +72,17 @@ class Panel(ScreenPanel):
|
||||
right.attach(cooldown, 0, 0, 2, 1)
|
||||
right.attach(adjust, 2, 0, 1, 1)
|
||||
if self.show_preheat:
|
||||
right.attach(self.preheat(), 0, 1, 3, 3)
|
||||
right.attach(self.preheat(), 0, 1, 3, 2)
|
||||
else:
|
||||
right.attach(self.delta_adjust(), 0, 1, 3, 3)
|
||||
right.attach(self.delta_adjust(), 0, 1, 3, 2)
|
||||
return right
|
||||
|
||||
def switch_preheat_adjust(self, widget):
|
||||
self.show_preheat ^= True
|
||||
if self._screen.vertical_mode:
|
||||
self.grid.remove_row(1)
|
||||
self.grid.attach(self.create_right_panel(), 0, 1, 1, 1)
|
||||
row = self.grid.get_child_at(0, 3)
|
||||
self.grid.remove(row)
|
||||
self.grid.attach(self.create_right_panel(), 0, 3, 1, 2)
|
||||
else:
|
||||
self.grid.remove_column(1)
|
||||
self.grid.attach(self.create_right_panel(), 1, 0, 1, 1)
|
||||
@ -106,34 +108,37 @@ class Panel(ScreenPanel):
|
||||
return scroll
|
||||
|
||||
def delta_adjust(self):
|
||||
deltagrid = Gtk.Grid(row_homogeneous=True, column_homogeneous=True)
|
||||
# Create buttons for increase and decrease
|
||||
self.labels["increase"] = self._gtk.Button("increase", None, "color1")
|
||||
self.labels["increase"].connect(
|
||||
"clicked", self.change_target_temp_incremental, "+"
|
||||
)
|
||||
self.labels["increase"].connect("clicked", self.change_target_temp_incremental, "+")
|
||||
self.labels["decrease"] = self._gtk.Button("decrease", None, "color3")
|
||||
self.labels["decrease"].connect(
|
||||
"clicked", self.change_target_temp_incremental, "-"
|
||||
)
|
||||
self.labels["decrease"].connect("clicked", self.change_target_temp_incremental, "-")
|
||||
|
||||
tempgrid = Gtk.Grid()
|
||||
for j, i in enumerate(self.tempdeltas):
|
||||
# Create buttons for temperature deltas
|
||||
for i in self.tempdeltas:
|
||||
self.labels[f"deg{i}"] = self._gtk.Button(label=i)
|
||||
self.labels[f"deg{i}"].connect("clicked", self.change_temp_delta, i)
|
||||
ctx = self.labels[f"deg{i}"].get_style_context()
|
||||
ctx.add_class("horizontal_togglebuttons")
|
||||
if i == self.tempdelta:
|
||||
ctx.add_class("horizontal_togglebuttons_active")
|
||||
|
||||
# Create grid for temperature deltas
|
||||
tempgrid = Gtk.Grid()
|
||||
for j, i in enumerate(self.tempdeltas):
|
||||
tempgrid.attach(self.labels[f"deg{i}"], j, 0, 1, 1)
|
||||
|
||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
vbox.pack_start(Gtk.Label(_("Temperature") + " (°C)"), False, False, 8)
|
||||
vbox.pack_end(tempgrid, True, True, 2)
|
||||
|
||||
vsize = 2 if self._screen.vertical_mode else 3
|
||||
deltagrid.attach(self.labels["decrease"], 0, 0, 1, vsize)
|
||||
deltagrid.attach(self.labels["increase"], 1, 0, 1, vsize)
|
||||
deltagrid.attach(vbox, 0, vsize, 2, 2)
|
||||
# Create grid for decrease button, increase button, temperature labels, and grid
|
||||
deltagrid = Gtk.Grid(row_homogeneous=True, column_homogeneous=True)
|
||||
if self._screen.vertical_mode:
|
||||
deltagrid.attach(self.labels["decrease"], 0, 1, 1, 1)
|
||||
deltagrid.attach(self.labels["increase"], 1, 1, 1, 1)
|
||||
deltagrid.attach(tempgrid, 0, 2, 2, 1)
|
||||
else:
|
||||
deltagrid.attach(self.labels["decrease"], 0, 1, 1, 3)
|
||||
deltagrid.attach(self.labels["increase"], 1, 1, 1, 3)
|
||||
deltagrid.attach(Gtk.Label(_("Temperature") + " (°C)"), 0, 4, 2, 1)
|
||||
deltagrid.attach(tempgrid, 0, 5, 2, 2)
|
||||
return deltagrid
|
||||
|
||||
def change_temp_delta(self, widget, tempdelta):
|
||||
|
Loading…
x
Reference in New Issue
Block a user