Some fixes:
- Fix info texts in installed widgets - check settings before sync - Update README.md
This commit is contained in:
parent
c4e820b6a9
commit
825f055387
3
.github/workflows/push_tr_file.yml
vendored
3
.github/workflows/push_tr_file.yml
vendored
|
@ -9,14 +9,13 @@ on:
|
|||
|
||||
jobs:
|
||||
|
||||
appimage:
|
||||
push_file:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
TX_TOKEN: ${{ secrets.TX_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
|
|
@ -13,6 +13,8 @@ it by creating an issue on GitHub or on Discord: https://discord.gg/YvmABK9YSk
|
|||
|
||||
Execute `pip install Rare` for all users Or `pip install Rare --user` for only one user.
|
||||
|
||||
To install latest git version use `pip install --upgrade https://github.com/Dummerle/Rare/archive/refs/heads/main.zip`
|
||||
|
||||
Linux: execute `rare` in your terminal.
|
||||
|
||||
Windows: execute `pythonw -m rare` in cmd
|
||||
|
@ -33,7 +35,7 @@ There are some AUR packages available:
|
|||
|
||||
#### Other
|
||||
|
||||
Install via `pip`.
|
||||
Install via `pip` or use a package
|
||||
|
||||
### Packages
|
||||
|
||||
|
@ -72,7 +74,8 @@ In [actions](https://github.com/Dummerle/Rare/actions) you find packages for the
|
|||
## Planned Features
|
||||
|
||||
- More Translations (Need help)
|
||||
- More Information about Games More planned features are in [projects](https://github.com/Dummerle/Rare/projects/1)
|
||||
- More Information about Games
|
||||
- More planned features are in [projects](https://github.com/Dummerle/Rare/projects/1)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|||
from logging import getLogger
|
||||
from typing import Union
|
||||
|
||||
from PyQt5.QtCore import QObject, pyqtSignal, QRunnable, QThreadPool, Qt
|
||||
from PyQt5.QtCore import QObject, pyqtSignal, QRunnable, QThreadPool, Qt, QSettings
|
||||
from PyQt5.QtWidgets import QDialog, QMessageBox, QSizePolicy, QLayout
|
||||
from qtawesome import icon
|
||||
|
||||
|
@ -109,7 +109,7 @@ class CloudSaveDialog(QDialog, Ui_SyncSaveDialog):
|
|||
|
||||
|
||||
class CloudSaveUtils(QObject):
|
||||
sync_finished = pyqtSignal(str, bool)
|
||||
sync_finished = pyqtSignal(str)
|
||||
|
||||
def __init__(self):
|
||||
super(CloudSaveUtils, self).__init__()
|
||||
|
@ -117,6 +117,7 @@ class CloudSaveUtils(QObject):
|
|||
saves = shared.api_results.saves
|
||||
|
||||
self.latest_saves = self.get_latest_saves(saves)
|
||||
self.settings = QSettings()
|
||||
|
||||
self.thread_pool = QThreadPool.globalInstance()
|
||||
|
||||
|
@ -133,7 +134,12 @@ class CloudSaveUtils(QObject):
|
|||
latest_saves[s.app_name] = s
|
||||
return latest_saves
|
||||
|
||||
def sync_before_launch_game(self, app_name) -> bool:
|
||||
def sync_before_launch_game(self, app_name, ignore_settings=False) -> bool:
|
||||
if not ignore_settings:
|
||||
default = self.settings.value("auto_sync_cloud", True, bool)
|
||||
if not self.settings.value(f"{app_name}/auto_sync_cloud", default, bool):
|
||||
return False
|
||||
|
||||
igame = self.core.get_installed_game(app_name)
|
||||
res, (dt_local, dt_remote) = self.core.check_savegame_state(igame.save_path, self.latest_saves.get(app_name))
|
||||
|
||||
|
@ -163,7 +169,13 @@ class CloudSaveUtils(QObject):
|
|||
|
||||
return False
|
||||
|
||||
def game_finished(self, app_name):
|
||||
def game_finished(self, app_name, ignore_settings=False):
|
||||
if not ignore_settings:
|
||||
default = self.settings.value("auto_sync_cloud", True, bool)
|
||||
if not self.settings.value(f"{app_name}/auto_sync_cloud", default, bool):
|
||||
self.sync_finished.emit(app_name)
|
||||
return
|
||||
|
||||
igame = self.core.get_installed_game(app_name)
|
||||
res, (dt_local, dt_remote) = self.core.check_savegame_state(igame.save_path, self.latest_saves.get(app_name))
|
||||
|
||||
|
@ -174,9 +186,11 @@ class CloudSaveUtils(QObject):
|
|||
elif res == SaveGameStatus.NO_SAVE:
|
||||
QMessageBox.warning(None, "No saves", self.tr(
|
||||
"There are no saves local and online. Maybe you have to change save path of {}").format(igame.title))
|
||||
self.sync_finished.emit(app_name)
|
||||
return
|
||||
|
||||
elif res == SaveGameStatus.SAME_AGE:
|
||||
self.sync_finished.emit(app_name)
|
||||
return
|
||||
|
||||
# Remote newer
|
||||
|
@ -204,8 +218,8 @@ class CloudSaveUtils(QObject):
|
|||
def worker_finished(self, error_message: str, app_name: str):
|
||||
if not error_message:
|
||||
|
||||
self.sync_finished.emit(app_name, False)
|
||||
self.sync_finished.emit(app_name)
|
||||
self.latest_saves = self.get_latest_saves(shared.api_results.saves)
|
||||
else:
|
||||
QMessageBox.warning(None, "Warning", self.tr("Syncing with cloud failed: \n ") + error_message)
|
||||
self.sync_finished.emit(app_name, True)
|
||||
self.sync_finished.emit(app_name)
|
||||
|
|
|
@ -37,6 +37,7 @@ class GameUtils(QObject):
|
|||
finished = pyqtSignal(str, str)
|
||||
cloud_save_finished = pyqtSignal(str)
|
||||
launch_queue = dict()
|
||||
game_launched = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(GameUtils, self).__init__(parent=parent)
|
||||
|
@ -59,8 +60,11 @@ class GameUtils(QObject):
|
|||
if game.supports_cloud_saves and self.cloud_save_utils.sync_before_launch_game(app_name):
|
||||
self.launch_queue[app_name] = (app_name, skip_update_check, offline)
|
||||
return
|
||||
else:
|
||||
self.launch_game(app_name, offline, skip_update_check)
|
||||
elif game.supports_cloud_saves:
|
||||
self.sync_finished(app_name)
|
||||
|
||||
self.launch_game(app_name, offline, skip_update_check)
|
||||
return
|
||||
|
||||
def launch_game(self, app_name: str, offline: bool = False, skip_update_check: bool = False, wine_bin: str = None,
|
||||
wine_pfx: str = None):
|
||||
|
@ -143,6 +147,7 @@ class GameUtils(QObject):
|
|||
process.game_finished.connect(self.game_finished)
|
||||
running_game = RunningGameModel(process=process, app_name=app_name)
|
||||
process.start(full_params[0], full_params[1:])
|
||||
self.game_launched.emit(app_name)
|
||||
|
||||
self.running_games[game.app_name] = running_game
|
||||
|
||||
|
@ -206,7 +211,8 @@ class GameUtils(QObject):
|
|||
if self.core.get_game(app_name).supports_cloud_saves:
|
||||
if exit_code != 0:
|
||||
r = QMessageBox.question(None, "Question", self.tr(
|
||||
"Game exited with code {}, which is not a normal code. It could be caused by a crash. Do you want to sync cloud saves"),
|
||||
"Game exited with code {}, which is not a normal code. It could be caused by a crash. Do you want to sync cloud saves").format(
|
||||
exit_code),
|
||||
buttons=QMessageBox.Yes | QMessageBox.No, defaultButton=QMessageBox.Yes)
|
||||
if r != QMessageBox.Yes:
|
||||
return
|
||||
|
|
|
@ -8,9 +8,9 @@ from PyQt5.QtWidgets import QGroupBox, QMessageBox, QAction, QLabel
|
|||
|
||||
from legendary.models.game import Game
|
||||
from rare import shared
|
||||
from rare.components.tabs.games.game_utils import GameUtils
|
||||
from rare.utils import utils
|
||||
from rare.utils.utils import create_desktop_link
|
||||
from rare.components.tabs.games.game_utils import GameUtils
|
||||
|
||||
logger = getLogger("Game")
|
||||
|
||||
|
@ -154,9 +154,10 @@ class BaseInstalledWidget(QGroupBox):
|
|||
self.syncing_cloud_saves = False
|
||||
|
||||
def sync_game(self):
|
||||
if self.game_utils.cloud_save_utils.sync_before_launch_game(self.game.app_name):
|
||||
if self.game_utils.cloud_save_utils.sync_before_launch_game(self.game.app_name, True):
|
||||
self.syncing_cloud_saves = True
|
||||
|
||||
def game_finished(self, app_name, error):
|
||||
if error:
|
||||
QMessageBox.warning(self, "Error", error)
|
||||
self.game_running = False
|
||||
|
|
|
@ -67,6 +67,8 @@ class InstalledIconWidget(BaseInstalledWidget):
|
|||
self.setLayout(self.layout)
|
||||
self.setFixedWidth(self.sizeHint().width())
|
||||
|
||||
self.game_utils.game_launched.connect(self.game_started)
|
||||
|
||||
def enterEvent(self, a0: QEvent = None) -> None:
|
||||
if self.game_running:
|
||||
self.info_label.setText(self.texts["hover"]["running"])
|
||||
|
@ -112,5 +114,9 @@ class InstalledIconWidget(BaseInstalledWidget):
|
|||
return
|
||||
|
||||
super().game_finished(app_name, error)
|
||||
|
||||
self.leaveEvent(None)
|
||||
|
||||
def game_started(self, app_name):
|
||||
if app_name == self.game.app_name:
|
||||
self.game_running = True
|
||||
self.leaveEvent(None)
|
||||
|
|
|
@ -68,10 +68,13 @@ class InstalledListWidget(BaseInstalledWidget):
|
|||
self.setLayout(self.layout)
|
||||
|
||||
self.game_utils.cloud_save_finished.connect(self.sync_finished)
|
||||
self.game_utils.finished.connect(self.game_finished)
|
||||
|
||||
self.leaveEvent = self.update_text
|
||||
self.enterEvent = self.update_text
|
||||
|
||||
self.game_utils.game_launched.connect(self.game_started)
|
||||
|
||||
def update_text(self, e=None):
|
||||
if self.update_available:
|
||||
self.info_label.setText(self.texts["default"]["update_available"])
|
||||
|
@ -81,3 +84,16 @@ class InstalledListWidget(BaseInstalledWidget):
|
|||
self.info_label.setText(self.texts["default"]["syncing"])
|
||||
else:
|
||||
self.info_label.setText("")
|
||||
|
||||
def game_started(self, app_name):
|
||||
if app_name == self.game.app_name:
|
||||
self.game_running = True
|
||||
self.update_text()
|
||||
self.launch_button.setDisabled(True)
|
||||
|
||||
def game_finished(self, app_name, error):
|
||||
if app_name != self.game.app_name:
|
||||
return
|
||||
super().game_finished(app_name, error)
|
||||
self.update_text(None)
|
||||
self.launch_button.setDisabled(False)
|
||||
|
|
Loading…
Reference in a new issue