Refactor Windows build script for improved readability and consistency
- Cleaned up whitespace and formatting in build_windows.py for better readability. - Consolidated environment variable setup for stdout and stderr. - Streamlined subprocess command calls by removing unnecessary line breaks. - Enhanced error handling and logging for better debugging. - Updated comments for clarity and consistency. Update updater.py to improve checksum verification logic - Modified checksum verification to prioritize specific .sha256 files matching installer names. - Added fallback logic to check for any .sha256 file if no specific match is found. Enhance update manager UI with download progress dialog - Introduced DownloadingDialog to provide feedback during update downloads. - Updated MainWindow to manage the new downloading dialog and handle its lifecycle. - Removed the skip version functionality from the update dialog as per new requirements. Refactor update manager UI tests for clarity and maintainability - Removed tests related to the skip version functionality. - Updated test cases to reflect changes in the update manager UI. - Ensured all tests are aligned with the new dialog structure and signal emissions.
This commit is contained in:
parent
88d9f200ab
commit
025e9c888c
10 changed files with 3066 additions and 3088 deletions
|
|
@ -270,6 +270,7 @@ class MainWindow(QMainWindow):
|
|||
self._background_threads = [] # Keep references to background threads
|
||||
self._background_workers = {} # Keep references to background workers
|
||||
self.checking_dialog = None # Track the checking dialog
|
||||
self.downloading_dialog = None # Track the download dialog
|
||||
self._is_manual_check = False # Track if this is a manual check (for UI feedback)
|
||||
|
||||
# Set window properties
|
||||
|
|
@ -1402,6 +1403,12 @@ class MainWindow(QMainWindow):
|
|||
Args:
|
||||
release: Release object with update info
|
||||
"""
|
||||
# Close checking dialog if open (manual check case)
|
||||
if hasattr(self, "checking_dialog") and self.checking_dialog:
|
||||
self.checking_dialog.close()
|
||||
self.checking_dialog = None
|
||||
self._is_manual_check = False
|
||||
|
||||
# Update status to show update available
|
||||
self.set_update_status(f"Update available: v{release.version}", emoji="✅")
|
||||
|
||||
|
|
@ -1413,7 +1420,6 @@ class MainWindow(QMainWindow):
|
|||
# Connect dialog signals
|
||||
dialog.update_now.connect(lambda: self._on_user_update_now(release))
|
||||
dialog.update_later.connect(lambda: self._on_user_update_later())
|
||||
dialog.skip_version.connect(lambda: self._on_user_skip_version(release.version))
|
||||
|
||||
# Show dialog (modal)
|
||||
dialog.exec()
|
||||
|
|
@ -1434,21 +1440,6 @@ class MainWindow(QMainWindow):
|
|||
logger.info("User deferred update")
|
||||
self.set_update_status("Update deferred", emoji="")
|
||||
|
||||
def _on_user_skip_version(self, version: str) -> None:
|
||||
"""Handle user clicking 'Skip Version' button.
|
||||
|
||||
Args:
|
||||
version: Version to skip
|
||||
"""
|
||||
logger.info(f"User skipped version {version}")
|
||||
|
||||
# Store skipped version in preferences
|
||||
skipped_file = Path.home() / ".webdrop-bridge" / "skipped_version.txt"
|
||||
skipped_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
skipped_file.write_text(version)
|
||||
|
||||
self.set_update_status(f"Skipped v{version}", emoji="")
|
||||
|
||||
def _start_update_download(self, release) -> None:
|
||||
"""Start downloading the update in background thread.
|
||||
|
||||
|
|
@ -1458,6 +1449,12 @@ class MainWindow(QMainWindow):
|
|||
logger.info(f"Starting download for v{release.version}")
|
||||
self.set_update_status(f"Downloading v{release.version}", emoji="⬇️")
|
||||
|
||||
# Show download progress dialog
|
||||
from webdrop_bridge.ui.update_manager_ui import DownloadingDialog
|
||||
|
||||
self.downloading_dialog = DownloadingDialog(self)
|
||||
self.downloading_dialog.show()
|
||||
|
||||
# Run download in background thread to avoid blocking UI
|
||||
self._perform_update_async(release)
|
||||
|
||||
|
|
@ -1558,6 +1555,10 @@ class MainWindow(QMainWindow):
|
|||
"""
|
||||
from webdrop_bridge.ui.update_manager_ui import InstallDialog
|
||||
|
||||
if hasattr(self, "downloading_dialog") and self.downloading_dialog:
|
||||
self.downloading_dialog.close()
|
||||
self.downloading_dialog = None
|
||||
|
||||
logger.info(f"Download complete: {installer_path}")
|
||||
self.set_update_status("Ready to install", emoji="✅")
|
||||
|
||||
|
|
@ -1572,6 +1573,10 @@ class MainWindow(QMainWindow):
|
|||
Args:
|
||||
error: Error message
|
||||
"""
|
||||
if hasattr(self, "downloading_dialog") and self.downloading_dialog:
|
||||
self.downloading_dialog.close()
|
||||
self.downloading_dialog = None
|
||||
|
||||
logger.error(f"Download failed: {error}")
|
||||
self.set_update_status(error, emoji="❌")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue