RareGame: Return values only from Game for app_name
and app_title
With launchable DLCs we will need to replace the InstalledGame in the DLC with the InstalledGame from the base game so depend these properties solely on the Game attribute. Furthermore, since we do not need backwards compatibility any more, remove the `title` property and rename its uses to use `app_title`
This commit is contained in:
parent
dfa12a0138
commit
687218d29b
|
@ -346,5 +346,5 @@ class DownloadsTab(QWidget):
|
|||
@pyqtSlot(RareGame, bool, str)
|
||||
def __on_uninstall_worker_result(self, rgame: RareGame, success: bool, message: str):
|
||||
if not success:
|
||||
QMessageBox.warning(None, self.tr("Uninstall - {}").format(rgame.title), message, QMessageBox.Close)
|
||||
QMessageBox.warning(None, self.tr("Uninstall - {}").format(rgame.app_title), message, QMessageBox.Close)
|
||||
rgame.state = RareGame.State.IDLE
|
||||
|
|
|
@ -144,10 +144,10 @@ class CloudSaves(QWidget, SideTabContents):
|
|||
self.cloud_save_path_edit.setText("")
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Error - {}").format(self.rgame.title),
|
||||
self.tr("Error - {}").format(self.rgame.app_title),
|
||||
self.tr(
|
||||
"Error while calculating path for <b>{}</b>. Insufficient permissions to create <b>{}</b>"
|
||||
).format(self.rgame.title, path),
|
||||
).format(self.rgame.app_title, path),
|
||||
)
|
||||
return
|
||||
if not path:
|
||||
|
@ -217,7 +217,7 @@ class CloudSaves(QWidget, SideTabContents):
|
|||
|
||||
self.rgame = rgame
|
||||
|
||||
self.set_title.emit(rgame.title)
|
||||
self.set_title.emit(rgame.app_title)
|
||||
rgame.signals.widget.update.connect(self.__update_widget)
|
||||
|
||||
self.__update_widget()
|
||||
|
|
|
@ -121,7 +121,7 @@ class GameInfo(QWidget, SideTabContents):
|
|||
if not os.path.exists(repair_file):
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Error - {}").format(self.rgame.title),
|
||||
self.tr("Error - {}").format(self.rgame.app_title),
|
||||
self.tr(
|
||||
"Repair file does not exist or game does not need a repair. Please verify game first"
|
||||
),
|
||||
|
@ -135,11 +135,11 @@ class GameInfo(QWidget, SideTabContents):
|
|||
if rgame.has_update:
|
||||
ans = QMessageBox.question(
|
||||
self,
|
||||
self.tr("Repair and update? - {}").format(self.rgame.title),
|
||||
self.tr("Repair and update? - {}").format(self.rgame.app_title),
|
||||
self.tr(
|
||||
"There is an update for <b>{}</b> from <b>{}</b> to <b>{}</b>. "
|
||||
"Do you want to update the game while repairing it?"
|
||||
).format(rgame.title, rgame.version, rgame.remote_version),
|
||||
).format(rgame.app_title, rgame.version, rgame.remote_version),
|
||||
) == QMessageBox.Yes
|
||||
rgame.repair(repair_and_update=ans)
|
||||
|
||||
|
@ -147,7 +147,7 @@ class GameInfo(QWidget, SideTabContents):
|
|||
def __on_worker_error(self, rgame: RareGame, message: str):
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Error - {}").format(rgame.title),
|
||||
self.tr("Error - {}").format(rgame.app_title),
|
||||
message
|
||||
)
|
||||
|
||||
|
@ -155,11 +155,11 @@ class GameInfo(QWidget, SideTabContents):
|
|||
def __on_verify(self):
|
||||
""" This method is to be called from the button only """
|
||||
if not os.path.exists(self.rgame.igame.install_path):
|
||||
logger.error(f"Installation path {self.rgame.igame.install_path} for {self.rgame.title} does not exist")
|
||||
logger.error(f"Installation path {self.rgame.igame.install_path} for {self.rgame.app_title} does not exist")
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Error - {}").format(self.rgame.title),
|
||||
self.tr("Installation path for <b>{}</b> does not exist. Cannot continue.").format(self.rgame.title),
|
||||
self.tr("Error - {}").format(self.rgame.app_title),
|
||||
self.tr("Installation path for <b>{}</b> does not exist. Cannot continue.").format(self.rgame.app_title),
|
||||
)
|
||||
return
|
||||
self.verify_game(self.rgame)
|
||||
|
@ -184,18 +184,18 @@ class GameInfo(QWidget, SideTabContents):
|
|||
if success:
|
||||
QMessageBox.information(
|
||||
self,
|
||||
self.tr("Summary - {}").format(rgame.title),
|
||||
self.tr("Summary - {}").format(rgame.app_title),
|
||||
self.tr("<b>{}</b> has been verified successfully. "
|
||||
"No missing or corrupt files found").format(rgame.title),
|
||||
"No missing or corrupt files found").format(rgame.app_title),
|
||||
)
|
||||
else:
|
||||
ans = QMessageBox.question(
|
||||
self,
|
||||
self.tr("Summary - {}").format(rgame.title),
|
||||
self.tr("Summary - {}").format(rgame.app_title),
|
||||
self.tr(
|
||||
"<b>{}</b> failed verification, <b>{}</b> file(s) corrupted, <b>{}</b> file(s) are missing. "
|
||||
"Do you want to repair them?"
|
||||
).format(rgame.title, failed, missing),
|
||||
).format(rgame.app_title, failed, missing),
|
||||
QMessageBox.Yes | QMessageBox.No,
|
||||
QMessageBox.Yes,
|
||||
)
|
||||
|
@ -216,7 +216,7 @@ class GameInfo(QWidget, SideTabContents):
|
|||
if os.path.basename(self.rgame.install_path) in os.path.basename(item):
|
||||
ans = QMessageBox.question(
|
||||
self,
|
||||
self.tr("Move game? - {}").format(self.rgame.title),
|
||||
self.tr("Move game? - {}").format(self.rgame.app_title),
|
||||
self.tr(
|
||||
"Destination <b>{}</b> already exists. "
|
||||
"Are you sure you want to overwrite it?"
|
||||
|
@ -255,8 +255,8 @@ class GameInfo(QWidget, SideTabContents):
|
|||
def __on_move_result(self, rgame: RareGame, dst_path: str):
|
||||
QMessageBox.information(
|
||||
self,
|
||||
self.tr("Summary - {}").format(rgame.title),
|
||||
self.tr("<b>{}</b> successfully moved to <b>{}<b>.").format(rgame.title, dst_path),
|
||||
self.tr("Summary - {}").format(rgame.app_title),
|
||||
self.tr("<b>{}</b> successfully moved to <b>{}<b>.").format(rgame.app_title, dst_path),
|
||||
)
|
||||
|
||||
@pyqtSlot()
|
||||
|
|
|
@ -97,15 +97,11 @@ class RareGameBase(QObject):
|
|||
|
||||
@property
|
||||
def app_name(self) -> str:
|
||||
return self.igame.app_name if self.igame is not None else self.game.app_name
|
||||
return self.game.app_name
|
||||
|
||||
@property
|
||||
def app_title(self) -> str:
|
||||
return self.igame.title if self.igame is not None else self.game.app_title
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
return self.app_title
|
||||
return self.game.app_title
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
|
@ -234,7 +230,7 @@ class RareGameSlim(RareGameBase):
|
|||
status, (dt_local, dt_remote) = self.save_game_state
|
||||
|
||||
def _upload():
|
||||
logger.info(f"Uploading save for {self.title}")
|
||||
logger.info(f"Uploading save for {self.app_title}")
|
||||
self.state = RareGameSlim.State.SYNCING
|
||||
self.core.upload_save(self.app_name, self.igame.save_path, dt_local)
|
||||
self.state = RareGameSlim.State.IDLE
|
||||
|
@ -246,7 +242,7 @@ class RareGameSlim(RareGameBase):
|
|||
logger.warning("Can't upload non existing save")
|
||||
return
|
||||
if self.state == RareGameSlim.State.SYNCING:
|
||||
logger.error(f"{self.title} is already syncing")
|
||||
logger.error(f"{self.app_title} is already syncing")
|
||||
return
|
||||
|
||||
if thread:
|
||||
|
@ -259,7 +255,7 @@ class RareGameSlim(RareGameBase):
|
|||
status, (dt_local, dt_remote) = self.save_game_state
|
||||
|
||||
def _download():
|
||||
logger.info(f"Downloading save for {self.title}")
|
||||
logger.info(f"Downloading save for {self.app_title}")
|
||||
self.state = RareGameSlim.State.SYNCING
|
||||
self.core.download_saves(self.app_name, self.latest_save.file.manifest_name, self.save_path)
|
||||
self.state = RareGameSlim.State.IDLE
|
||||
|
@ -271,7 +267,7 @@ class RareGameSlim(RareGameBase):
|
|||
logger.error("Can't download non existing save")
|
||||
return
|
||||
if self.state == RareGameSlim.State.SYNCING:
|
||||
logger.error(f"{self.title} is already syncing")
|
||||
logger.error(f"{self.app_title} is already syncing")
|
||||
return
|
||||
|
||||
if thread:
|
||||
|
|
|
@ -104,17 +104,17 @@ class OriginWineWorker(QRunnable):
|
|||
if install_dir:
|
||||
logger.debug("Found Unix install directory %s", install_dir)
|
||||
else:
|
||||
logger.info("Could not find Unix install directory for %s", rgame.title)
|
||||
logger.info("Could not find Unix install directory for %s", rgame.app_title)
|
||||
else:
|
||||
logger.info("Could not find Wine install directory for %s", rgame.title)
|
||||
logger.info("Could not find Wine install directory for %s", rgame.app_title)
|
||||
|
||||
if install_dir:
|
||||
if os.path.isdir(install_dir):
|
||||
install_size = path_size(install_dir)
|
||||
rgame.set_origin_attributes(install_dir, install_size)
|
||||
logger.info("Origin game %s (%s, %s)", rgame.title, install_dir, format_size(install_size))
|
||||
logger.info("Origin game %s (%s, %s)", rgame.app_title, install_dir, format_size(install_size))
|
||||
else:
|
||||
logger.warning("Origin game %s (%s does not exist)", rgame.title, install_dir)
|
||||
logger.warning("Origin game %s (%s does not exist)", rgame.app_title, install_dir)
|
||||
else:
|
||||
logger.info("Origin game %s is not installed", rgame.title)
|
||||
logger.info("Origin game %s is not installed", rgame.app_title)
|
||||
logger.info("Origin worker finished in %ss", time.time() - t)
|
||||
|
|
Loading…
Reference in a new issue