splash_screen: tweak layout sizes and remove get_allocation that can cause isssues
fixes #813 gtk: fix content_width while vertical returning 0
This commit is contained in:
parent
abb1f0d2d2
commit
20346a90dc
@ -45,6 +45,7 @@ class KlippyGtk:
|
|||||||
else:
|
else:
|
||||||
self.action_bar_width = int(self.width * .1)
|
self.action_bar_width = int(self.width * .1)
|
||||||
self.action_bar_height = int(self.height)
|
self.action_bar_height = int(self.height)
|
||||||
|
logging.info(f"{self.action_bar_width=}")
|
||||||
|
|
||||||
self.color_list = {} # This is set by screen.py init_style()
|
self.color_list = {} # This is set by screen.py init_style()
|
||||||
for key in self.color_list:
|
for key in self.color_list:
|
||||||
@ -59,12 +60,13 @@ class KlippyGtk:
|
|||||||
return self.action_bar_height
|
return self.action_bar_height
|
||||||
|
|
||||||
def get_content_width(self):
|
def get_content_width(self):
|
||||||
|
if self.screen.vertical_mode:
|
||||||
|
return self.width
|
||||||
return self.width - self.action_bar_width
|
return self.width - self.action_bar_width
|
||||||
|
|
||||||
def get_content_height(self):
|
def get_content_height(self):
|
||||||
if self.screen.vertical_mode:
|
if self.screen.vertical_mode:
|
||||||
return self.height - self.titlebar_height - self.action_bar_height
|
return self.height - self.titlebar_height - self.action_bar_height
|
||||||
else:
|
|
||||||
return self.height - self.titlebar_height
|
return self.height - self.titlebar_height
|
||||||
|
|
||||||
def get_font_size(self):
|
def get_font_size(self):
|
||||||
|
@ -55,11 +55,10 @@ class BasePanel(ScreenPanel):
|
|||||||
if self._screen.vertical_mode:
|
if self._screen.vertical_mode:
|
||||||
self.action_bar.set_hexpand(True)
|
self.action_bar.set_hexpand(True)
|
||||||
self.action_bar.set_vexpand(False)
|
self.action_bar.set_vexpand(False)
|
||||||
self.action_bar.set_size_request(0, self._gtk.get_action_bar_height())
|
|
||||||
else:
|
else:
|
||||||
self.action_bar.set_hexpand(False)
|
self.action_bar.set_hexpand(False)
|
||||||
self.action_bar.set_vexpand(True)
|
self.action_bar.set_vexpand(True)
|
||||||
self.action_bar.set_size_request(self._gtk.get_action_bar_width(), 0)
|
self.action_bar.set_size_request(self._gtk.get_action_bar_width(), self._gtk.get_action_bar_height())
|
||||||
|
|
||||||
self.action_bar.get_style_context().add_class('action_bar')
|
self.action_bar.get_style_context().add_class('action_bar')
|
||||||
self.action_bar.add(self.control['back'])
|
self.action_bar.add(self.control['back'])
|
||||||
@ -88,7 +87,7 @@ class BasePanel(ScreenPanel):
|
|||||||
self.control['time_box'].pack_end(self.control['time'], True, True, 10)
|
self.control['time_box'].pack_end(self.control['time'], True, True, 10)
|
||||||
|
|
||||||
self.titlebar = Gtk.Box(spacing=5)
|
self.titlebar = Gtk.Box(spacing=5)
|
||||||
self.titlebar.set_size_request(0, self._gtk.get_titlebar_height())
|
self.titlebar.set_size_request(self._gtk.get_content_width(), self._gtk.get_titlebar_height())
|
||||||
self.titlebar.set_valign(Gtk.Align.CENTER)
|
self.titlebar.set_valign(Gtk.Align.CENTER)
|
||||||
self.titlebar.add(self.control['temp_box'])
|
self.titlebar.add(self.control['temp_box'])
|
||||||
self.titlebar.add(self.titlelbl)
|
self.titlebar.add(self.titlelbl)
|
||||||
|
@ -47,7 +47,7 @@ class ExcludeObjectPanel(ScreenPanel):
|
|||||||
if self._screen.vertical_mode:
|
if self._screen.vertical_mode:
|
||||||
grid.attach(self.labels['map'], 0, 2, 2, 1)
|
grid.attach(self.labels['map'], 0, 2, 2, 1)
|
||||||
grid.attach(scroll, 0, 3, 2, 1)
|
grid.attach(scroll, 0, 3, 2, 1)
|
||||||
scroll.set_size_request(self._screen.width, -1)
|
scroll.set_size_request(self._gtk.get_content_width(), -1)
|
||||||
else:
|
else:
|
||||||
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
||||||
grid.attach(scroll, 1, 2, 1, 1)
|
grid.attach(scroll, 1, 2, 1, 1)
|
||||||
|
@ -17,7 +17,7 @@ class SplashScreenPanel(ScreenPanel):
|
|||||||
|
|
||||||
def __init__(self, screen, title):
|
def __init__(self, screen, title):
|
||||||
super().__init__(screen, title)
|
super().__init__(screen, title)
|
||||||
image = self._gtk.Image("klipper", self._screen.width / 5, self._screen.height * .5)
|
image = self._gtk.Image("klipper", self._gtk.get_content_width() * .2, self._gtk.get_content_height() * .5)
|
||||||
self.labels['text'] = Gtk.Label(_("Initializing printer..."))
|
self.labels['text'] = Gtk.Label(_("Initializing printer..."))
|
||||||
self.labels['text'].set_line_wrap(True)
|
self.labels['text'].set_line_wrap(True)
|
||||||
self.labels['text'].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
self.labels['text'].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||||
@ -42,7 +42,7 @@ class SplashScreenPanel(ScreenPanel):
|
|||||||
self.labels['actions'].set_vexpand(False)
|
self.labels['actions'].set_vexpand(False)
|
||||||
self.labels['actions'].set_halign(Gtk.Align.CENTER)
|
self.labels['actions'].set_halign(Gtk.Align.CENTER)
|
||||||
self.labels['actions'].set_homogeneous(True)
|
self.labels['actions'].set_homogeneous(True)
|
||||||
self.labels['actions'].set_size_request(self._screen.base_panel.content.get_allocation().width, 0)
|
self.labels['actions'].set_size_request(self._gtk.get_content_width(), -1)
|
||||||
|
|
||||||
scroll = self._gtk.ScrolledWindow()
|
scroll = self._gtk.ScrolledWindow()
|
||||||
scroll.set_hexpand(True)
|
scroll.set_hexpand(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user