Skip to content

Commit

Permalink
fix px variable accessible issue if width > 0 check failed
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Jul 31, 2024
1 parent baafdb6 commit b54b166
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module/gtkwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ def set_background(self, bg=None):
if os.path.isfile(bg):
try:
py = GdkPixbuf.Pixbuf.new_from_file(bg)
px = None
if self.width > 0:
px = py.scale_simple(
self.width, self.height, GdkPixbuf.InterpType.BILINEAR)
if px and self.background_pixbuf != px:
if px != None and self.background_pixbuf != px:
self.background_pixbuf = px
except Exception as e:
print(str(e))
Expand All @@ -367,7 +368,7 @@ def apply_scale(self):
"ui_icon_sleep", "ui_icon_keyboard_layout_dd", "ui_icon_default_session_dd"]:
self.o(but).set_pixel_size(12*scale)
# login box width
self.o("ui_box_reset_passwd").set_size_request(250*scale, -1)
self.o("ui_box_reset_passwd").set_size_request(250*scale, -1)
self.o("ui_box_login").set_size_request(250*scale, -1)
# login button & entry 128 x 31
for but in ["ui_button_login", "ui_box_username", "ui_entry_reset_username", "ui_entry_password",
Expand Down

0 comments on commit b54b166

Please sign in to comment.