Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions rare/commands/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class PreLaunchSignals(QObject):


class PreLaunch(QRunnable):

def __init__(self, args: InitParams, rgame: RareGameSlim, sync_action=None):
super(PreLaunch, self).__init__()
self.signals = PreLaunchSignals()
Expand Down Expand Up @@ -94,8 +93,7 @@ def prepare_launch(self, args: InitParams) -> Optional[LaunchParams]:
proc = get_configured_qprocess(shlex.split(launch.pre_launch_command), launch.environment)
proc.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels)
proc.readyReadStandardOutput.connect(
(lambda obj: obj.logger.debug(
str(proc.readAllStandardOutput().data(), "utf-8", "ignore"))).__get__(self)
(lambda obj: obj.logger.debug(str(proc.readAllStandardOutput().data(), "utf-8", "ignore"))).__get__(self)
)
self.signals.pre_launch_command_started.emit()
self.logger.info("Running pre-launch command %s, %s", proc.program(), proc.arguments())
Expand All @@ -115,7 +113,6 @@ class SyncCheckWorkerSignals(QObject):


class SyncCheckWorker(QRunnable):

def __init__(self, core: LegendaryCore, rgame: RareGameSlim):
super().__init__()
self.signals = SyncCheckWorkerSignals()
Expand Down Expand Up @@ -257,9 +254,7 @@ def send_message(self, message: BaseModel):

def check_saves(self, exit_code: int):
# self.rgame.signals.widget.refresh.connect(lambda: self.on_exit(exit_code))
self.rgame.signals.widget.refresh.connect(
(lambda obj: obj.on_exit(exit_code)).__get__(self)
)
self.rgame.signals.widget.refresh.connect((lambda obj: obj.on_exit(exit_code)).__get__(self))

state, (dt_local, dt_remote) = self.rgame.save_game_state

Expand All @@ -271,9 +266,7 @@ def check_saves(self, exit_code: int):
# self.sync_dialog.result_ready.connect(
# lambda a: self.__check_saves_finished(exit_code, a)
# )
self.sync_dialog.result_ready.connect(
(lambda obj, a: obj.check_saves_finished(exit_code, a)).__get__(self)
)
self.sync_dialog.result_ready.connect((lambda obj, a: obj.check_saves_finished(exit_code, a)).__get__(self))
self.sync_dialog.open()

@Slot(int, int)
Expand Down
4 changes: 1 addition & 3 deletions rare/components/dialogs/login/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def __init__(self, args: Namespace, core: LegendaryCore, parent=None):
self.import_page.validated.connect(self._on_page_validated)

