forked from CreatBot/CreatBotKlipperScreen
menu: refactor adding items to menu so they can be dynamically added/rmeoved.
This commit is contained in:
@@ -16,7 +16,11 @@ class MainPanel(MenuPanel):
|
||||
|
||||
def initialize(self, panel_name, items, extrudercount):
|
||||
print("### Making MainMenu")
|
||||
|
||||
self.layout = Gtk.Layout()
|
||||
self.layout.set_size(self._screen.width, self._screen.height)
|
||||
grid = KlippyGtk.HomogeneousGrid()
|
||||
grid.set_size_request(self._screen.width, self._screen.height)
|
||||
|
||||
# Create Extruders and bed icons
|
||||
eq_grid = KlippyGtk.HomogeneousGrid()
|
||||
@@ -36,6 +40,14 @@ class MainPanel(MenuPanel):
|
||||
eq_grid.attach(self.labels['heater_bed'], 0, i/2+1, width, 1)
|
||||
|
||||
grid.attach(eq_grid, 0, 0, 1, 1)
|
||||
|
||||
self.items = items
|
||||
self.create_menu_items()
|
||||
|
||||
self.grid = Gtk.Grid()
|
||||
self.grid.set_row_homogeneous(True)
|
||||
self.grid.set_column_homogeneous(True)
|
||||
|
||||
grid.attach(self.arrangeMenuItems(items, 2, True), 1, 0, 1, 1)
|
||||
self.grid = grid
|
||||
|
||||
@@ -43,11 +55,12 @@ class MainPanel(MenuPanel):
|
||||
"heater_bed": 0,
|
||||
"extruder": 0
|
||||
}
|
||||
self.layout.put(grid, 0, 0)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def get(self):
|
||||
return self.grid
|
||||
def activate(self):
|
||||
return
|
||||
|
||||
def update_temp(self, dev, temp, target):
|
||||
if dev in self.labels:
|
||||
|
Reference in New Issue
Block a user