From 874b74d59a7eb00b0bfff55679203b232e65d991 Mon Sep 17 00:00:00 2001 From: Jordan Ruthe Date: Mon, 15 Feb 2021 14:58:33 -0500 Subject: [PATCH] screen_panel: Put icons on a side bar instead of on the header --- ks_includes/KlippyGtk.py | 4 ++-- ks_includes/screen_panel.py | 31 +++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ks_includes/KlippyGtk.py b/ks_includes/KlippyGtk.py index 834eeea6..ad6429ca 100644 --- a/ks_includes/KlippyGtk.py +++ b/ks_includes/KlippyGtk.py @@ -23,8 +23,8 @@ class KlippyGtk: self.header_size = int(round((self.width / self.width_ratio) / 1.33)) self.img_width = int(round(self.width / self.width_ratio)) self.img_height = int(round(self.height / self.height_ratio)) - self.header_image_scale_width = .625 - self.header_image_scale_height = .625 + self.header_image_scale_width = 1.2 + self.header_image_scale_height = 1.4 logger.debug("img width: %s height: %s" % (self.img_width, self.img_height)) diff --git a/ks_includes/screen_panel.py b/ks_includes/screen_panel.py index 45939cc5..d25c8b0c 100644 --- a/ks_includes/screen_panel.py +++ b/ks_includes/screen_panel.py @@ -25,21 +25,33 @@ class ScreenPanel: self.layout = Gtk.Layout() self.layout.set_size(self._screen.width, self._screen.height) + left_bar_width = int(self._screen.width * .1) + + self.control_grid = self._gtk.HomogeneousGrid() + self.control_grid.set_size_request(left_bar_width, self._screen.height) + button_scale = self._gtk.get_header_image_scale() logger.debug("Button scale: %s" % button_scale) if back == True: self.control['back'] = self._gtk.ButtonImage('back', None, None, button_scale[0], button_scale[1]) self.control['back'].connect("clicked", self._screen._menu_go_back) - self.layout.put(self.control['back'], 0, 0) + self.control_grid.attach(self.control['back'], 0, 0, 1, 1) self.control['home'] = self._gtk.ButtonImage('home', None, None, button_scale[0], button_scale[1]) self.control['home'].connect("clicked", self.menu_return, True) - self.layout.put(self.control['home'], self._screen.width - round( - self._gtk.get_image_width() * button_scale[0] * 1.45), 0) + self.control_grid.attach(self.control['home'], 0, 1, 1, 1) + + self.control['printer_select'] = Gtk.Label("") + self.control_grid.attach(self.control['printer_select'], 0, 2, 1, 1) + else: + for i in range(3): + self.control['space%s' % i] = Gtk.Label("") + self.control_grid.attach(self.control['space%s' % i], 0, i, 1, 1) self.control['estop'] = self._gtk.ButtonImage('emergency', None, None, button_scale[0], button_scale[1]) self.control['estop'].connect("clicked", self.emergency_stop) - self.layout.put(self.control['estop'], int(self._screen.width/4*3 - button_scale[0]/2), 0) + self.control_grid.attach(self.control['estop'], 0, 3, 1, 1) + #self.layout.put(self.control['estop'], int(self._screen.width/4*3 - button_scale[0]/2), 0) try: env = Environment(extensions=["jinja2.ext.i18n"]) @@ -50,16 +62,19 @@ class ScreenPanel: logger.debug("Error parsing jinja for title: %s" % title) self.title = Gtk.Label() - self.title.set_size_request(self._screen.width, self.title_spacing) + self.title.set_size_request(self._screen.width - left_bar_width, self.title_spacing) self.title.set_hexpand(True) self.title.set_halign(Gtk.Align.CENTER) self.title.set_valign(Gtk.Align.CENTER) self.set_title(title) - self.layout.put(self.title, 0, 0) + self.content = Gtk.Box(spacing=0) - self.content.set_size_request(self._screen.width, self._screen.height - self.title_spacing) - self.layout.put(self.content, 0, self.title_spacing) + self.content.set_size_request(self._screen.width - left_bar_width, self._screen.height - self.title_spacing) + + self.layout.put(self.control_grid, 0, 0) + self.layout.put(self.title, left_bar_width, 0) + self.layout.put(self.content, left_bar_width, self.title_spacing) def initialize(self, panel_name):