diff --git a/wirepy.py b/wirepy.py index 3ece856..46fff58 100755 --- a/wirepy.py +++ b/wirepy.py @@ -427,7 +427,7 @@ class FrameWidgets(ttk.Frame): if is_encrypt.is_file(): Path.unlink(f"{Path.home()}/.config/wire_py/{select_tl}.dat") Path.unlink(f"/tmp/tlecdcwg/{select_tl}.conf") - with open(keys, "r", encoding="utf-8") as readfile: + with open(AppConfig.KEYS_FILE, "r", encoding="utf-8") as readfile: with open(f"{Path.home()}/.config/wire_py/keys2", "w", encoding="utf-8") as writefile: for line in readfile: if pre_key not in line.strip("\n"): @@ -502,17 +502,15 @@ class FrameWidgets(ttk.Frame): self.l_box.update() new_a_connect = self.lb_rename.get() self.lb_rename.delete(0, tk.END) - if self.a != "" and self.a == select_tl: - self.a = Tunnel.active() - self.str_var.set(value=self.a) - with open(AppConfig.SETTINGS_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(AppConfig.SETTINGS_FILE, "w", encoding="utf-8") as theme_set5: - theme_set5.writelines(lines5) - self.autoconnect_var.set(value=new_a_connect) - + + with open(AppConfig.SETTINGS_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(AppConfig.SETTINGS_FILE, "w", encoding="utf-8") as theme_set5: + theme_set5.writelines(lines5) + self.autoconnect_var.set(value=new_a_connect) + self.update_connection_display() Create.encrypt() except IndexError: @@ -542,7 +540,7 @@ class FrameWidgets(ttk.Frame): key = Tunnel.con_to_dict(file) pre_key = key[3] if len(pre_key) != 0: - p_key = keys.read_text(encoding="utf-8") + p_key = AppConfig.KEYS_FILE.read_text(encoding="utf-8") if pre_key in p_key or f"{pre_key}\n" in p_key: msg_t = _("Tunnel already available!\nPlease use another file for import") @@ -550,7 +548,7 @@ class FrameWidgets(ttk.Frame): else: - with open(keys, "a", encoding="utf-8") as keyfile: + with open(AppConfig.KEYS_FILE, "a", encoding="utf-8") as keyfile: keyfile.write(f"{pre_key}\r") if len(path_split1) > 17: p1 = shutil.copy(filepath, "/tmp/tlecdcwg/")