self.info_message = {
self.landing_index: self.tr(
"<i>Select log-in method.</i>"
),
self.landing_index: self.tr("<i>Select log-in method.</i>"),
self.browser_index: self.tr(
"<i>Click the <strong>Open Browser</strong> button to open the "
"login page in your web browser or copy the link and paste it "
Expand Down
5 changes: 1 addition & 4 deletions rare/components/dialogs/login/browser_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class BrowserLogin(LoginFrame):

def __init__(self, core: LegendaryCore, parent=None):
super(BrowserLogin, self).__init__(core, parent=parent)

Expand All @@ -34,9 +33,7 @@ def __init__(self, core: LegendaryCore, parent=None):
self.ui.copy_button.setIcon(qta_icon("mdi.content-copy", "fa5.copy"))
self.ui.copy_button.clicked.connect(self._on_copy_link)
self.ui.form_layout.setWidget(
self.ui.form_layout.getWidgetPosition(self.ui.sid_label)[0],
QFormLayout.ItemRole.FieldRole,
self.auth_edit
self.ui.form_layout.getWidgetPosition(self.ui.sid_label)[0], QFormLayout.ItemRole.FieldRole, self.auth_edit
)

self.ui.open_button.clicked.connect(self._on_open_browser)
Expand Down
1 change: 0 additions & 1 deletion rare/components/dialogs/login/import_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class ImportLogin(LoginFrame):

# FIXME: Use pathspec instead of duplicated code
if platform.system() == "Windows":
localappdata = os.path.expandvars("%LOCALAPPDATA%")
Expand Down
1 change: 0 additions & 1 deletion rare/components/dialogs/login/login_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ def _on_input_changed(self):
@abstractmethod
def do_login(self) -> None:
pass

8 changes: 3 additions & 5 deletions rare/components/dialogs/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ def __init__(self, rcore: RareCore, rgame: RareGame, parent=None):
self.rcore = rcore
self.core = rcore.core()
self.rgame: Optional[RareGame] = rgame
self.options: MoveGameModel = MoveGameModel(
rgame.app_name, rgame.install_path, rgame.folder_name
)
self.options: MoveGameModel = MoveGameModel(rgame.app_name, rgame.install_path, rgame.folder_name)

self.target_path_edit = PathEdit(
path=self.options.target_path,
Expand Down Expand Up @@ -115,15 +113,15 @@ def reject_handler(self):

@Slot(Qt.CheckState)
def __on_rename_path_changed(self, state: Qt.CheckState):
self.options.rename_path = (state == Qt.CheckState.Checked)
self.options.rename_path = state == Qt.CheckState.Checked
self.full_path_info.setText(self.options.full_path)
_ = QSignalBlocker(self.ui.reset_name_check)
self.ui.reset_name_check.setChecked(self.options.reset_name)
self.action_button.setEnabled(True)

@Slot(Qt.CheckState)
def __on_reset_name_changed(self, state: Qt.CheckState):
self.options.reset_name = (state == Qt.CheckState.Checked)
self.options.reset_name = state == Qt.CheckState.Checked
self.full_path_info.setText(self.options.full_path)
_ = QSignalBlocker(self.ui.rename_path_check)
self.ui.rename_path_check.setChecked(self.options.rename_path)
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def eventFilter(self, w: QObject, e: QEvent) -> bool:
if e.button() == Qt.MouseButton.LeftButton:
origin = QPoint(
self.main_bar.tabRect(tab_idx).bottomRight().x() - self.account_menu.sizeHint().width(),
self.main_bar.tabRect(tab_idx).bottomRight().y()
self.main_bar.tabRect(tab_idx).bottomRight().y(),
)
self.account_menu.exec(self.mapToGlobal(origin))
return True
Expand Down
11 changes: 5 additions & 6 deletions rare/components/tabs/downloads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,15 @@ def __refresh_download(self, item: InstallQueueItemModel):
worker = InstallInfoWorker(self.core, item.options)

worker.signals.result.connect(
(lambda obj, d: obj.start_download(
InstallQueueItemModel(options=item.options, download=d))).__get__(self)
(lambda obj, d: obj.start_download(InstallQueueItemModel(options=item.options, download=d))).__get__(self)
)
worker.signals.failed.connect(
(lambda obj, m: obj.logger.error(
f"Failed to refresh download for {item.options.app_name} with error: {m}")).__get__(self)
(lambda obj, m: obj.logger.error(f"Failed to refresh download for {item.options.app_name} with error: {m}")).__get__(
self
)
)
worker.signals.finished.connect(
(lambda obj: obj.logger.info(
f"Download refresh worker finished for {item.options.app_name}")).__get__(self)
(lambda obj: obj.logger.info(f"Download refresh worker finished for {item.options.app_name}")).__get__(self)
)

QThreadPool.globalInstance().start(worker)
Expand Down
3 changes: 1 addition & 2 deletions rare/components/tabs/downloads/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ def _handle_postinstall(self, postinstall, igame):
proc = QProcess(self)
proc.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels)
proc.readyReadStandardOutput.connect(
(lambda obj: obj.logger.debug(
str(proc.readAllStandardOutput().data(), "utf-8", "ignore"))).__get__(self)
(lambda obj: obj.logger.debug(str(proc.readAllStandardOutput().data(), "utf-8", "ignore"))).__get__(self)
)
proc.setProgram(fullpath)
proc.setArguments(postinstall.get("args", "").split(" "))
Expand Down
24 changes: 13 additions & 11 deletions rare/components/tabs/downloads/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ def _on_settings_clicked(self):
def _update_game(self, auto: bool):
self.ui.update_button.setDisabled(True)
self.ui.settings_button.setDisabled(True)
self.enqueue.emit(InstallOptionsModel(
app_name=self.game.app_name,
base_path=self.igame.install_path,
platform=self.igame.platform,
update=True,
silent=auto, # True if settings
))
self.enqueue.emit(
InstallOptionsModel(
app_name=self.game.app_name,
base_path=self.igame.install_path,
platform=self.igame.platform,
update=True,
silent=auto, # True if settings
)
)

def set_enabled(self, enabled: bool):
self.ui.update_button.setEnabled(enabled)
Expand Down Expand Up @@ -145,13 +147,13 @@ def __init__(
worker = InstallInfoWorker(core, item.options)
worker.signals.result.connect(self.__update_info)
worker.signals.failed.connect(
(lambda obj, m: obj.logger.error(
f"Failed to requeue download for {item.options.app_name} with error: {m}")).__get__(self)
(
lambda obj, m: obj.logger.error(f"Failed to requeue download for {item.options.app_name} with error: {m}")
).__get__(self)
)
worker.signals.failed.connect((lambda obj, m: obj.remove.emit(item.options.app_name)).__get__(self))
worker.signals.finished.connect(
(lambda obj: obj.logger.error(
f"Download requeue worker finished for {item.options.app_name}")).__get__(self)
(lambda obj: obj.logger.error(f"Download requeue worker finished for {item.options.app_name}")).__get__(self)
)
QThreadPool.globalInstance().start(worker)
self.info_widget = QueueInfoWidget(imgmgr, None, None, None, old_igame, parent=self)
Expand Down
1 change: 0 additions & 1 deletion rare/components/tabs/integrations/eos_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class CheckForUpdateWorkerSignals(QObject):


class CheckForUpdateWorker(QRunnable):

def __init__(self, core: LegendaryCore):
super(CheckForUpdateWorker, self).__init__()
self.signals = CheckForUpdateWorkerSignals()
Expand Down
5 changes: 3 additions & 2 deletions rare/components/tabs/integrations/import_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class ImportWorkerSignals(QObject):


class ImportWorker(QRunnable):

def __init__(
self,
core: LegendaryCore,
Expand Down Expand Up @@ -278,7 +277,9 @@ def _app_name_changed(self, app_name: str):
self.ui.import_dlcs_check.setCheckState(Qt.CheckState.Unchecked)
self.ui.import_force_check.setCheckState(Qt.CheckState.Unchecked)
self.ui.import_dlcs_check.setEnabled(self.app_name_edit.is_valid and bool(self.core.get_dlc_for_game(app_name)))
self.ui.import_button.setEnabled(not bool(self.worker) and (self.app_name_edit.is_valid and self.import_path_edit.is_valid))
self.ui.import_button.setEnabled(
not bool(self.worker) and (self.app_name_edit.is_valid and self.import_path_edit.is_valid)
)

@Slot(Qt.CheckState)
def _on_import_folder_changed(self, state: Qt.CheckState):
Expand Down
39 changes: 22 additions & 17 deletions rare/components/tabs/library/details/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def repair_game(self, rgame: RareGame):
"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.app_title, rgame.version, rgame.remote_version),
)
ans = (mbox == QMessageBox.StandardButton.Yes)
ans = mbox == QMessageBox.StandardButton.Yes
rgame.repair(repair_and_update=ans)

@Slot(RareGame, str)
Expand Down Expand Up @@ -252,9 +252,7 @@ def move_game(self, rgame: RareGame, options: MoveGameModel):
ans = QMessageBox.question(
self,
self.tr("Move game? - {}").format(self.rgame.app_title),
self.tr("Destination <b>{}</b> already exists. Are you sure you want to overwrite it?").format(
new_install_path
),
self.tr("Destination <b>{}</b> already exists. Are you sure you want to overwrite it?").format(new_install_path),
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
QMessageBox.StandardButton.Yes,
)
Expand Down Expand Up @@ -439,10 +437,13 @@ def update_game(self, rgame: RareGame):
else:
self.ui.install_button.setText(self.tr("Install"))

self.ui.description_field.setText(rgame.game.metadata['description'])
self.ui.description_field.setText(rgame.game.metadata["description"])

for page in (
self.ui.ach_progress_page, self.ui.ach_completed_page, self.ui.ach_uninitiated_page, self.ui.ach_hidden_page,
self.ui.ach_progress_page,
self.ui.ach_completed_page,
self.ui.ach_uninitiated_page,
self.ui.ach_hidden_page,
):
for w in page.findChildren(AchievementWidget, options=Qt.FindChildOption.FindDirectChildrenOnly):
page.layout().removeWidget(w)
Expand All @@ -455,12 +456,17 @@ def update_game(self, rgame: RareGame):

for group, page in zip(
(
sorted(ach.hidden, key=lambda a: a['xp'], reverse=False),
sorted(ach.uninitiated, key=lambda a: a['xp'], reverse=False),
sorted(ach.completed, key=lambda a: a['unlock_date'], reverse=True),
sorted(ach.in_progress, key=lambda a: a['progress'], reverse=True),
sorted(ach.hidden, key=lambda a: a["xp"], reverse=False),
sorted(ach.uninitiated, key=lambda a: a["xp"], reverse=False),
sorted(ach.completed, key=lambda a: a["unlock_date"], reverse=True),
sorted(ach.in_progress, key=lambda a: a["progress"], reverse=True),
),
(
self.ui.ach_hidden_page,
self.ui.ach_uninitiated_page,
self.ui.ach_completed_page,
self.ui.ach_progress_page,
),
(self.ui.ach_hidden_page, self.ui.ach_uninitiated_page, self.ui.ach_completed_page, self.ui.ach_progress_page, )
):
self.ui.achievements_toolbox.setItemEnabled(self.ui.achievements_toolbox.indexOf(page), bool(group))
if bool(group):
Expand All @@ -483,17 +489,16 @@ def __init__(self, manager: QtRequests, achievement: Dict, parent=None):

image = LoadingImageWidget(manager, parent=self)
image.setFixedSize(ImageSize.LibraryIcon)
image.fetchPixmap(achievement['icon_link'])
image.fetchPixmap(achievement["icon_link"])

title = QLabel(
f"<b><font color={achievement['tier']['hexColor']}>{achievement['display_name']}</font></b>"
f" ({achievement['xp']} XP)",
parent=self
f"<b><font color={achievement['tier']['hexColor']}>{achievement['display_name']}</font></b> ({achievement['xp']} XP)",
parent=self,
)
title.setWordWrap(True)
description = QLabel(achievement['description'], parent=self)
description = QLabel(achievement["description"], parent=self)
description.setWordWrap(True)
unlock_date = achievement['unlock_date'].astimezone() if achievement['unlock_date'] else None
unlock_date = achievement["unlock_date"].astimezone() if achievement["unlock_date"] else None
unlock_date_str = f" ( On: {relative_date(unlock_date)} )" if unlock_date else ""
progress = QLabel(f"Progress: <b>{achievement['progress'] * 100:,.2f}%</b> {unlock_date_str}", parent=self)
if unlock_date:
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent=None):

@Slot()
def _on_update_available(self):
self.tabBar().setTabText(self.about_index, "About (!)")
self.tabBar().setTabText(self.about_index, "About (!)")
1 change: 0 additions & 1 deletion rare/components/tabs/settings/legendary.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class RefreshGameMetaWorkerSignals(QObject):


class RefreshGameMetaWorker(Worker):

def __init__(self, core: LegendaryCore, platforms: Set[str], include_unreal: bool):
super(RefreshGameMetaWorker, self).__init__()
self.core = core
Expand Down
Loading