Skip to content

Commit

Permalink
use 'restart_lli' for both TUI and GUI
Browse files Browse the repository at this point in the history
fix typo in 'update_to_latest_lli_release' name

use 'restart_lli' in GUI as well as TUI with 'os.execv'

revert previous changes
  • Loading branch information
n8marti committed Apr 1, 2024
1 parent 3a93008 commit 3e447cd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 36 deletions.
3 changes: 2 additions & 1 deletion LogosLinuxInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def parse_args(args, parser):
break
if config.ACTION is None:
config.ACTION = run_control_panel
logging.debug(f"{config.ACTION=}")


def run_control_panel():
Expand Down Expand Up @@ -317,7 +318,7 @@ def main():
utils.check_for_updates()

# Check if app is installed.
install_not_required = ['remove_install_dir', 'check_dependencies', 'update_latest_lli_release',
install_not_required = ['remove_install_dir', 'check_dependencies', 'update_to_latest_lli_release',
'update_to_latest_recommended_appimage', 'set_appimage_symlink']
if config.ACTION == "disabled":
msg.logos_error("That option is disabled.", "info")
Expand Down
17 changes: 6 additions & 11 deletions LogosLinuxInstaller.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
a = Analysis(
['LogosLinuxInstaller.py'],
pathex=[],
#binaries=[('/usr/bin/tclsh8.6', '.')],
binaries=[],
datas=[],
datas=[('img/*-128-icon.png', 'img')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
Expand All @@ -18,26 +19,20 @@ pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
exclude_binaries=True,
name='LogosLinuxInstaller',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='LogosLinuxInstaller',
)
23 changes: 6 additions & 17 deletions gui_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import logging
import os
import sys
import subprocess
import threading
from pathlib import Path
from queue import Queue
Expand Down Expand Up @@ -616,7 +614,9 @@ def __init__(self, root, *args, **kwargs):
self.gui.deps_button.config(command=self.install_deps)
self.gui.backup_button.config(command=self.run_backup)
self.gui.restore_button.config(command=self.run_restore)
self.gui.update_lli_button.config(command=self.update_to_latest_lli_release)
self.gui.update_lli_button.config(
command=self.update_to_latest_lli_release
)
self.gui.latest_appimage_button.config(
command=self.update_to_latest_appimage
)
Expand Down Expand Up @@ -756,22 +756,11 @@ def open_file_dialog(self, filetype_name, filetype_extension):

def update_to_latest_lli_release(self, evt=None):
self.start_indeterminate_progress()
self.gui.messagevar.set("Updating to latest Logos Linux Installer version…")
self.gui.messagevar.set("Updating to latest Logos Linux Installer version…") # noqa: E501
t = Thread(
target=utils.update_to_latest_lli_release,
daemon=True,
)
t.start()
logging.debug("Finished updating Logos Linux Installer version.")
t.join()

logging.debug("Restarting Logos Linux Installer.")
if self.root is not None:
self.root.destroy()

args = [sys.executable]
subprocess.Popen(args)
sys.exit()

def update_to_latest_appimage(self, evt=None):
config.APPIMAGE_FILE_PATH = config.RECOMMENDED_WINE64_APPIMAGE_FULL_FILENAME # noqa: E501
Expand Down Expand Up @@ -850,10 +839,10 @@ def update_latest_lli_release_button(self, evt=None):
state = '!disabled'
elif status == 1:
state = 'disabled'
msg = "This button is disabled. Logos Linux Installer is up-to-date."
msg = "This button is disabled. Logos Linux Installer is up-to-date." # noqa: E501
elif status == 2:
state = 'disabled'
msg = "This button is disabled. Logos Linux Installer is newer than the latest release."
msg = "This button is disabled. Logos Linux Installer is newer than the latest release." # noqa: E501
if msg:
gui.ToolTip(self.gui.update_lli_button, msg)
self.clear_message_text()
Expand Down
15 changes: 8 additions & 7 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,12 @@ def reboot():


def restart_lli():
if config.DIALOG != tk:
logging.debug("Restarting Logos Linux Installer.")
args = [sys.executable]
subprocess.Popen(args)
sys.exit()
logging.debug("Restarting Logos Linux Installer.")
pidfile = Path('/tmp/LogosLinuxInstaller.pid')
if pidfile.is_file():
pidfile.unlink()
os.execv(sys.executable, [sys.executable])
sys.exit()


def set_verbose():
Expand Down Expand Up @@ -1164,6 +1165,7 @@ def get_recommended_appimage():

def compare_logos_linux_installer_version():
if config.LLI_CURRENT_VERSION is not None and config.LLI_LATEST_VERSION is not None:
logging.debug(f"{config.LLI_CURRENT_VERSION=}; {config.LLI_LATEST_VERSION=}")
if version.parse(config.LLI_CURRENT_VERSION) < version.parse(config.LLI_LATEST_VERSION):
# Current release is older than recommended.
status = 0
Expand Down Expand Up @@ -1235,8 +1237,7 @@ def update_lli_binary():

os.chmod(sys.argv[0], os.stat(sys.argv[0]).st_mode | 0o111)
logging.debug("Successfully updated Logos Linux Installer.")
if config.DIALOG == "curses":
restart_lli()
restart_lli()


def is_appimage(file_path):
Expand Down

0 comments on commit 3e447cd

Please sign in to comment.