screen_panel: Put icons on a side bar instead of on the header
This commit is contained in:
parent
49f7cf0e46
commit
874b74d59a
@ -23,8 +23,8 @@ class KlippyGtk:
|
|||||||
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
|
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
|
||||||
self.img_width = int(round(self.width / self.width_ratio))
|
self.img_width = int(round(self.width / self.width_ratio))
|
||||||
self.img_height = int(round(self.height / self.height_ratio))
|
self.img_height = int(round(self.height / self.height_ratio))
|
||||||
self.header_image_scale_width = .625
|
self.header_image_scale_width = 1.2
|
||||||
self.header_image_scale_height = .625
|
self.header_image_scale_height = 1.4
|
||||||
|
|
||||||
logger.debug("img width: %s height: %s" % (self.img_width, self.img_height))
|
logger.debug("img width: %s height: %s" % (self.img_width, self.img_height))
|
||||||
|
|
||||||
|
@ -25,21 +25,33 @@ class ScreenPanel:
|
|||||||
self.layout = Gtk.Layout()
|
self.layout = Gtk.Layout()
|
||||||
self.layout.set_size(self._screen.width, self._screen.height)
|
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()
|
button_scale = self._gtk.get_header_image_scale()
|
||||||
logger.debug("Button scale: %s" % button_scale)
|
logger.debug("Button scale: %s" % button_scale)
|
||||||
if back == True:
|
if back == True:
|
||||||
self.control['back'] = self._gtk.ButtonImage('back', None, None, button_scale[0], button_scale[1])
|
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.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'] = self._gtk.ButtonImage('home', None, None, button_scale[0], button_scale[1])
|
||||||
self.control['home'].connect("clicked", self.menu_return, True)
|
self.control['home'].connect("clicked", self.menu_return, True)
|
||||||
self.layout.put(self.control['home'], self._screen.width - round(
|
self.control_grid.attach(self.control['home'], 0, 1, 1, 1)
|
||||||
self._gtk.get_image_width() * button_scale[0] * 1.45), 0)
|
|
||||||
|
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'] = self._gtk.ButtonImage('emergency', None, None, button_scale[0], button_scale[1])
|
||||||
self.control['estop'].connect("clicked", self.emergency_stop)
|
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:
|
try:
|
||||||
env = Environment(extensions=["jinja2.ext.i18n"])
|
env = Environment(extensions=["jinja2.ext.i18n"])
|
||||||
@ -50,16 +62,19 @@ class ScreenPanel:
|
|||||||
logger.debug("Error parsing jinja for title: %s" % title)
|
logger.debug("Error parsing jinja for title: %s" % title)
|
||||||
|
|
||||||
self.title = Gtk.Label()
|
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_hexpand(True)
|
||||||
self.title.set_halign(Gtk.Align.CENTER)
|
self.title.set_halign(Gtk.Align.CENTER)
|
||||||
self.title.set_valign(Gtk.Align.CENTER)
|
self.title.set_valign(Gtk.Align.CENTER)
|
||||||
self.set_title(title)
|
self.set_title(title)
|
||||||
self.layout.put(self.title, 0, 0)
|
|
||||||
|
|
||||||
self.content = Gtk.Box(spacing=0)
|
self.content = Gtk.Box(spacing=0)
|
||||||
self.content.set_size_request(self._screen.width, self._screen.height - self.title_spacing)
|
self.content.set_size_request(self._screen.width - left_bar_width, self._screen.height - self.title_spacing)
|
||||||
self.layout.put(self.content, 0, 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):
|
def initialize(self, panel_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user