1
0
Fork 0
mirror of synced 2024-06-29 19:51:02 +12:00

Fix some small issues

- shop: fix overlaying widgets
- launch_dialog.py dlg: error when catching exception
- fix exit in offline mode
This commit is contained in:
Dummerle 2021-12-31 01:03:37 +01:00
parent 080c8f8831
commit 78c0a74692
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
3 changed files with 8 additions and 7 deletions

View file

@ -12,7 +12,6 @@ from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMessageBox
from requests import HTTPError from requests import HTTPError
import legendary import legendary
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
import rare.resources.resources import rare.resources.resources
import rare.shared as shared import rare.shared as shared
@ -208,7 +207,7 @@ class App(QApplication):
def exit_app(self, exit_code=0): def exit_app(self, exit_code=0):
# FIXME: Fix this with the downlaod tab redesign # FIXME: Fix this with the downlaod tab redesign
if self.mainwindow is not None: if self.mainwindow is not None:
if self.mainwindow.tab_widget.downloadTab.is_download_active: if not shared.args.offline and self.mainwindow.tab_widget.downloadTab.is_download_active:
question = QMessageBox.question( question = QMessageBox.question(
self.mainwindow, self.mainwindow,
self.tr("Close"), self.tr("Close"),

View file

@ -3,7 +3,7 @@ import platform
from logging import getLogger from logging import getLogger
from PyQt5.QtCore import Qt, pyqtSignal, QRunnable, QObject, QThreadPool from PyQt5.QtCore import Qt, pyqtSignal, QRunnable, QObject, QThreadPool
from PyQt5.QtWidgets import QDialog from PyQt5.QtWidgets import QDialog, QApplication
from requests.exceptions import ConnectionError, HTTPError from requests.exceptions import ConnectionError, HTTPError
from legendary.core import LegendaryCore from legendary.core import LegendaryCore
@ -43,13 +43,13 @@ class ApiRequestWorker(QRunnable):
def run(self) -> None: def run(self) -> None:
try: try:
result = shared.core.get_game_and_dlc_list(True, "Mac") result = shared.core.get_game_and_dlc_list(True, "Mac")
except HTTPError(): except HTTPError:
result = [], {} result = [], {}
self.signals.result.emit(result, "mac") self.signals.result.emit(result, "mac")
try: try:
result = shared.core.get_game_and_dlc_list(True, "Win32") result = shared.core.get_game_and_dlc_list(True, "Win32")
except HTTPError(): except HTTPError:
result = [], {} result = [], {}
self.signals.result.emit(result, "32bit") self.signals.result.emit(result, "32bit")
@ -103,6 +103,7 @@ class LaunchDialog(QDialog, Ui_LaunchDialog):
if self.offline: if self.offline:
pass pass
else: else:
QApplication.processEvents()
if self.core.login(): if self.core.login():
logger.info("You are logged in") logger.info("You are logged in")
else: else:

View file

@ -1,6 +1,5 @@
import datetime import datetime
import logging import logging
import random
from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
@ -86,6 +85,7 @@ class ShopWidget(QScrollArea, Ui_ShopWidget):
item = self.discount_widget.layout().itemAt(i) item = self.discount_widget.layout().itemAt(i)
if item: if item:
item.widget().deleteLater() item.widget().deleteLater()
if wishlist and wishlist[0] == "error": if wishlist and wishlist[0] == "error":
self.discount_widget.layout().addWidget( self.discount_widget.layout().addWidget(
QLabel(self.tr("Failed to get wishlist: ") + wishlist[1]) QLabel(self.tr("Failed to get wishlist: ") + wishlist[1])
@ -112,8 +112,9 @@ class ShopWidget(QScrollArea, Ui_ShopWidget):
logger.warning(str(game) + str(e)) logger.warning(str(game) + str(e))
continue continue
self.discounts_gb.setVisible(discounts > 0) self.discounts_gb.setVisible(discounts > 0)
self.discount_widget.update()
self.discount_stack.setCurrentIndex(0) self.discount_stack.setCurrentIndex(0)
# fix widget overlay
self.discount_widget.layout().update()
def add_free_games(self, free_games: list): def add_free_games(self, free_games: list):
for i in range(self.free_widget.layout().count()): for i in range(self.free_widget.layout().count()):