aboutsummaryrefslogtreecommitdiff
path: root/src/__main__.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-04-23 21:29:06 +0200
committerBotond Hende <nettingman@gmail.com>2024-04-23 21:29:06 +0200
commit8e110fe19f15185636952299fa4bdd8d9be310e9 (patch)
tree667ef93d850fd95e8ae167b35d5c2c54db393f27 /src/__main__.py
initial commitHEADmaster
Diffstat (limited to 'src/__main__.py')
-rw-r--r--src/__main__.py124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/__main__.py b/src/__main__.py
new file mode 100644
index 0000000..e641672
--- /dev/null
+++ b/src/__main__.py
@@ -0,0 +1,124 @@
+"""
+Maid RPG character generator
+'maid' by Wazul
+
+2017.06.08.
+"""
+import sys
+from PyQt5 import QtWidgets, QtGui, QtCore, Qt
+from .modules.maidWidget import CMaidWidget
+from .modules.helpWidget import CHelpWidget
+from .modules.masterWidget import CMasterWidget
+from .modules.butlerWidget import CButlerWidget
+from .modules.data_reader import MaidDataReader
+
+class ApplicationWindow(QtWidgets.QMainWindow):
+ """ Main window for the application. """
+ def __init__(self, data_reader):
+ QtWidgets.QMainWindow.__init__(self)
+ self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
+ self.setWindowTitle('RMG - MaidRPG random generator')
+
+ self.icon = QtGui.QIcon('icon.ico')
+ self.setWindowIcon(self.icon)
+
+ self.setTabPosition(QtCore.Qt.TopDockWidgetArea, QtWidgets.QTabWidget.North)
+
+ # self.setFixedWidth(550)
+ # self.setFixedHeight(650)
+
+ self.statusbarMessage = QtWidgets.QLabel("Version number 1.1 - 'maid' by Wazul (2017)")
+ self.statusBar().addWidget(self.statusbarMessage)
+
+
+ self.maidDock = QtWidgets.QDockWidget('Random maid')
+ self.maidDock.parent = self
+
+ self.maidDock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
+ titleWidget = QtWidgets.QWidget()
+ self.maidDock.setTitleBarWidget(titleWidget)
+
+ self.maidWidget = CMaidWidget(data_reader, self.maidDock)
+ self.maidDock.setWidget(self.maidWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.maidDock)
+
+
+ self.butlerDock = QtWidgets.QDockWidget('Random butler')
+ self.butlerDock.parent = self
+
+ self.butlerDock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
+ titleWidget = QtWidgets.QWidget()
+ self.butlerDock.setTitleBarWidget(titleWidget)
+
+ self.butlerWidget = CButlerWidget(data_reader, self.butlerDock)
+ self.butlerDock.setWidget(self.butlerWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.butlerDock)
+
+
+ self.masterDock = QtWidgets.QDockWidget('Random master')
+ self.masterDock.parent = self
+
+ self.masterDock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
+ titleWidgetMaster = QtWidgets.QWidget()
+ self.masterDock.setTitleBarWidget(titleWidgetMaster)
+
+ self.masterWidget = CMasterWidget(data_reader, self.masterDock)
+ self.masterDock.setWidget(self.masterWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.masterDock)
+
+
+ self.helpDock = QtWidgets.QDockWidget('Help')
+ self.helpDock.parent = self
+
+ self.helpDock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
+ titleWidgetHelp = QtWidgets.QWidget()
+ self.helpDock.setTitleBarWidget(titleWidgetHelp)
+
+ self.helpWidget = CHelpWidget(self.helpDock)
+ self.helpDock.setWidget(self.helpWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.helpDock)
+
+
+ self.tabifyDockWidget(self.maidDock, self.butlerDock)
+ self.tabifyDockWidget(self.butlerDock, self.masterDock)
+ self.tabifyDockWidget(self.masterDock, self.helpDock)
+ self.maidDock.raise_()
+ self.seq = 0
+
+ def keyPressEvent(self, event):
+ if self.seq == 0 and event.key() == QtCore.Qt.Key_Up:
+ self.seq += 1
+ elif self.seq == 1 and event.key() == QtCore.Qt.Key_Up:
+ self.seq += 1
+ self.helpDock.setFocus()
+ elif self.seq == 2 and event.key() == QtCore.Qt.Key_Down:
+ self.seq += 1
+ elif self.seq == 3 and event.key() == QtCore.Qt.Key_Down:
+ self.seq += 1
+ elif self.seq == 4 and event.key() == QtCore.Qt.Key_Left:
+ self.seq += 1
+ elif self.seq == 5 and event.key() == QtCore.Qt.Key_Right:
+ self.seq += 1
+ elif self.seq == 6 and event.key() == QtCore.Qt.Key_Left:
+ self.seq += 1
+ elif self.seq == 7 and event.key() == QtCore.Qt.Key_Right:
+ self.seq += 1
+ elif self.seq == 8 and event.key() == QtCore.Qt.Key_B:
+ self.seq += 1
+ elif self.seq == 9 and event.key() == QtCore.Qt.Key_A:
+ self.helpWidget.easterEgg()
+ else:
+ self.seq = 0
+
+
+def main(argv):
+ data_reader = MaidDataReader()
+ qt_args = [argv[0], '-style', 'Fusion'] + argv[1:]
+ app = QtWidgets.QApplication(qt_args)
+ main_window = ApplicationWindow(data_reader)
+ main_window.show()
+ sys.exit(app.exec_())
+
+
+if __name__ == '__main__':
+ main(sys.argv)