aboutsummaryrefslogtreecommitdiff
path: root/src
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
initial commitHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/__init__.py0
-rw-r--r--src/__main__.py124
-rw-r--r--src/modules/__init__.py0
-rw-r--r--src/modules/butlerWidget.py715
-rw-r--r--src/modules/data_reader.py59
-rw-r--r--src/modules/helpWidget.py31
-rw-r--r--src/modules/maidWidget.py845
-rw-r--r--src/modules/masterWidget.py677
8 files changed, 2451 insertions, 0 deletions
diff --git a/src/__init__.py b/src/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/__init__.py
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)
diff --git a/src/modules/__init__.py b/src/modules/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/modules/__init__.py
diff --git a/src/modules/butlerWidget.py b/src/modules/butlerWidget.py
new file mode 100644
index 0000000..c941745
--- /dev/null
+++ b/src/modules/butlerWidget.py
@@ -0,0 +1,715 @@
+"""
+Widget for the random maid dock.
+"""
+
+from random import randint
+from math import floor
+from PyQt5 import QtWidgets, QtCore
+
+
+class CButlerWidget(QtWidgets.QWidget):
+
+ def __init__(self, data_reader, parent=None):
+ QtWidgets.QWidget.__init__(self, parent)
+ self.data_reader = data_reader
+ self.parent = parent
+
+ self.stats = [0, 0, 0, 0, 0, 0]
+
+ self.loVLayoutMain = QtWidgets.QVBoxLayout()
+ self.loHLayoutMain = QtWidgets.QHBoxLayout()
+
+ self.gbBasic = QtWidgets.QGroupBox('Basics', self)
+ self.loGbBasic = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Name: ')
+ hLayout.addWidget(textLabel)
+ self.liName = QtWidgets.QLineEdit()
+ self.liName.setFixedWidth(200)
+ hLayout.addWidget(self.liName)
+ hLayout.addStretch(1)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Age: ')
+ hLayout.addWidget(textLabel)
+ self.liAge = QtWidgets.QSpinBox()
+ self.liAge.setFixedWidth(50)
+ self.liAge.setMaximum(9999)
+ hLayout.addWidget(self.liAge)
+ self.bAge = QtWidgets.QPushButton('R')
+ self.bAge.parent = self.liAge
+ self.bAge.setFixedWidth(50)
+ hLayout.addWidget(self.bAge)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Suit color: ')
+ hLayout.addWidget(textLabel)
+ self.liUniColor = QtWidgets.QLineEdit()
+ self.liUniColor.setFixedWidth(150)
+ hLayout.addWidget(self.liUniColor)
+ self.bUniColor = QtWidgets.QPushButton('R')
+ self.bUniColor.parent = self.liUniColor
+ self.bUniColor.setFixedWidth(50)
+ hLayout.addWidget(self.bUniColor)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Hair color: ')
+ hLayout.addWidget(textLabel)
+ self.liHairColor = QtWidgets.QLineEdit()
+ self.liHairColor.setFixedWidth(150)
+ hLayout.addWidget(self.liHairColor)
+ self.bHairColor = QtWidgets.QPushButton('R')
+ self.bHairColor.setFixedWidth(50)
+ self.bHairColor.parent = self.liHairColor
+ hLayout.addWidget(self.bHairColor)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Eye color: ')
+ hLayout.addWidget(textLabel)
+ self.liEyeColor = QtWidgets.QLineEdit()
+ self.liEyeColor.setFixedWidth(150)
+ hLayout.addWidget(self.liEyeColor)
+ self.bEyeColor = QtWidgets.QPushButton('R')
+ self.bEyeColor.setFixedWidth(50)
+ self.bEyeColor.parent = self.liEyeColor
+ hLayout.addWidget(self.bEyeColor)
+ self.loGbBasic.addLayout(hLayout)
+ self.gbBasic.setLayout(self.loGbBasic)
+ self.loH1 = QtWidgets.QHBoxLayout()
+ self.loH1.addWidget(self.gbBasic)
+ self.gbMaidType = QtWidgets.QGroupBox('Butler Type', self)
+ self.loGbMaidType = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('First: ')
+ hLayout.addWidget(textLabel)
+ self.liFirstType = QtWidgets.QComboBox()
+ self.setButlerTypeComboBox(self.liFirstType)
+ self.liFirstType.setFixedWidth(100)
+ hLayout.addWidget(self.liFirstType)
+ self.bFirstType = QtWidgets.QPushButton('R')
+ self.bFirstType.setFixedWidth(50)
+ self.bFirstType.parent = self.liFirstType
+ hLayout.addWidget(self.bFirstType)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.descFirst = QtWidgets.QLabel('')
+ self.descFirst.setWordWrap(True)
+ self.liFirstType.desc = self.descFirst
+ self.liFirstType.changeList = [0, 0, 0, 0, 0, 0]
+ hLayout.addWidget(self.descFirst)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Second: ')
+ hLayout.addWidget(textLabel)
+ self.liSecondType = QtWidgets.QComboBox()
+ self.setButlerTypeComboBox(self.liSecondType)
+ self.liSecondType.setFixedWidth(100)
+ hLayout.addWidget(self.liSecondType)
+ self.bSecondType = QtWidgets.QPushButton('R')
+ self.bSecondType.setFixedWidth(50)
+ self.bSecondType.parent = self.liSecondType
+ hLayout.addWidget(self.bSecondType)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.descSecond = QtWidgets.QLabel('')
+ self.descSecond.setWordWrap(True)
+ self.liSecondType.desc = self.descSecond
+ self.liSecondType.changeList = [0, 0, 0, 0, 0, 0]
+ hLayout.addWidget(self.descSecond)
+ self.loGbMaidType.addLayout(hLayout)
+ self.gbMaidType.setLayout(self.loGbMaidType)
+ self.gbMaidType.setFixedWidth(220)
+ self.loH1.addWidget(self.gbMaidType)
+ self.gbAttri = QtWidgets.QGroupBox('Attributes', self)
+ self.loGbAttri = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('ATH:')
+ textLabel.setToolTip('Athletics: Physical ability, combat ability.')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liATH = QtWidgets.QSpinBox()
+ self.liATH.setFixedWidth(35)
+ hLayout.addWidget(self.liATH, 1, QtCore.Qt.AlignRight)
+ self.textATH = QtWidgets.QLabel('(0)')
+ self.liATH.sumVal = self.textATH
+ hLayout.addWidget(self.textATH, 1, QtCore.Qt.AlignRight)
+ self.bATH = QtWidgets.QPushButton('R')
+ self.bATH.setFixedWidth(50)
+ self.bATH.parent = self.liATH
+ hLayout.addWidget(self.bATH, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('AFF:')
+ textLabel.setToolTip('Affection: How good are you at forming bonds with your master and the other maids?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liAFF = QtWidgets.QSpinBox()
+ self.liAFF.setFixedWidth(35)
+ hLayout.addWidget(self.liAFF, 1, QtCore.Qt.AlignRight)
+ self.textAFF = QtWidgets.QLabel('(0)')
+ self.liAFF.sumVal = self.textAFF
+ hLayout.addWidget(self.textAFF, 1, QtCore.Qt.AlignRight)
+ self.bAFF = QtWidgets.QPushButton('R')
+ self.bAFF.setFixedWidth(50)
+ self.bAFF.parent = self.liAFF
+ hLayout.addWidget(self.bAFF, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('SKI:')
+ textLabel.setToolTip('Skill: How good are you at your maid duties?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liSKI = QtWidgets.QSpinBox()
+ self.liSKI.setFixedWidth(35)
+ hLayout.addWidget(self.liSKI, 1, QtCore.Qt.AlignRight)
+ self.textSKI = QtWidgets.QLabel('(0)')
+ self.liSKI.sumVal = self.textSKI
+ hLayout.addWidget(self.textSKI, 1, QtCore.Qt.AlignRight)
+ self.bSKI = QtWidgets.QPushButton('R')
+ self.bSKI.setFixedWidth(50)
+ self.bSKI.parent = self.liSKI
+ hLayout.addWidget(self.bSKI, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('CNN:')
+ textLabel.setToolTip(
+ 'Cunning: How capable are you at tricking enemies and other maids, and deceiving the master?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liCNN = QtWidgets.QSpinBox()
+ self.liCNN.setFixedWidth(35)
+ hLayout.addWidget(self.liCNN, 1, QtCore.Qt.AlignRight)
+ self.textCNN = QtWidgets.QLabel('(0)')
+ self.liCNN.sumVal = self.textCNN
+ hLayout.addWidget(self.textCNN, 1, QtCore.Qt.AlignRight)
+ self.bCNN = QtWidgets.QPushButton('R')
+ self.bCNN.setFixedWidth(50)
+ self.bCNN.parent = self.liCNN
+ hLayout.addWidget(self.bCNN, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('LCK:')
+ textLabel.setToolTip('Luck: Just how lucky are you?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liLCK = QtWidgets.QSpinBox()
+ self.liLCK.setFixedWidth(35)
+ hLayout.addWidget(self.liLCK, 1, QtCore.Qt.AlignRight)
+ self.textLCK = QtWidgets.QLabel('(0)')
+ self.liLCK.sumVal = self.textLCK
+ hLayout.addWidget(self.textLCK, 1, QtCore.Qt.AlignRight)
+ self.bLCK = QtWidgets.QPushButton('R')
+ self.bLCK.setFixedWidth(50)
+ self.bLCK.parent = self.liLCK
+ hLayout.addWidget(self.bLCK, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('WIL:')
+ textLabel.setToolTip('Will: How positive and constructive is your thinking?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liWIL = QtWidgets.QSpinBox()
+ self.liWIL.setFixedWidth(35)
+ hLayout.addWidget(self.liWIL, 1, QtCore.Qt.AlignRight)
+ self.textWIL = QtWidgets.QLabel('(0)')
+ self.liWIL.sumVal = self.textWIL
+ hLayout.addWidget(self.textWIL, 1, QtCore.Qt.AlignRight)
+ self.bWIL = QtWidgets.QPushButton('R')
+ self.bWIL.setFixedWidth(50)
+ self.bWIL.parent = self.liWIL
+ hLayout.addWidget(self.bWIL, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+ self.gbAttri.setLayout(self.loGbAttri)
+ self.loH2 = QtWidgets.QHBoxLayout()
+ self.loH2.addWidget(self.gbAttri)
+ self.gbEtc = QtWidgets.QGroupBox('Etcetera', self)
+ self.loGbEtc = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Butler root: ')
+ hLayout.addWidget(textLabel)
+ self.liMaidRoot = QtWidgets.QComboBox()
+ self.setButlerRootComboBox()
+ self.liMaidRoot.setFixedWidth(150)
+ hLayout.addWidget(self.liMaidRoot)
+ self.bMaidRoot = QtWidgets.QPushButton('R')
+ self.bMaidRoot.parent = self.liMaidRoot
+ self.bMaidRoot.setFixedWidth(50)
+ hLayout.addWidget(self.bMaidRoot)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Butler power: ')
+ hLayout.addWidget(textLabel)
+ self.liMP = QtWidgets.QComboBox()
+ self.liMP.setFixedWidth(150)
+ self.liFirstType.powerBox = self.liMP
+ self.liMP.parent = self.liFirstType
+ hLayout.addWidget(self.liMP)
+ self.bButlerPower = QtWidgets.QPushButton('R')
+ self.bButlerPower.parent = self.liMP
+ self.liMP.rollButton = self.bButlerPower
+ self.bButlerPower.setFixedWidth(50)
+ hLayout.addWidget(self.bButlerPower)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Butler power 2: ')
+ hLayout.addWidget(textLabel)
+ self.liMP2 = QtWidgets.QComboBox()
+ self.liMP2.setFixedWidth(150)
+ self.liSecondType.powerBox = self.liMP2
+ self.liMP2.parent = self.liSecondType
+ hLayout.addWidget(self.liMP2)
+ self.bButlerPower2 = QtWidgets.QPushButton('R')
+ self.bButlerPower2.parent = self.liMP2
+ self.liMP2.rollButton = self.bButlerPower2
+ self.bButlerPower2.setFixedWidth(50)
+ hLayout.addWidget(self.bButlerPower2)
+ self.loGbEtc.addLayout(hLayout)
+ self.liMP.otherMP = self.liMP2
+ self.liMP2.otherMP = self.liMP
+ self.favor = QtWidgets.QLabel('Favor: 0')
+ self.spirit = QtWidgets.QLabel('Spirit: 0')
+ self.loGbEtc.addWidget(self.favor)
+ self.loGbEtc.addWidget(self.spirit)
+ self.gbEtc.setLayout(self.loGbEtc)
+ self.loH2.addWidget(self.gbEtc)
+ self.gbSpec = QtWidgets.QGroupBox('Special Qualities', self)
+ self.loGbSpec = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec1 = QtWidgets.QComboBox()
+ self.setButlerQualityComboBox(self.liSpec1)
+ self.liSpec1.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec1, 10, QtCore.Qt.AlignRight)
+ self.bSpec1 = QtWidgets.QPushButton('R')
+ self.bSpec1.setFixedWidth(50)
+ self.bSpec1.parent = self.liSpec1
+ hLayout.addWidget(self.bSpec1, 0, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec2 = QtWidgets.QComboBox()
+ self.setButlerQualityComboBox(self.liSpec2)
+ self.liSpec2.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec2, 10, QtCore.Qt.AlignRight)
+ self.bSpec2 = QtWidgets.QPushButton('R')
+ self.bSpec2.setFixedWidth(50)
+ self.bSpec2.parent = self.liSpec2
+ hLayout.addWidget(self.bSpec2, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec3 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec3, 1, QtCore.Qt.AlignRight)
+ self.liSpec3 = QtWidgets.QComboBox()
+ self.setButlerQualityComboBox(self.liSpec3)
+ self.liSpec3.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec3, 1, QtCore.Qt.AlignRight)
+ self.bSpec3 = QtWidgets.QPushButton('R')
+ self.bSpec3.setFixedWidth(50)
+ self.bSpec3.parent = self.liSpec3
+ self.cbSpec3.button = self.bSpec3
+ self.cbSpec3.box = self.liSpec3
+ hLayout.addWidget(self.bSpec3, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec4 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec4, 1, QtCore.Qt.AlignRight)
+ self.liSpec4 = QtWidgets.QComboBox()
+ self.setButlerQualityComboBox(self.liSpec4)
+ self.liSpec4.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec4, 1, QtCore.Qt.AlignRight)
+ self.bSpec4 = QtWidgets.QPushButton('R')
+ self.bSpec4.setFixedWidth(50)
+ self.bSpec4.parent = self.liSpec4
+ self.cbSpec4.button = self.bSpec4
+ self.cbSpec4.box = self.liSpec4
+ hLayout.addWidget(self.bSpec4, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec5 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec5, 1, QtCore.Qt.AlignRight)
+ self.liSpec5 = QtWidgets.QComboBox()
+ self.setButlerQualityComboBox(self.liSpec5)
+ self.liSpec5.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec5, 1, QtCore.Qt.AlignRight)
+ self.bSpec5 = QtWidgets.QPushButton('R')
+ self.bSpec5.setFixedWidth(50)
+ self.bSpec5.parent = self.liSpec5
+ self.cbSpec5.button = self.bSpec5
+ self.cbSpec5.box = self.liSpec5
+ hLayout.addWidget(self.bSpec5, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ self.gbSpec.setLayout(self.loGbSpec)
+ self.gbSpec.setFixedWidth(250)
+ self.loH3 = QtWidgets.QHBoxLayout()
+ self.loH3.addWidget(self.gbSpec)
+ self.gbWeap = QtWidgets.QGroupBox('Weapons', self)
+ self.loGbWeap = QtWidgets.QVBoxLayout()
+ self.liWeapon = QtWidgets.QComboBox()
+ self.setButlerWeaponComboBox(self.liWeapon)
+ self.loGbWeap.addWidget(self.liWeapon)
+ self.bWeap = QtWidgets.QPushButton('R')
+ self.bWeap.parent = self.liWeapon
+ self.loGbWeap.addWidget(self.bWeap)
+ self.loGbWeap.addWidget(QtWidgets.QLabel('\n\n'))
+ self.liWeapon2 = QtWidgets.QComboBox()
+ self.setButlerWeaponComboBox(self.liWeapon2)
+ self.loGbWeap.addWidget(self.liWeapon2)
+ self.bWeap2 = QtWidgets.QPushButton('R')
+ self.bWeap2.parent = self.liWeapon2
+ self.loGbWeap.addWidget(self.bWeap2)
+ self.liWeapon.otherWeapon = self.liWeapon2
+ self.liWeapon2.otherWeapon = self.liWeapon
+ self.gbWeap.setLayout(self.loGbWeap)
+ self.loH3.addWidget(self.gbWeap)
+
+ self.gbSave = QtWidgets.QGroupBox('Generate and save', self)
+ self.loGbSave = QtWidgets.QVBoxLayout()
+ self.bRollAll = QtWidgets.QPushButton('GENERATE\nBUTLER', self)
+ self.loGbSave.addWidget(self.bRollAll)
+ self.bSave = QtWidgets.QPushButton('SAVE', self)
+ self.loGbSave.addWidget(self.bSave)
+ self.gbSave.setLayout(self.loGbSave)
+ self.gbSave.setFixedWidth(120)
+ self.loH3.addWidget(self.gbSave)
+
+ self.loVLayoutMain.addLayout(self.loH1)
+ self.loVLayoutMain.addLayout(self.loH2)
+ self.loVLayoutMain.addLayout(self.loH3)
+ self.loHLayoutMain.addLayout(self.loVLayoutMain)
+ self.setLayout(self.loHLayoutMain)
+
+ self.setEnabilities()
+ self.cbSpec3.clicked.connect(self.setEnabilities)
+ self.cbSpec4.clicked.connect(self.setEnabilities)
+ self.cbSpec5.clicked.connect(self.setEnabilities)
+ self.liATH.valueChanged.connect(self.calculateStats)
+ self.liAFF.valueChanged.connect(self.calculateStats)
+ self.liSKI.valueChanged.connect(self.calculateStats)
+ self.liCNN.valueChanged.connect(self.calculateStats)
+ self.liLCK.valueChanged.connect(self.calculateStats)
+ self.liWIL.valueChanged.connect(self.calculateStats)
+ self.bAge.clicked.connect(self.generateAge)
+ self.bUniColor.clicked.connect(self.generateSuitColor)
+ self.bHairColor.clicked.connect(self.generateHairColor)
+ self.bEyeColor.clicked.connect(self.generateEyeColor)
+ self.bATH.clicked.connect(self.generateAttribute)
+ self.bAFF.clicked.connect(self.generateAttribute)
+ self.bSKI.clicked.connect(self.generateAttribute)
+ self.bCNN.clicked.connect(self.generateAttribute)
+ self.bLCK.clicked.connect(self.generateLuckAttribute)
+ self.bWIL.clicked.connect(self.generateWilAttribute)
+ self.bFirstType.clicked.connect(self.generateButlerType)
+ self.bSecondType.clicked.connect(self.generateButlerType)
+ self.bButlerPower.clicked.connect(self.generateButlerPower)
+ self.bButlerPower2.clicked.connect(self.generateButlerPower)
+ self.bMaidRoot.clicked.connect(self.generateButlerRoot)
+ self.bSpec1.clicked.connect(self.generateButlerQuality)
+ self.bSpec2.clicked.connect(self.generateButlerQuality)
+ self.bSpec3.clicked.connect(self.generateButlerQuality)
+ self.bSpec4.clicked.connect(self.generateButlerQuality)
+ self.bSpec5.clicked.connect(self.generateButlerQuality)
+ self.bWeap.clicked.connect(self.generateButlerWeapon)
+ self.bWeap2.clicked.connect(self.generateButlerWeapon)
+ self.liFirstType.currentIndexChanged.connect(self.changedButlerType)
+ self.liSecondType.currentIndexChanged.connect(self.changedButlerType)
+ self.liMP.currentIndexChanged.connect(self.changedButlerPower)
+ self.liMP2.currentIndexChanged.connect(self.changedButlerPower)
+ self.liMaidRoot.currentIndexChanged.connect(self.changedButlerRoot)
+ self.liSpec1.currentIndexChanged.connect(self.changedButlerQuality)
+ self.liSpec2.currentIndexChanged.connect(self.changedButlerQuality)
+ self.liSpec3.currentIndexChanged.connect(self.changedButlerQuality)
+ self.liSpec4.currentIndexChanged.connect(self.changedButlerQuality)
+ self.liSpec5.currentIndexChanged.connect(self.changedButlerQuality)
+ self.liWeapon.currentIndexChanged.connect(self.changedButlerWeapon)
+ self.liWeapon2.currentIndexChanged.connect(self.changedButlerWeapon)
+ self.bRollAll.clicked.connect(self.generateButler)
+ self.bSave.clicked.connect(self.saveButler)
+
+ def setEnabilities(self):
+ for checkb in [self.cbSpec3, self.cbSpec4, self.cbSpec5]:
+ if not checkb.isChecked():
+ checkb.button.setEnabled(False)
+ checkb.box.setEnabled(False)
+ checkb.box.setCurrentIndex(-1)
+ else:
+ checkb.button.setEnabled(True)
+ checkb.box.setEnabled(True)
+
+ def generateAge(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled age...', 1500)
+ i = int(str(randint(1, 6)) + str(randint(1, 6)))
+ self.liAge.setValue(i)
+
+ def generateSuitColor(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled color...', 1500)
+ self.liUniColor.setText(self.data_reader.get_butler_random_suit_color())
+
+ def generateHairColor(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled color...', 1500)
+ self.liHairColor.setText(self.data_reader.get_butler_random_hair_color())
+
+ def generateEyeColor(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled color...', 1500)
+ self.liEyeColor.setText(self.data_reader.get_random_color())
+
+ def generateAttribute(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled attribute...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ retVal = int(floor((x + y) / 2))
+ caller.parent.setValue(retVal)
+
+ def generateLuckAttribute(self, hideMessage=False):
+ if hideMessage == False:
+ self.parent.parent.statusBar().showMessage('Rolled attribute...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ retVal = int(floor((x + y) / 3))
+ self.liLCK.setValue(retVal)
+
+ def generateWilAttribute(self, hideMessage=False):
+ if hideMessage == False:
+ self.parent.parent.statusBar().showMessage('Rolled attribute...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ retVal = x + y
+ self.liWIL.setValue(retVal)
+
+ def generateButlerType(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled butler type...', 1500)
+ i = randint(0, 5)
+ caller.parent.setCurrentIndex(i)
+
+ def generateButlerPower(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ if caller.parent.count() != 0:
+ self.parent.parent.statusBar().showMessage('Rolled butler power...', 1500)
+ if caller.parent.count() != 0:
+ while True:
+ i = randint(0, 5)
+ caller.parent.setCurrentIndex(i)
+ if caller.parent.otherMP.currentText() == '' or caller.parent.otherMP.currentText() != caller.parent.currentText():
+ break
+
+ def generateButlerRoot(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled butler root...', 1500)
+ i = randint(0, 5)
+ self.liMaidRoot.setCurrentIndex(i)
+
+ def generateButlerQuality(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled butler special quality...', 1500)
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+
+ def generateButlerWeapon(self, caller):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled weapon...', 1500)
+ while True:
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+ if caller.parent.otherWeapon.currentText() == '' or caller.parent.otherWeapon.currentText() != caller.parent.currentText():
+ break
+
+ def calculateStats(self):
+ stat0 = self.liATH.value() + self.liFirstType.changeList[0] + self.liSecondType.changeList[0]
+ stat1 = self.liAFF.value() + self.liFirstType.changeList[1] + self.liSecondType.changeList[1]
+ stat2 = self.liSKI.value() + self.liFirstType.changeList[2] + self.liSecondType.changeList[2]
+ stat3 = self.liCNN.value() + self.liFirstType.changeList[3] + self.liSecondType.changeList[3]
+ stat4 = self.liLCK.value() + self.liFirstType.changeList[4] + self.liSecondType.changeList[4]
+ stat5 = self.liWIL.value() + self.liFirstType.changeList[5] + self.liSecondType.changeList[5]
+ self.stats = [stat0, stat1, stat2, stat3, stat4, stat5]
+ for i in range(len(self.stats)):
+ if self.stats[i] < 0:
+ self.stats[i] = 0
+
+ self.liATH.sumVal.setText('(' + str(self.stats[0]) + ')')
+ self.liAFF.sumVal.setText('(' + str(self.stats[1]) + ')')
+ self.liSKI.sumVal.setText('(' + str(self.stats[2]) + ')')
+ self.liCNN.sumVal.setText('(' + str(self.stats[3]) + ')')
+ self.liLCK.sumVal.setText('(' + str(self.stats[4]) + ')')
+ self.liWIL.sumVal.setText('(' + str(self.stats[5]) + ')')
+ self.favor.setText('Favor: ' + str(self.stats[1] * 2))
+ self.spirit.setText('Spirit: ' + str(self.stats[5] * 10))
+
+ def changedButlerType(self):
+ comboBox = self.sender()
+ ii = comboBox.currentIndex()
+ elem = self.data_reader.data["butler"]["types"][ii]
+ comboBox.desc.setText(elem[1])
+ comboBox.changeList = elem[2]
+ comboBox.setToolTip(elem[3])
+ self.calculateStats()
+ comboBox.powerBox.setCurrentIndex(-1)
+ for j in range(6):
+ comboBox.powerBox.removeItem(0)
+
+ for item in self.data_reader.data["butler"]["powers"][ii]:
+ comboBox.powerBox.insertItem(100, item[0])
+
+ comboBox.powerBox.setCurrentIndex(-1)
+ self.generateButlerPower(comboBox.powerBox.rollButton)
+
+ def changedButlerPower(self):
+ comboBox = self.sender()
+ i = comboBox.currentIndex()
+ j = comboBox.parent.currentIndex()
+ if not comboBox.currentIndex() == -1:
+ comboBox.setToolTip(self.data_reader.data["butler"]["powers"][j][i][1])
+ else:
+ comboBox.setToolTip('')
+
+ def changedButlerRoot(self):
+ i = self.liMaidRoot.currentIndex()
+ self.liMaidRoot.setToolTip(self.data_reader.data["butler"]["roots"][i][1])
+
+ def changedButlerQuality(self):
+ comboBox = self.sender()
+ i = comboBox.currentIndex()
+ if not i == -1:
+ comboBox.setToolTip(self.data_reader.data["butler"]["qualities"][i][1])
+ else:
+ comboBox.setToolTip('')
+
+ def changedButlerWeapon(self):
+ comboBox = self.sender()
+ i = comboBox.currentIndex()
+ if not i == -1:
+ comboBox.setToolTip(self.data_reader.data["butler"]["weapons"][i][1])
+ else:
+ comboBox.setToolTip('')
+
+ def setButlerRootComboBox(self):
+ for elem in self.data_reader.data["butler"]["roots"]:
+ self.liMaidRoot.insertItem(100, elem[0])
+
+ self.liMaidRoot.setCurrentIndex(-1)
+
+ def setButlerTypeComboBox(self, comboBox):
+ for elem in self.data_reader.data["butler"]["types"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def setButlerQualityComboBox(self, comboBox):
+ for elem in self.data_reader.data["butler"]["qualities"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def setButlerWeaponComboBox(self, comboBox):
+ for elem in self.data_reader.data["butler"]["weapons"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def generateButler(self):
+ self.generateAge(True)
+ self.generateSuitColor(True)
+ self.generateHairColor(True)
+ self.generateEyeColor(True)
+ self.generateAttribute(self.bATH)
+ self.generateAttribute(self.bAFF)
+ self.generateAttribute(self.bSKI)
+ self.generateAttribute(self.bCNN)
+ self.generateLuckAttribute(True)
+ self.generateWilAttribute(True)
+ self.generateButlerType(self.bFirstType)
+ self.generateButlerType(self.bSecondType)
+ self.generateButlerRoot(True)
+ self.generateButlerQuality(self.bSpec1)
+ self.generateButlerQuality(self.bSpec2)
+ if self.bSpec3.isEnabled():
+ self.generateButlerQuality(self.bSpec3)
+ if self.bSpec4.isEnabled():
+ self.generateButlerQuality(self.bSpec4)
+ if self.bSpec5.isEnabled():
+ self.generateButlerQuality(self.bSpec5)
+ self.generateButlerWeapon(self.bWeap)
+ self.generateButlerWeapon(self.bWeap2)
+
+ def saveButler(self):
+ savePath = QtWidgets.QFileDialog.getSaveFileName(None, 'Save your butler as...', '',
+ 'Text Documents (*.txt);;All files (*.*)')
+ if not savePath[0] == '':
+ starSeparator = '-----------------------------------------------------------------------------------------\n'
+ printList = []
+ printList.append(starSeparator)
+ printList.append('Name: ' + self.liName.text() + '\n')
+ printList.append('Age: ' + str(self.liAge.value()) + '\n')
+ printList.append('Suit color: ' + self.liUniColor.text() + '\n')
+ printList.append('Eye color: ' + self.liEyeColor.text() + '\n')
+ printList.append('Hair color: ' + self.liHairColor.text() + '\n')
+ printList.append(starSeparator)
+ printList.append('Stats:\n')
+ printList.append('Athletics: ' + str(self.stats[0]) + '\n')
+ printList.append('Affection: ' + str(self.stats[1]) + '\n')
+ printList.append('Skill: ' + str(self.stats[2]) + '\n')
+ printList.append('Cunning: ' + str(self.stats[3]) + '\n')
+ printList.append('Luck: ' + str(self.stats[4]) + '\n')
+ printList.append('Will: ' + str(self.stats[5]) + '\n')
+ printList.append(self.favor.text() + '\n')
+ printList.append(self.spirit.text() + '\n')
+ printList.append(starSeparator)
+ printList.append('Butler types:\n')
+ printList.append(self.liFirstType.currentText() + ': ' + self.liFirstType.toolTip() + '\n')
+ printList.append(self.liSecondType.currentText() + ': ' + self.liSecondType.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Butler powers:\n')
+ printList.append(self.liMP.currentText() + ': ' + self.liMP.toolTip() + '\n')
+ if self.liMP2.isEnabled():
+ printList.append(self.liMP2.currentText() + ': ' + self.liMP2.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Butler root: ' + self.liMaidRoot.currentText() + '\n')
+ printList.append(self.liMaidRoot.toolTip() + '\n')
+ printList.append('\n')
+ printList.append(starSeparator)
+ printList.append('Special quailities:\n')
+ printList.append(self.liSpec1.currentText() + ': ' + self.liSpec1.toolTip() + '\n')
+ printList.append(self.liSpec2.currentText() + ': ' + self.liSpec2.toolTip() + '\n')
+ if self.liSpec3.isEnabled():
+ printList.append(self.liSpec3.currentText() + ': ' + self.liSpec3.toolTip() + '\n')
+ if self.liSpec4.isEnabled():
+ printList.append(self.liSpec4.currentText() + ': ' + self.liSpec4.toolTip() + '\n')
+ if self.liSpec5.isEnabled():
+ printList.append(self.liSpec5.currentText() + ': ' + self.liSpec5.toolTip() + '\n')
+ printList.append(starSeparator)
+ printList.append('Weapon: ' + self.liWeapon.currentText() + '\n')
+ printList.append(self.liWeapon.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Weapon 2: ' + self.liWeapon2.currentText() + '\n')
+ printList.append(self.liWeapon2.toolTip() + '\n')
+ f = open(savePath[0], 'w+')
+ for line in printList:
+ f.write(line)
+
+ f.close()
+ return
diff --git a/src/modules/data_reader.py b/src/modules/data_reader.py
new file mode 100644
index 0000000..8bd9ac9
--- /dev/null
+++ b/src/modules/data_reader.py
@@ -0,0 +1,59 @@
+import os.path
+import json
+import sys
+from random import randrange, randint
+
+
+class MaidDataReader:
+ PATH = os.path.join(os.path.dirname(__file__), "..", "..", "resources", "data.json")
+
+ def __init__(self):
+ self.data = None
+ with open(MaidDataReader.PATH, "r") as f:
+ content = f.read()
+ self.data = json.loads(content)
+
+ if self.data is None:
+ sys.exit("Could not read JSON data.")
+
+ rare_color_count = len(self.data["common"]["colors"]["rare"])
+ self.color_random_max = rare_color_count + 2 * len(self.data["common"]["colors"]["double_chance"])
+ self.rare_color_start_index = self.color_random_max - rare_color_count
+
+ def get_random_color(self):
+ index = randrange(self.color_random_max)
+ if index >= self.rare_color_start_index:
+ return self.data["common"]["colors"]["rare"][index - self.rare_color_start_index]
+
+ return self.data["common"]["colors"]["double_chance"][int(index / 2)]
+
+ def get_butler_random_suit_color(self):
+ return self.__get_butler_random_color(self.data["butler"]["colors"]["suit"])
+
+ def get_butler_random_hair_color(self):
+ return self.__get_butler_random_color(self.data["butler"]["colors"]["hair"])
+
+ @staticmethod
+ def generate_master_age(type_index):
+ if type_index == 0:
+ return randint(1, 6) + randint(1, 6)
+ elif type_index == 1:
+ return randint(1, 6) + randint(1, 6) + 5
+ elif type_index == 2:
+ return randint(1, 6) + randint(1, 6) + 8
+ elif type_index == 3:
+ return randint(1, 6) + randint(1, 6) + 12
+ elif type_index == 4:
+ return int(str(randint(1, 6)) + str(randint(1, 6)))
+ elif type_index == 5:
+ return int(str(randint(1, 6)) + str(randint(1, 6))) + 10
+
+ raise ValueError("Invalid master type index: {}".format(type_index))
+
+ def __get_butler_random_color(self, color_list):
+ index = randrange(len(color_list) + 1)
+ if index >= len(color_list):
+ return self.get_random_color()
+
+ return color_list[index]
+
diff --git a/src/modules/helpWidget.py b/src/modules/helpWidget.py
new file mode 100644
index 0000000..c2c9794
--- /dev/null
+++ b/src/modules/helpWidget.py
@@ -0,0 +1,31 @@
+"""
+Widget for the help dock.
+"""
+import os.path
+
+from PyQt5 import QtWidgets, QtGui, QtCore
+
+class CHelpWidget(QtWidgets.QWidget):
+
+ def __init__(self, parent=None):
+ QtWidgets.QWidget.__init__(self, parent)
+ self.parent = parent
+ self.loVLayoutMain = QtWidgets.QVBoxLayout()
+ self.loHLayoutMain = QtWidgets.QHBoxLayout()
+ self.loVLayoutMain.setAlignment(QtCore.Qt.AlignTop)
+ self.helpText = QtWidgets.QLabel("To fully generate a maid press the 'GENERATE MAID' button. In a case of identical stat values " + 'you have to choose which stat to use when rolling for maid power. You can do this with ' + "the 'MP' button. To generate a second maid power (if available) hold down the 'Shift' key " + "then press the 'MP' button of your choosing (from the available options).\n\n" + "To reroll a singe value press the corresponding 'R' button.\n" + 'To roll a Special quality from a specific secondary table (for example: Magic) choose that primary table from the popuplist ' + "then press the corresponding 'R' button while holding down the 'Shift' key.\n\n" + 'Hover your cursor over a choosen trait to see its description.\n\n' + "To save your maid in a txt file press the 'SAVE' button.\n\n\n" + "PS.: There are no easter eggs in this program. Do not try out famous cheat codes.")
+ self.helpText.setWordWrap(True)
+ self.loVLayoutMain.addWidget(self.helpText)
+ hlayout = QtWidgets.QHBoxLayout()
+ hlayout.setAlignment(QtCore.Qt.AlignCenter)
+ self.picture = QtWidgets.QLabel()
+ maid_picture_path = os.path.join(os.path.dirname(__file__), "..", "..", "resources", "ram.png")
+ self.picture.setPixmap(QtGui.QPixmap(maid_picture_path).scaled(360, 360))
+ self.picture.setGeometry(0, 0, 360, 360)
+ hlayout.addWidget(self.picture)
+ self.loVLayoutMain.addLayout(hlayout)
+ self.loHLayoutMain.addLayout(self.loVLayoutMain)
+ self.setLayout(self.loHLayoutMain)
+
+ def easterEgg(self):
+ self.parent.parent.statusbarMessage.setText('ALL YOUR MAID ARE BELONG TO US')
diff --git a/src/modules/maidWidget.py b/src/modules/maidWidget.py
new file mode 100644
index 0000000..44865b0
--- /dev/null
+++ b/src/modules/maidWidget.py
@@ -0,0 +1,845 @@
+"""
+Widget for the random maid dock.
+"""
+from random import randint
+from math import floor
+from PyQt5 import QtWidgets, QtCore
+
+class CMaidWidget(QtWidgets.QWidget):
+
+ def __init__(self, data_reader, parent=None):
+ QtWidgets.QWidget.__init__(self, parent)
+ self.data_reader = data_reader
+ self.parent = parent
+
+ self.stats = [0, 0, 0, 0, 0, 0]
+ self.rebuildingMaidPowers = False
+
+ self.loVLayoutMain = QtWidgets.QVBoxLayout()
+ self.loHLayoutMain = QtWidgets.QHBoxLayout()
+
+ self.gbBasic = QtWidgets.QGroupBox('Basics', self)
+ self.loGbBasic = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Name: ')
+ hLayout.addWidget(textLabel)
+ self.liName = QtWidgets.QLineEdit()
+ self.liName.setFixedWidth(200)
+ hLayout.addWidget(self.liName)
+ hLayout.addStretch(1)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Age: ')
+ hLayout.addWidget(textLabel)
+ self.liAge = QtWidgets.QSpinBox()
+ self.liAge.setFixedWidth(50)
+ self.liAge.setMaximum(9999)
+ hLayout.addWidget(self.liAge)
+ hLayout.addStretch(1)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Uniform color: ')
+ hLayout.addWidget(textLabel)
+ self.liUniColor = QtWidgets.QLineEdit()
+ self.liUniColor.setFixedWidth(150)
+ hLayout.addWidget(self.liUniColor)
+ self.bUniColor = QtWidgets.QPushButton('R')
+ self.bUniColor.parent = self.liUniColor
+ self.bUniColor.setFixedWidth(50)
+ hLayout.addWidget(self.bUniColor)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Eye color: ')
+ hLayout.addWidget(textLabel)
+ self.liEyeColor = QtWidgets.QLineEdit()
+ self.liEyeColor.setFixedWidth(150)
+ hLayout.addWidget(self.liEyeColor)
+ self.bEyeColor = QtWidgets.QPushButton('R')
+ self.bEyeColor.setFixedWidth(50)
+ self.bEyeColor.parent = self.liEyeColor
+ hLayout.addWidget(self.bEyeColor)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Hair color: ')
+ hLayout.addWidget(textLabel)
+ self.liHairColor = QtWidgets.QLineEdit()
+ self.liHairColor.setFixedWidth(150)
+ hLayout.addWidget(self.liHairColor)
+ self.bHairColor = QtWidgets.QPushButton('R')
+ self.bHairColor.setFixedWidth(50)
+ self.bHairColor.parent = self.liHairColor
+ hLayout.addWidget(self.bHairColor)
+ self.loGbBasic.addLayout(hLayout)
+ self.gbBasic.setLayout(self.loGbBasic)
+ self.loH1 = QtWidgets.QHBoxLayout()
+ self.loH1.addWidget(self.gbBasic)
+ self.gbMaidType = QtWidgets.QGroupBox('Maid Type', self)
+ self.loGbMaidType = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('First: ')
+ hLayout.addWidget(textLabel)
+ self.liFirstType = QtWidgets.QComboBox()
+ self.setMaidTypeComboBox(self.liFirstType)
+ self.liFirstType.setFixedWidth(100)
+ hLayout.addWidget(self.liFirstType)
+ self.bFirstType = QtWidgets.QPushButton('R')
+ self.bFirstType.setFixedWidth(50)
+ self.bFirstType.parent = self.liFirstType
+ hLayout.addWidget(self.bFirstType)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.descFirst = QtWidgets.QLabel('')
+ self.descFirst.setWordWrap(True)
+ self.liFirstType.desc = self.descFirst
+ self.liFirstType.changeList = [0, 0, 0, 0, 0, 0]
+ hLayout.addWidget(self.descFirst)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Second: ')
+ hLayout.addWidget(textLabel)
+ self.liSecondType = QtWidgets.QComboBox()
+ self.setMaidTypeComboBox(self.liSecondType)
+ self.liSecondType.setFixedWidth(100)
+ hLayout.addWidget(self.liSecondType)
+ self.bSecondType = QtWidgets.QPushButton('R')
+ self.bSecondType.setFixedWidth(50)
+ self.bSecondType.parent = self.liSecondType
+ hLayout.addWidget(self.bSecondType)
+ self.loGbMaidType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.descSecond = QtWidgets.QLabel('')
+ self.descSecond.setWordWrap(True)
+ self.liSecondType.desc = self.descSecond
+ self.liSecondType.changeList = [0, 0, 0, 0, 0, 0]
+ hLayout.addWidget(self.descSecond)
+ self.loGbMaidType.addLayout(hLayout)
+ self.gbMaidType.setLayout(self.loGbMaidType)
+ self.gbMaidType.setFixedWidth(220)
+ self.loH1.addWidget(self.gbMaidType)
+ self.gbAttri = QtWidgets.QGroupBox('Attributes', self)
+ self.loGbAttri = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('ATH:')
+ textLabel.setToolTip('Athletics: Physical ability, combat ability.')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liATH = QtWidgets.QSpinBox()
+ self.liATH.setFixedWidth(35)
+ hLayout.addWidget(self.liATH, 1, QtCore.Qt.AlignRight)
+ self.textATH = QtWidgets.QLabel('(0)')
+ self.liATH.sumVal = self.textATH
+ hLayout.addWidget(self.textATH, 1, QtCore.Qt.AlignRight)
+ self.bATH = QtWidgets.QPushButton('R')
+ self.bATH.setFixedWidth(50)
+ self.bATH.parent = self.liATH
+ hLayout.addWidget(self.bATH, 1, QtCore.Qt.AlignRight)
+ self.bMpATH = QtWidgets.QPushButton('MP')
+ self.bMpATH.setFixedWidth(50)
+ self.bMpATH.statType = 0
+ self.liATH.mpButton = self.bMpATH
+ hLayout.addWidget(self.bMpATH, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('AFF:')
+ textLabel.setToolTip('Affection: How good are you at forming bonds with your master and the other maids?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liAFF = QtWidgets.QSpinBox()
+ self.liAFF.setFixedWidth(35)
+ hLayout.addWidget(self.liAFF, 1, QtCore.Qt.AlignRight)
+ self.textAFF = QtWidgets.QLabel('(0)')
+ self.liAFF.sumVal = self.textAFF
+ hLayout.addWidget(self.textAFF, 1, QtCore.Qt.AlignRight)
+ self.bAFF = QtWidgets.QPushButton('R')
+ self.bAFF.setFixedWidth(50)
+ self.bAFF.parent = self.liAFF
+ hLayout.addWidget(self.bAFF, 1, QtCore.Qt.AlignRight)
+ self.bMpAFF = QtWidgets.QPushButton('MP')
+ self.bMpAFF.setFixedWidth(50)
+ self.bMpAFF.statType = 1
+ self.liAFF.mpButton = self.bMpAFF
+ hLayout.addWidget(self.bMpAFF, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('SKI:')
+ textLabel.setToolTip('Skill: How good are you at your maid duties?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liSKI = QtWidgets.QSpinBox()
+ self.liSKI.setFixedWidth(35)
+ hLayout.addWidget(self.liSKI, 1, QtCore.Qt.AlignRight)
+ self.textSKI = QtWidgets.QLabel('(0)')
+ self.liSKI.sumVal = self.textSKI
+ hLayout.addWidget(self.textSKI, 1, QtCore.Qt.AlignRight)
+ self.bSKI = QtWidgets.QPushButton('R')
+ self.bSKI.setFixedWidth(50)
+ self.bSKI.parent = self.liSKI
+ hLayout.addWidget(self.bSKI, 1, QtCore.Qt.AlignRight)
+ self.bMpSKI = QtWidgets.QPushButton('MP')
+ self.bMpSKI.setFixedWidth(50)
+ self.bMpSKI.statType = 2
+ self.liSKI.mpButton = self.bMpSKI
+ hLayout.addWidget(self.bMpSKI, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('CNN:')
+ textLabel.setToolTip('Cunning: How capable are you at tricking enemies and other maids, and deceiving the master?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liCNN = QtWidgets.QSpinBox()
+ self.liCNN.setFixedWidth(35)
+ hLayout.addWidget(self.liCNN, 1, QtCore.Qt.AlignRight)
+ self.textCNN = QtWidgets.QLabel('(0)')
+ self.liCNN.sumVal = self.textCNN
+ hLayout.addWidget(self.textCNN, 1, QtCore.Qt.AlignRight)
+ self.bCNN = QtWidgets.QPushButton('R')
+ self.bCNN.setFixedWidth(50)
+ self.bCNN.parent = self.liCNN
+ hLayout.addWidget(self.bCNN, 1, QtCore.Qt.AlignRight)
+ self.bMpCNN = QtWidgets.QPushButton('MP')
+ self.bMpCNN.setFixedWidth(50)
+ self.bMpCNN.statType = 3
+ self.liCNN.mpButton = self.bMpCNN
+ hLayout.addWidget(self.bMpCNN, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('LCK:')
+ textLabel.setToolTip('Luck: Just how lucky are you?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liLCK = QtWidgets.QSpinBox()
+ self.liLCK.setFixedWidth(35)
+ hLayout.addWidget(self.liLCK, 1, QtCore.Qt.AlignRight)
+ self.textLCK = QtWidgets.QLabel('(0)')
+ self.liLCK.sumVal = self.textLCK
+ hLayout.addWidget(self.textLCK, 1, QtCore.Qt.AlignRight)
+ self.bLCK = QtWidgets.QPushButton('R')
+ self.bLCK.setFixedWidth(50)
+ self.bLCK.parent = self.liLCK
+ hLayout.addWidget(self.bLCK, 1, QtCore.Qt.AlignRight)
+ self.bMpLCK = QtWidgets.QPushButton('MP')
+ self.bMpLCK.setFixedWidth(50)
+ self.bMpLCK.statType = 4
+ self.liLCK.mpButton = self.bMpLCK
+ hLayout.addWidget(self.bMpLCK, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('WIL:')
+ textLabel.setToolTip('Will: How positive and constructive is your thinking?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liWIL = QtWidgets.QSpinBox()
+ self.liWIL.setFixedWidth(35)
+ hLayout.addWidget(self.liWIL, 1, QtCore.Qt.AlignRight)
+ self.textWIL = QtWidgets.QLabel('(0)')
+ self.liWIL.sumVal = self.textWIL
+ hLayout.addWidget(self.textWIL, 1, QtCore.Qt.AlignRight)
+ self.bWIL = QtWidgets.QPushButton('R')
+ self.bWIL.setFixedWidth(50)
+ self.bWIL.parent = self.liWIL
+ hLayout.addWidget(self.bWIL, 1, QtCore.Qt.AlignRight)
+ self.bMpWIL = QtWidgets.QPushButton('MP')
+ self.bMpWIL.setFixedWidth(50)
+ self.bMpWIL.statType = 5
+ self.liWIL.mpButton = self.bMpWIL
+ hLayout.addWidget(self.bMpWIL, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ self.gbAttri.setLayout(self.loGbAttri)
+ self.loH2 = QtWidgets.QHBoxLayout()
+ self.loH2.addWidget(self.gbAttri)
+ self.gbEtc = QtWidgets.QGroupBox('Etcetera', self)
+ self.loGbEtc = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Maid root: ')
+ hLayout.addWidget(textLabel)
+ self.liMaidRoot = QtWidgets.QComboBox()
+ self.setMaidRootComboBox()
+ self.liMaidRoot.setFixedWidth(130)
+ hLayout.addWidget(self.liMaidRoot)
+ self.bMaidRoot = QtWidgets.QPushButton('R')
+ self.bMaidRoot.parent = self.liMaidRoot
+ self.bMaidRoot.setFixedWidth(50)
+ hLayout.addWidget(self.bMaidRoot)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Stress explosion: ')
+ hLayout.addWidget(textLabel)
+ self.liStress = QtWidgets.QComboBox()
+ self.setStressExplosionComboBox()
+ self.liStress.setFixedWidth(130)
+ hLayout.addWidget(self.liStress)
+ self.bStress = QtWidgets.QPushButton('R')
+ self.bStress.parent = self.liStress
+ self.bStress.setFixedWidth(50)
+ hLayout.addWidget(self.bStress)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Maid power: ')
+ hLayout.addWidget(textLabel)
+ self.liMP = QtWidgets.QComboBox()
+ self.liMP.setFixedWidth(150)
+ hLayout.addWidget(self.liMP)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Maid power 2: ')
+ hLayout.addWidget(textLabel)
+ self.liMP2 = QtWidgets.QComboBox()
+ self.liMP2.setFixedWidth(150)
+ hLayout.addWidget(self.liMP2)
+ self.loGbEtc.addLayout(hLayout)
+
+ self.favor = QtWidgets.QLabel('Favor: 0')
+ self.spirit = QtWidgets.QLabel('Spirit: 0')
+ self.loGbEtc.addWidget(self.favor)
+ self.loGbEtc.addWidget(self.spirit)
+
+ self.gbEtc.setLayout(self.loGbEtc)
+ self.loH2.addWidget(self.gbEtc)
+ self.gbSpec = QtWidgets.QGroupBox('Special Qualities', self)
+ self.loGbSpec = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec1 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec1)
+ self.liSpec1.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec1, 10, QtCore.Qt.AlignRight)
+ self.bSpec1 = QtWidgets.QPushButton('R')
+ self.bSpec1.setFixedWidth(50)
+ self.bSpec1.parent = self.liSpec1
+ hLayout.addWidget(self.bSpec1, 0, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec2 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec2)
+ self.liSpec2.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec2, 10, QtCore.Qt.AlignRight)
+ self.bSpec2 = QtWidgets.QPushButton('R')
+ self.bSpec2.setFixedWidth(50)
+ self.bSpec2.parent = self.liSpec2
+ hLayout.addWidget(self.bSpec2, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec3 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec3, 1, QtCore.Qt.AlignRight)
+ self.liSpec3 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec3)
+ self.liSpec3.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec3, 1, QtCore.Qt.AlignRight)
+ self.bSpec3 = QtWidgets.QPushButton('R')
+ self.bSpec3.setFixedWidth(50)
+ self.bSpec3.parent = self.liSpec3
+ self.cbSpec3.button = self.bSpec3
+ self.cbSpec3.box = self.liSpec3
+ hLayout.addWidget(self.bSpec3, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec4 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec4, 1, QtCore.Qt.AlignRight)
+ self.liSpec4 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec4)
+ self.liSpec4.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec4, 1, QtCore.Qt.AlignRight)
+ self.bSpec4 = QtWidgets.QPushButton('R')
+ self.bSpec4.setFixedWidth(50)
+ self.bSpec4.parent = self.liSpec4
+ self.cbSpec4.button = self.bSpec4
+ self.cbSpec4.box = self.liSpec4
+ hLayout.addWidget(self.bSpec4, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec5 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec5, 1, QtCore.Qt.AlignRight)
+ self.liSpec5 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec5)
+ self.liSpec5.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec5, 1, QtCore.Qt.AlignRight)
+ self.bSpec5 = QtWidgets.QPushButton('R')
+ self.bSpec5.setFixedWidth(50)
+ self.bSpec5.parent = self.liSpec5
+ self.cbSpec5.button = self.bSpec5
+ self.cbSpec5.box = self.liSpec5
+ hLayout.addWidget(self.bSpec5, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ self.gbSpec.setLayout(self.loGbSpec)
+ self.gbSpec.setFixedWidth(250)
+
+ self.loH3 = QtWidgets.QHBoxLayout()
+ self.loH3.addWidget(self.gbSpec)
+ self.gbWeap = QtWidgets.QGroupBox('Weapon', self)
+ self.loGbWeap = QtWidgets.QVBoxLayout()
+ self.cbEnableWeapon = QtWidgets.QCheckBox('Enable weapon')
+ self.cbEnableWeapon.setChecked(True)
+ self.loGbWeap.addWidget(self.cbEnableWeapon)
+ self.liWeapon = QtWidgets.QComboBox()
+ self.setWeaponComboBox()
+ self.loGbWeap.addWidget(self.liWeapon)
+ self.bWeap = QtWidgets.QPushButton('R')
+ self.loGbWeap.addWidget(self.bWeap)
+ self.cbEnableWeapon.button = self.bWeap
+ self.cbEnableWeapon.box = self.liWeapon
+ self.gbWeap.setLayout(self.loGbWeap)
+ self.loH3.addWidget(self.gbWeap)
+
+ self.gbSave = QtWidgets.QGroupBox('Generate and save', self)
+ self.loGbSave = QtWidgets.QVBoxLayout()
+ self.bRollAll = QtWidgets.QPushButton('GENERATE\nMAID', self)
+ self.loGbSave.addWidget(self.bRollAll)
+ self.bSave = QtWidgets.QPushButton('SAVE', self)
+ self.loGbSave.addWidget(self.bSave)
+ self.gbSave.setLayout(self.loGbSave)
+ self.gbSave.setFixedWidth(120)
+ self.loH3.addWidget(self.gbSave)
+
+ self.loVLayoutMain.addLayout(self.loH1)
+ self.loVLayoutMain.addLayout(self.loH2)
+ self.loVLayoutMain.addLayout(self.loH3)
+ self.loHLayoutMain.addLayout(self.loVLayoutMain)
+ self.setLayout(self.loHLayoutMain)
+
+ self.setEnabilities()
+ self.setMaidPowerComboBox(self.liMP, [0, 1, 2, 3, 4, 5])
+ self.setMaidPowerComboBox(self.liMP2, [0, 1, 2, 3, 4, 5])
+ self.bATH.clicked.connect(self.generateAttribute)
+ self.bAFF.clicked.connect(self.generateAttribute)
+ self.bSKI.clicked.connect(self.generateAttribute)
+ self.bCNN.clicked.connect(self.generateAttribute)
+ self.bLCK.clicked.connect(self.generateAttribute)
+ self.bWIL.clicked.connect(self.generateAttribute)
+ self.bFirstType.clicked.connect(self.generateMaidType)
+ self.bSecondType.clicked.connect(self.generateMaidType)
+ self.bUniColor.clicked.connect(self.generateMaidColor)
+ self.bEyeColor.clicked.connect(self.generateMaidColor)
+ self.bHairColor.clicked.connect(self.generateMaidColor)
+ self.bSpec1.clicked.connect(self.generateSpecialQuality)
+ self.bSpec2.clicked.connect(self.generateSpecialQuality)
+ self.bSpec3.clicked.connect(self.generateSpecialQuality)
+ self.bSpec4.clicked.connect(self.generateSpecialQuality)
+ self.bSpec5.clicked.connect(self.generateSpecialQuality)
+ self.bWeap.clicked.connect(self.generateWeapon)
+ self.bMaidRoot.clicked.connect(self.generateMaidRoot)
+ self.bStress.clicked.connect(self.generateStressExplosion)
+ self.bMpATH.clicked.connect(self.generateMaidPower)
+ self.bMpAFF.clicked.connect(self.generateMaidPower)
+ self.bMpSKI.clicked.connect(self.generateMaidPower)
+ self.bMpCNN.clicked.connect(self.generateMaidPower)
+ self.bMpLCK.clicked.connect(self.generateMaidPower)
+ self.bMpWIL.clicked.connect(self.generateMaidPower)
+ self.bRollAll.clicked.connect(self.generateFullMaid)
+ self.bSave.clicked.connect(self.saveMaid)
+ self.cbEnableWeapon.clicked.connect(self.setEnabilities)
+ self.cbSpec3.clicked.connect(self.setEnabilities)
+ self.cbSpec4.clicked.connect(self.setEnabilities)
+ self.cbSpec5.clicked.connect(self.setEnabilities)
+ self.liFirstType.currentIndexChanged.connect(self.changedMaidType)
+ self.liSecondType.currentIndexChanged.connect(self.changedMaidType)
+ self.liSpec1.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec2.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec3.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec4.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec5.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liWeapon.currentIndexChanged.connect(self.changedWeapon)
+ self.liMaidRoot.currentIndexChanged.connect(self.changedMaidRoot)
+ self.liStress.currentIndexChanged.connect(self.changedStressExplosion)
+ self.liATH.valueChanged.connect(self.calculateStats)
+ self.liAFF.valueChanged.connect(self.calculateStats)
+ self.liSKI.valueChanged.connect(self.calculateStats)
+ self.liCNN.valueChanged.connect(self.calculateStats)
+ self.liLCK.valueChanged.connect(self.calculateStats)
+ self.liWIL.valueChanged.connect(self.calculateStats)
+ self.liMP.activated.connect(self.changedMaidPower)
+ self.liMP2.activated.connect(self.changedMaidPower)
+
+ def setEnabilities(self):
+ for checkb in [self.cbEnableWeapon, self.cbSpec3, self.cbSpec4, self.cbSpec5]:
+ if not checkb.isChecked():
+ checkb.button.setEnabled(False)
+ checkb.box.setEnabled(False)
+ checkb.box.setCurrentIndex(-1)
+ else:
+ checkb.button.setEnabled(True)
+ checkb.box.setEnabled(True)
+
+ def generateAttribute(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled attribute...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ retVal = int(floor((x + y) / 3))
+ caller.parent.setValue(retVal)
+
+ def generateMaidType(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled maid type...', 1500)
+ i = randint(0, 5)
+ caller.parent.setCurrentIndex(i)
+
+ def generateMaidColor(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled color...', 1500)
+ caller.parent.setText(self.data_reader.get_random_color())
+
+ def generateWeapon(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled weapon...', 1500)
+ i = randint(0, 35)
+ self.liWeapon.setCurrentIndex(i)
+
+ def generateMaidRoot(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled maid root...', 1500)
+ i = randint(0, 17)
+ self.liMaidRoot.setCurrentIndex(i)
+
+ def generateStressExplosion(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled stress explosion...', 1500)
+ i = randint(0, 17)
+ self.liStress.setCurrentIndex(i)
+
+ def generateMaidPower(self, caller=False, generateSecond=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled maid power...', 1500)
+ if not QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier and not generateSecond:
+ upperLimit = self.liMP.count()
+ desiredStat = caller.statType
+ while True:
+ success = False
+ while True:
+ i = randint(0, upperLimit - 1)
+ text = self.liMP.itemText(i)
+ if text != self.liMP2.currentText():
+ break
+
+ for elem in self.data_reader.data["maid"]["powers"][desiredStat]:
+ if elem[0] == text:
+ success = True
+ self.liMP.setCurrentIndex(i)
+ break
+
+ if success:
+ break
+
+ self.changedMaidPower(self.liMP)
+ elif self.liMP2.isEnabled():
+ upperLimit = self.liMP2.count()
+ desiredStat = caller.statType
+ while True:
+ success = False
+ while True:
+ i = randint(0, upperLimit - 1)
+ text = self.liMP2.itemText(i)
+ if text != self.liMP.currentText():
+ break
+
+ for elem in self.data_reader.data["maid"]["powers"][desiredStat]:
+ if elem[0] == text:
+ success = True
+ self.liMP2.setCurrentIndex(i)
+ break
+
+ if success:
+ break
+
+ self.changedMaidPower(self.liMP2)
+
+ def generateSpecialQuality(self, caller=False):
+ onlySecondary = False
+ allowed2Go = True
+ if caller == False:
+ if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
+ onlySecondary = True
+ caller = self.sender()
+ if onlySecondary:
+ if caller.parent.currentIndex() < 18:
+ allowed2Go = False
+ if allowed2Go:
+ self.parent.parent.statusBar().showMessage('Rolled special quality...', 1500)
+ if allowed2Go:
+ i = -1
+ if not onlySecondary:
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+ if i > 17 or i == -1:
+ i = randint(37, 42)
+ caller.parent.setCurrentIndex(i)
+
+ def calculateStats(self):
+ stat0 = self.liATH.value() + self.liFirstType.changeList[0] + self.liSecondType.changeList[0]
+ stat1 = self.liAFF.value() + self.liFirstType.changeList[1] + self.liSecondType.changeList[1]
+ stat2 = self.liSKI.value() + self.liFirstType.changeList[2] + self.liSecondType.changeList[2]
+ stat3 = self.liCNN.value() + self.liFirstType.changeList[3] + self.liSecondType.changeList[3]
+ stat4 = self.liLCK.value() + self.liFirstType.changeList[4] + self.liSecondType.changeList[4]
+ stat5 = self.liWIL.value() + self.liFirstType.changeList[5] + self.liSecondType.changeList[5]
+ self.stats = [stat0, stat1, stat2, stat3, stat4, stat5]
+ for i in range(len(self.stats)):
+ if self.stats[i] < 0:
+ self.stats[i] = 0
+
+ self.liATH.sumVal.setText('(' + str(self.stats[0]) + ')')
+ self.liAFF.sumVal.setText('(' + str(self.stats[1]) + ')')
+ self.liSKI.sumVal.setText('(' + str(self.stats[2]) + ')')
+ self.liCNN.sumVal.setText('(' + str(self.stats[3]) + ')')
+ self.liLCK.sumVal.setText('(' + str(self.stats[4]) + ')')
+ self.liWIL.sumVal.setText('(' + str(self.stats[5]) + ')')
+ self.favor.setText('Favor: ' + str(self.stats[1] * 2))
+ self.spirit.setText('Spirit: ' + str(self.stats[5] * 10))
+ highestValue = -1
+ for i in range(len(self.stats)):
+ if highestValue < self.stats[i]:
+ highestValue = self.stats[i]
+
+ highestValueList = []
+ buttonList = [
+ self.bMpATH, self.bMpAFF, self.bMpSKI, self.bMpCNN, self.bMpLCK, self.bMpWIL]
+ for i in range(len(self.stats)):
+ if self.stats[i] == highestValue:
+ buttonList[i].setEnabled(True)
+ highestValueList.append(i)
+ else:
+ buttonList[i].setEnabled(False)
+
+ if self.stats[0] + self.stats[1] + self.stats[2] + self.stats[3] + self.stats[4] + self.stats[5] < 10:
+ self.liMP2.setEnabled(True)
+ else:
+ self.liMP2.setCurrentIndex(-1)
+ self.liMP2.setEnabled(False)
+ self.setMaidPowerComboBox(self.liMP, highestValueList)
+ self.setMaidPowerComboBox(self.liMP2, highestValueList)
+
+ def changedMaidType(self):
+ comboBox = self.sender()
+ elem = self.data_reader.data["maid"]["types"][comboBox.currentIndex()]
+ comboBox.setToolTip(elem[1])
+ comboBox.changeList = elem[2]
+ comboBox.desc.setText(elem[3])
+ self.calculateStats()
+
+ def changedMaidPower(self, comboBox=0):
+ if not self.rebuildingMaidPowers:
+ if type(comboBox) is int:
+ comboBox = self.sender()
+ text = comboBox.currentText()
+ found = False
+ for stat in self.data_reader.data["maid"]["powers"]:
+ for elem in stat:
+ if elem[0] == text:
+ comboBox.setToolTip(elem[1])
+ found = True
+
+ if comboBox.currentIndex() == -1 or found == False:
+ comboBox.setToolTip('')
+
+ def changedSpecialQuailty(self):
+ comboBox = self.sender()
+ if comboBox.currentIndex() < 36:
+ if not comboBox.currentIndex() == -1:
+ if comboBox.count() > 36:
+ for i in range(7):
+ comboBox.removeItem(36)
+
+ elem = self.data_reader.data["maid"]["qualities"][comboBox.currentIndex()]
+ comboBox.setToolTip(elem[1])
+ if elem[2] is not None:
+ comboBox.setStyleSheet('color: olive')
+ comboBox.insertSeparator(36)
+ for item in reversed(elem[2]):
+ comboBox.insertItem(37, item[0])
+
+ comboBox.previousIndex = comboBox.currentIndex()
+ else:
+ comboBox.setStyleSheet('color: black')
+ else:
+ comboBox.setStyleSheet('color: black')
+ comboBox.setToolTip('')
+ else:
+ comboBox.setStyleSheet('color: black')
+ item = self.data_reader.data["maid"]["qualities"][comboBox.previousIndex][2][(comboBox.currentIndex() - 37)]
+ comboBox.setToolTip(item[1])
+
+ def changedWeapon(self):
+ if not self.liWeapon.currentIndex() == -1:
+ desc = self.data_reader.data["maid"]["weapons"][self.liWeapon.currentIndex()][1]
+ self.liWeapon.setToolTip(desc)
+ else:
+ self.liWeapon.setToolTip('')
+
+ def changedMaidRoot(self):
+ self.liMaidRoot.setToolTip(self.data_reader.data["maid"]["roots"][self.liMaidRoot.currentIndex()][1])
+
+ def changedStressExplosion(self):
+ self.liStress.setToolTip(self.data_reader.data["common"]["stress_explosions"][self.liStress.currentIndex()][1])
+
+ def setMaidPowerComboBox(self, comboBox, highestStats):
+ self.rebuildingMaidPowers = True
+ text = comboBox.itemText(comboBox.currentIndex())
+ for i in range(comboBox.count()):
+ comboBox.removeItem(0)
+
+ for statNumber in highestStats:
+ for elem in self.data_reader.data["maid"]["powers"][statNumber]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.insertSeparator(100)
+
+ comboBox.removeItem(comboBox.count() - 1)
+ listOfNames = [ comboBox.itemText(i) for i in range(comboBox.count()) ]
+ comboBox.setCurrentIndex(-1)
+ for i in range(len(listOfNames)):
+ if listOfNames[i] == text:
+ comboBox.setCurrentIndex(i)
+
+ self.rebuildingMaidPowers = False
+ self.changedMaidPower(comboBox)
+
+ def setMaidTypeComboBox(self, comboBox):
+ for elem in self.data_reader.data["maid"]["types"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+ comboBox.previousIndex = -1
+
+ def setSpecialQualityComboBox(self, comboBox):
+ for elem in self.data_reader.data["maid"]["qualities"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def setWeaponComboBox(self):
+ for elem in self.data_reader.data["maid"]["weapons"]:
+ self.liWeapon.insertItem(100, elem[0])
+
+ self.liWeapon.setCurrentIndex(-1)
+
+ def setMaidRootComboBox(self):
+ for elem in self.data_reader.data["maid"]["roots"]:
+ self.liMaidRoot.insertItem(100, elem[0])
+
+ self.liMaidRoot.setCurrentIndex(-1)
+
+ def setStressExplosionComboBox(self):
+ for elem in self.data_reader.data["common"]["stress_explosions"]:
+ self.liStress.insertItem(100, elem[0])
+
+ self.liStress.setCurrentIndex(-1)
+
+ def generateFullMaid(self):
+ self.generateMaidColor(self.bUniColor)
+ self.generateMaidColor(self.bHairColor)
+ self.generateMaidColor(self.bEyeColor)
+ self.generateAttribute(self.bATH)
+ self.generateAttribute(self.bAFF)
+ self.generateAttribute(self.bSKI)
+ self.generateAttribute(self.bCNN)
+ self.generateAttribute(self.bLCK)
+ self.generateAttribute(self.bWIL)
+ self.generateMaidType(self.bFirstType)
+ self.generateMaidType(self.bSecondType)
+ self.liMP.setCurrentIndex(-1)
+ self.liMP2.setCurrentIndex(-1)
+ onlyButton = None
+ for button in [self.bMpATH, self.bMpAFF, self.bMpSKI, self.bMpCNN, self.bMpLCK, self.bMpWIL]:
+ if button.isEnabled():
+ if onlyButton == None:
+ onlyButton = button
+ elif onlyButton == 'MORE':
+ continue
+ else:
+ onlyButton = 'MORE'
+
+ if onlyButton != None and onlyButton != 'MORE':
+ self.generateMaidPower(onlyButton)
+ if self.liMP2.isEnabled():
+ self.generateMaidPower(onlyButton, True)
+ self.generateMaidRoot(True)
+ self.generateStressExplosion(True)
+ self.generateSpecialQuality(self.bSpec1)
+ self.generateSpecialQuality(self.bSpec2)
+ if self.liSpec3.isEnabled():
+ self.generateSpecialQuality(self.bSpec3)
+ if self.liSpec4.isEnabled():
+ self.generateSpecialQuality(self.bSpec4)
+ if self.liSpec5.isEnabled():
+ self.generateSpecialQuality(self.bSpec5)
+ if self.liWeapon.isEnabled():
+ self.generateWeapon(True)
+ return
+
+ def saveMaid(self):
+ savePath = QtWidgets.QFileDialog.getSaveFileName(None, 'Save your maid as...', '', 'Text Documents (*.txt);;All files (*.*)')
+ if not savePath[0] == '':
+ starSeparator = '-----------------------------------------------------------------------------------------\n'
+ printList = []
+ printList.append(starSeparator)
+ printList.append('Name: ' + self.liName.text() + '\n')
+ printList.append('Age: ' + str(self.liAge.value()) + '\n')
+ printList.append('Uniform color: ' + self.liUniColor.text() + '\n')
+ printList.append('Eye color: ' + self.liEyeColor.text() + '\n')
+ printList.append('Hair color: ' + self.liHairColor.text() + '\n')
+ printList.append(starSeparator)
+ printList.append('Stats:\n')
+ printList.append('Athletics: ' + str(self.stats[0]) + '\n')
+ printList.append('Affection: ' + str(self.stats[1]) + '\n')
+ printList.append('Skill: ' + str(self.stats[2]) + '\n')
+ printList.append('Cunning: ' + str(self.stats[3]) + '\n')
+ printList.append('Luck: ' + str(self.stats[4]) + '\n')
+ printList.append('Will: ' + str(self.stats[5]) + '\n')
+ printList.append(self.favor.text() + '\n')
+ printList.append(self.spirit.text() + '\n')
+ printList.append(starSeparator)
+ printList.append('Maid types:\n')
+ printList.append(self.liFirstType.currentText() + ': ' + self.liFirstType.toolTip() + '\n')
+ printList.append(self.liSecondType.currentText() + ': ' + self.liSecondType.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Maid powers:\n')
+ printList.append(self.liMP.currentText() + ': ' + self.liMP.toolTip() + '\n')
+ if self.liMP2.isEnabled():
+ printList.append(self.liMP2.currentText() + ': ' + self.liMP2.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Maid root: ' + self.liMaidRoot.currentText() + '\n')
+ printList.append(self.liMaidRoot.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Stress explosion: ' + self.liStress.currentText() + '\n')
+ printList.append(self.liStress.toolTip() + '\n')
+ printList.append(starSeparator)
+ printList.append('Special quailities:\n')
+ printList.append(self.liSpec1.currentText() + ': ' + self.liSpec1.toolTip() + '\n')
+ printList.append(self.liSpec2.currentText() + ': ' + self.liSpec2.toolTip() + '\n')
+ if self.liSpec3.isEnabled():
+ printList.append(self.liSpec3.currentText() + ': ' + self.liSpec3.toolTip() + '\n')
+ if self.liSpec4.isEnabled():
+ printList.append(self.liSpec4.currentText() + ': ' + self.liSpec4.toolTip() + '\n')
+ if self.liSpec5.isEnabled():
+ printList.append(self.liSpec5.currentText() + ': ' + self.liSpec5.toolTip() + '\n')
+ printList.append(starSeparator)
+ if self.liWeapon.isEnabled():
+ printList.append('Weapon: ' + self.liWeapon.currentText() + '\n')
+ printList.append(self.liWeapon.toolTip() + '\n')
+ f = open(savePath[0], 'w+')
+ for line in printList:
+ f.write(line)
+
+ f.close()
+ return
diff --git a/src/modules/masterWidget.py b/src/modules/masterWidget.py
new file mode 100644
index 0000000..bde645a
--- /dev/null
+++ b/src/modules/masterWidget.py
@@ -0,0 +1,677 @@
+"""
+Widget for the random master dock.
+"""
+from random import randint
+from math import floor
+from PyQt5 import QtWidgets, QtCore
+
+class CMasterWidget(QtWidgets.QWidget):
+
+ def __init__(self, data_reader, parent=None):
+ QtWidgets.QWidget.__init__(self, parent)
+ self.data_reader = data_reader
+ self.parent = parent
+
+ self.stats = [0, 0, 0, 0, 0, 0]
+
+ self.loVLayoutMain = QtWidgets.QVBoxLayout()
+ self.loHLayoutMain = QtWidgets.QHBoxLayout()
+
+ self.gbBasic = QtWidgets.QGroupBox('Basics', self)
+ self.loGbBasic = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Name: ')
+ hLayout.addWidget(textLabel)
+ self.liName = QtWidgets.QLineEdit()
+ self.liName.setFixedWidth(200)
+ hLayout.addWidget(self.liName)
+ hLayout.addStretch(1)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Gender: ')
+ hLayout.addWidget(textLabel)
+ self.rbMale = QtWidgets.QRadioButton('Male')
+ self.rbFemale = QtWidgets.QRadioButton('Female')
+ hLayout.addWidget(self.rbMale)
+ hLayout.addWidget(self.rbFemale)
+ self.rbMale.setChecked(True)
+ self.bgGender = QtWidgets.QButtonGroup()
+ self.bgGender.addButton(self.rbMale)
+ self.bgGender.addButton(self.rbFemale)
+ self.bGender = QtWidgets.QPushButton('R')
+ self.bGender.setFixedWidth(50)
+ hLayout.addWidget(self.bGender)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Eye color: ')
+ hLayout.addWidget(textLabel)
+ self.liEyeColor = QtWidgets.QLineEdit()
+ self.liEyeColor.setFixedWidth(150)
+ hLayout.addWidget(self.liEyeColor)
+ self.bEyeColor = QtWidgets.QPushButton('R')
+ self.bEyeColor.setFixedWidth(50)
+ self.bEyeColor.parent = self.liEyeColor
+ hLayout.addWidget(self.bEyeColor)
+ self.loGbBasic.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Hair color: ')
+ hLayout.addWidget(textLabel)
+ self.liHairColor = QtWidgets.QLineEdit()
+ self.liHairColor.setFixedWidth(150)
+ hLayout.addWidget(self.liHairColor)
+ self.bHairColor = QtWidgets.QPushButton('R')
+ self.bHairColor.setFixedWidth(50)
+ self.bHairColor.parent = self.liHairColor
+ hLayout.addWidget(self.bHairColor)
+ self.loGbBasic.addLayout(hLayout)
+ self.gbBasic.setLayout(self.loGbBasic)
+ self.loH1 = QtWidgets.QHBoxLayout()
+ self.loH1.addWidget(self.gbBasic)
+ self.gbMasterType = QtWidgets.QGroupBox('Master Type', self)
+ self.loGbMasterType = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Type: ')
+ hLayout.addWidget(textLabel)
+ self.liMasterType = QtWidgets.QComboBox()
+ self.liMasterType.setFixedWidth(100)
+ self.setMasterTypeComboBox()
+ hLayout.addWidget(self.liMasterType)
+ self.bMT = QtWidgets.QPushButton('R')
+ self.bMT.setFixedWidth(50)
+ hLayout.addWidget(self.bMT)
+ self.loGbMasterType.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Age: ')
+ hLayout.addWidget(textLabel)
+ self.spAge = QtWidgets.QSpinBox()
+ self.spAge.setFixedWidth(50)
+ self.spAge.setMaximum(9999)
+ hLayout.addWidget(self.spAge)
+ self.bAge = QtWidgets.QPushButton('R')
+ self.bAge.setFixedWidth(50)
+ hLayout.addWidget(self.bAge)
+ self.loGbMasterType.addLayout(hLayout)
+ self.laAge = QtWidgets.QLabel('Age dice: ')
+ self.loGbMasterType.addWidget(self.laAge)
+ self.gbMasterType.setLayout(self.loGbMasterType)
+ self.gbMasterType.setFixedHeight(160)
+ self.gbMasterType.setFixedWidth(210)
+ self.loH1.addWidget(self.gbMasterType)
+ self.gbAttri = QtWidgets.QGroupBox('Attributes', self)
+ self.loGbAttri = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('ATH:')
+ textLabel.setToolTip('Athletics: Physical ability, combat ability.')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liATH = QtWidgets.QSpinBox()
+ self.liATH.setFixedWidth(35)
+ hLayout.addWidget(self.liATH, 1, QtCore.Qt.AlignRight)
+ self.bATH = QtWidgets.QPushButton('R')
+ self.bATH.setFixedWidth(50)
+ self.bATH.parent = self.liATH
+ hLayout.addWidget(self.bATH, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('AFF:')
+ textLabel.setToolTip('Affection: How good are you at forming bonds with the maids?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liAFF = QtWidgets.QSpinBox()
+ self.liAFF.setFixedWidth(35)
+ hLayout.addWidget(self.liAFF, 1, QtCore.Qt.AlignRight)
+ self.bAFF = QtWidgets.QPushButton('R')
+ self.bAFF.setFixedWidth(50)
+ self.bAFF.parent = self.liAFF
+ hLayout.addWidget(self.bAFF, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('SKI:')
+ textLabel.setToolTip('Skill: How good are you at your duties?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liSKI = QtWidgets.QSpinBox()
+ self.liSKI.setFixedWidth(35)
+ hLayout.addWidget(self.liSKI, 1, QtCore.Qt.AlignRight)
+ self.bSKI = QtWidgets.QPushButton('R')
+ self.bSKI.setFixedWidth(50)
+ self.bSKI.parent = self.liSKI
+ hLayout.addWidget(self.bSKI, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('CNN:')
+ textLabel.setToolTip('Cunning: How capable are you at tricking enemies and the maids?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liCNN = QtWidgets.QSpinBox()
+ self.liCNN.setFixedWidth(35)
+ hLayout.addWidget(self.liCNN, 1, QtCore.Qt.AlignRight)
+ self.bCNN = QtWidgets.QPushButton('R')
+ self.bCNN.setFixedWidth(50)
+ self.bCNN.parent = self.liCNN
+ hLayout.addWidget(self.bCNN, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('LCK:')
+ textLabel.setToolTip('Luck: Just how lucky are you?')
+ hLayout.addWidget(textLabel, 1, QtCore.Qt.AlignRight)
+ self.liLCK = QtWidgets.QSpinBox()
+ self.liLCK.setFixedWidth(35)
+ hLayout.addWidget(self.liLCK, 1, QtCore.Qt.AlignRight)
+ self.bLCK = QtWidgets.QPushButton('R')
+ self.bLCK.setFixedWidth(50)
+ self.bLCK.parent = self.liLCK
+ hLayout.addWidget(self.bLCK, 1, QtCore.Qt.AlignRight)
+ self.loGbAttri.addLayout(hLayout)
+ textLabel = QtWidgets.QLabel(' WIL: 2')
+ textLabel.setToolTip('Luck: Just how lucky are you?')
+ self.loGbAttri.addWidget(textLabel)
+ textLabel = QtWidgets.QLabel(' Spirit: 20')
+ self.loGbAttri.addWidget(textLabel)
+ self.gbAttri.setLayout(self.loGbAttri)
+ self.gbAttri.setFixedWidth(150)
+ self.gbAttri.setFixedHeight(200)
+ self.loH2 = QtWidgets.QHBoxLayout()
+ self.loH2.addWidget(self.gbAttri)
+ self.gbEtc = QtWidgets.QGroupBox('Etcetera', self)
+ self.loGbEtc = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Master power source: ')
+ hLayout.addWidget(textLabel)
+ self.liMP = QtWidgets.QComboBox()
+ self.liMP.setFixedWidth(130)
+ self.setMasterPowerComboBox(self.liMP)
+ hLayout.addWidget(self.liMP)
+ self.bMP = QtWidgets.QPushButton('R')
+ self.bMP.parent = self.liMP
+ self.bMP.setFixedWidth(50)
+ hLayout.addWidget(self.bMP)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Master power source 2: ')
+ hLayout.addWidget(textLabel)
+ self.liMP2 = QtWidgets.QComboBox()
+ self.liMP2.setFixedWidth(130)
+ self.setMasterPowerComboBox(self.liMP2)
+ hLayout.addWidget(self.liMP2)
+ self.bMP2 = QtWidgets.QPushButton('R')
+ self.bMP2.parent = self.liMP2
+ self.bMP2.setFixedWidth(50)
+ hLayout.addWidget(self.bMP2)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Favorite maid type: ')
+ hLayout.addWidget(textLabel)
+ self.liFavorite = QtWidgets.QComboBox()
+ self.liFavorite.setFixedWidth(130)
+ self.setFavoriteMaidTypeComboBox()
+ hLayout.addWidget(self.liFavorite)
+ self.bFavorite = QtWidgets.QPushButton('R')
+ self.bFavorite.parent = self.liFavorite
+ self.bFavorite.setFixedWidth(50)
+ hLayout.addWidget(self.bFavorite)
+ self.loGbEtc.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ textLabel = QtWidgets.QLabel('Stress explosion: ')
+ hLayout.addWidget(textLabel)
+ self.liStress = QtWidgets.QComboBox()
+ self.setStressExplosionComboBox()
+ self.liStress.setFixedWidth(130)
+ hLayout.addWidget(self.liStress)
+ self.bStress = QtWidgets.QPushButton('R')
+ self.bStress.parent = self.liStress
+ self.bStress.setFixedWidth(50)
+ hLayout.addWidget(self.bStress)
+ self.loGbEtc.addLayout(hLayout)
+ self.gbEtc.setFixedHeight(200)
+ self.gbEtc.setLayout(self.loGbEtc)
+ self.loH2.addWidget(self.gbEtc)
+ self.gbSpec = QtWidgets.QGroupBox('Special Qualities', self)
+ self.loGbSpec = QtWidgets.QVBoxLayout()
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec1 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec1)
+ self.liSpec1.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec1, 10, QtCore.Qt.AlignRight)
+ self.bSpec1 = QtWidgets.QPushButton('R')
+ self.bSpec1.setFixedWidth(50)
+ self.bSpec1.parent = self.liSpec1
+ hLayout.addWidget(self.bSpec1, 0, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.liSpec2 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec2)
+ self.liSpec2.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec2, 10, QtCore.Qt.AlignRight)
+ self.bSpec2 = QtWidgets.QPushButton('R')
+ self.bSpec2.setFixedWidth(50)
+ self.bSpec2.parent = self.liSpec2
+ hLayout.addWidget(self.bSpec2, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec3 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec3, 1, QtCore.Qt.AlignRight)
+ self.liSpec3 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec3)
+ self.liSpec3.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec3, 1, QtCore.Qt.AlignRight)
+ self.bSpec3 = QtWidgets.QPushButton('R')
+ self.bSpec3.setFixedWidth(50)
+ self.bSpec3.parent = self.liSpec3
+ self.cbSpec3.button = self.bSpec3
+ self.cbSpec3.box = self.liSpec3
+ hLayout.addWidget(self.bSpec3, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec4 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec4, 1, QtCore.Qt.AlignRight)
+ self.liSpec4 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec4)
+ self.liSpec4.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec4, 1, QtCore.Qt.AlignRight)
+ self.bSpec4 = QtWidgets.QPushButton('R')
+ self.bSpec4.setFixedWidth(50)
+ self.bSpec4.parent = self.liSpec4
+ self.cbSpec4.button = self.bSpec4
+ self.cbSpec4.box = self.liSpec4
+ hLayout.addWidget(self.bSpec4, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ hLayout = QtWidgets.QHBoxLayout()
+ self.cbSpec5 = QtWidgets.QCheckBox()
+ hLayout.addWidget(self.cbSpec5, 1, QtCore.Qt.AlignRight)
+ self.liSpec5 = QtWidgets.QComboBox()
+ self.setSpecialQualityComboBox(self.liSpec5)
+ self.liSpec5.setFixedWidth(150)
+ hLayout.addWidget(self.liSpec5, 1, QtCore.Qt.AlignRight)
+ self.bSpec5 = QtWidgets.QPushButton('R')
+ self.bSpec5.setFixedWidth(50)
+ self.bSpec5.parent = self.liSpec5
+ self.cbSpec5.button = self.bSpec5
+ self.cbSpec5.box = self.liSpec5
+ hLayout.addWidget(self.bSpec5, 1, QtCore.Qt.AlignRight)
+ self.loGbSpec.addLayout(hLayout)
+
+ self.gbSpec.setLayout(self.loGbSpec)
+ self.loH3 = QtWidgets.QHBoxLayout()
+ self.loH3.addWidget(self.gbSpec)
+
+ self.gbTrauma = QtWidgets.QGroupBox('Trauma', self)
+ self.loGbTrauma = QtWidgets.QVBoxLayout()
+ self.cbEnableTrauma = QtWidgets.QCheckBox('Enable trauma')
+ self.loGbTrauma.addWidget(self.cbEnableTrauma)
+ self.liTrauma = QtWidgets.QComboBox()
+ self.setTraumaComboBox()
+ self.loGbTrauma.addWidget(self.liTrauma)
+ self.bTrauma = QtWidgets.QPushButton('R')
+ self.loGbTrauma.addWidget(self.bTrauma)
+ self.cbEnableTrauma.button = self.bTrauma
+ self.cbEnableTrauma.box = self.liTrauma
+ self.gbTrauma.setLayout(self.loGbTrauma)
+ self.gbTrauma.setFixedWidth(150)
+ self.loH3.addWidget(self.gbTrauma)
+
+ self.gbSave = QtWidgets.QGroupBox('Generate and save', self)
+ self.loGbSave = QtWidgets.QVBoxLayout()
+ self.bRollAll = QtWidgets.QPushButton('GENERATE\nMASTER', self)
+ self.loGbSave.addWidget(self.bRollAll)
+ self.bSave = QtWidgets.QPushButton('SAVE', self)
+ self.loGbSave.addWidget(self.bSave)
+ self.gbSave.setLayout(self.loGbSave)
+ self.gbSave.setFixedWidth(120)
+ self.loH3.addWidget(self.gbSave)
+
+ self.loVLayoutMain.addLayout(self.loH1)
+ self.loVLayoutMain.addLayout(self.loH2)
+ self.loVLayoutMain.addLayout(self.loH3)
+ self.loHLayoutMain.addLayout(self.loVLayoutMain)
+ self.setLayout(self.loHLayoutMain)
+
+ self.setEnabilities()
+ self.cbEnableTrauma.clicked.connect(self.setEnabilities)
+ self.cbSpec3.clicked.connect(self.setEnabilities)
+ self.cbSpec4.clicked.connect(self.setEnabilities)
+ self.cbSpec5.clicked.connect(self.setEnabilities)
+ self.bHairColor.clicked.connect(self.generateMaidColor)
+ self.bEyeColor.clicked.connect(self.generateMaidColor)
+ self.bGender.clicked.connect(self.generateGender)
+ self.bATH.clicked.connect(self.generateAttribute)
+ self.bAFF.clicked.connect(self.generateAttribute)
+ self.bSKI.clicked.connect(self.generateAttribute)
+ self.bCNN.clicked.connect(self.generateAttribute)
+ self.bLCK.clicked.connect(self.generateAttribute)
+ self.bMT.clicked.connect(self.generateMasterType)
+ self.bAge.clicked.connect(self.generateAge)
+ self.bMP.clicked.connect(self.generateMasterPower)
+ self.bMP2.clicked.connect(self.generateMasterPower)
+ self.bStress.clicked.connect(self.generateStressExplosion)
+ self.bFavorite.clicked.connect(self.generateFavoriteMaidType)
+ self.bSpec1.clicked.connect(self.generateSpecialQuality)
+ self.bSpec2.clicked.connect(self.generateSpecialQuality)
+ self.bSpec3.clicked.connect(self.generateSpecialQuality)
+ self.bSpec4.clicked.connect(self.generateSpecialQuality)
+ self.bSpec5.clicked.connect(self.generateSpecialQuality)
+ self.bTrauma.clicked.connect(self.generateTrauma)
+ self.liMasterType.currentIndexChanged.connect(self.changedMasterType)
+ self.liMP.currentIndexChanged.connect(self.changedMasterPower)
+ self.liMP2.currentIndexChanged.connect(self.changedMasterPower)
+ self.liStress.currentIndexChanged.connect(self.changedStressExplosion)
+ self.liFavorite.currentIndexChanged.connect(self.changedFavoriteMaidType)
+ self.liSpec1.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec2.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec3.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec4.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.liSpec5.currentIndexChanged.connect(self.changedSpecialQuailty)
+ self.bRollAll.clicked.connect(self.generateMaster)
+ self.bSave.clicked.connect(self.saveMaster)
+
+ def setEnabilities(self):
+ for checkb in [self.cbEnableTrauma, self.cbSpec3, self.cbSpec4, self.cbSpec5]:
+ if not checkb.isChecked():
+ checkb.button.setEnabled(False)
+ checkb.box.setEnabled(False)
+ checkb.box.setCurrentIndex(-1)
+ else:
+ checkb.button.setEnabled(True)
+ checkb.box.setEnabled(True)
+
+ def generateMaidColor(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled color...', 1500)
+ caller.parent.setText(self.data_reader.get_random_color())
+
+ def generateGender(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled gender...', 1500)
+ i = randint(0, 1)
+ if i == 0:
+ self.rbMale.setChecked(True)
+ else:
+ self.rbFemale.setChecked(True)
+
+ def generateAttribute(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled attribute...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ retVal = int(floor((x + y) / 4))
+ caller.parent.setValue(retVal)
+
+ def generateMasterType(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled master type...', 1500)
+ i = randint(0, 5)
+ self.liMasterType.setCurrentIndex(i)
+
+ def generateAge(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled age...', 1500)
+ self.spAge.setValue(self.data_reader.generate_master_age(self.liMasterType.currentIndex()))
+
+ def generateMasterPower(self, caller=False):
+ if caller == False:
+ caller = self.sender()
+ self.parent.parent.statusBar().showMessage('Rolled master power...', 1500)
+ x = randint(1, 6)
+ y = randint(1, 6)
+ i = x + y - 2
+ caller.parent.setCurrentIndex(i)
+
+ def generateStressExplosion(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled stress explosion...', 1500)
+ i = randint(0, 17)
+ self.liStress.setCurrentIndex(i)
+
+ def generateFavoriteMaidType(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled favorite maid type...', 1500)
+ i = randint(0, 5)
+ self.liFavorite.setCurrentIndex(i)
+
+ def generateTrauma(self, hideMessage=False):
+ if not hideMessage:
+ self.parent.parent.statusBar().showMessage('Rolled trauma...', 1500)
+ i = randint(0, 35)
+ self.liTrauma.setCurrentIndex(i)
+
+ def generateSpecialQuality(self, caller=False):
+ onlySecondary = False
+ allowed2Go = True
+ inWhichTable = 0
+ if caller == False:
+ if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
+ onlySecondary = True
+ caller = self.sender()
+ if onlySecondary:
+ if caller.parent.currentIndex() < 35:
+ allowed2Go = False
+ if allowed2Go:
+ self.parent.parent.statusBar().showMessage('Rolled special quality...', 1500)
+ if caller.parent.currentIndex() < 36:
+ inWhichTable = 1
+ elif caller.parent.currentIndex() < 55:
+ inWhichTable = 2
+ else:
+ inWhichTable = 3
+ if allowed2Go:
+ if inWhichTable == 1:
+ i = -1
+ if not onlySecondary:
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+ if i == 35:
+ i = randint(37, 54)
+ caller.parent.setCurrentIndex(i)
+ i = randint(56, 61)
+ caller.parent.setCurrentIndex(i)
+ elif caller.parent.currentIndex() == 35:
+ i = randint(37, 54)
+ caller.parent.setCurrentIndex(i)
+ elif inWhichTable == 2:
+ i = -1
+ if not onlySecondary:
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+ else:
+ i = randint(56, 61)
+ caller.parent.setCurrentIndex(i)
+ elif inWhichTable == 3:
+ i = -1
+ if not onlySecondary:
+ i = randint(0, 35)
+ caller.parent.setCurrentIndex(i)
+ else:
+ i = randint(56, 61)
+ caller.parent.setCurrentIndex(i)
+
+ def changedMasterType(self):
+ ii = self.liMasterType.currentIndex()
+ type_of_master = self.data_reader.data["master"]["types"][ii]
+ self.liMasterType.setToolTip(type_of_master[1])
+ self.laAge.setText('Age dice: {}'.format(type_of_master[2]))
+ self.spAge.setValue(self.data_reader.generate_master_age(ii))
+
+ def changedMasterPower(self, caller=False):
+ comboBox = self.sender()
+ comboBox.setToolTip(self.data_reader.data["master"]["powers"][comboBox.currentIndex()][1])
+
+ def changedStressExplosion(self):
+ self.liStress.setToolTip(self.data_reader.data["common"]["stress_explosions"][self.liStress.currentIndex()][1])
+
+ def changedFavoriteMaidType(self):
+ elem = self.data_reader.data["maid"]["types"][self.liFavorite.currentIndex()]
+ self.liFavorite.setToolTip(elem[1])
+
+ def changedSpecialQuailty(self):
+ comboBox = self.sender()
+ if comboBox.currentIndex() < 36:
+ if not comboBox.currentIndex() == -1:
+ if comboBox.count() > 36:
+ for i in range(26):
+ comboBox.removeItem(36)
+
+ elem = self.data_reader.data["master"]["qualities"][comboBox.currentIndex()]
+ comboBox.setToolTip(elem[1])
+ if comboBox.currentIndex() == 35:
+ comboBox.setStyleSheet('color: olive')
+ comboBox.insertSeparator(36)
+ for elem in reversed(self.data_reader.data["maid"]["qualities"][18:]):
+ comboBox.insertItem(37, elem[0])
+
+ else:
+ comboBox.setStyleSheet('color: black')
+ else:
+ comboBox.setStyleSheet('color: black')
+ comboBox.setToolTip('')
+ elif comboBox.currentIndex() < 55:
+ comboBox.setStyleSheet('color: olive')
+ for i in range(7):
+ comboBox.removeItem(55)
+
+ comboBox.insertSeparator(55)
+ elem = self.data_reader.data["maid"]["qualities"][18:][(comboBox.currentIndex() - 37)]
+ comboBox.setToolTip(elem[1])
+ comboBox.previousIndex = comboBox.currentIndex()
+ for item in reversed(elem[2]):
+ comboBox.insertItem(56, item[0])
+
+ else:
+ comboBox.setStyleSheet('color: black')
+ item = self.data_reader.data["maid"]["qualities"][18:][(comboBox.previousIndex - 37)][2][(comboBox.currentIndex() - 56)]
+ comboBox.setToolTip(item[1])
+
+ def setMasterTypeComboBox(self):
+ for elem in self.data_reader.data["master"]["types"]:
+ self.liMasterType.insertItem(100, elem[0])
+
+ self.liMasterType.setCurrentIndex(-1)
+
+ def setMasterPowerComboBox(self, comboBox):
+ for elem in self.data_reader.data["master"]["powers"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def setStressExplosionComboBox(self):
+ for elem in self.data_reader.data["common"]["stress_explosions"]:
+ self.liStress.insertItem(100, elem[0])
+
+ self.liStress.setCurrentIndex(-1)
+
+ def setFavoriteMaidTypeComboBox(self):
+ for elem in self.data_reader.data["maid"]["types"]:
+ self.liFavorite.insertItem(100, elem[0])
+
+ self.liFavorite.setCurrentIndex(-1)
+
+ def setSpecialQualityComboBox(self, comboBox):
+ for elem in self.data_reader.data["master"]["qualities"]:
+ comboBox.insertItem(100, elem[0])
+
+ comboBox.setCurrentIndex(-1)
+
+ def setTraumaComboBox(self):
+ for elem in self.data_reader.data["master"]["traumas"]:
+ self.liTrauma.insertItem(100, elem)
+
+ self.liTrauma.setCurrentIndex(-1)
+
+ def generateMaster(self):
+ self.generateGender(True)
+ self.generateMaidColor(self.bEyeColor)
+ self.generateMaidColor(self.bHairColor)
+ self.generateAttribute(self.bATH)
+ self.generateAttribute(self.bAFF)
+ self.generateAttribute(self.bSKI)
+ self.generateAttribute(self.bCNN)
+ self.generateAttribute(self.bLCK)
+ self.generateMasterPower(self.bMP)
+ self.generateMasterPower(self.bMP2)
+ self.generateFavoriteMaidType(True)
+ self.generateMasterType(True)
+ self.generateStressExplosion(True)
+ self.generateSpecialQuality(self.bSpec1)
+ self.generateSpecialQuality(self.bSpec2)
+ if self.bSpec3.isEnabled():
+ self.generateSpecialQuality(self.bSpec3)
+ if self.bSpec4.isEnabled():
+ self.generateSpecialQuality(self.bSpec4)
+ if self.bSpec5.isEnabled():
+ self.generateSpecialQuality(self.bSpec5)
+ if self.bTrauma.isEnabled():
+ self.generateTrauma(True)
+
+ def saveMaster(self):
+ savePath = QtWidgets.QFileDialog.getSaveFileName(None, 'Save your master as...', '', 'Text Documents (*.txt);;All files (*.*)')
+ if not savePath[0] == '':
+ starSeparator = '-----------------------------------------------------------------------------------------\n'
+ printList = []
+ printList.append(starSeparator)
+ printList.append('Name: ' + self.liName.text() + '\n')
+ printList.append('Age: ' + str(self.spAge.value()) + '\n')
+ genderText = 'male'
+ if self.rbFemale.isChecked():
+ genderText = 'female'
+ printList.append('Gender: ' + genderText + '\n')
+ printList.append('Eye color: ' + self.liEyeColor.text() + '\n')
+ printList.append('Hair color: ' + self.liHairColor.text() + '\n')
+ printList.append(starSeparator)
+ printList.append('Stats:\n')
+ printList.append('Athletics: ' + str(self.liATH.value()) + '\n')
+ printList.append('Affection: ' + str(self.liAFF.value()) + '\n')
+ printList.append('Skill: ' + str(self.liSKI.value()) + '\n')
+ printList.append('Cunning: ' + str(self.liCNN.value()) + '\n')
+ printList.append('Luck: ' + str(self.liLCK.value()) + '\n')
+ printList.append('Will: 2\n')
+ printList.append('Spirit: 20\n')
+ printList.append(starSeparator)
+ printList.append('Master type:' + self.liMasterType.currentText() + '\n')
+ printList.append(self.liMasterType.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Master powers:\n')
+ printList.append(self.liMP.currentText() + ': ' + self.liMP.toolTip() + '\n')
+ printList.append(self.liMP2.currentText() + ': ' + self.liMP2.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Favorite maid type: ' + self.liFavorite.currentText() + '\n')
+ printList.append(self.liFavorite.toolTip() + '\n')
+ printList.append('\n')
+ printList.append('Stress explosion: ' + self.liStress.currentText() + '\n')
+ printList.append(self.liStress.toolTip() + '\n')
+ printList.append(starSeparator)
+ printList.append('Special quailities:\n')
+ printList.append(self.liSpec1.currentText() + ': ' + self.liSpec1.toolTip() + '\n')
+ printList.append(self.liSpec2.currentText() + ': ' + self.liSpec2.toolTip() + '\n')
+ if self.liSpec3.isEnabled():
+ printList.append(self.liSpec3.currentText() + ': ' + self.liSpec3.toolTip() + '\n')
+ if self.liSpec4.isEnabled():
+ printList.append(self.liSpec4.currentText() + ': ' + self.liSpec4.toolTip() + '\n')
+ if self.liSpec5.isEnabled():
+ printList.append(self.liSpec5.currentText() + ': ' + self.liSpec5.toolTip() + '\n')
+ printList.append(starSeparator)
+ if self.liTrauma.isEnabled():
+ printList.append('Trauma: ' + self.liTrauma.currentText() + '\n')
+ printList.append(self.liTrauma.toolTip() + '\n')
+ f = open(savePath[0], 'w+')
+ for line in printList:
+ f.write(line)
+
+ f.close()
+ return