Skip to content

Commit

Permalink
Merge pull request #403 from loathingKernel/develop
Browse files Browse the repository at this point in the history
RareLauncher: Fix wrong arguments in pre-launch command `QProcess.start()`
  • Loading branch information
loathingKernel authored May 17, 2024
2 parents fb736fa + 9b476af commit 4dea963
Show file tree
Hide file tree
Showing 18 changed files with 233 additions and 222 deletions.
5 changes: 4 additions & 1 deletion rare/commands/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def prepare_launch(self, args: InitArgs) -> Optional[LaunchArgs]:
proc = get_configured_process()
proc.setProcessEnvironment(launch_args.environment)
self.signals.started_pre_launch_command.emit()
proc.start(launch_args.pre_launch_command[0], launch_args.pre_launch_command[1:])
pre_launch_command = launch_args.pre_launch_command.split()
# self.logger.debug("Executing prelaunch command %s, %s", pre_launch_command[0], pre_launch_command[1:])
proc.start(pre_launch_command[0], pre_launch_command[1:])
if launch_args.pre_launch_wait:
proc.waitForFinished(-1)
return launch_args
Expand Down Expand Up @@ -310,6 +312,7 @@ def launch_game(self, args: LaunchArgs):
print(args.executable, " ".join(args.arguments))
self.stop()
return
# self.logger.debug("Executing prelaunch command %s, %s", args.executable, args.arguments)
self.game_process.start(args.executable, args.arguments)

def error_occurred(self, error_str: str):
Expand Down
30 changes: 17 additions & 13 deletions rare/components/tabs/games/game_info/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from rare.shared import LegendaryCoreSingleton, GlobalSignalsSingleton, ArgumentsSingleton
from rare.utils.json_formatter import QJsonModel
from rare.widgets.side_tab import SideTabWidget, SideTabContents
from .game_dlc import GameDlc
from .game_info import GameInfo
from .game_settings import GameSettings
from .dlcs import GameDlcs
from .details import GameDetails
from .settings import GameSettings
from .cloud_saves import CloudSaves


Expand All @@ -24,45 +24,48 @@ def __init__(self, parent=None):
self.signals = GlobalSignalsSingleton()
self.args = ArgumentsSingleton()

self.info_tab = GameInfo(self)
self.info_tab.import_clicked.connect(self.import_clicked)
self.info_index = self.addTab(self.info_tab, self.tr("Information"))
self.details_tab = GameDetails(self)
self.details_tab.import_clicked.connect(self.import_clicked)
self.details_index = self.addTab(self.details_tab, self.tr("Information"))

self.settings_tab = GameSettings(self)
self.settings_index = self.addTab(self.settings_tab, self.tr("Settings"))

self.cloud_saves_tab = CloudSaves(self)
self.cloud_saves_index = self.addTab(self.cloud_saves_tab, self.tr("Cloud Saves"))

self.dlc_tab = GameDlc(self)
self.dlc_index = self.addTab(self.dlc_tab, self.tr("Downloadable Content"))
self.dlcs_tab = GameDlcs(self)
self.dlcs_index = self.addTab(self.dlcs_tab, self.tr("Downloadable Content"))

# FIXME: Hiding didn't work, so don't add these tabs in normal mode. Fix this properly later
if self.args.debug:
self.game_meta_view = GameMetadataView(self)
self.game_meta_index = self.addTab(self.game_meta_view, self.tr("Game Metadata"))
self.igame_meta_view = GameMetadataView(self)
self.igame_meta_index = self.addTab(self.igame_meta_view, self.tr("InstalledGame Metadata"))
self.rgame_meta_view = GameMetadataView(self)
self.rgame_meta_index = self.addTab(self.rgame_meta_view, self.tr("RareGame Metadata"))

self.setCurrentIndex(self.info_index)
self.setCurrentIndex(self.details_index)

def update_game(self, rgame: RareGame):
self.info_tab.update_game(rgame)
self.details_tab.update_game(rgame)

self.settings_tab.load_settings(rgame)
self.settings_tab.setEnabled(rgame.is_installed or rgame.is_origin)

self.dlc_tab.update_dlcs(rgame)
self.dlc_tab.setEnabled(rgame.is_installed and bool(rgame.owned_dlcs))
self.dlcs_tab.update_dlcs(rgame)
self.dlcs_tab.setEnabled(rgame.is_installed and bool(rgame.owned_dlcs))

self.cloud_saves_tab.update_game(rgame)
# self.cloud_saves_tab.setEnabled(rgame.game.supports_cloud_saves or rgame.game.supports_mac_cloud_saves)

