Skip to content

Commit

Permalink
ctmod: Add message_box_message connection for reporting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic2kk committed Aug 1, 2024
1 parent 1718e0c commit da84191
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pupgui2/networkutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def download_file(url: str, destination: str, progress_callback: Callable[[int],
Returns `True` if download succeeds, `False` otherwise.
Raises: OSError, requests.ConnectionError, requests.Timeout
Raises: `OSError`, `requests.ConnectionError`, `requests.Timeout`
Return Type: bool
"""

Expand Down
8 changes: 1 addition & 7 deletions pupgui2/resources/ctmods/ctmod_luxtorpeda.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ def __download(self, url: str, destination: str, known_size: int = 0):
except Exception as e:
print(f"Failed to download tool {CT_NAME} - Reason: {e}")

## TODO this causes a segfault and "The cached device pixel ratio value was stale on window expose. Please file a QTBUG which explains how to reproduce."
# create_msgbox(
# title=self.tr('Error!'),
# text=self.tr("Failed to download tool {CT_NAME}".format(CT_NAME=CT_NAME)),
# icon=QMessageBox.Warning,
# detailed_text="{EXCEPTION}".format(EXCEPTION=e)
# )
self.message_box_message.emit("Error!", "Failed to download tool {CT_NAME}!\n\nReason: {EXCEPTION}".format(CT_NAME=CT_NAME, EXCEPTION=e), QMessageBox.Icon.Warning)


def __fetch_github_data(self, tag):
Expand Down
10 changes: 3 additions & 7 deletions pupgui2/resources/ctmods/ctmod_z0dxvk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (C) 2022 DavidoTek, partially based on AUNaseef's protonup

import os
from PySide6.QtWidgets import QMessageBox
import requests

from PySide6.QtCore import QObject, QCoreApplication, Signal, Property
Expand All @@ -25,6 +26,7 @@ class CtInstaller(QObject):

p_download_progress_percent = 0
download_progress_percent = Signal(int)
message_box_message = Signal((str, str, QMessageBox.Icon))

def __init__(self, main_window = None):
super(CtInstaller, self).__init__()
Expand Down Expand Up @@ -68,13 +70,7 @@ def __download(self, url: str, destination: str, known_size: int = 0):
except Exception as e:
print(f"Failed to download tool {CT_NAME} - Reason: {e}")

## TODO this causes a segfault and "The cached device pixel ratio value was stale on window expose. Please file a QTBUG which explains how to reproduce."
# create_msgbox(
# title=self.tr('Error!'),
# text=self.tr("Failed to download tool {CT_NAME}".format(CT_NAME=CT_NAME)),
# icon=QMessageBox.Warning,
# detailed_text="{EXCEPTION}".format(EXCEPTION=e)
# )
self.message_box_message.emit("Error!", "Failed to download tool {CT_NAME}!\n\nReason: {EXCEPTION}".format(CT_NAME=CT_NAME, EXCEPTION=e), QMessageBox.Icon.Warning)

def __fetch_data(self, tag: str = '') -> dict:
"""
Expand Down

0 comments on commit da84191

Please sign in to comment.