updater replace Downloadbutton with Lx Tools installer
This commit is contained in:
38
wirepy.py
38
wirepy.py
@ -6,6 +6,8 @@ import logging
|
||||
import getpass
|
||||
import shutil
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import tkinter as tk
|
||||
import webbrowser
|
||||
from functools import partial
|
||||
@ -192,7 +194,7 @@ class FrameWidgets(ttk.Frame):
|
||||
|
||||
self.version_label = tk.Label(
|
||||
self.header_frame,
|
||||
text=f"{AppConfig.VERSION} • {Msg.STR["header_left_bottom"]}",
|
||||
text=f"{AppConfig.VERSION} • {Msg.STR['header_left_bottom']}",
|
||||
font=("Helvetica", 9),
|
||||
fg="#bdc3c7",
|
||||
bg="#2c3e50",
|
||||
@ -481,6 +483,15 @@ class FrameWidgets(ttk.Frame):
|
||||
else:
|
||||
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
|
||||
def update_ui_for_update(self, res):
|
||||
"""Update UI elements based on an update check result"""
|
||||
@ -517,25 +528,20 @@ class FrameWidgets(ttk.Frame):
|
||||
|
||||
else:
|
||||
self.set_update.set(value=0)
|
||||
update_text = f"Update {res} {_('available!')}"
|
||||
|
||||
# Clear the label text since we'll show the button instead
|
||||
self.update_label.set("")
|
||||
|
||||
# Create the update button
|
||||
self.update_btn = ttk.Menubutton(self.menu_frame, text=update_text)
|
||||
self.update_btn.grid(column=4, columnspan=3, row=0, padx=0)
|
||||
Tooltip(
|
||||
self.update_btn, _("Click to download new version"), self.tooltip_state
|
||||
self.update_btn = ttk.Button(
|
||||
self.menu_frame,
|
||||
image=self.image_manager.load_image("update"),
|
||||
style="Toolbutton",
|
||||
command=self.updater,
|
||||
)
|
||||
|
||||
self.download = tk.Menu(self, relief="flat")
|
||||
self.update_btn.configure(menu=self.download, style="Toolbutton")
|
||||
self.download.add_command(
|
||||
label=_("Download"),
|
||||
command=lambda: GiteaUpdate.download(
|
||||
f"{AppConfig.DOWNLOAD_URL}/{res}.zip", res
|
||||
),
|
||||
self.update_btn.grid(column=5, row=0, padx=0)
|
||||
Tooltip(
|
||||
self.update_btn, _("Click to install new version"), self.tooltip_state
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@ -723,11 +729,11 @@ class FrameWidgets(ttk.Frame):
|
||||
)
|
||||
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"])
|
||||
|
||||
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?
|
||||
MessageDialog(
|
||||
"error",
|
||||
|
Reference in New Issue
Block a user