1
0
Fork 0
mirror of synced 2024-05-18 11:32:50 +12:00

Dialogs: Re-implement all dialogs on top of a few common super-classes

Also add a dialog to select optional downloads before verifying
and refactor the move widget into a full-fledged dialog.

To keep dialogs in a common format and allow them to share the same
properties, three classes of dialogs have been implemented inheriting from
each other.

The classes are `BaseDialog` -> `ButtonDialog` -> `ActionDialog`

* Basedialog: is the basis of all dialogs and is responsible for
rejecting close requests from the window manager and the keyboard.
It also restricts access to `exec()` and `exec_()` because they are harmful.
It serves as the basis of Launch and Login dialogs

* ButtonDialog: is offering buttons for accepting or rejecting the presented
option. It implements its own buttons and exposes abstract methods to
implement handling in them. It restricts access to `close()` because these
dialogs should always product a result.
It is the basis of Uninstall, Selective dialogs.

* ActionDialog: in addition to the ButtonDialog, it offers an action buttom
with to validate the form or to make the dialog unable to close. It serves
as the basis of Install and Move dialogs.

Accordingly all dialogs in Rare have been updated to use these classes.
This commit is contained in:
loathingKernel 2023-12-19 20:53:21 +02:00
parent cd1743cb92
commit 0ea4b1a824
6 changed files with 5 additions and 6 deletions

View file

@ -122,7 +122,7 @@ class CloudSaves(QWidget, SideTabContents):
except Exception as e:
logger.warning(str(e))
resolver = WineSavePathResolver(self.core, self.rgame)
if not resolver.environment.get("WINEPREFIX"):
if not resolver.environ.get("WINEPREFIX"):
del resolver
self.cloud_save_path_edit.setText("")
QMessageBox.warning(self, "Warning", "No wine prefix selected. Please set it in settings")

View file

@ -46,7 +46,7 @@ class LaunchSettingsBase(QGroupBox):
prelaunch_layout.addWidget(self.prelaunch_check)
self.main_layout = QFormLayout(self)
self.main_layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
self.main_layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
self.main_layout.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter)
self.main_layout.setFormAlignment(Qt.AlignLeading | Qt.AlignTop)

View file

@ -119,7 +119,7 @@ class OverlaySettings(QGroupBox):
@abstractmethod
def set_activation_state(self, state: ActivationStates):
raise NotImplemented
raise NotImplementedError
def update_settings(self):

View file

@ -40,7 +40,7 @@ class ProtonSettings(QGroupBox):
layout = QFormLayout(self)
layout.addRow(self.tr("Proton tool"), self.tool_combo)
layout.addRow(self.tr("Compat data"), self.tool_prefix)
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
layout.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter)
layout.setFormAlignment(Qt.AlignLeading | Qt.AlignTop)

View file

@ -46,7 +46,7 @@ class WineSettings(QGroupBox):
layout = QFormLayout(self)
layout.addRow(self.tr("Prefix"), self.wine_prefix)
layout.addRow(self.tr("Executable"), self.wine_exec)
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
layout.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter)
layout.setFormAlignment(Qt.AlignLeading | Qt.AlignTop)

View file

@ -1,4 +1,3 @@
import platform
from typing import Union
from PyQt5.QtCore import QProcessEnvironment, pyqtSignal, QSize, Qt