From 7f6d43be7085f8d9e5a236e684303fa2fdc7688b Mon Sep 17 00:00:00 2001
From: zkk <1007518571@qq.com>
Date: Tue, 4 Mar 2025 16:07:27 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BE=E6=A0=87=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=94=B9=E4=B8=BB?=
=?UTF-8?q?=E9=A2=98=E5=9B=BE=E6=A0=87=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
panels/base_panel.py | 37 +++++++++++++++-----------------
styles/dark/images/ethernet.svg | 9 ++++++++
styles/light/images/ethernet.svg | 1 +
3 files changed, 27 insertions(+), 20 deletions(-)
create mode 100644 styles/dark/images/ethernet.svg
create mode 100644 styles/light/images/ethernet.svg
diff --git a/panels/base_panel.py b/panels/base_panel.py
index 9ca192ed..aea17cc4 100644
--- a/panels/base_panel.py
+++ b/panels/base_panel.py
@@ -25,31 +25,12 @@ class BasePanel(ScreenPanel):
self.current_extruder = None
self.last_usage_report = datetime.now()
self.usage_report = 0
-
- icon_size_width = self._gtk.content_width * 0.05
- icon_size_height = self._gtk.content_height * 0.05
-
- network_icons_map = {
- "excellent": "wifi_excellent",
- "good": "wifi_good",
- "fair": "wifi_fair",
- "weak": "wifi_weak",
- "ethernet": "ethernet",
- }
-
-
- self.network_icons = {
- key: self._gtk.PixbufFromIcon(value, width=icon_size_width, height=icon_size_height)
- for key, value in network_icons_map.items()
- }
-
+ self.load_network_icons()
try:
self.sdbus_nm = SdbusNm(self.network_interface_refresh)
except Exception as e:
logging.exception("Failed to initialize SdbusNm: %s", e)
self.sdbus_nm = None
-
-
# Action bar buttons
abscale = self.bts * 1.1
self.control['back'] = self._gtk.Button('back', scale=abscale)
@@ -195,6 +176,7 @@ class BasePanel(ScreenPanel):
width = pixbuf.get_width()
height = pixbuf.get_height()
button.set_image(self._gtk.Image(name, width, height))
+ self.load_network_icons()
def show_heaters(self, show=True):
try:
@@ -471,6 +453,21 @@ class BasePanel(ScreenPanel):
else:
return self.network_icons["weak"]
+ def load_network_icons(self):
+ icon_size_width = self._gtk.content_width * 0.05
+ icon_size_height = self._gtk.content_height * 0.05
+ network_icons_map = {
+ "excellent": "wifi_excellent",
+ "good": "wifi_good",
+ "fair": "wifi_fair",
+ "weak": "wifi_weak",
+ "ethernet": "ethernet",
+ }
+ self.network_icons = {
+ key: self._gtk.PixbufFromIcon(value, width=icon_size_width, height=icon_size_height)
+ for key, value in network_icons_map.items()
+ }
+
def set_ks_printer_cfg(self, printer):
ScreenPanel.ks_printer_cfg = self._config.get_printer_config(printer)
if self.ks_printer_cfg is not None:
diff --git a/styles/dark/images/ethernet.svg b/styles/dark/images/ethernet.svg
new file mode 100644
index 00000000..056f5b9a
--- /dev/null
+++ b/styles/dark/images/ethernet.svg
@@ -0,0 +1,9 @@
+
diff --git a/styles/light/images/ethernet.svg b/styles/light/images/ethernet.svg
new file mode 100644
index 00000000..6cc86d06
--- /dev/null
+++ b/styles/light/images/ethernet.svg
@@ -0,0 +1 @@
+
\ No newline at end of file