if self.args.debug:
self.game_meta_view.update_game(rgame, rgame.game)
self.igame_meta_view.update_game(rgame, rgame.igame)
self.rgame_meta_view.update_game(rgame, rgame.metadata)

self.setCurrentIndex(self.info_index)
self.setCurrentIndex(self.details_index)

def keyPressEvent(self, a0: QKeyEvent):
if a0.key() == Qt.Key_Escape:
Expand All @@ -75,6 +78,7 @@ def __init__(self, parent=None):
self.implements_scrollarea = True
self.setColumnWidth(0, 300)
self.setWordWrap(True)
self.setEditTriggers(QTreeView.NoEditTriggers)
self.model = QJsonModel()
self.setModel(self.model)
self.rgame: Optional[RareGame] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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.game_info import Ui_GameInfo
from rare.ui.components.tabs.games.game_info.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 All @@ -28,13 +28,13 @@
logger = getLogger("GameInfo")


class GameInfo(QWidget, SideTabContents):
class GameDetails(QWidget, SideTabContents):
# str: app_name
import_clicked = pyqtSignal(str)

def __init__(self, parent=None):
super(GameInfo, self).__init__(parent=parent)
self.ui = Ui_GameInfo()
super(GameDetails, self).__init__(parent=parent)
self.ui = Ui_GameDetails()
self.ui.setupUi(self)
# lk: set object names for CSS properties
self.ui.install_button.setObjectName("InstallButton")
Expand Down
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.game_dlc import Ui_GameDlc
from rare.ui.components.tabs.games.game_info.game_dlc_widget import Ui_GameDlcWidget
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.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 Expand Up @@ -98,12 +98,12 @@ def install_dlc(self):
self.rdlc.install()


class GameDlc(QToolBox, SideTabContents):
class GameDlcs(QToolBox, SideTabContents):

def __init__(self, parent=None):
super(GameDlc, self).__init__(parent=parent)
super(GameDlcs, self).__init__(parent=parent)
self.implements_scrollarea = True
self.ui = Ui_GameDlc()
self.ui = Ui_GameDlcs()
self.ui.setupUi(self)
self.core = LegendaryCoreSingleton()
self.signals = GlobalSignalsSingleton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

if pf.system() != "Windows":
from rare.components.tabs.settings.widgets.wine import WineSettings

if pf.system() in {"Linux", "FreeBSD"}:
from rare.components.tabs.settings.widgets.proton import ProtonSettings
from rare.components.tabs.settings.widgets.overlay import MangoHudSettings
if pf.system() in {"Linux", "FreeBSD"}:
from rare.components.tabs.settings.widgets.proton import ProtonSettings
from rare.components.tabs.settings.widgets.overlay import MangoHudSettings

logger = getLogger("GameSettings")

Expand Down Expand Up @@ -140,21 +139,18 @@ def load_settings(self, rgame: RareGame):


if pf.system() != "Windows":

class GameWineSettings(WineSettings):
def load_settings(self, app_name):
self.app_name = app_name

if pf.system() in {"Linux", "FreeBSD"}:
class GameProtonSettings(ProtonSettings):
def load_settings(self, app_name: str):
self.app_name = app_name

if pf.system() in {"Linux", "FreeBSD"}:

class GameProtonSettings(ProtonSettings):
def load_settings(self, app_name: str):
self.app_name = app_name

class GameMangoHudSettings(MangoHudSettings):
def load_settings(self, app_name: str):
self.app_name = app_name
class GameMangoHudSettings(MangoHudSettings):
def load_settings(self, app_name: str):
self.app_name = app_name


class GameDxvkSettings(DxvkSettings):
Expand All @@ -169,18 +165,19 @@ def load_settings(self, app_name):

