From 6bfecbdee8efd8f56b702dff9ec5a0e1293a8d62 Mon Sep 17 00:00:00 2001 From: Ali Riza KESKIN Date: Tue, 26 Nov 2024 14:19:49 +0300 Subject: [PATCH] better scale support for userlist --- src/data/main.ui | 4 +--- src/main.py | 22 ++++++++++++---------- src/module/gtkwindow.py | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/data/main.ui b/src/data/main.ui index 5cbd6f0..1207f62 100644 --- a/src/data/main.ui +++ b/src/data/main.ui @@ -1768,7 +1768,7 @@ WAN IP: ui_button_userselect right - + True False vertical @@ -1791,7 +1791,6 @@ WAN IP: - 200 -1 True True @@ -1802,7 +1801,6 @@ WAN IP: False - 200 True False vertical diff --git a/src/main.py b/src/main.py index eb31c12..1807811 100644 --- a/src/main.py +++ b/src/main.py @@ -29,12 +29,6 @@ def _(msg): return msg -scale = float(get("scale", "0")) -if scale < 1: - scale = 1 - -os.environ["GDK_SCALE"] = str(int(scale)) -#os.environ["GDK_DPI_SCALE"] = str(1/scale) os.environ["UBUNTU_MENUPROXY"] = "" os.environ["SESSION_MANAGER"] = "lightdm" @@ -63,10 +57,18 @@ def _(msg): else: settings.set_property("gtk-icon-theme-name", "Adwaita") -settings.set_property( - "gtk-font-name", "{} {}".format(get("font", "Regular"), int(10*(scale % 1 + 1)))) -settings.set_property("gtk-xft-dpi", 1024*96*scale) -settings.set_property("gtk-xft-antialias", True) +def set_scale(scale=0): + if scale <= 0: + scale = 1 + os.environ["GDK_SCALE"] = str(int(scale)) + #os.environ["GDK_DPI_SCALE"] = str(1/scale) + settings.set_property( + "gtk-font-name", "{} {}".format(get("font", "Regular"), int(10*(scale % 1 + 1)))) + settings.set_property("gtk-xft-dpi", 1024*96*scale) + settings.set_property("gtk-xft-antialias", True) + +scale = float(get("scale", "0")) +set_scale(scale) loaded_modules = [] base_modules = ["lightdm.py", "gtkwindow.py", "monitor.py"] diff --git a/src/module/gtkwindow.py b/src/module/gtkwindow.py index 61d03a8..90725b6 100644 --- a/src/module/gtkwindow.py +++ b/src/module/gtkwindow.py @@ -390,7 +390,8 @@ def apply_scale(self): "ui_entry_new_password1", "ui_entry_new_password2", "ui_box_reset_buttons"]: self.o(but).set_size_request(128*scale, 31*scale) # user list - self.o("ui_popover_userlist").set_size_request(200*scale, self.height/3) + self.o("ui_box_userlist_main").set_size_request(250*scale, self.height/3) + self.o("ui_popover_userlist").set_size_request(250*scale, self.height/3) ############### css load ############### @@ -435,7 +436,6 @@ def sync_resolution(self): self.update_user_background() else: self.set_background(get("background", "user", "gtkwindow")) - self.o("ui_popover_userlist").set_size_request(250, self.height/3) self.apply_scale() ############### windowmanager ###############