1
0
Fork 0
mirror of synced 2024-06-03 03:04:42 +12:00

Dialogs: Homogenize dialog titles

This commit is contained in:
loathingKernel 2023-02-18 19:36:49 +02:00
parent e6c703f873
commit 4ef73b48ef
6 changed files with 32 additions and 20 deletions

View file

@ -2,10 +2,10 @@ import os
import platform as pf
from typing import Tuple, List, Union, Optional
from PyQt5.QtCore import Qt, QThreadPool, QSettings
from PyQt5.QtCore import Qt, QThreadPool, QSettings, QCoreApplication
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtGui import QCloseEvent, QKeyEvent
from PyQt5.QtWidgets import QDialog, QFileDialog, QCheckBox, QLayout, QWidget, QVBoxLayout, QApplication
from PyQt5.QtWidgets import QDialog, QFileDialog, QCheckBox, QLayout, QWidget, QVBoxLayout
from legendary.utils.selective_dl import get_sdl_appname
from rare.models.game import RareGame
@ -68,7 +68,7 @@ class InstallDialog(QDialog):
else:
header = self.tr("Install")
self.ui.install_dialog_label.setText(f'<h3>{header} "{self.rgame.app_title}"</h3>')
self.setWindowTitle(f'{QApplication.instance().applicationName()} - {header} "{self.rgame.app_title}"')
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(

View file

@ -1,4 +1,4 @@
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QCoreApplication
from PyQt5.QtWidgets import (
QHBoxLayout,
QPushButton,
@ -12,11 +12,11 @@ from rare.widgets.indicator_edit import PathEdit
class PathInputDialog(QDialog):
def __init__(self, title_text, text, path="Select Directory"):
super().__init__()
def __init__(self, title_text, text, path="Select Directory", parent=None):
super(PathInputDialog, self).__init__(parent=parent)
self.path = ""
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowTitle(title_text)
self.setWindowTitle(f'{title_text} - {QCoreApplication.instance().applicationName()}')
self.info_label = QLabel(text)
self.info_label.setWordWrap(True)

View file

@ -1,4 +1,4 @@
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtCore import Qt, pyqtSignal, QCoreApplication
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtWidgets import (
QDialog,
@ -7,7 +7,6 @@ from PyQt5.QtWidgets import (
QCheckBox,
QHBoxLayout,
QPushButton,
QApplication,
)
from legendary.utils.selective_dl import get_sdl_appname
@ -23,7 +22,8 @@ class UninstallDialog(QDialog):
super(UninstallDialog, self).__init__(parent=parent)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint)
self.setWindowTitle(f'{QApplication.instance().applicationName()} - Uninstall "{rgame.app_title}"')
header = self.tr("Uninstall")
self.setWindowTitle(f'{header} "{rgame.app_title}" - {QCoreApplication.instance().applicationName()}')
self.info_text = QLabel(
self.tr("Do you really want to uninstall <b>{}</b>?").format(rgame.app_title)
)

View file

@ -3,17 +3,26 @@ import shutil
from logging import getLogger
from typing import Dict, List
from PyQt5.QtCore import pyqtSignal, QSettings, QSize, Qt, QMimeData, pyqtSlot
from PyQt5.QtCore import pyqtSignal, QSettings, QSize, Qt, QMimeData, pyqtSlot, QCoreApplication
from PyQt5.QtGui import QDrag, QDropEvent, QDragEnterEvent, QDragMoveEvent, QFont
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QInputDialog, QFrame, QMessageBox, QSizePolicy, \
QWidget, QScrollArea
from PyQt5.QtWidgets import (
QHBoxLayout,
QLabel,
QPushButton,
QInputDialog,
QFrame,
QMessageBox,
QSizePolicy,
QWidget,
QScrollArea,
)
from rare import shared
from rare.shared import RareCore
from rare.ui.components.tabs.settings.widgets.wrapper import Ui_WrapperSettings
from rare.utils import config_helper
from rare.utils.misc import icon
logger = getLogger("Wrapper Settings")
logger = getLogger("WrapperSettings")
extra_wrapper_regex = {
"proton": "\".*proton\" run", # proton
@ -85,7 +94,7 @@ class WrapperSettings(QWidget, Ui_WrapperSettings):
self.wrapper_scroll.setWidget(self.scroll_content)
self.widget_stack.insertWidget(0, self.wrapper_scroll)
self.core = shared.LegendaryCoreSingleton()
self.core = RareCore.instance().core()
self.add_button.clicked.connect(self.add_button_pressed)
self.settings = QSettings()
@ -136,7 +145,10 @@ class WrapperSettings(QWidget, Ui_WrapperSettings):
return data
def add_button_pressed(self):
wrapper, done = QInputDialog.getText(self, "Input Dialog", self.tr("Insert name of wrapper"))
header = self.tr("Add wrapper")
wrapper, done = QInputDialog.getText(
self, f"{header} - {QCoreApplication.instance().applicationName()}", self.tr("Insert wrapper executable")
)
if not done:
return
self.add_wrapper(wrapper)

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'rare/ui/components/tabs/settings/widgets/wrapper.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
@ -46,7 +46,7 @@ class Ui_WrapperSettings(object):
def retranslateUi(self, WrapperSettings):
_translate = QtCore.QCoreApplication.translate
self.no_wrapper_label.setText(_translate("WrapperSettings", "No wrapper added"))
self.add_button.setText(_translate("WrapperSettings", "Add Wrapper"))
self.add_button.setText(_translate("WrapperSettings", "Add wrapper"))
if __name__ == "__main__":

View file

@ -65,7 +65,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Add Wrapper</string>
<string>Add wrapper</string>
</property>
</widget>
</item>