Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 1.10.9 #338

Merged
merged 34 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
dda1793
Rare: Version 1.10.8
loathingKernel Dec 13, 2023
23716e4
Lgndr: Log function name using the decorator
loathingKernel Dec 13, 2023
5abae7e
FlowLayout: Fix overlapping widgets and remove default arguments
loathingKernel Dec 13, 2023
cfbb6ea
GamesTab: Initialize when first shown.
loathingKernel Dec 14, 2023
dfa12a0
IconGameWidget: Make icons slightly smaller by using the Library preset
loathingKernel Dec 14, 2023
687218d
RareGame: Return values only from Game for `app_name` and `app_title`
loathingKernel Dec 14, 2023
1677ea7
FetchWorker: Fix issue with missing MacOS assets on MacOS
loathingKernel Dec 15, 2023
76083b9
Ui: Update some strings in RareSettings form
loathingKernel Dec 15, 2023
5133711
RareGameBase: use default platform for version
loathingKernel Dec 15, 2023
cada2ae
ImportWorker: Use default platform when importing, fallback to Window…
loathingKernel Dec 15, 2023
1b85440
IndicatorEdit: Set placeholder as tooltip too
loathingKernel Dec 15, 2023
fd809c7
UI: Update some strings
loathingKernel Dec 15, 2023
392b4b7
RareSettings: Always show information label in interface section
loathingKernel Dec 15, 2023
6d5b60a
LegendarySettings: Add path edit for macOS specific `mac_install_dir`…
loathingKernel Dec 15, 2023
097b76f
FetchWorker: Update strings `MacOS` -> `macOS`
loathingKernel Dec 15, 2023
c3bdffc
RareCore: Check if LEGENDARY_CONFIG_PATH is set before creating a new…
loathingKernel Dec 15, 2023
db588ed
Use legendary's installation directory inference
loathingKernel Dec 15, 2023
6249e56
InstallDialog: Oooooooof.gif
loathingKernel Dec 15, 2023
0bd34af
ImportGroup: calculate correct install dir when importing game
loathingKernel Dec 15, 2023
79df146
Rare: expand `LEGENDARY_CONFIG_PATH` before using it.
loathingKernel Dec 16, 2023
8e57308
RareCore: Set `install_dir` and `mac_install_dir` on new configurati…
loathingKernel Dec 16, 2023
1139765
ImageSize: Make Library images slightly larger to accommodate more te…
loathingKernel Dec 16, 2023
447d704
Lgndr: Log what config location we are using
loathingKernel Dec 16, 2023
5f5e471
RareGameBase: Add `default_platform` property
loathingKernel Dec 16, 2023
54ac89a
Lgndr: Validate default platform if it is coming from the config
loathingKernel Dec 16, 2023
bfa2335
RareCore: Strengthen config initialization and checks
loathingKernel Dec 16, 2023
b93435d
Lgndr: Disable legendary's update checks and ignore config file options
loathingKernel Dec 16, 2023
1cf53e3
Library: Filter unreal engine entries expect for the dedicated option
loathingKernel Dec 16, 2023
c9264c7
HeadBar: Default to `Mac games` fitler on macOS
loathingKernel Dec 16, 2023
dfa60aa
ImportGroup: Add platform selection when importing games.
loathingKernel Dec 16, 2023
32565b3
HeadBar: Update some strings
loathingKernel Dec 16, 2023
a990400
Rare: Release 1.10.9
loathingKernel Dec 17, 2023
bc485ed
RareCore: Don't delete overlay RareGame at exit
loathingKernel Dec 17, 2023
85d2937
GameSettings: Hide proton settings on macOS
loathingKernel Dec 17, 2023
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
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AppDir:
id: io.github.dummerle.rare
name: Rare
icon: Rare
version: 1.10.7
version: 1.10.9
exec: usr/bin/python3
exec_args: $APPDIR/usr/src/rare/main.py $@
apt:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ force-exclude = '''

[tool.poetry]
name = "rare"
version = "1.10.7"
version = "1.10.9"
description = "A GUI for Legendary"
authors = ["Dummerle"]
license = "GPL3"
Expand Down
2 changes: 1 addition & 1 deletion rare/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.10.7"
__version__ = "1.10.9"
__codename__ = "Garlic Crab"

# For PyCharm profiler
Expand Down
2 changes: 0 additions & 2 deletions rare/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def __init__(self, args: Namespace):
self.signals = RareCore.instance().signals()
self.core = RareCore.instance().core()

config_helper.init_config_handler(self.core)

lang = self.settings.value("language", self.core.language_code, type=str)
self.load_translator(lang)

Expand Down
87 changes: 50 additions & 37 deletions rare/components/dialogs/install_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ def __init__(self, rgame: RareGame, options: InstallOptionsModel, parent=None):
self.ui.install_dialog_label.setText(f'<h3>{header} "{self.rgame.app_title}"</h3>')
self.setWindowTitle(f'{header} "{self.rgame.app_title}" - {QCoreApplication.instance().applicationName()}')

if not self.options.base_path:
self.options.base_path = self.core.lgd.config.get(
"Legendary", "install_dir", fallback=os.path.expanduser("~/legendary")
)
if options.base_path:
base_path = options.base_path
elif rgame.is_installed:
base_path = rgame.install_path
else:
base_path = self.core.get_default_install_dir(rgame.default_platform)

self.install_dir_edit = PathEdit(
path=self.options.base_path,
path=base_path,
file_mode=QFileDialog.DirectoryOnly,
edit_func=self.option_changed,
save_func=self.save_install_edit,
Expand All @@ -90,36 +92,24 @@ def __init__(self, rgame: RareGame, options: InstallOptionsModel, parent=None):
QFormLayout.FieldRole, self.install_dir_edit
)

if self.options.update:
self.ui.install_dir_label.setEnabled(False)
self.install_dir_edit.setEnabled(False)
self.ui.shortcut_label.setEnabled(False)
self.ui.shortcut_check.setEnabled(False)
else:
self.ui.shortcut_check.setChecked(QSettings().value("create_shortcut", True, bool))
self.install_dir_edit.setDisabled(rgame.is_installed)
self.ui.install_dir_label.setDisabled(rgame.is_installed)
self.ui.shortcut_label.setDisabled(rgame.is_installed)
self.ui.shortcut_check.setDisabled(rgame.is_installed)
self.ui.shortcut_check.setChecked(not rgame.is_installed and QSettings().value("create_shortcut", True, bool))

self.error_box()

platforms = self.rgame.platforms
self.ui.platform_combo.addItems(reversed(platforms))
self.ui.platform_combo.currentIndexChanged.connect(lambda: self.option_changed(None))
self.ui.platform_combo.currentIndexChanged.connect(lambda: self.error_box())
self.ui.platform_combo.currentIndexChanged.connect(
lambda i: self.error_box(
self.tr("Warning"),
self.tr("You will not be able to run the game if you select <b>{}</b> as platform").format(
self.ui.platform_combo.itemText(i)
),
)
if (self.ui.platform_combo.currentText() == "Mac" and pf.system() != "Darwin")
else None
)
self.ui.platform_combo.setCurrentIndex(
self.ui.platform_combo.findText(
"Mac" if (pf.system() == "Darwin" and "Mac" in platforms) else "Windows"
)
)
self.ui.platform_combo.currentTextChanged.connect(self.setup_sdl_list)
self.ui.platform_combo.addItems(reversed(rgame.platforms))
combo_text = rgame.igame.platform if rgame.is_installed else rgame.default_platform
self.ui.platform_combo.setCurrentIndex(self.ui.platform_combo.findText(combo_text))
self.ui.platform_combo.currentIndexChanged.connect(lambda i: self.option_changed(None))
self.ui.platform_combo.currentIndexChanged.connect(self.check_incompatible_platform)
self.ui.platform_combo.currentIndexChanged.connect(self.reset_install_dir)
self.ui.platform_combo.currentIndexChanged.connect(self.reset_sdl_list)

self.ui.platform_label.setDisabled(rgame.is_installed)
self.ui.platform_combo.setDisabled(rgame.is_installed)

self.advanced.ui.max_workers_spin.setValue(self.core.lgd.config.getint("Legendary", "max_workers", fallback=0))
self.advanced.ui.max_workers_spin.valueChanged.connect(self.option_changed)
Expand All @@ -139,7 +129,10 @@ def __init__(self, rgame: RareGame, options: InstallOptionsModel, parent=None):

self.selectable_checks: List[TagCheckBox] = []
self.config_tags: Optional[List[str]] = None
self.setup_sdl_list(self.ui.platform_combo.currentText())

self.reset_install_dir(self.ui.platform_combo.currentIndex())
self.reset_sdl_list(self.ui.platform_combo.currentIndex())
self.check_incompatible_platform(self.ui.platform_combo.currentIndex())

self.ui.install_button.setEnabled(False)

Expand All @@ -155,9 +148,10 @@ def __init__(self, rgame: RareGame, options: InstallOptionsModel, parent=None):
self.selectable.setEnabled(False)

if pf.system() == "Darwin":
self.ui.shortcut_label.setDisabled(True)
self.ui.shortcut_check.setDisabled(True)
self.ui.shortcut_check.setChecked(False)
self.ui.shortcut_check.setToolTip(self.tr("Creating a shortcut is not supported on MacOS"))
self.ui.shortcut_check.setToolTip(self.tr("Creating a shortcut is not supported on macOS"))

self.advanced.ui.install_prereqs_label.setEnabled(False)
self.advanced.ui.install_prereqs_check.setEnabled(False)
Expand Down Expand Up @@ -190,8 +184,16 @@ def execute(self):
self.__on_verify()
self.show()

@pyqtSlot(str)
def setup_sdl_list(self, platform="Windows"):
@pyqtSlot(int)
def reset_install_dir(self, index: int):
if not self.rgame.is_installed:
platform = self.ui.platform_combo.itemText(index)
default_dir = self.core.get_default_install_dir(platform)
self.install_dir_edit.setText(default_dir)

@pyqtSlot(int)
def reset_sdl_list(self, index: int):
platform = self.ui.platform_combo.itemText(index)
for cb in self.selectable_checks:
cb.disconnect()
cb.deleteLater()
Expand Down Expand Up @@ -223,8 +225,19 @@ def setup_sdl_list(self, platform="Windows"):
else:
self.selectable.setDisabled(True)

@pyqtSlot(int)
def check_incompatible_platform(self, index: int):
platform = self.ui.platform_combo.itemText(index)
if platform == "Mac" and pf.system() != "Darwin":
self.error_box(
self.tr("Warning"),
self.tr("You will not be able to run the game if you select <b>{}</b> as platform").format(platform)
)
else:
self.error_box()

def get_options(self):
self.options.base_path = self.install_dir_edit.text() if not self.options.update else None
self.options.base_path = "" if self.rgame.is_installed else self.install_dir_edit.text()
self.options.max_workers = self.advanced.ui.max_workers_spin.value()
self.options.shared_memory = self.advanced.ui.max_memory_spin.value()
self.options.order_opt = self.advanced.ui.dl_optimizations_check.isChecked()
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/downloads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,5 @@ def __on_uninstall_dialog_closed(self, options: UninstallOptionsModel):
@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
21 changes: 12 additions & 9 deletions rare/components/tabs/games/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from logging import getLogger

from PyQt5.QtCore import QSettings, Qt, pyqtSlot
from PyQt5.QtGui import QShowEvent
from PyQt5.QtWidgets import QStackedWidget, QVBoxLayout, QWidget, QScrollArea, QFrame

from rare.models.game import RareGame
Expand Down Expand Up @@ -33,8 +34,6 @@ def __init__(self, parent=None):
self.image_manager = ImageManagerSingleton()
self.settings = QSettings()

self.active_filter: int = 0

self.games_page = QWidget(parent=self)
games_page_layout = QVBoxLayout(self.games_page)
self.addWidget(self.games_page)
Expand Down Expand Up @@ -69,6 +68,7 @@ def __init__(self, parent=None):

self.icon_view = QWidget(self.icon_view_scroll)
icon_view_layout = LibraryLayout(self.icon_view)
icon_view_layout.setSpacing(9)
icon_view_layout.setContentsMargins(0, 13, 0, 13)
icon_view_layout.setAlignment(Qt.AlignTop)

Expand Down Expand Up @@ -97,16 +97,20 @@ def __init__(self, parent=None):
self.head_bar.refresh_list.clicked.connect(self.library_controller.update_list)
self.head_bar.view.toggled.connect(self.toggle_view)

f = self.settings.value("filter", 0, int)
if f >= len(self.head_bar.available_filters):
f = 0
self.active_filter = self.head_bar.available_filters[f]
self.active_filter: str = self.head_bar.filter.currentData(Qt.UserRole)

# signals
self.signals.game.installed.connect(self.update_count_games_label)
self.signals.game.uninstalled.connect(self.update_count_games_label)

self.init = True

def showEvent(self, a0: QShowEvent):
if a0.spontaneous() or not self.init:
return super().showEvent(a0)
self.setup_game_list()
self.init = False
return super().showEvent(a0)

@pyqtSlot()
def scroll_to_top(self):
Expand Down Expand Up @@ -149,7 +153,7 @@ def setup_game_list(self):
for rgame in self.rcore.games:
icon_widget, list_widget = self.add_library_widget(rgame)
if not icon_widget or not list_widget:
logger.warning(f"Excluding {rgame.app_name} from the game list")
logger.warning("Excluding %s from the game list", rgame.app_title)
continue
self.icon_view.layout().addWidget(icon_widget)
self.list_view.layout().addWidget(list_widget)
Expand All @@ -160,8 +164,7 @@ def add_library_widget(self, rgame: RareGame):
try:
icon_widget, list_widget = self.library_controller.add_game(rgame)
except Exception as e:
raise e
logger.error(f"{rgame.app_name} is broken. Don't add it to game list: {e}")
logger.error("Could not add widget for %s to library: %s", rgame.app_name, e)
return None, None
icon_widget.show_info.connect(self.show_game_info)
list_widget.show_info.connect(self.show_game_info)
Expand Down
6 changes: 3 additions & 3 deletions rare/components/tabs/games/game_info/cloud_saves.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ def wine_resolver_finished(self, path, app_name):
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:
Expand Down Expand Up @@ -217,7 +217,7 @@ def update_game(self, rgame: RareGame):

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()
32 changes: 17 additions & 15 deletions rare/components/tabs/games/game_info/game_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __on_repair(self):
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"
),
Expand All @@ -135,31 +135,31 @@ def repair_game(self, rgame: RareGame):
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)

@pyqtSlot(RareGame, str)
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
)

@pyqtSlot()
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)
Expand All @@ -184,18 +184,18 @@ def __on_verify_result(self, rgame: RareGame, success, failed, missing):
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,
)
Expand All @@ -216,7 +216,7 @@ def __on_move(self, dst_path: str):
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?"
Expand Down Expand Up @@ -255,8 +255,8 @@ def __on_move_progress(self, rgame: RareGame, progress: int, total_size: int, co
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()
Expand Down Expand Up @@ -284,7 +284,9 @@ def __update_widget(self):
)

self.ui.platform.setText(
self.rgame.igame.platform if self.rgame.is_installed and not self.rgame.is_non_asset else "Windows"
self.rgame.igame.platform
if self.rgame.is_installed and not self.rgame.is_non_asset
else self.rgame.default_platform
)

self.ui.lbl_grade.setDisabled(
Expand Down
10 changes: 5 additions & 5 deletions rare/components/tabs/games/game_widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def __visibility(widget: Union[IconGameWidget,ListGameWidget], filter_name, sear
elif "hidden" in widget.rgame.metadata.tags:
visible = False
elif filter_name == "installed":
visible = widget.rgame.is_installed
visible = widget.rgame.is_installed and not widget.rgame.is_unreal
elif filter_name == "offline":
visible = widget.rgame.can_run_offline
visible = widget.rgame.can_run_offline and not widget.rgame.is_unreal
elif filter_name == "32bit":
visible = widget.rgame.is_win32
visible = widget.rgame.is_win32 and not widget.rgame.is_unreal
elif filter_name == "mac":
visible = widget.rgame.is_mac
visible = widget.rgame.is_mac and not widget.rgame.is_unreal
elif filter_name == "installable":
visible = not widget.rgame.is_non_asset
visible = not widget.rgame.is_non_asset and not widget.rgame.is_unreal
elif filter_name == "include_ue":
visible = True
elif filter_name == "all":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IconGameWidget(GameWidget):
def __init__(self, rgame: RareGame, parent=None):
super().__init__(rgame, parent)
self.setObjectName(f"{rgame.app_name}")
self.setFixedSize(ImageSize.Display)
self.setFixedSize(ImageSize.Library)
self.ui = IconWidget()
self.ui.setupUi(self)

Expand Down
Loading
Loading