updater replace Downloadbutton with Lx Tools installer

This commit is contained in:
2025-07-02 23:25:57 +02:00
parent 47aa3ac749
commit 7b8ec10e6c
4 changed files with 40 additions and 22 deletions

View File

@ -9,7 +9,19 @@ My standard System: Linux Mint 22 Cinnamon
- Replace Download Button with Lx Tools installer - Replace Download Button with Lx Tools installer
### Added ### Added
23-06-2025 02-07-2025
- Complete code for faulty f" string configuration dur addicted and fixed
- updater replace Downloadbutton with Lx Tools installer
- remove logviewer icon
- add settings.png icon for update button
### Added
27-06-2025
- Header added for more modern desing - Header added for more modern desing

BIN
lx-icons/16/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View File

@ -6,6 +6,8 @@ import logging
import getpass import getpass
import shutil import shutil
import sys import sys
import os
import subprocess
import tkinter as tk import tkinter as tk
import webbrowser import webbrowser
from functools import partial from functools import partial
@ -192,7 +194,7 @@ class FrameWidgets(ttk.Frame):
self.version_label = tk.Label( self.version_label = tk.Label(
self.header_frame, self.header_frame,
text=f"{AppConfig.VERSION}{Msg.STR["header_left_bottom"]}", text=f"{AppConfig.VERSION}{Msg.STR['header_left_bottom']}",
font=("Helvetica", 9), font=("Helvetica", 9),
fg="#bdc3c7", fg="#bdc3c7",
bg="#2c3e50", bg="#2c3e50",
@ -481,6 +483,15 @@ class FrameWidgets(ttk.Frame):
else: else:
self.updates_lb.grid_remove() self.updates_lb.grid_remove()
def updater(self):
"""Start the lxtools_installer"""
tmp_dir = Path("/tmp/lxtools")
Path.mkdir(tmp_dir, exist_ok=True)
os.chdir(tmp_dir)
result = subprocess.run(["/usr/local/bin/lxtools_installer"], check=False)
if result.returncode != 0:
MessageDialog("error", result.stderr)
# Update the labels based on the result # Update the labels based on the result
def update_ui_for_update(self, res): def update_ui_for_update(self, res):
"""Update UI elements based on an update check result""" """Update UI elements based on an update check result"""
@ -517,25 +528,20 @@ class FrameWidgets(ttk.Frame):
else: else:
self.set_update.set(value=0) self.set_update.set(value=0)
update_text = f"Update {res} {_('available!')}"
# Clear the label text since we'll show the button instead # Clear the label text since we'll show the button instead
self.update_label.set("") self.update_label.set("")
# Create the update button # Create the update button
self.update_btn = ttk.Menubutton(self.menu_frame, text=update_text) self.update_btn = ttk.Button(
self.update_btn.grid(column=4, columnspan=3, row=0, padx=0) self.menu_frame,
Tooltip( image=self.image_manager.load_image("update"),
self.update_btn, _("Click to download new version"), self.tooltip_state style="Toolbutton",
command=self.updater,
) )
self.update_btn.grid(column=5, row=0, padx=0)
self.download = tk.Menu(self, relief="flat") Tooltip(
self.update_btn.configure(menu=self.download, style="Toolbutton") self.update_btn, _("Click to install new version"), self.tooltip_state
self.download.add_command(
label=_("Download"),
command=lambda: GiteaUpdate.download(
f"{AppConfig.DOWNLOAD_URL}/{res}.zip", res
),
) )
@staticmethod @staticmethod
@ -723,11 +729,11 @@ class FrameWidgets(ttk.Frame):
) )
data_import, key_name = Tunnel.parse_files_to_dictionary(filepath=filepath) data_import, key_name = Tunnel.parse_files_to_dictionary(filepath=filepath)
if CryptoUtil.find_key(f"{data_import[key_name]["PrivateKey"]}="): if CryptoUtil.find_key(f"{data_import[key_name]['PrivateKey']}="):
MessageDialog("error", Msg.STR["tl_exist"], title=Msg.STR["imp_err"]) MessageDialog("error", Msg.STR["tl_exist"], title=Msg.STR["imp_err"])
elif not CryptoUtil.is_valid_base64( elif not CryptoUtil.is_valid_base64(
f"{data_import[key_name]["PrivateKey"]}=" f"{data_import[key_name]['PrivateKey']}="
): # 2. Second check: Is it valid Base64? ): # 2. Second check: Is it valid Base64?
MessageDialog( MessageDialog(
"error", "error",

View File

@ -59,7 +59,7 @@ class AppConfig:
# Updates # Updates
# 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year # 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
VERSION: str = "v. 2.06.2625" VERSION: str = "v. 2.07.0225"
UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases" UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases"
DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive" DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive"
@ -187,12 +187,12 @@ class Image:
"icon_export": [ "icon_export": [
"/usr/share/icons/lx-icons/48/wg_export.png", "/usr/share/icons/lx-icons/48/wg_export.png",
], ],
"icon_log": [
"/usr/share/icons/lx-icons/48/log.png",
],
"icon_trash": [ "icon_trash": [
"/usr/share/icons/lx-icons/48/wg_trash.png", "/usr/share/icons/lx-icons/48/wg_trash.png",
], ],
"update": [
"/usr/share/icons/lx-icons/16/settings.png",
],
} }
# Get paths to try # Get paths to try
@ -210,7 +210,7 @@ class Image:
self.images[image_key] = photo self.images[image_key] = photo
return photo return photo
except tk.TclError as e: except tk.TclError as e:
# print(f"{LocaleStrings.MSGP["fail_load_image"]}{path}: {e}") print(f"{LocaleStrings.MSGP['fail_load_image']}{path}: {e}")
continue continue
# Return None if no image found # Return None if no image found