1
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
GeckoLoader/children_ui.py

201 lines
8.3 KiB
Python
Raw Normal View History

2020-11-06 19:22:08 +09:00
import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from fileutils import resource_path
class PrefWindow(QtWidgets.QDialog):
def __init__(self):
super().__init__(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint)
self.setup_ui()
def setup_ui(self):
self.setObjectName("Dialog")
self.setFixedSize(300, 120)
self.setModal(True)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(resource_path(os.path.join("bin", "icon.ico"))), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
#Buttonbox
self.buttonBox = QtWidgets.QDialogButtonBox(self)
self.buttonBox.setFixedSize(280, 30)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.formLayoutWidget = QtWidgets.QGridLayout(self)
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.comboBoxLayout = QtWidgets.QGridLayout()
self.comboBoxLayout.setVerticalSpacing(10)
self.comboBoxLayout.setObjectName("comboBoxLayout")
#qtstyle box
self.qtstyleSelect = QtWidgets.QComboBox()
self.qtstyleSelect.setObjectName("qtstyleSelect")
self.comboBoxLayout.addWidget(self.qtstyleSelect, 1, 1, 1, 1)
#qtstyle label
self.qtstyleLabel = QtWidgets.QLabel()
self.qtstyleLabel.setObjectName("qtstyleLabel")
self.comboBoxLayout.addWidget(self.qtstyleLabel, 1, 0, 1, 1)
#qtdark theme
self.qtdarkButton = QtWidgets.QCheckBox()
self.qtdarkButton.setObjectName("formalnaming")
self.qtdarkButton.setText("Dark Theme")
self.comboBoxLayout.addWidget(self.qtdarkButton, 2, 0, 1, 1)
self.formLayoutWidget.addLayout(self.comboBoxLayout, 0, 0, 1, 1)
self.formLayoutWidget.addWidget(self.buttonBox, 1, 0, 1, 1)
self.retranslateUi()
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
QtCore.QMetaObject.connectSlotsByName(self)
def retranslateUi(self):
self.setWindowTitle(QtWidgets.QApplication.translate("Dialog", "Preferences", None))
self.qtstyleLabel.setText(QtWidgets.QApplication.translate("Dialog", "GUI Style:", None))
class SettingsWindow(QtWidgets.QDialog):
def __init__(self):
super().__init__(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint)
self.setup_ui()
def setup_ui(self):
self.setObjectName("Dialog")
if sys.platform == "win32":
self.setFixedSize(300, 210)
else:
self.setFixedSize(370, 210)
2020-11-06 19:22:08 +09:00
self.setModal(True)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(resource_path(os.path.join("bin", "icon.ico"))), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
#Buttonbox
self.buttonBox = QtWidgets.QDialogButtonBox(self)
if sys.platform == "win32":
self.buttonBox.setFixedSize(280, 30)
else:
self.buttonBox.setFixedSize(350, 30)
2020-11-06 19:22:08 +09:00
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.formLayoutWidget = QtWidgets.QGridLayout(self)
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.comboBoxLayout = QtWidgets.QGridLayout()
self.comboBoxLayout.setVerticalSpacing(10)
self.comboBoxLayout.setObjectName("comboBoxLayout")
#protect codes
self.protectCodes = QtWidgets.QCheckBox()
self.protectCodes.setObjectName("protectCodes")
self.protectCodes.setText("Protect Game (Prevent user codes)")
self.comboBoxLayout.addWidget(self.protectCodes, 1, 0, 1, 1)
#encrypt codes
self.encryptCodes = QtWidgets.QCheckBox()
self.encryptCodes.setObjectName("encryptCodes")
self.encryptCodes.setText("Encrypt codes")
self.comboBoxLayout.addWidget(self.encryptCodes, 2, 0, 1, 1)
#Codehook Address Label
self.codehookLabel = QtWidgets.QLabel()
self.codehookLabel.setObjectName("codehookLabel")
self.comboBoxLayout.addWidget(self.codehookLabel, 3, 0, 1, 1)
#Codehook Address Textbox
self.codehookLineEdit = QtWidgets.QLineEdit()
self.codehookLineEdit.setEnabled(False)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.codehookLineEdit.sizePolicy().hasHeightForWidth())
self.codehookLineEdit.setSizePolicy(sizePolicy)
self.codehookLineEdit.setMinimumSize(QtCore.QSize(79, 23))
self.codehookLineEdit.setMaximumSize(QtCore.QSize(79, 23))
font = QtGui.QFont()
font.setFamily("Consolas")
font.setPointSize(12)
font.setWeight(42)
self.codehookLineEdit.setFont(font)
self.codehookLineEdit.setText("")
self.codehookLineEdit.setMaxLength(8)
self.codehookLineEdit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.codehookLineEdit.setObjectName("codehookLineEdit")
self.comboBoxLayout.addWidget(self.codehookLineEdit, 3, 1, 1, 1)
#kernelHook Address Label
self.kernelHookLabel = QtWidgets.QLabel()
self.kernelHookLabel.setObjectName("kernelHookLabel")
self.comboBoxLayout.addWidget(self.kernelHookLabel, 4, 0, 1, 1)
#kernelHook Address Textbox
self.kernelHookLineEdit = QtWidgets.QLineEdit()
self.kernelHookLineEdit.setEnabled(False)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.kernelHookLineEdit.sizePolicy().hasHeightForWidth())
self.kernelHookLineEdit.setSizePolicy(sizePolicy)
self.kernelHookLineEdit.setMinimumSize(QtCore.QSize(79, 23))
self.kernelHookLineEdit.setMaximumSize(QtCore.QSize(79, 23))
font = QtGui.QFont()
font.setFamily("Consolas")
font.setPointSize(12)
font.setWeight(42)
self.kernelHookLineEdit.setFont(font)
self.kernelHookLineEdit.setText("")
self.kernelHookLineEdit.setMaxLength(8)
self.kernelHookLineEdit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.kernelHookLineEdit.setObjectName("kernelHookLineEdit")
self.comboBoxLayout.addWidget(self.kernelHookLineEdit, 4, 1, 1, 1)
#verbosity label
self.verbosityLabel = QtWidgets.QLabel()
self.verbosityLabel.setObjectName("verbosityLabel")
self.comboBoxLayout.addWidget(self.verbosityLabel, 5, 0, 1, 1)
#verbosity box
self.verbositySelect = QtWidgets.QComboBox()
self.verbositySelect.addItems(["1", "2", "3", "0"])
self.verbositySelect.setObjectName("verbositySelect")
self.comboBoxLayout.addWidget(self.verbositySelect, 5, 1, 1, 1)
self.formLayoutWidget.addLayout(self.comboBoxLayout, 0, 0, 1, 1)
self.formLayoutWidget.addWidget(self.buttonBox, 1, 0, 1, 1)
self.set_edit_fields()
self.retranslateUi()
self.buttonBox.accepted.connect(self.accept)
QtCore.QMetaObject.connectSlotsByName(self)
def set_edit_fields(self):
self.protectCodes.setEnabled(True)
self.encryptCodes.setEnabled(True)
self.codehookLineEdit.setEnabled(True)
self.kernelHookLineEdit.setEnabled(True)
self.verbositySelect.setEnabled(True)
def retranslateUi(self):
self.setWindowTitle(QtWidgets.QApplication.translate("Dialog", "Advanced Settings", None))
self.codehookLabel.setText(QtWidgets.QApplication.translate("Dialog", "Codehook Address:", None))
self.kernelHookLabel.setText(QtWidgets.QApplication.translate("Dialog", "Kernel Init Address:", None))
self.verbosityLabel.setText(QtWidgets.QApplication.translate("Dialog", "Verbosity:", None))