diff --git a/ui/main_frame.py b/ui/main_frame.py index ff4033b..4a08655 100644 --- a/ui/main_frame.py +++ b/ui/main_frame.py @@ -33,7 +33,7 @@ class MainFrame(ttk.Frame): super().__init__(container, **kwargs) self.image_manager = image_manager - self.columnconfigure(1, weight=1) + self.columnconfigure(1, weight=0) self.columnconfigure(2, weight=18) self.rowconfigure(2, weight=1) diff --git a/ui/menu_bar.py b/ui/menu_bar.py index 6b6ee2c..5ed9c69 100644 --- a/ui/menu_bar.py +++ b/ui/menu_bar.py @@ -1,6 +1,7 @@ import os import subprocess +import threading import tkinter as tk import webbrowser from functools import partial @@ -54,12 +55,6 @@ class MenuBar(ttk.Frame): self.animated_icon_frame.bind("", lambda e: self.updater()) self.animated_icon.bind("", lambda e: self.updater()) - res = GiteaUpdate.api_down( - AppConfig.UPDATE_URL, AppConfig.VERSION, ConfigManager.get( - "updates") - ) - self.update_ui_for_update(res) - # Tooltip Menu self.tooltip_label = tk.StringVar() self.tooltip_update_label() @@ -91,6 +86,19 @@ class MenuBar(ttk.Frame): self.log_btn.grid(column=11, row=0, sticky='e') Tooltip(self.log_btn, "Show Log", state_var=self.tooltip_state) + self.update_thread = threading.Thread(target=self.check_for_updates, daemon=True) + self.update_thread.start() + + def check_for_updates(self): + """ + Checks for updates in a separate thread. + """ + res = GiteaUpdate.api_down( + AppConfig.UPDATE_URL, AppConfig.VERSION, ConfigManager.get("updates") + ) + # Schedule the UI update in the main thread + self.after(0, self.update_ui_for_update, res) + def update_ui_for_update(self, res): self.animated_icon_frame.grid_remove() self.animated_icon.hide() diff --git a/ui/tunnel_details.py b/ui/tunnel_details.py index e4380dc..f0f2b72 100644 --- a/ui/tunnel_details.py +++ b/ui/tunnel_details.py @@ -20,7 +20,8 @@ class TunnelDetails(ttk.Frame): self.active_frame.rowconfigure(0, weight=1) self.interface_frame = ttk.LabelFrame(self, text=Msg.STR["interface"]) - self.interface_frame.grid(column=0, row=1, sticky="nsew", padx=10, pady=5) + self.interface_frame.grid( + column=0, row=1, sticky="nsew", padx=10, pady=5) self.interface_frame.columnconfigure(0, weight=1) self.interface_frame.rowconfigure(0, weight=1) self.interface_frame.rowconfigure(1, weight=1) @@ -38,26 +39,35 @@ class TunnelDetails(ttk.Frame): self.lb_tunnel = None self.color_label() - self.address_label = ttk.Label(self.interface_frame, textvariable=self.add_var, foreground="#0071ff") - self.address_label.grid(column=0, row=0, sticky="nsew", padx=10, pady=(0, 20)) + self.address_label = ttk.Label( + self.interface_frame, textvariable=self.add_var, foreground="#0071ff") + self.address_label.grid( + column=0, row=0, sticky="ew", padx=10) self.address_label.config(font=("Ubuntu", 9)) - self.dns_label = ttk.Label(self.interface_frame, textvariable=self.dns_var, foreground="#0071ff") - self.dns_label.grid(column=0, row=1, sticky="nsew", padx=10, pady=(0, 20)) + self.dns_label = ttk.Label( + self.interface_frame, textvariable=self.dns_var, foreground="#0071ff") + self.dns_label.grid(column=0, row=1, sticky="ew", + padx=10) self.dns_label.config(font=("Ubuntu", 9)) - self.endpoint_label = ttk.Label(self.peer_frame, textvariable=self.enp_var, foreground="#0071ff") - self.endpoint_label.grid(column=0, row=0, sticky="nsew", padx=10, pady=(0, 30)) + self.endpoint_label = ttk.Label( + self.peer_frame, textvariable=self.enp_var, foreground="#0071ff") + self.endpoint_label.grid( + column=0, row=0, sticky="ew", padx=10) self.endpoint_label.config(font=("Ubuntu", 9)) def color_label(self): if self.lb_tunnel: self.lb_tunnel.destroy() - foreground = "yellow" if ConfigManager.get("theme") != "light" else "green" - self.lb_tunnel = ttk.Label(self.active_frame, textvariable=self.str_var, foreground=foreground) + foreground = "yellow" if ConfigManager.get( + "theme") != "light" else "green" + self.lb_tunnel = ttk.Label( + self.active_frame, textvariable=self.str_var, foreground=foreground) self.lb_tunnel.config(font=("Ubuntu", 11, "bold")) - self.lb_tunnel.grid(column=0, row=0, padx=10, pady=(0, 10), sticky="nsew") + self.lb_tunnel.grid(column=0, row=0, padx=10, + pady=(0, 10), sticky="ns") def update_details(self, active_tunnel_name, tunnel_data): self.str_var.set(active_tunnel_name) diff --git a/ui/tunnel_list.py b/ui/tunnel_list.py index 94838e1..4b4f71d 100644 --- a/ui/tunnel_list.py +++ b/ui/tunnel_list.py @@ -27,10 +27,10 @@ class TunnelList(ttk.Frame): self.scrollbar.grid(column=1, row=0, sticky="ns") self.list_box.configure(yscrollcommand=self.scrollbar.set) - self.columnconfigure(0, weight=1) - self.rowconfigure(0, weight=1) - self.list_frame.columnconfigure(0, weight=1) - self.list_frame.rowconfigure(0, weight=1) + self.columnconfigure(0, weight=5) + self.rowconfigure(0, weight=5) + self.list_frame.columnconfigure(0, weight=5) + self.list_frame.rowconfigure(0, weight=5) def populate(self, tunnels): self.list_box.delete(0, tk.END)