diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c381f24..3af9204 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,7 +5,7 @@
-
+
@@ -43,28 +43,28 @@
- {
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "Python.INSTALL.executor": "Run",
- "Python.cls_mth_fc.executor": "Run",
- "Python.install.executor": "Run",
- "Python.main.executor": "Run",
- "Python.messagebox.executor": "Run",
- "Python.start_wg.executor": "Run",
- "Python.testtheme.executor": "Run",
- "Python.wg_func.executor": "Run",
- "Python.wg_main.executor": "Run",
- "Python.wirepy.executor": "Run",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "Shell Script.install.executor": "Run",
- "Shell Script.run_as.executor": "Run",
- "git-widget-placeholder": "21-04-2025-new-tooltip",
- "last_opened_file_path": "/home/punix/Pyapps/wire-py",
- "settings.editor.selected.configurable": "ml.llm.LLMConfigurable"
+
+}]]>
diff --git a/wirepy.py b/wirepy.py
index ca0631b..25fe1d7 100755
--- a/wirepy.py
+++ b/wirepy.py
@@ -131,8 +131,10 @@ class FrameWidgets(ttk.Frame):
set_tip = tk.BooleanVar()
self.settings = tk.Menu(self, relief="flat")
self.options_btn.configure(menu=self.settings, style="Toolbutton")
- self.settings.add_checkbutton(label=_("Disable Updates"), command=lambda: self.update(set_update.get()), variable=set_update)
- self.settings.add_checkbutton(label=_("Disable Tooltips"), command=lambda: self.tooltip(set_tip.get()), variable=set_tip)
+ self.settings.add_checkbutton(label=_("Disable Updates"),
+ command=lambda: self.update_setting(set_update.get()), variable=set_update)
+ self.settings.add_checkbutton(label=_("Disable Tooltips"),
+ command=lambda: self.tooltip(set_tip.get()), variable=set_tip)
self.settings.add_command(label=_("Light"), command=self.theme_change_light)
self.settings.add_command(label=_("Dark"), command=self.theme_change_dark)
@@ -300,14 +302,14 @@ class FrameWidgets(ttk.Frame):
Tooltip(self.lb_rename, _("To rename a tunnel, at least one must be in the list"), tips)
# Button Rename
- self.btn_rename = ttk.Button(self.lb_frame4, text=_("Rename"), state="disable", command=self.tl_rename, padding=4,
- style="RnButton.TButton")
+ self.btn_rename = ttk.Button(self.lb_frame4, text=_("Rename"), state="disable", command=self.tl_rename,
+ padding=4, style="RnButton.TButton")
self.btn_rename.grid(column=3, row=0, padx=5, pady=10, sticky="ne")
# Check Buttons
self.selected_option = tk.IntVar()
self.autoconnect_var = tk.StringVar()
- self.autoconnect_var.set(self.auto_con)
+ self.autoconnect_var.set(f"{self.auto_con}")
# Frame for Labels, Entry and Button
self.autoconnect = ttk.Label(self.lb_frame3, textvariable=self.autoconnect_var, width=15)
@@ -329,8 +331,9 @@ class FrameWidgets(ttk.Frame):
self.on_off()
- def info(self):
- def link_btn():
+ @staticmethod
+ def info():
+ def link_btn() -> str | None:
webbrowser.open("https://git.ilunix.de/punix/Wire-Py")
msg_t = _("Wire-Py a simple Wireguard Gui for Linux systems.\n\n"
@@ -366,7 +369,8 @@ class FrameWidgets(ttk.Frame):
theme_set2.writelines(lines4)
self.color_label()
- def update(self, update_res):
+ @staticmethod
+ def update_setting(update_res):
"""
write off or on in file
Args:
@@ -385,8 +389,9 @@ class FrameWidgets(ttk.Frame):
lines2[1] = "on\n"
with open(set_file, "w", encoding="utf-8") as set_f2:
set_f2.writelines(lines2)
-
- def tooltip(self, tip) -> None:
+
+ @staticmethod
+ def tooltip(tip) -> None:
"""
write True or False in a file
Args:
@@ -651,14 +656,14 @@ class FrameWidgets(ttk.Frame):
except subprocess.CalledProcessError:
print("Tunnel exist!")
- def handle_tunnel_data(self, tunnel_name: str) -> dict[str, str]:
+ def handle_tunnel_data(self, tunnel_name: str) -> tuple[str, str, str, str | None]:
"""_summary_
Args:
- tunnel_name (str): name of tunnel
+ tunnel_name (str): name of a tunnel
Returns:
- Dict[str, str]: dictionary with tunneldata
+ tuple[str, str]: tuple with tunnel data
"""
wg_read = f"/tmp/tlecdcwg/{tunnel_name}.conf"
@@ -670,7 +675,7 @@ class FrameWidgets(ttk.Frame):
def box_set(self):
"""
- This Method will display the autostart label which
+ This Method will display the autostarted label which
Tunnel is automatically started regardless of the active tunnel.
The selected tunnel is written into a file to read it after the start of the system.
"""
@@ -776,7 +781,8 @@ class FrameWidgets(ttk.Frame):
"""
Stop Button
"""
- self.btn_stst = ttk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_stop, command=lambda: self.wg_switch("stop"), padding=0)
+ self.btn_stst = ttk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_stop,
+ command=lambda: self.wg_switch("stop"), padding=0)
self.btn_stst.grid(column=0, row=0, padx=5, pady=8)
Tooltip(self.btn_stst, _("Click to stop selected Wireguard Tunnel"), tips)
@@ -785,7 +791,8 @@ class FrameWidgets(ttk.Frame):
"""
Start Button
"""
- self.btn_stst = ttk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_start, command=lambda: self.wg_switch("start"), padding=0)
+ self.btn_stst = ttk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_start,
+ command=lambda: self.wg_switch("start"), padding=0)
self.btn_stst.grid(column=0, row=0, padx=5, pady=8)
tl = Tunnel.list()
@@ -839,11 +846,11 @@ class FrameWidgets(ttk.Frame):
def handle_connection_state(self, action: str, tunnel_name: str = None) -> None:
"""
- Central management for connection states
+ central management for connection states
Args:
action (str): "start", "stop" or "toggle"
- tunnel_name (str, optional): name of tunnel for start-option. defaults to None.
+ tunnel_name (str, optional): name of a tunnel for a start-option. defaults to None.
"""
if action == "stop":
if self.a: