bed_mesh: Updates to content to include action bar width

This commit is contained in:
Jordan Ruthe 2021-02-15 15:53:39 -05:00
parent f047830852
commit 0a5e931d17
4 changed files with 22 additions and 9 deletions

View File

@ -23,11 +23,21 @@ 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.action_bar_width = int(self.width * .1)
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))
def get_action_bar_width(self):
return self.action_bar_width
def get_content_width(self):
return self.width - self.action_bar_width
def get_content_height(self):
return self.height - self.header_size
def get_header_size(self):
return self.header_size

View File

@ -25,10 +25,10 @@ class ScreenPanel:
self.layout = Gtk.Layout()
self.layout.set_size(self._screen.width, self._screen.height)
left_bar_width = int(self._screen.width * .1)
action_bar_width = self._gtk.get_action_bar_width()
self.control_grid = self._gtk.HomogeneousGrid()
self.control_grid.set_size_request(left_bar_width - 2, self._screen.height)
self.control_grid.set_size_request(action_bar_width - 2, self._screen.height)
self.control_grid.get_style_context().add_class('action_bar')
button_scale = self._gtk.get_header_image_scale()
@ -63,7 +63,7 @@ class ScreenPanel:
logger.debug("Error parsing jinja for title: %s" % title)
self.title = Gtk.Label()
self.title.set_size_request(self._screen.width - left_bar_width, self.title_spacing)
self.title.set_size_request(self._screen.width - action_bar_width, self.title_spacing)
self.title.set_hexpand(True)
self.title.set_halign(Gtk.Align.CENTER)
self.title.set_valign(Gtk.Align.CENTER)
@ -71,11 +71,11 @@ class ScreenPanel:
self.content = Gtk.Box(spacing=0)
self.content.set_size_request(self._screen.width - left_bar_width, self._screen.height - self.title_spacing)
self.content.set_size_request(self._screen.width - action_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)
self.layout.put(self.title, action_bar_width, 0)
self.layout.put(self.content, action_bar_width, self.title_spacing)
def initialize(self, panel_name):

View File

@ -255,7 +255,7 @@ class BedMeshPanel(ScreenPanel):
self.labels['create_profile'].set_valign(Gtk.Align.START)
box = Gtk.Box(spacing=5)
box.set_size_request(self._screen.width, self._screen.height - self._gtk.get_header_size() -
box.set_size_request(self._gtk.get_content_width(), self._gtk.get_content_height() -
self._screen.keyboard_height - 20)
box.set_hexpand(True)
box.set_vexpand(False)

View File

@ -622,15 +622,18 @@ class KlipperScreen(Gtk.Window):
logger.debug("PID %s" % p.pid)
keyboard = Gtk.Socket()
#keyboard.connect("plug-added", self.plug_added)
action_bar_width = self.gtk.get_action_bar_width()
box = Gtk.VBox()
box.set_size_request(self.width, self.keyboard_height)
box.set_size_request(self.width - action_bar_width, self.keyboard_height)
box.add(keyboard)
cur_panel = self.panels[self._cur_panels[-1]]
#for i in ['back','estop','home']:
# if i in cur_panel.control:
# cur_panel.control[i].set_sensitive(False)
cur_panel.get().put(box, 0, self.height - 200)
cur_panel.get().put(box, action_bar_width, self.height - 200)
self.show_all()
keyboard.add_id(xid)
keyboard.show()