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

Wine/Proton/Wrappers #298

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
88b6e91
BrowserLogin: Add dedicated application mode to Rare for the webview …
loathingKernel Feb 2, 2024
9eb5f2c
Dialogs: Align contents on center when the WM doesn't respect the dia…
loathingKernel Feb 2, 2024
b67c391
Chore: fix argument name in `keyPressEvent`
loathingKernel Feb 3, 2024
07b5d38
SideTabContainer: Align top by default
loathingKernel Feb 3, 2024
36ad33b
SteamGrades: Return the Steam game ID with the grade and store it.
loathingKernel Sep 15, 2023
7a5bb0b
RareGame: Use None for unset steam appid.
loathingKernel Sep 15, 2023
af6d7c5
Various WIP
loathingKernel Sep 19, 2023
cd1743c
GameSettings: Re-strucure settings widgets
loathingKernel Dec 18, 2023
0ea4b1a
Dialogs: Re-implement all dialogs on top of a few common super-classes
loathingKernel Dec 19, 2023
0ea29bc
HeadBar: Use int as the data type for the combo boxes and improve checks
loathingKernel Dec 23, 2023
8bde2c2
Rare: Import platform specific modules only on the relevant platforms
loathingKernel Dec 23, 2023
17066f9
Rare: cherry-pick some of sourcery suggestions
loathingKernel Dec 24, 2023
49ad79e
Rare: be more explicit when checking for running platform
loathingKernel Dec 25, 2023
98213d1
HeadBar: Return LibraryFilter/Order object from `current_filter/order…
loathingKernel Dec 31, 2023
bb5b0f1
Overlays: Update title strings
loathingKernel Dec 31, 2023
aadf795
Overlays: Reorder method assignments
loathingKernel Jan 11, 2024
f33c89a
Library: Fix filtering while searching for games
loathingKernel Jan 13, 2024
a15a2fb
OverlaySettings: Refactor to be more event-driven complaint
loathingKernel Jan 18, 2024
1cfcb78
EnvVars: Add `MANGOHUD` as read-only
loathingKernel Jan 20, 2024
a104cf4
Wrappers: Add WrapperDialog based on ButtonDialog for consistent look…
loathingKernel Jan 20, 2024
8df9b08
WrapperDialog: Use subtitle
loathingKernel Jan 20, 2024
e8e4ed7
Remove some unused imports
loathingKernel Jan 20, 2024
fb91a55
Dialogs: Use consistent dialog titles for the launcher's dialogs
loathingKernel Jan 21, 2024
9403005
Wrappers: Add a combobox with existing wrappers for the user to choos…
loathingKernel Jan 22, 2024
c5c581e
Workflows: Use a matrix for upload job
loathingKernel Jan 22, 2024
284543a
Rare: Decouple Rare's locale from legendary's
loathingKernel Jan 23, 2024
f088fc9
RareApp: Fix wrong logging qualifier
loathingKernel Jan 23, 2024
8a3bdbd
Rare: Improve translation handling
loathingKernel Jan 24, 2024
2d3a8de
Rare: Update some strings
loathingKernel Jan 24, 2024
b84686a
Overlay: Clean old code
loathingKernel Jan 24, 2024
52d2ca7
Config: Re-arrange arguments to match the rest of the function signat…
loathingKernel Jan 27, 2024
3313f15
WineResolver: Fix proton command invocation
loathingKernel Jan 27, 2024
4f4689e
RareSettings: Add global options for style sheets and color schemes
loathingKernel Jan 28, 2024
7c3d5dc
Library: Clean up how changing views works
loathingKernel Jan 28, 2024
b1e537a
Library: Initialize only one view on each run
loathingKernel Jan 28, 2024
6be9eec
Rare: Offline mode kinda works again
loathingKernel Jan 28, 2024
b7b1bc6
RareSettings: Use QDesktopServices to open the file manager for us
loathingKernel Feb 2, 2024
2f84a50
Launcher: Color output to STDERR as a slight red
loathingKernel Feb 5, 2024
6a747ce
Rare: Move sub-commands implementations in the `commands` subfolder
loathingKernel Feb 5, 2024
3fe02e5
GameProcess: Reset tried connections after accepting the dialog.
loathingKernel Jan 27, 2024
582b83c
WIP
loathingKernel Feb 12, 2024
e776ed4
WineSettings: Order executable before prefix
loathingKernel Feb 16, 2024
6db35d1
RareApp: Call quit on instance
loathingKernel Feb 16, 2024
5359b73
Settings: Use membership instead of double inheritance
loathingKernel Feb 16, 2024
db3cf68
LaunchSettings: Work around path separator difference on Windows
loathingKernel Feb 17, 2024
68ea7b9
Merge branch 'develop' of github.com:loathingKernel/Rare into develop
loathingKernel Feb 17, 2024
d16b3d5
Runners: rename proton to steam
loathingKernel Feb 18, 2024
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
37 changes: 16 additions & 21 deletions .github/workflows/job_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,34 @@ on:
type: string
name2:
type: string
default: ""
file2:
type: string
default: ""

jobs:
release:
name: Upload
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: ${{ inputs.name1 }}
file: ${{ inputs.file1 }}
- name: ${{ inputs.name2 }}
file: ${{ inputs.file2 }}
steps:

- name: Download ${{ inputs.name1 }} artifact
- name: Download ${{ matrix.name }} from artifact
uses: actions/download-artifact@v3
if: ${{ matrix.name != '' }}
with:
name: ${{ inputs.name1 }}
- name: Upload ${{ inputs.name1 }} to release
name: ${{ matrix.name }}
- name: Upload ${{ matrix.name }} to release
uses: svenstaro/upload-release-action@v2
if: ${{ matrix.name != '' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ inputs.file1 }}
asset_name: ${{ inputs.name1 }}
file: ${{ matrix.file }}
asset_name: ${{ matrix.name }}
tag: ${{ inputs.version }}
overwrite: true

- name: Download ${{ inputs.name2 }} artifact
uses: actions/download-artifact@v3
if: ${{ inputs.name2 != '' }}
with:
name: ${{ inputs.name2 }}
- name: Upload ${{ inputs.name2 }} to release
uses: svenstaro/upload-release-action@v2
if: ${{ inputs.name2 != '' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ inputs.file2 }}
asset_name: ${{ inputs.name2 }}
tag: ${{ inputs.version }}
overwrite: true
6 changes: 3 additions & 3 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
host = https://www.transifex.com

[o:rare-1:p:rare:r:placeholder-ts]
file_filter = rare/resources/languages/<lang>.ts
source_file = rare/resources/languages/translation_source.ts
source_lang = en_US
file_filter = rare/resources/languages/rare_<lang>.ts
source_file = rare/resources/languages/source.ts
source_lang = en
type = QT
minimum_perc = 50

2 changes: 1 addition & 1 deletion misc/pip_upgrade_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from subprocess import call

for dist in pkg_resources.working_set:
call("python -m pip install --upgrade " + dist.project_name, shell=True)
call(f"python -m pip install --upgrade {dist.project_name}", shell=True)
5 changes: 4 additions & 1 deletion misc/py2ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
cwd="$(pwd)"
cd "$(dirname "$0")"/.. || exit

pylupdate5 -noobsolete $(find rare/ -iname "*.py") -ts rare/resources/languages/translation_source.ts
#py_files=$(find rare -iname "*.py" -not -path rare/ui)
#ui_files=$(find rare/ui -iname "*.ui")

pylupdate5 -noobsolete $(find rare/ -iname "*.py") -ts rare/resources/languages/source.ts

cd "$cwd" || exit
13 changes: 7 additions & 6 deletions rare/launcher/__init__.py → rare/commands/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from rare.lgndr.core import LegendaryCore
from rare.models.base_game import RareGameSlim
from rare.models.launcher import ErrorModel, Actions, FinishedModel, BaseModel, StateChangedModel
from rare.models.options import options
from rare.widgets.rare_app import RareApp, RareAppException
from .cloud_sync_dialog import CloudSyncDialog, CloudSyncDialogResult
from .console_dialog import ConsoleDialog
Expand Down Expand Up @@ -142,11 +143,11 @@ def __init__(self, args: InitArgs):
return
self.rgame = RareGameSlim(self.core, game)

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

if QSettings().value("show_console", False, bool):
self.console = ConsoleDialog()
if QSettings(self).value(*options.log_games):
self.console = ConsoleDialog(game.app_title)
self.console.show()

self.game_process.finished.connect(self.__process_finished)
Expand Down Expand Up @@ -294,10 +295,10 @@ def launch_game(self, args: LaunchArgs):
))
if self.rgame.app_name in DETACHED_APP_NAMES and platform.system() == "Windows":
self.game_process.deleteLater()
subprocess.Popen([args.executable] + args.arguments, cwd=args.working_directory,
env={i: args.environment.value(i) for i in args.environment.keys()})
if self.console:
self.console.log("Launching game 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.stop()
return
if self.args.dry_run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from rare.ui.components.tabs.games.game_info.cloud_sync_widget import Ui_CloudSyncWidget
from rare.utils.misc import icon
from rare.widgets.dialogs import ButtonDialog, dialog_title_game
from rare.widgets.dialogs import ButtonDialog, game_title

logger = getLogger("CloudSyncDialog")

Expand All @@ -28,9 +28,9 @@ class CloudSyncDialog(ButtonDialog):
def __init__(self, igame: InstalledGame, dt_local: datetime, dt_remote: datetime, parent=None):
super(CloudSyncDialog, self).__init__(parent=parent)
header = self.tr("Cloud saves for")
self.setWindowTitle(dialog_title_game(header, igame.title))
self.setWindowTitle(game_title(header, igame.title))

title_label = QLabel(f"<h4>{dialog_title_game(header, igame.title)}</h4>", self)
title_label = QLabel(f"<h4>{game_title(header, igame.title)}</h4>", self)

sync_widget = QWidget(self)
self.sync_ui = Ui_CloudSyncWidget()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import platform
from typing import Union

from PyQt5.QtCore import QProcessEnvironment, pyqtSignal, QSize, Qt
Expand All @@ -15,17 +14,20 @@
)

from rare.ui.launcher.console_env import Ui_ConsoleEnv
from rare.widgets.dialogs import dialog_title, game_title


class ConsoleDialog(QDialog):
term = pyqtSignal()
kill = pyqtSignal()
env: QProcessEnvironment

def __init__(self, parent=None):
def __init__(self, app_title: str, parent=None):
super(ConsoleDialog, self).__init__(parent=parent)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowTitle("Rare - Console")
self.setWindowTitle(
dialog_title(game_title(self.tr("Console"), app_title))
)
self.setGeometry(0, 0, 640, 480)
layout = QVBoxLayout()

Expand Down Expand Up @@ -62,7 +64,7 @@ def __init__(self, parent=None):

self.setLayout(layout)

self.env_variables = ConsoleEnv(self)
self.env_variables = ConsoleEnv(app_title, self)
self.env_variables.hide()

self.accept_close = False
Expand Down Expand Up @@ -140,11 +142,14 @@ def closeEvent(self, a0: QCloseEvent) -> None:

class ConsoleEnv(QDialog):

def __init__(self, parent=None):
def __init__(self, app_title: str, parent=None):
super(ConsoleEnv, self).__init__(parent=parent)
self.setAttribute(Qt.WA_DeleteOnClose, False)
self.ui = Ui_ConsoleEnv()
self.ui.setupUi(self)
self.setWindowTitle(
dialog_title(game_title(self.tr("Environment"), app_title))
)

def setTable(self, env: QProcessEnvironment):
self.ui.table.clearContents()
Expand All @@ -168,12 +173,12 @@ def __init__(self, parent=None):
self._cursor_output = self.textCursor()

def log(self, text):
html = f"<p style=\"color:#BBB;white-space:pre\">{text}</p>"
html = f"<p style=\"color:#aaa;white-space:pre\">{text}</p>"
self._cursor_output.insertHtml(html)
self.scroll_to_last_line()

def error(self, text):
html = f"<p style=\"color:#eee;white-space:pre\">{text}</p>"
html = f"<p style=\"color:#a33;white-space:pre\">{text}</p>"
self._cursor_output.insertHtml(html)
self.scroll_to_last_line()

Expand Down
File renamed without changes.
Empty file added rare/commands/reaper.py
Empty file.
13 changes: 13 additions & 0 deletions rare/commands/webview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys
from argparse import Namespace

from legendary.utils import webview_login


def launch(args: Namespace) -> int:
if webview_login.do_webview_login(
callback_code=sys.stdout.write, user_agent=f'EpicGamesLauncher/{args.egl_version}'
):
return 0
else:
return 1
5 changes: 3 additions & 2 deletions rare/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from PyQt5.QtWidgets import QApplication, QMessageBox
from requests import HTTPError

from rare.models.options import options
from rare.components.dialogs.launch_dialog import LaunchDialog
from rare.components.main_window import MainWindow
from rare.shared import RareCore
Expand Down Expand Up @@ -45,8 +46,8 @@ def __init__(self, args: Namespace):
self.signals = RareCore.instance().signals()
self.core = RareCore.instance().core()

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

# set Application name for settings
self.main_window: Optional[MainWindow] = None
Expand Down
6 changes: 3 additions & 3 deletions rare/components/dialogs/install_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from rare.ui.components.dialogs.install_dialog_advanced import Ui_InstallDialogAdvanced
from rare.utils.misc import format_size, icon
from rare.widgets.collapsible_widget import CollapsibleFrame
from rare.widgets.dialogs import ActionDialog, dialog_title_game
from rare.widgets.dialogs import ActionDialog, game_title
from rare.widgets.indicator_edit import PathEdit, IndicatorReasonsCommon
from rare.widgets.selective_widget import SelectiveWidget

Expand Down Expand Up @@ -74,8 +74,8 @@ def __init__(self, rgame: RareGame, options: InstallOptionsModel, parent=None):
elif options.reset_sdl:
header = self.tr("Modify")
bicon = icon("fa.gear")
self.setWindowTitle(dialog_title_game(header, rgame.app_title))
self.setSubtitle(dialog_title_game(header, rgame.app_title))
self.setWindowTitle(game_title(header, rgame.app_title))
self.setSubtitle(game_title(header, rgame.app_title))

install_widget = QWidget(self)
self.ui = Ui_InstallDialog()
Expand Down
20 changes: 17 additions & 3 deletions rare/components/dialogs/login/browser_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from logging import getLogger
from typing import Tuple

from PyQt5.QtCore import pyqtSignal, QUrl
from PyQt5.QtCore import pyqtSignal, QUrl, QProcess, pyqtSlot
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QFrame, qApp, QFormLayout, QLineEdit
from legendary.core import LegendaryCore
from legendary.utils import webview_login

from rare.lgndr.core import LegendaryCore
from rare.ui.components.dialogs.login.browser_login import Ui_BrowserLogin
from rare.utils.misc import icon
from rare.utils.paths import get_rare_executable
from rare.widgets.indicator_edit import IndicatorLineEdit, IndicatorReasonsCommon

logger = getLogger("BrowserLogin")
Expand Down Expand Up @@ -43,6 +44,7 @@ def __init__(self, core: LegendaryCore, parent=None):
self.ui.open_button.clicked.connect(self.open_browser)
self.sid_edit.textChanged.connect(self.changed.emit)

@pyqtSlot()
def copy_link(self):
clipboard = qApp.clipboard()
clipboard.setText(self.login_url)
Expand Down Expand Up @@ -79,12 +81,24 @@ def do_login(self):
except Exception as e:
logger.warning(e)

@pyqtSlot()
def open_browser(self):
if not webview_login.webview_available:
logger.warning("You don't have webengine installed, you will need to manually copy the authorizationCode.")
QDesktopServices.openUrl(QUrl(self.login_url))
else:
if webview_login.do_webview_login(callback_code=self.core.auth_ex_token):
cmd = get_rare_executable() + ["login", self.core.get_egl_version()]
proc = QProcess(self)
proc.start(cmd[0], cmd[1:])
proc.waitForFinished(-1)
out, err = (
proc.readAllStandardOutput().data().decode("utf-8", "ignore"),
proc.readAllStandardError().data().decode("utf-8", "ignore")
)
proc.deleteLater()

if out:
self.core.auth_ex_token(out)
logger.info("Successfully logged in as %s", {self.core.lgd.userdata['displayName']})
self.success.emit()
else:
Expand Down
8 changes: 4 additions & 4 deletions rare/components/dialogs/move_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from rare.models.game import RareGame
from rare.shared import RareCore
from rare.utils.misc import path_size, format_size, icon
from rare.widgets.dialogs import ActionDialog, dialog_title_game
from rare.widgets.dialogs import ActionDialog, game_title
from rare.widgets.elide_label import ElideLabel
from rare.widgets.indicator_edit import PathEdit, IndicatorReasons, IndicatorReasonsCommon

Expand All @@ -33,8 +33,8 @@ class MoveDialog(ActionDialog):
def __init__(self, rgame: RareGame, parent=None):
super(MoveDialog, self).__init__(parent=parent)
header = self.tr("Move")
self.setWindowTitle(dialog_title_game(header, rgame.app_title))
self.setSubtitle(dialog_title_game(header, rgame.app_title))
self.setWindowTitle(game_title(header, rgame.app_title))
self.setSubtitle(game_title(header, rgame.app_title))

self.rcore = RareCore.instance()
self.core = RareCore.instance().core()
Expand Down Expand Up @@ -135,7 +135,7 @@ def helper_func(reason: int) -> Tuple[bool, str, int]:
if not os.access(path, os.W_OK) or not os.access(self.rgame.install_path, os.W_OK):
return helper_func(MovePathEditReasons.NO_WRITE_PERM)

if src_path == dst_path or src_path == dst_install_path:
if src_path in {dst_path, dst_install_path}:
return helper_func(MovePathEditReasons.SAME_DIR)

if str(src_path) in str(dst_path):
Expand Down
8 changes: 4 additions & 4 deletions rare/components/dialogs/selective_dialog.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QLayout, QGroupBox
from PyQt5.QtWidgets import QVBoxLayout, QGroupBox

from rare.models.game import RareGame
from rare.models.install import SelectiveDownloadsModel
from rare.utils.misc import icon
from rare.widgets.dialogs import ButtonDialog, dialog_title_game
from rare.widgets.dialogs import ButtonDialog, game_title
from rare.widgets.selective_widget import SelectiveWidget


Expand All @@ -14,8 +14,8 @@ class SelectiveDialog(ButtonDialog):
def __init__(self, rgame: RareGame, parent=None):
super(SelectiveDialog, self).__init__(parent=parent)
header = self.tr("Optional downloads for")
self.setWindowTitle(dialog_title_game(header, rgame.app_title))
self.setSubtitle(dialog_title_game(header, rgame.app_title))
self.setWindowTitle(game_title(header, rgame.app_title))
self.setSubtitle(game_title(header, rgame.app_title))

self.rgame = rgame
self.selective_widget = SelectiveWidget(rgame, rgame.igame.platform, self)
Expand Down
6 changes: 3 additions & 3 deletions rare/components/dialogs/uninstall_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from rare.models.game import RareGame
from rare.models.install import UninstallOptionsModel
from rare.utils.misc import icon
from rare.widgets.dialogs import ButtonDialog, dialog_title_game
from rare.widgets.dialogs import ButtonDialog, game_title


class UninstallDialog(ButtonDialog):
Expand All @@ -16,8 +16,8 @@ class UninstallDialog(ButtonDialog):
def __init__(self, rgame: RareGame, options: UninstallOptionsModel, parent=None):
super(UninstallDialog, self).__init__(parent=parent)
header = self.tr("Uninstall")
self.setWindowTitle(dialog_title_game(header, rgame.app_title))
self.setSubtitle(dialog_title_game(header, rgame.app_title))
self.setWindowTitle(game_title(header, rgame.app_title))
self.setSubtitle(game_title(header, rgame.app_title))

self.keep_files = QCheckBox(self.tr("Keep files"))
self.keep_files.setChecked(bool(options.keep_files))
Expand Down
Loading
Loading