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

Various fixes and chores #513

Merged
merged 17 commits into from
Jan 11, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/job_nuitka-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
run: |
python3 -m setuptools_scm --force-write-version-files
- name: Build
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }}
run: >-
python -m nuitka
--assume-yes-for-downloads
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/job_nuitka-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
run: |
python3 -m setuptools_scm --force-write-version-files
- name: Build
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }}
run: >-
arch -${{ matrix.arch }}
python -m nuitka
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/job_nuitka-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
run: |
python3 -m setuptools_scm --force-write-version-files
- name: Build
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }}
run: >-
python -m nuitka
--assume-yes-for-downloads
Expand Down
14 changes: 14 additions & 0 deletions freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
None, # ShowCmd
"TARGETDIR", # WkDir
),
(
"StartMenuShortcut", # Shortcut
"StartMenuFolder", # Directory_
"Rare", # Name
"TARGETDIR", # Component_
"[TARGETDIR]Rare.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
"TARGETDIR", # WkDir
),
]

msi_data = {
Expand Down
17 changes: 11 additions & 6 deletions rare/commands/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ def launch_game(self, args: LaunchArgs):
self.logger.info("%s %s", args.executable, " ".join(args.arguments))
if self.console:
self.console.log(f"Dry run {self.rgame.app_title} ({self.rgame.app_name})")
self.console.log(f"{shlex.join([args.executable] + args.arguments)}")
self.console.log(f"{shlex.join((args.executable, *args.arguments))}")
self.console.accept_close = True
print(shlex.join([args.executable] + args.arguments))
self.stop()
return

if args.is_origin_game:
# executable is a protocol link (link2ea://launchgame/...)
QDesktopServices.openUrl(QUrl(args.executable))
self.stop() # stop because it is not a subprocess
return
Expand All @@ -328,9 +328,14 @@ def launch_game(self, args: LaunchArgs):

if self.rgame.app_name in DETACHED_APP_NAMES and platform.system() == "Windows":
if self.console:
self.console.log("Launching as a detached process")
subprocess.Popen([args.executable] + args.arguments, cwd=args.working_directory,
env={i: args.environment.value(i) for i in args.environment.keys()})
self.console.log(f"Launching {args.executable} as a detached process")
subprocess.Popen(
(args.executable, *args.arguments),
cwd=args.working_directory,
env={i: args.environment.value(i) for i in args.environment.keys()},
shell=True,
creationflags=subprocess.DETACHED_PROCESS,
)
self.stop() # stop because we do not attach to the output
return

Expand Down Expand Up @@ -432,7 +437,7 @@ def stop(self):
self.server.close()
self.server.deleteLater()
except RuntimeError as e:
self.logger.error("Error occured while stopping server: %s", e)
self.logger.error("Error occurred while stopping server: %s", e)

self.processEvents()
if not self.console:
Expand Down
2 changes: 1 addition & 1 deletion rare/commands/launcher/cloud_sync_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from legendary.core import LegendaryCore
from legendary.models.game import InstalledGame

from rare.ui.components.tabs.games.game_info.cloud_sync_widget import Ui_CloudSyncWidget
from rare.ui.components.tabs.library.details.cloud_sync_widget import Ui_CloudSyncWidget
from rare.utils.misc import qta_icon
from rare.widgets.dialogs import ButtonDialog, game_title

Expand Down
2 changes: 1 addition & 1 deletion rare/commands/launcher/lgd_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_launch_args(rgame: RareGameSlim, init_args: InitArgs = None) -> LaunchAr

def get_configured_process(env: dict = None):
proc = QProcess()
proc.setProcessChannelMode(QProcess.MergedChannels)
proc.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels)
proc.readyReadStandardOutput.connect(
lambda: logger.info(
str(proc.readAllStandardOutput().data(), "utf-8", "ignore")
Expand Down
8 changes: 5 additions & 3 deletions rare/components/dialogs/login/import_login.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
from getpass import getuser
from logging import getLogger

Expand All @@ -17,7 +18,7 @@ class ImportLogin(QFrame):
isValid = Signal(bool)

# FIXME: Use pathspec instead of duplicated code
if os.name == "nt":
if platform.system() == "Windows":
localappdata = os.path.expandvars("%LOCALAPPDATA%")
else:
localappdata = os.path.join("drive_c/users", getuser(), "Local Settings/Application Data")
Expand All @@ -35,14 +36,15 @@ def __init__(self, core: LegendaryCore, parent=None):
self.text_egl_found = self.tr("Found EGL Program Data. Click 'Next' to import them.")
self.text_egl_notfound = self.tr("Could not find EGL Program Data. ")

if os.name == "nt":
if platform.system() == "Windows":
if not self.core.egl.appdata_path and os.path.exists(self.egl_appdata):
self.core.egl.appdata_path = self.egl_appdata
if not self.core.egl.appdata_path:
self.ui.status_label.setText(self.text_egl_notfound)
else:
self.ui.status_label.setText(self.text_egl_found)
self.found = True
self.ui.prefix_combo.setCurrentText(self.egl_appdata)
else:
if programdata_path := self.core.egl.programdata_path:
if wine_pfx := programdata_path.split("drive_c")[0]:
Expand Down Expand Up @@ -78,7 +80,7 @@ def prefix_path(self):
self.ui.prefix_combo.setCurrentText(names[0])

def is_valid(self) -> bool:
if os.name == "nt":
if platform.system() == "Windows":
return self.found
else:
egl_wine_pfx = self.ui.prefix_combo.currentText()
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/details/cloud_saves.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from rare.models.options import options
from rare.shared import RareCore
from rare.shared.workers.wine_resolver import WineSavePathResolver
from rare.ui.components.tabs.games.game_info.cloud_settings_widget import Ui_CloudSettingsWidget
from rare.ui.components.tabs.games.game_info.cloud_sync_widget import Ui_CloudSyncWidget
from rare.ui.components.tabs.library.details.cloud_settings_widget import Ui_CloudSettingsWidget
from rare.ui.components.tabs.library.details.cloud_sync_widget import Ui_CloudSyncWidget
from rare.utils.metrics import timelogger
from rare.utils.misc import qta_icon
from rare.widgets.indicator_edit import PathEdit, IndicatorReasonsCommon
Expand Down
13 changes: 11 additions & 2 deletions rare/components/tabs/library/details/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Qt,
Slot,
Signal,
QUrl,
)
from PySide6.QtWidgets import (
QWidget,
Expand All @@ -19,7 +20,7 @@
from rare.models.game import RareGame
from rare.shared import RareCore
from rare.shared.workers import VerifyWorker, MoveWorker
from rare.ui.components.tabs.games.game_info.details import Ui_GameDetails
from rare.ui.components.tabs.library.details.details import Ui_GameDetails
from rare.utils.misc import format_size, qta_icon, style_hyperlink
from rare.widgets.image_widget import ImageWidget, ImageSize
from rare.widgets.side_tab import SideTabContents
Expand Down Expand Up @@ -50,6 +51,9 @@ def __init__(self, parent=None):
self.ui.move_button.setIcon(qta_icon("mdi.folder-move-outline"))
self.ui.uninstall_button.setIcon(qta_icon("ri.uninstall-line"))

self.ui.grade.setOpenExternalLinks(True)
self.ui.install_path.setOpenExternalLinks(True)

self.rcore = RareCore.instance()
self.core = RareCore.instance().core()
self.args = RareCore.instance().args()
Expand Down Expand Up @@ -287,7 +291,12 @@ def __update_widget(self):
self.ui.lbl_install_path.setEnabled(bool(self.rgame.install_path))
self.ui.install_path.setEnabled(bool(self.rgame.install_path))
self.ui.install_path.setText(
self.rgame.install_path if self.rgame.install_path else "N/A"
style_hyperlink(
QUrl.fromLocalFile(self.rgame.install_path).toString(),
self.rgame.install_path
)
if self.rgame.install_path
else "N/A"
)

self.ui.platform.setText(
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/details/dlcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from rare.models.game import RareGame
from rare.shared import LegendaryCoreSingleton, GlobalSignalsSingleton
from rare.ui.components.tabs.games.game_info.dlcs import Ui_GameDlcs
from rare.ui.components.tabs.games.game_info.dlc_widget import Ui_GameDlcWidget
from rare.ui.components.tabs.library.details.dlcs import Ui_GameDlcs
from rare.ui.components.tabs.library.details.dlc_widget import Ui_GameDlcWidget
from rare.widgets.image_widget import ImageWidget, ImageSize
from rare.widgets.side_tab import SideTabContents
from rare.utils.misc import widget_object_name, qta_icon
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/integrations/egl_sync_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from rare.models.pathspec import PathSpec
from rare.shared import RareCore
from rare.shared.workers.wine_resolver import WinePathResolver
from rare.ui.components.tabs.games.integrations.egl_sync_group import Ui_EGLSyncGroup
from rare.ui.components.tabs.games.integrations.egl_sync_list_group import Ui_EGLSyncListGroup
from rare.ui.components.tabs.library.integrations.egl_sync_group import Ui_EGLSyncGroup
from rare.ui.components.tabs.library.integrations.egl_sync_list_group import Ui_EGLSyncListGroup
from rare.widgets.elide_label import ElideLabel
from rare.widgets.indicator_edit import PathEdit, IndicatorReasonsCommon

Expand Down
19 changes: 14 additions & 5 deletions rare/components/tabs/library/integrations/eos_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from logging import getLogger
from typing import Optional

from PySide6.QtCore import QRunnable, QObject, Signal, QThreadPool, Qt, Slot, QSize
from PySide6.QtCore import QRunnable, QObject, Signal, QThreadPool, Qt, Slot, QSize, QUrl
from PySide6.QtGui import QShowEvent
from PySide6.QtWidgets import (
QGroupBox,
Expand All @@ -20,9 +20,9 @@
from rare.lgndr.core import LegendaryCore
from rare.models.game import RareEosOverlay
from rare.shared import RareCore
from rare.ui.components.tabs.games.integrations.eos_widget import Ui_EosWidget
from rare.ui.components.tabs.library.integrations.eos_widget import Ui_EosWidget
from rare.utils import config_helper as config
from rare.utils.misc import qta_icon
from rare.utils.misc import qta_icon, style_hyperlink
from rare.widgets.elide_label import ElideLabel

logger = getLogger("EpicOverlay")
Expand Down Expand Up @@ -175,6 +175,7 @@ def __init__(self, parent=None):
self.ui.uninstall_button.setIcon(qta_icon("ri.uninstall-line"))

self.installed_path_label = ElideLabel(parent=self)
self.installed_path_label.setOpenExternalLinks(True)
self.installed_version_label = ElideLabel(parent=self)

self.ui.info_label_layout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.installed_version_label)
Expand All @@ -195,7 +196,11 @@ def __init__(self, parent=None):

if self.overlay.is_installed: # installed
self.installed_version_label.setText(f"<b>{self.overlay.version}</b>")
self.installed_path_label.setText(os.path.normpath(self.overlay.install_path))
self.installed_path_label.setText(
style_hyperlink(
QUrl.fromLocalFile(self.overlay.install_path).toString(), self.overlay.install_path
)
)
self.ui.overlay_stack.setCurrentWidget(self.ui.info_page)
else:
self.ui.overlay_stack.setCurrentWidget(self.ui.install_page)
Expand Down Expand Up @@ -261,7 +266,11 @@ def install_finished(self):
return
self.ui.overlay_stack.setCurrentWidget(self.ui.info_page)
self.installed_version_label.setText(f"<b>{self.overlay.version}</b>")
self.installed_path_label.setText(self.overlay.install_path)
self.installed_path_label.setText(
style_hyperlink(
QUrl.fromLocalFile(self.overlay.install_path).toString(), self.overlay.install_path
)
)
self.ui.update_button.setEnabled(False)

@Slot()
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/library/integrations/import_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from rare.lgndr.glue.arguments import LgndrImportGameArgs
from rare.lgndr.glue.monkeys import LgndrIndirectStatus, get_boolean_choice_factory
from rare.shared import RareCore
from rare.ui.components.tabs.games.integrations.import_group import Ui_ImportGroup
from rare.ui.components.tabs.library.integrations.import_group import Ui_ImportGroup
from rare.widgets.elide_label import ElideLabel
from rare.widgets.indicator_edit import IndicatorLineEdit, IndicatorReasonsCommon, PathEdit

Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/rare.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def on_view_combo_changed(self, index: int):

@Slot()
def open_directory(self):
QDesktopServices.openUrl(QUrl(f"file://{log_dir()}"))
QDesktopServices.openUrl(QUrl.fromLocalFile(log_dir()))

@Slot()
def save_window_size(self):
Expand Down
Loading
Loading