class GameSettings(GameSettingsBase):
def __init__(self, parent=None):
if pf.system() in {"Linux", "FreeBSD"}:
super(GameSettings, self).__init__(
GameLaunchSettings, GameDxvkSettings, GameEnvVars,
GameWineSettings, GameProtonSettings, GameMangoHudSettings,
parent=parent
)
elif pf.system() != "Windows":
super(GameSettings, self).__init__(
GameLaunchSettings, GameDxvkSettings, GameEnvVars,
GameWineSettings,
parent=parent
)
if pf.system() != "Windows":
if pf.system() in {"Linux", "FreeBSD"}:
super(GameSettings, self).__init__(
GameLaunchSettings, GameDxvkSettings, GameEnvVars,
GameWineSettings, GameProtonSettings, GameMangoHudSettings,
parent=parent
)
else:
super(GameSettings, self).__init__(
GameLaunchSettings, GameDxvkSettings, GameEnvVars,
GameWineSettings,
parent=parent
)
else:
super(GameSettings, self).__init__(
GameLaunchSettings, GameDxvkSettings, GameEnvVars,
Expand All @@ -193,8 +190,8 @@ def load_settings(self, rgame: RareGame):
self.launch.load_settings(rgame)
if pf.system() != "Windows":
self.wine.load_settings(rgame.app_name)
if pf.system() in {"Linux", "FreeBSD"}:
self.proton_tool.load_settings(rgame.app_name)
self.mangohud.load_settings(rgame.app_name)
if pf.system() in {"Linux", "FreeBSD"}:
self.proton_tool.load_settings(rgame.app_name)
self.mangohud.load_settings(rgame.app_name)
self.dxvk.load_settings(rgame.app_name)
self.env_vars.load_settings(rgame.app_name)
1 change: 0 additions & 1 deletion rare/components/tabs/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .landing import LandingWidget, LandingPage
from .search import SearchPage
from .store_api import StoreAPI
from .widgets.details import DetailsWidget
from .wishlist import WishlistPage


Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/store/landing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rare.widgets.side_tab import SideTabContents
from rare.widgets.sliding_stack import SlidingStackedWidget
from .store_api import StoreAPI
from .widgets.details import DetailsWidget
from .widgets.details import StoreDetailsWidget
from .widgets.groups import StoreGroup
from .widgets.items import StoreItemWidget

Expand All @@ -44,7 +44,7 @@ def __init__(self, store_api: StoreAPI, parent=None):
self.landing_scroll.widget().setAutoFillBackground(False)
self.landing_scroll.viewport().setAutoFillBackground(False)

self.details_widget = DetailsWidget([], store_api, parent=self)
self.details_widget = StoreDetailsWidget([], store_api, parent=self)
self.details_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.details_widget.set_title.connect(self.set_title)
self.details_widget.back_clicked.connect(self.show_main)
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/store/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .constants import Constants
from .results import ResultsWidget
from .store_api import StoreAPI
from .widgets.details import DetailsWidget
from .widgets.details import StoreDetailsWidget

logger = logging.getLogger("Shop")

Expand All @@ -35,7 +35,7 @@ def __init__(self, store_api: StoreAPI, parent=None):
self.search_widget.set_title.connect(self.set_title)
self.search_widget.show_details.connect(self.show_details)

self.details_widget = DetailsWidget([], store_api, parent=self)
self.details_widget = StoreDetailsWidget([], store_api, parent=self)
self.details_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.details_widget.set_title.connect(self.set_title)
self.details_widget.back_clicked.connect(self.show_main)
Expand Down
8 changes: 4 additions & 4 deletions rare/components/tabs/store/widgets/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from rare.components.tabs.store.api.models.response import CatalogOfferModel
from rare.components.tabs.store.store_api import StoreAPI
from rare.models.image import ImageSize
from rare.ui.components.tabs.store.details import Ui_DetailsWidget
from rare.ui.components.tabs.store.details import Ui_StoreDetailsWidget
from rare.utils.misc import qta_icon
from rare.widgets.elide_label import ElideLabel
from rare.widgets.side_tab import SideTabWidget, SideTabContents
Expand All @@ -24,15 +24,15 @@
logger = logging.getLogger("StoreDetails")


class DetailsWidget(QWidget, SideTabContents):
class StoreDetailsWidget(QWidget, SideTabContents):
back_clicked: pyqtSignal = pyqtSignal()

# TODO Design
def __init__(self, installed: List, store_api: StoreAPI, parent=None):
super(DetailsWidget, self).__init__(parent=parent)
super(StoreDetailsWidget, self).__init__(parent=parent)
self.implements_scrollarea = True

self.ui = Ui_DetailsWidget()
self.ui = Ui_StoreDetailsWidget()
self.ui.setupUi(self)
self.ui.main_layout.setContentsMargins(0, 0, 3, 0)

Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/store/wishlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from rare.widgets.sliding_stack import SlidingStackedWidget
from .api.models.response import WishlistItemModel, CatalogOfferModel
from .store_api import StoreAPI
from .widgets.details import DetailsWidget
from .widgets.details import StoreDetailsWidget
from .widgets.items import WishlistItemWidget


Expand All @@ -26,7 +26,7 @@ def __init__(self, api: StoreAPI, parent=None):
self.wishlist_widget.set_title.connect(self.set_title)
self.wishlist_widget.show_details.connect(self.show_details)

self.details_widget = DetailsWidget([], api, parent=self)
self.details_widget = StoreDetailsWidget([], api, parent=self)
self.details_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.details_widget.set_title.connect(self.set_title)
self.details_widget.back_clicked.connect(self.show_main)
Expand Down
Loading

0 comments on commit 4dea963

Please sign in to comment.