Bump version to 0.6.5 and enhance update download functionality
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
- Updated version number in __init__.py to 0.6.5. - Modified the download_update method in updater.py to accept a progress_callback for tracking download progress. - Implemented chunked downloading in _download_file to report progress via the callback. - Adjusted installer launching logic in updater.py to handle MSI files correctly using msiexec. - Connected download progress signal in main_window.py to update the downloading dialog.
This commit is contained in:
parent
fba25534d9
commit
9609a12ae7
9 changed files with 2930 additions and 2884 deletions
|
|
@ -238,7 +238,7 @@ class UpdateManager:
|
|||
return None
|
||||
|
||||
async def download_update(
|
||||
self, release: Release, output_dir: Optional[Path] = None
|
||||
self, release: Release, output_dir: Optional[Path] = None, progress_callback=None
|
||||
) -> Optional[Path]:
|
||||
"""Download installer from release assets.
|
||||
|
||||
|
|
@ -279,6 +279,7 @@ class UpdateManager:
|
|||
self._download_file,
|
||||
installer_asset["browser_download_url"],
|
||||
output_file,
|
||||
progress_callback,
|
||||
),
|
||||
timeout=300,
|
||||
)
|
||||
|
|
@ -299,12 +300,13 @@ class UpdateManager:
|
|||
output_file.unlink()
|
||||
return None
|
||||
|
||||
def _download_file(self, url: str, output_path: Path) -> bool:
|
||||
def _download_file(self, url: str, output_path: Path, progress_callback=None) -> bool:
|
||||
"""Download file from URL (blocking).
|
||||
|
||||
Args:
|
||||
url: URL to download from
|
||||
output_path: Path to save file
|
||||
progress_callback: Optional callable(bytes_downloaded, total_bytes)
|
||||
|
||||
Returns:
|
||||
True if successful, False otherwise
|
||||
|
|
@ -312,8 +314,21 @@ class UpdateManager:
|
|||
try:
|
||||
logger.debug(f"Downloading from {url}")
|
||||
with urlopen(url, timeout=300) as response: # 5 min timeout
|
||||
total = int(response.headers.get("Content-Length", 0))
|
||||
downloaded = 0
|
||||
chunk_size = 65536 # 64 KB chunks
|
||||
with open(output_path, "wb") as f:
|
||||
f.write(response.read())
|
||||
while True:
|
||||
chunk = response.read(chunk_size)
|
||||
if not chunk:
|
||||
break
|
||||
f.write(chunk)
|
||||
downloaded += len(chunk)
|
||||
if progress_callback:
|
||||
try:
|
||||
progress_callback(downloaded, total)
|
||||
except Exception:
|
||||
pass # Never let progress errors abort the download
|
||||
logger.debug(f"Downloaded {output_path.stat().st_size} bytes")
|
||||
return True
|
||||
except URLError as e:
|
||||
|
|
@ -421,9 +436,12 @@ class UpdateManager:
|
|||
import subprocess
|
||||
|
||||
if platform.system() == "Windows":
|
||||
# Windows: Run MSI installer
|
||||
# Windows: MSI files must be launched via msiexec
|
||||
logger.info(f"Launching installer: {installer_path}")
|
||||
subprocess.Popen([str(installer_path)])
|
||||
if str(installer_path).lower().endswith(".msi"):
|
||||
subprocess.Popen(["msiexec.exe", "/i", str(installer_path)])
|
||||
else:
|
||||
subprocess.Popen([str(installer_path)])
|
||||
return True
|
||||
elif platform.system() == "Darwin":
|
||||
# macOS: Mount DMG and run installer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue