From 4ca43b2049c9d273e1c813434cf6453bf68e4119 Mon Sep 17 00:00:00 2001 From: zkk <1007518571@qq.com> Date: Tue, 16 Jul 2024 17:31:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AB=96=E5=B1=8F=E7=9A=84?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- panels/main_menu.py | 14 +++++++++----- panels/temperature.py | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/panels/main_menu.py b/panels/main_menu.py index ff4ae789..37cd3123 100644 --- a/panels/main_menu.py +++ b/panels/main_menu.py @@ -19,13 +19,17 @@ class Panel(MenuPanel): self.h = self.f = 0 self.main_menu = Gtk.Grid(row_homogeneous=True, column_homogeneous=True, hexpand=True, vexpand=True) - self.labels['menu'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0, homogeneous=False) + if self._screen.vertical_mode: + self.labels['menu'] = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0, homogeneous=False) + else: + self.labels['menu'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0, homogeneous=False) logo_image = self._gtk.Image("klipper", self._gtk.content_width * 0.2, self._gtk.content_height * 0.5) self.labels['menu'].pack_start(logo_image, False, False, 80) # temp_Button = self.arrangeMenuItems(items, 1, True) temp_Button = self._gtk.Button("heat-up", _("Temperature")) - temp_Button.set_margin_start(120) - temp_Button.set_margin_end(120) + temp_Button.set_valign(Gtk.Align.CENTER) + temp_Button.set_halign(Gtk.Align.CENTER) + temp_Button.set_size_request(200, 100) temp_Button.get_style_context().add_class('custom-temp-button') temp_Button.connect('clicked', self.menu_item_clicked, {"panel": "temperature"}) self.labels['menu'].pack_start(temp_Button, True, True, 0) @@ -39,8 +43,8 @@ class Panel(MenuPanel): self._gtk.reset_temp_color() if self._screen.vertical_mode: self.main_menu.attach(self.labels['devices'], 0, 0, 2, 1) - self.main_menu.attach(self.labels['menu'], 0, 1, 1, 2) - self.main_menu.attach(self.labels['da'], 1, 1, 1, 2) + self.main_menu.attach(self.labels['da'], 0, 1, 2, 1) + self.main_menu.attach(self.labels['menu'], 0, 2, 2, 1) else: self.main_menu.attach(self.labels['devices'], 0, 0, 2, 1) self.main_menu.attach(self.labels['menu'], 0, 1, 1, 2) diff --git a/panels/temperature.py b/panels/temperature.py index 913fecb1..a126af7f 100644 --- a/panels/temperature.py +++ b/panels/temperature.py @@ -33,7 +33,8 @@ class Panel(ScreenPanel): right_panel = self.create_right_panel() right_panel.set_halign(Gtk.Align.CENTER) - right_panel.set_size_request(400, -1) + right_panel.set_valign(Gtk.Align.CENTER) + right_panel.set_size_request(self._screen.width / 5 * 3, self._screen.height / 5 * 4) dev = self.create_left_panel() if self._screen.vertical_mode: self.grid.attach(right_panel, 0, 0, 1, 1)