From 8896f59efda4705dde69430df7dda7c7d293acec Mon Sep 17 00:00:00 2001 From: punix Date: Mon, 21 Apr 2025 09:39:35 +0200 Subject: [PATCH] fix in converter and fix in import for no valid files --- __pycache__/cls_mth_fc.cpython-312.pyc | Bin 16061 -> 16029 bytes cls_mth_fc.py | 10 ++++----- start_wg.py | 1 + wirepy.py | 28 ++++++++++++++----------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/__pycache__/cls_mth_fc.cpython-312.pyc b/__pycache__/cls_mth_fc.cpython-312.pyc index f9e636e679dda451eebc6ea4f186916dc23bc8c9..d2a4eeb70a6cfff52d47e63b06f271f68da8096a 100644 GIT binary patch delta 199 zcmdm6JGYkiG%qg~0}yDhX303Tk$0UYW69<{n#xR*A8IQzi#7-XY4OQYI@~-pLN&rQ zA~m9EEWr$$ZFMx57!Peu)0@g@a6?FDy52;+1#*{#3_93va0_+V-w;!no;NXXLEL3A zlMeSA{9-ehXGAP0zre3|fkSU{A(!;#7z15KM%~R_hW3n%cAHNbX|pkUZ2o4U!o;u5 xs{fgpflcrO6Oi>GYO|(w4^C-XEA)I0bKrDNN6sn71JAvY1JS zJ1Xx1kH8Inu^G%WA{LZi;Mcprq4(nhGXt;SuVNmc8;%GnxmYnAv0`$uVcx7};LOOV zzd6g$o{`aE^C}~4Hb$?_*DO?+_;p$JKQlA134UM#vOdIZ=Ctl%WUSph&E^xMr~?zD T;70}!`Pq$yi&3~p5@;>}+gn4l diff --git a/cls_mth_fc.py b/cls_mth_fc.py index e22e16f..48025c6 100755 --- a/cls_mth_fc.py +++ b/cls_mth_fc.py @@ -179,6 +179,7 @@ class GiteaUpdate: result = subprocess.call(to_down, shell=True) if result == 0: shutil.chown(str(Path.home()) + f"/{res}.zip", 1000, 1000) + # img_w, img_i, w_title, w_txt hand over iw = r"/usr/share/icons/lx-icons/64/info.png" ii = down_ok_image @@ -187,6 +188,7 @@ class GiteaUpdate: msg_window(iw, ii, wt, msg_t) else: + # img_w, img_i, w_title, w_txt hand over iw = r"/usr/share/icons/lx-icons/64/error.png" ii = down_not_ok_image @@ -194,6 +196,7 @@ class GiteaUpdate: msg_t = _("Download failed! Please try again") msg_window(iw, ii, wt, msg_t) except subprocess.CalledProcessError: + # img_w, img_i, w_title, w_txt hand over iw = r"/usr/share/icons/lx-icons/64/error.png" ii = down_not_ok_image @@ -293,11 +296,9 @@ class Tunnel: if "," in dns: dns = dns[:-1] endpoint = final_dict["Endpoint"] - try: - pre_key = final_dict.get("PresharedKey") + pre_key = final_dict.get("PresharedKey") + if pre_key is None: pre_key = final_dict.get("PreSharedKey") - finally: - pass return address, dns, endpoint, pre_key @staticmethod @@ -344,7 +345,6 @@ class Tunnel: shutil.copytree("/tmp/tlecdcwg/", "/tmp/wire_py", dirs_exist_ok=True) source = Path("/tmp/wire_py") shutil.make_archive(wg_tar, "zip", source) - # shutil.chown(wg_tar + '.zip', 1000, 1000) shutil.rmtree(source) with zipfile.ZipFile((wg_tar + ".zip"), "r") as zf: if len(zf.namelist()) != 0: diff --git a/start_wg.py b/start_wg.py index b5aff30..8f2636c 100755 --- a/start_wg.py +++ b/start_wg.py @@ -8,6 +8,7 @@ from subprocess import check_call path_to_file = Path(Path.home() / ".config/wire_py/settings") with open(path_to_file, "r", encoding="utf-8") as a_con: + # This funtion is for the independent autostart of the previously selected tunnel lines = a_con.readlines() a_con = lines[7].strip() diff --git a/wirepy.py b/wirepy.py index ca3e663..c5108ab 100755 --- a/wirepy.py +++ b/wirepy.py @@ -54,7 +54,6 @@ def signal_handler(signum, frame): signame = signals_to_names_dict.get(signum, f"Unnamed signal: {signum}") # End program for certain signals, report to others only reception - if signum in (signal.SIGINT, signal.SIGTERM): exit_code = 1 print( @@ -99,7 +98,6 @@ class Wirepy(tk.Tk): self.style = ttk.Style(self) self.tk.call("source", str(tcl_path) + "/water.tcl") - # self.tk.call('source', 'TK-Themes/water.tcl') with open(wg_set, "r", encoding="utf-8") as read_file: lines = read_file.readlines() if "light\n" in lines: @@ -248,13 +246,13 @@ class FrameWidgets(ttk.Frame): The mouse moves from the entry widget Remove Tool-Tip """ - window.my_tool_tip.destroy() + window.my_tool_tip.destroy() + # App Menu self.version_lb = ttk.Label(self.menu_frame, text=VERSION) self.version_lb.config(font=("Ubuntu", 11), foreground="#00c4ff") self.version_lb.grid(column=0, row=0, rowspan=4, padx=10) - self.options_btn = ttk.Menubutton(self.menu_frame, text=_("Options")) self.options_btn.grid(column=1, columnspan=1, row=0) @@ -301,6 +299,7 @@ class FrameWidgets(ttk.Frame): # Update and Tooltip Label self.updates_lb = ttk.Label(self.menu_frame) self.updates_lb.grid(column=4, columnspan=3, row=0, padx=10) + # View Checkbox for enable or disable Tooltip if WG_TIPS: set_tip.set(value=False) @@ -605,7 +604,6 @@ class FrameWidgets(ttk.Frame): self.wg_autostart.configure(state="disabled") # for disable checkbox when Listbox empty - def empty_list_start_enter(event): """ The mouse moves into the entry widget @@ -908,6 +906,7 @@ class FrameWidgets(ttk.Frame): self.selected_option = tk.IntVar() self.autoconnect_var = tk.StringVar() self.autoconnect_var.set(self.auto_con) + # Frame for Labels, Entry and Button self.autoconnect = ttk.Label( self.lb_frame3, textvariable=self.autoconnect_var, width=15 @@ -1037,6 +1036,7 @@ class FrameWidgets(ttk.Frame): ) as readfile: p_key = readfile.readlines() if pre_key in p_key or pre_key + "\n" in p_key: + # img_w, img_i, w_title, w_txt hand over iw = r"/usr/share/icons/lx-icons/64/error.png" ii = r"/usr/share/icons/lx-icons/48/wg_msg.png" @@ -1254,7 +1254,10 @@ class FrameWidgets(ttk.Frame): ) Path.chmod(wg_read, 0o600) - if "PrivateKey = " and "Endpoint = " not in read: + if ("PrivateKey = " in read) and ("Endpoint = " in read): + pass + else: + # img_w, img_i, w_title, w_txt hand over iw = r"/usr/share/icons/lx-icons/64/error.png" ii = r"/usr/share/icons/lx-icons/48/wg_msg.png" @@ -1264,12 +1267,12 @@ class FrameWidgets(ttk.Frame): ) msg_window(iw, ii, wt, msg_t) - except EOFError: - pass - except TypeError: - pass - except FileNotFoundError: - pass + except EOFError as e: + print(e) + except TypeError as e: + print(e) + except FileNotFoundError as e: + print(e) except subprocess.CalledProcessError: print("Tunnel exist!") @@ -1366,6 +1369,7 @@ class FrameWidgets(ttk.Frame): """ shows data in the label """ + # Address Label self.address = ttk.Label( self.lb_frame, textvariable=self.add, foreground="#0071ff"