rows reformat

This commit is contained in:
2025-04-23 14:29:47 +02:00
parent 3bab0710a4
commit c43c12f961
4 changed files with 42 additions and 45 deletions

View File

@ -156,7 +156,6 @@ class FrameWidgets(ttk.Frame):
Set light theme
"""
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "light")
with open(wg_set, "r", encoding="utf-8") as theme_set2:
lines3 = theme_set2.readlines()
@ -170,7 +169,6 @@ class FrameWidgets(ttk.Frame):
Set dark theme
"""
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "dark")
with open(wg_set, "r", encoding="utf-8") as theme_set2:
lines4 = theme_set2.readlines()
@ -303,8 +301,8 @@ class FrameWidgets(ttk.Frame):
# Bottom Frame 4
self.lb_frame3 = ttk.Frame(self)
self.lb_frame3.configure(relief="flat")
self.lb_frame3.grid(column=0, row=5, columnspan=4, sticky="snew",
padx=2, pady=2)
self.lb_frame3.grid(column=0, row=5, columnspan=4, sticky="snew",
padx=2, pady=2)
# Bottom Frame 5
self.lb_frame4 = ttk.Frame(self)
@ -382,7 +380,7 @@ class FrameWidgets(ttk.Frame):
# Button Import
self.btn_i = ttk.Button(self.lb_frame_btn_lbox, image=self.imp_pic,
command=self.import_sl, padding=0)
command=self.import_sl, padding=0)
self.btn_i.grid(column=0, row=1, padx=15, pady=8)
Tooltip(self.btn_i, _("Click to import a Wireguard Tunnel"), tips)
@ -395,7 +393,7 @@ class FrameWidgets(ttk.Frame):
self.select_tunnel = self.l_box.curselection()
select_tl = self.l_box.get(self.select_tunnel[0])
with open(f"/tmp/tlecdcwg/{select_tl}.conf", "r+", encoding="utf-8"
) as file2:
) as file2:
key = Tunnel.con_to_dict(file2)
pre_key = key[3]
check_call(["nmcli", "connection", "delete", select_tl])
@ -403,8 +401,8 @@ class FrameWidgets(ttk.Frame):
with open(wg_set, "r", encoding="utf-8") as set_file6:
lines6 = set_file6.readlines()
if (
select_tl == lines6[7].strip()
and "off\n" not in lines6[7].strip()
select_tl == lines6[7].strip()
and "off\n" not in lines6[7].strip()
):
lines6[7] = "off\n"
with open(wg_set, "w", encoding="utf-8") as set_file7:
@ -430,12 +428,12 @@ class FrameWidgets(ttk.Frame):
self.wg_autostart.configure(state="disabled")
self.lb_rename.configure(state="disabled")
Tooltip(self.wg_autostart, _("You must have at least one\ntunnel",
"in the list,to use the autostart"), tips)
"in the list,to use the autostart"), tips)
Tooltip(self.btn_exp, _("No Tunnels in List for Export"), tips)
Tooltip(self.btn_stst, _("No tunnels to start in the list"), tips)
Tooltip(self.lb_rename, _("To rename a tunnel, at least one must",
"be in the list"), tips,)
"be in the list"), tips, )
self.lb_rename.insert(0, _("Max. 12 characters!"))
if self.a != "" and self.a == select_tl:
@ -482,8 +480,8 @@ class FrameWidgets(ttk.Frame):
Tooltip(self.btn_tr, _("No tunnels to delete in the list"), tips)
else:
Tooltip(self.btn_tr, _("Click to delete a Wireguard Tunnel\nSelect from the list!"),
tips,
)
tips,
)
# Button Export
self.btn_exp = ttk.Button(
@ -585,8 +583,8 @@ class FrameWidgets(ttk.Frame):
with open(wg_set, "r", encoding="utf-8") as set_file5:
lines5 = set_file5.readlines()
if (
select_tl == lines5[7].strip()
and "off\n" not in lines5[7].strip()
select_tl == lines5[7].strip()
and "off\n" not in lines5[7].strip()
):
lines5[7] = new_a_connect
with open(wg_set, "w", encoding="utf-8") as theme_set5:
@ -635,7 +633,6 @@ class FrameWidgets(ttk.Frame):
self.wg_autostart.grid(column=0, row=0, pady=15, padx=15, sticky="nw")
if self.l_box.size() >= 1 and len(self.l_box.curselection()) >= 1:
Tooltip(
self.wg_autostart, _("To use the autostart, enable this Checkbox"), tips
)
@ -690,9 +687,9 @@ class FrameWidgets(ttk.Frame):
self.a = Tunnel.active()
if (
"PrivateKey = " in read
and "PublicKey = " in read
and "Endpoint =" in read
"PrivateKey = " in read
and "PublicKey = " in read
and "Endpoint =" in read
):
with open(filepath, "r", encoding="utf-8") as file:
key = Tunnel.con_to_dict(file)
@ -718,8 +715,8 @@ class FrameWidgets(ttk.Frame):
if len(path_split1) > 17:
p1 = shutil.copy(filepath, "/tmp/tlecdcwg/")
path_split = path_split1[
len(path_split1) - 17 :
]
len(path_split1) - 17:
]
os.rename(
p1, f"/tmp/tlecdcwg/{path_split}"
)
@ -828,7 +825,7 @@ class FrameWidgets(ttk.Frame):
self.stop()
wg_read = f"/tmp/tlecdcwg/{self.a}.conf"
with open(
wg_read, "r", encoding="utf-8"
wg_read, "r", encoding="utf-8"
) as file_for_key:
data = Tunnel.con_to_dict(file_for_key)