class descriptions added redundancy reduced

This commit is contained in:
2025-05-20 12:31:30 +02:00
parent 55f2119bc3
commit 4cdcfadbac
3 changed files with 104 additions and 48 deletions

View File

@ -244,7 +244,7 @@ class FrameWidgets(ttk.Frame):
self.tl = Tunnel.parse_files_to_dictionary(directory=AppConfig.TEMP_DIR)
LxTools.clean_files(AppConfig.TEMP_DIR, file=None)
AppConfig.ensure_directories()
# self.tl = LxTools.get_file_name(AppConfig.TEMP_DIR)
for tunnels, values in self.tl.items():
self.l_box.insert("end", tunnels)
self.l_box.update()
@ -475,7 +475,7 @@ class FrameWidgets(ttk.Frame):
a tk.Toplevel window
"""
def link_btn() -> str | None:
def link_btn() -> None:
webbrowser.open("https://git.ilunix.de/punix/Wire-Py")
msg_t = _(
@ -583,8 +583,7 @@ class FrameWidgets(ttk.Frame):
)
self.btn_stst.grid(column=0, row=0, padx=5, pady=8)
tl = LxTools.get_file_name(AppConfig.TEMP_DIR)
if len(self.tl) == 0:
if self.l_box.size() == 0:
Tooltip(self.btn_stst, Msg.TTIP["empty_list"], self.tooltip_state)
else:
Tooltip(self.btn_stst, Msg.TTIP["start_tl"], self.tooltip_state)
@ -908,9 +907,7 @@ class FrameWidgets(ttk.Frame):
if self.selected_option.get() == 0:
ConfigManager.set("autostart", "off")
tl = [f"{file}" for file in AppConfig.CONFIG_DIR.glob("*.dat")]
if len(tl) == 0:
if self.l_box.size() == 0:
self.wg_autostart.configure(state="disabled")
if self.selected_option.get() >= 1:
@ -923,9 +920,12 @@ class FrameWidgets(ttk.Frame):
def tl_rename(self) -> None:
"""
method to rename a tunnel
Method to rename a tunnel. Validates input for length,
special characters, and duplicate names,
performs the renaming via `nmcli` if valid, updates
the configuration file in the directory,
and adjusts UI elements such as listboxes and labels.
"""
name_of_file = LxTools.get_file_name(AppConfig.TEMP_DIR)
special_characters = ["\\", "/", "{", "}", " "]
if len(self.lb_rename.get()) > 12:
@ -955,7 +955,9 @@ class FrameWidgets(ttk.Frame):
Msg.STR["false_signs"],
)
elif self.lb_rename.get() in name_of_file:
elif self.lb_rename.get() in [
file.stem for file in AppConfig.CONFIG_DIR.glob("*.dat")
]:
LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_info"],
@ -1019,7 +1021,9 @@ class FrameWidgets(ttk.Frame):
print(e)
def handle_tunnel_data(self, active=None, data=None) -> None:
"""Processes tunnel data from an active connection and updates
UI elements like labels with information about address, DNS, and endpoint.
"""
tunnel = active
values = data[tunnel]
# Address Label