From af702f297bf11690ad7ecd0d8b57bde7011b4947 Mon Sep 17 00:00:00 2001 From: punix Date: Fri, 25 Apr 2025 13:40:19 +0200 Subject: [PATCH] rename wg_set to file_set fix LxTools.clean_files --- __pycache__/cls_mth_fc.cpython-312.pyc | Bin 23194 -> 23208 bytes cls_mth_fc.py | 12 ++++---- wirepy.py | 38 ++++++++++++------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/__pycache__/cls_mth_fc.cpython-312.pyc b/__pycache__/cls_mth_fc.cpython-312.pyc index f2b87c1cee3128a5553e7ec4b4586ef07ce98bcd..17c51db277dab0f0908ad38eec3132c17cb74c6d 100644 GIT binary patch delta 238 zcmbQWm2t&ZM&8rByj%=Gu(y~y!(=1xLK()q$?IjD7{w;vHY{@nEzCe7Az|`a17((<4Gdo=e=&H? VE%%w3flcTG6AP={=2wOrGyt`;L{@nm0F zGe-T%EwbutCNtEo@+fUyFDuK#^8%=|onbmd2SXa;<~y3YjBKkI85pKAPUhEM%ji3K zueRUhOY9<(SMcym*44=Zu{W>Pnasqe zDF#MhdbWXqfH6=_(Lo?l%nT$F6eiy`P-gkj!0=@ Aborting with exit code {exit_code}." ) - LxTools.clean_files(dirname) + LxTools.clean_files(dirname, file) print("Breakdown by user...") sys.exit(exit_code) else: print(f"Signal {signum} received and ignored.") - LxTools.clean_files(dirname) + LxTools.clean_files(dirname, file) print("Process unexpectedly ended...") signal.signal(signal.SIGINT, signal_handler) diff --git a/wirepy.py b/wirepy.py index d3056c8..da37fcd 100755 --- a/wirepy.py +++ b/wirepy.py @@ -68,7 +68,7 @@ class Wirepy(tk.Tk): self.style = ttk.Style(self) self.tk.call("source", f"{tcl_path}/water.tcl") - with open(wg_set, "r", encoding="utf-8") as read_file: + 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") @@ -120,17 +120,17 @@ class FrameWidgets(ttk.Frame): Set on or off in file """ if set_update.get() == 1: - with open(wg_set, "r", encoding="utf-8") as set_f2: + with open(set_file, "r", encoding="utf-8") as set_f2: lines2 = set_f2.readlines() lines2[1] = "off\n" - with open(wg_set, "w", encoding="utf-8") as set_f2: + with open(set_file, "w", encoding="utf-8") as set_f2: set_f2.writelines(lines2) if set_update.get() == 0: - with open(wg_set, "r", encoding="utf-8") as set_f2: + with open(set_file, "r", encoding="utf-8") as set_f2: lines2 = set_f2.readlines() lines2[1] = "on\n" - with open(wg_set, "w", encoding="utf-8") as set_f2: + with open(set_file, "w", encoding="utf-8") as set_f2: set_f2.writelines(lines2) def tooltip(): @@ -138,17 +138,17 @@ class FrameWidgets(ttk.Frame): Set True or False in file """ if set_tip.get(): - with open(wg_set, "r", encoding="utf-8") as set_f2: + with open(set_file, "r", encoding="utf-8") as set_f2: lines2 = set_f2.readlines() lines2[5] = "False\n" - with open(wg_set, "w", encoding="utf-8") as set_f2: + with open(set_file, "w", encoding="utf-8") as set_f2: set_f2.writelines(lines2) else: - with open(wg_set, "r", encoding="utf-8") as set_f2: + with open(set_file, "r", encoding="utf-8") as set_f2: lines2 = set_f2.readlines() lines2[5] = "True\n" - with open(wg_set, "w", encoding="utf-8") as set_f2: + with open(set_file, "w", encoding="utf-8") as set_f2: set_f2.writelines(lines2) def info(): @@ -372,14 +372,14 @@ class FrameWidgets(ttk.Frame): pre_key = key[3] check_call(["nmcli", "connection", "delete", select_tl]) self.l_box.delete(self.select_tunnel[0]) - with open(wg_set, "r", encoding="utf-8") as set_f6: + with open(set_filele, "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() ): lines6[7] = "off\n" - with open(wg_set, "w", encoding="utf-8") as set_f7: + with open(set_file, "w", encoding="utf-8") as set_f7: set_f7.writelines(lines6) self.selected_option.set(0) self.autoconnect_var.set(_("no Autoconnect")) @@ -552,14 +552,14 @@ class FrameWidgets(ttk.Frame): if self.a != "" and self.a == select_tl: self.a = Tunnel.active() self.str_var.set(value=self.a) - with open(wg_set, "r", encoding="utf-8") as set_f5: + with open(set_file, "r", encoding="utf-8") as set_f5: lines5 = set_f5.readlines() if ( 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: + with open(set_file, "w", encoding="utf-8") as theme_set5: theme_set5.writelines(lines5) self.autoconnect_var.set(value=new_a_connect) @@ -849,10 +849,10 @@ class FrameWidgets(ttk.Frame): select_tl = self.l_box.get(select_tunnel[0]) if self.selected_option.get() == 0: - with open(wg_set, "r", encoding="utf-8") as set_f3: + with open(set_file, "r", encoding="utf-8") as set_f3: lines3 = set_f3.readlines() lines3[7] = "off\n" - with open(wg_set, "w", encoding="utf-8") as set_f3: + with open(set_file, "w", encoding="utf-8") as set_f3: set_f3.writelines(lines3) tl = Tunnel.list() @@ -861,10 +861,10 @@ class FrameWidgets(ttk.Frame): self.wg_autostart.configure(state="disabled") if self.selected_option.get() >= 1: - with open(wg_set, "r", encoding="utf-8") as set_f3: + with open(set_file, "r", encoding="utf-8") as set_f3: lines3 = set_f3.readlines() lines3[7] = select_tl - with open(wg_set, "w", encoding="utf-8") as set_f3: + with open(set_file, "w", encoding="utf-8") as set_f3: set_f3.writelines(lines3) except IndexError: @@ -878,7 +878,7 @@ class FrameWidgets(ttk.Frame): Set (on), the selected tunnel is displayed in the label. At (off) the label is first emptied then filled with No Autoconnect """ - with open(wg_set, "r", encoding="utf-8") as set_f4: + with open(set_file, "r", encoding="utf-8") as set_f4: lines4 = set_f4.readlines() if lines4[7] != "off\n": @@ -987,7 +987,7 @@ class FrameWidgets(ttk.Frame): View activ Tunnel in color green or yellow """ - with open(wg_set, "r", encoding="utf-8") as read_file: + 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(