with opening reduced

This commit is contained in:
Désiré Werner Menrath 2025-04-29 09:02:06 +02:00
parent 53f66ea76d
commit 6f02724daa

View File

@ -73,12 +73,12 @@ class Wirepy(tk.Tk):
self.style = ttk.Style(self)
self.tk.call("source", f"{tcl_path}/water.tcl")
with open(set_file, "r", encoding="utf-8") as read_file:
lines = read_file.readlines()
if "light\n" in lines:
self.tk.call("set_theme", "light")
else:
self.tk.call("set_theme", "dark")
lines = set_file.read_text()
if "light\n" in lines:
self.tk.call("set_theme", "light")
else:
self.tk.call("set_theme", "dark")
# Load the image file from the disk
self.wg_icon = tk.PhotoImage(file=r"/usr/share/icons/lx-icons/48/wg_vpn.png")
@ -436,10 +436,8 @@ class FrameWidgets(ttk.Frame):
self.l_box.delete(self.select_tunnel[0])
with open(set_file, "r", encoding="utf-8") as set_f6:
lines6 = set_f6.readlines()
if (
select_tl == lines6[7].strip()
and "off\n" not in lines6[7].strip()
):
if (select_tl == lines6[7].strip()
and "off\n" not in lines6[7].strip()):
lines6[7] = "off\n"
with open(set_file, "w", encoding="utf-8") as set_f7:
set_f7.writelines(lines6)
@ -805,14 +803,12 @@ class FrameWidgets(ttk.Frame):
"""
View activ Tunnel in the color green or yellow
"""
lines = set_file.read_text()
if "light\n" in lines:
self.lb_tunnel = ttk.Label(self, textvariable=self.str_var, foreground="green")
with open(set_file, "r", encoding="utf-8") as read_file:
lines = read_file.readlines()
if "light\n" in lines:
self.lb_tunnel = ttk.Label(self, textvariable=self.str_var, foreground="green")
else:
self.lb_tunnel = ttk.Label(self, textvariable=self.str_var, foreground="yellow")
else:
self.lb_tunnel = ttk.Label(self, textvariable=self.str_var, foreground="yellow")
self.lb_tunnel.config(font=("Ubuntu", 11, "bold"))
self.lb_tunnel.grid(column=2, padx=10, row=1)