add basic Generalized Gamma for alpha relaxation

This commit is contained in:
Dominik Demuth 2024-09-07 19:19:02 +02:00
parent f30ff3b758
commit f94f78893c
13 changed files with 1592 additions and 335 deletions

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/_ui/datawidget.ui'
# Form implementation generated from reading ui file './nmreval/src/resources/_ui/datawidget.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING! All changes made in this file will be lost!
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
@ -49,6 +50,12 @@ class Ui_DataWidget(object):
self.horizontalLayout.addWidget(self.func_toolButton)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.pokemon_toolbutton = QtWidgets.QToolButton(self.frame)
self.pokemon_toolbutton.setText("")
self.pokemon_toolbutton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
self.pokemon_toolbutton.setAutoRaise(True)
self.pokemon_toolbutton.setObjectName("pokemon_toolbutton")
self.horizontalLayout.addWidget(self.pokemon_toolbutton)
self.verticalLayout_2.addWidget(self.frame)
self.retranslateUi(DataWidget)

254
src/gui_qt/_py/pokeentry.py Normal file
View File

@ -0,0 +1,254 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled2.ui'
#
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(640, 642)
self.verticalLayout_4 = QtWidgets.QVBoxLayout(Form)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.artwork_label = QtWidgets.QLabel(Form)
self.artwork_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.artwork_label.setObjectName("artwork_label")
self.verticalLayout_4.addWidget(self.artwork_label)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setVerticalSpacing(12)
self.gridLayout.setObjectName("gridLayout")
self.label_4 = QtWidgets.QLabel(Form)
self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.type1_label = QtWidgets.QLabel(Form)
self.type1_label.setObjectName("type1_label")
self.verticalLayout_2.addWidget(self.type1_label)
self.type2_label = QtWidgets.QLabel(Form)
self.type2_label.setObjectName("type2_label")
self.verticalLayout_2.addWidget(self.type2_label)
self.gridLayout.addLayout(self.verticalLayout_2, 2, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(Form)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 7, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(Form)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 4, 0, 1, 1)
self.height_label = QtWidgets.QLabel(Form)
self.height_label.setObjectName("height_label")
self.gridLayout.addWidget(self.height_label, 4, 1, 1, 1)
self.weight_label = QtWidgets.QLabel(Form)
self.weight_label.setObjectName("weight_label")
self.gridLayout.addWidget(self.weight_label, 5, 1, 1, 1)
self.label_1 = QtWidgets.QLabel(Form)
self.label_1.setObjectName("label_1")
self.gridLayout.addWidget(self.label_1, 1, 0, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.ability1_label = QtWidgets.QLabel(Form)
self.ability1_label.setObjectName("ability1_label")
self.verticalLayout.addWidget(self.ability1_label)
self.ability2_label = QtWidgets.QLabel(Form)
self.ability2_label.setObjectName("ability2_label")
self.verticalLayout.addWidget(self.ability2_label)
self.ability3_label = QtWidgets.QLabel(Form)
self.ability3_label.setObjectName("ability3_label")
self.verticalLayout.addWidget(self.ability3_label)
self.gridLayout.addLayout(self.verticalLayout, 3, 1, 1, 1)
self.species_label = QtWidgets.QLabel(Form)
self.species_label.setObjectName("species_label")
self.gridLayout.addWidget(self.species_label, 1, 1, 1, 1)
self.label_5 = QtWidgets.QLabel(Form)
self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
self.gender_label = QtWidgets.QLabel(Form)
self.gender_label.setObjectName("gender_label")
self.gridLayout.addWidget(self.gender_label, 6, 0, 1, 2)
self.label = QtWidgets.QLabel(Form)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.nationaldex_label = QtWidgets.QLabel(Form)
self.nationaldex_label.setObjectName("nationaldex_label")
self.gridLayout.addWidget(self.nationaldex_label, 0, 1, 1, 1)
self.verticalLayout_4.addLayout(self.gridLayout)
self.groupBox = QtWidgets.QGroupBox(Form)
self.groupBox.setFlat(True)
self.groupBox.setObjectName("groupBox")
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox)
self.gridLayout_4.setContentsMargins(3, 3, 3, 3)
self.gridLayout_4.setObjectName("gridLayout_4")
self.spec_attack_bar = QtWidgets.QProgressBar(self.groupBox)
self.spec_attack_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.spec_attack_bar.setMaximum(194)
self.spec_attack_bar.setProperty("value", 24)
self.spec_attack_bar.setObjectName("spec_attack_bar")
self.gridLayout_4.addWidget(self.spec_attack_bar, 0, 3, 1, 1)
self.label_8 = QtWidgets.QLabel(self.groupBox)
self.label_8.setObjectName("label_8")
self.gridLayout_4.addWidget(self.label_8, 0, 2, 1, 1)
self.spec_defense_bar = QtWidgets.QProgressBar(self.groupBox)
self.spec_defense_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.spec_defense_bar.setMaximum(250)
self.spec_defense_bar.setProperty("value", 24)
self.spec_defense_bar.setObjectName("spec_defense_bar")
self.gridLayout_4.addWidget(self.spec_defense_bar, 1, 3, 1, 1)
self.label_6 = QtWidgets.QLabel(self.groupBox)
self.label_6.setFrameShadow(QtWidgets.QFrame.Plain)
self.label_6.setObjectName("label_6")
self.gridLayout_4.addWidget(self.label_6, 0, 0, 1, 1)
self.hp_bar = QtWidgets.QProgressBar(self.groupBox)
self.hp_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.hp_bar.setMaximum(255)
self.hp_bar.setProperty("value", 24)
self.hp_bar.setObjectName("hp_bar")
self.gridLayout_4.addWidget(self.hp_bar, 0, 1, 1, 1)
self.speed_bar = QtWidgets.QProgressBar(self.groupBox)
self.speed_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.speed_bar.setMaximum(200)
self.speed_bar.setProperty("value", 24)
self.speed_bar.setObjectName("speed_bar")
self.gridLayout_4.addWidget(self.speed_bar, 2, 3, 1, 1)
self.label_11 = QtWidgets.QLabel(self.groupBox)
self.label_11.setObjectName("label_11")
self.gridLayout_4.addWidget(self.label_11, 2, 2, 1, 1)
self.label_10 = QtWidgets.QLabel(self.groupBox)
self.label_10.setObjectName("label_10")
self.gridLayout_4.addWidget(self.label_10, 1, 2, 1, 1)
self.defense_bar = QtWidgets.QProgressBar(self.groupBox)
self.defense_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.defense_bar.setMaximum(250)
self.defense_bar.setProperty("value", 24)
self.defense_bar.setObjectName("defense_bar")
self.gridLayout_4.addWidget(self.defense_bar, 2, 1, 1, 1)
self.attack_bar = QtWidgets.QProgressBar(self.groupBox)
self.attack_bar.setStyleSheet("QProgressBar{\n"
" border: none;\n"
" background-color: transparent;\n"
" text-align: center;\n"
"}\n"
"\n"
"QProgressBar::chunk {\n"
" background-color: #009cda;\n"
" border-radius: 3px;\n"
"}")
self.attack_bar.setMaximum(190)
self.attack_bar.setProperty("value", 24)
self.attack_bar.setObjectName("attack_bar")
self.gridLayout_4.addWidget(self.attack_bar, 1, 1, 1, 1)
self.label_7 = QtWidgets.QLabel(self.groupBox)
self.label_7.setObjectName("label_7")
self.gridLayout_4.addWidget(self.label_7, 1, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.groupBox)
self.label_9.setObjectName("label_9")
self.gridLayout_4.addWidget(self.label_9, 2, 0, 1, 1)
self.verticalLayout_4.addWidget(self.groupBox)
self.groupBox_2 = QtWidgets.QGroupBox(Form)
self.groupBox_2.setFlat(True)
self.groupBox_2.setCheckable(False)
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout_3.setContentsMargins(3, 3, 3, 3)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.evolution_bar = QtWidgets.QLabel(self.groupBox_2)
self.evolution_bar.setFrameShape(QtWidgets.QFrame.NoFrame)
self.evolution_bar.setFrameShadow(QtWidgets.QFrame.Raised)
self.evolution_bar.setLineWidth(0)
self.evolution_bar.setObjectName("evolution_bar")
self.verticalLayout_3.addWidget(self.evolution_bar)
self.verticalLayout_4.addWidget(self.groupBox_2)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.artwork_label.setText(_translate("Form", "TextLabel"))
self.label_4.setText(_translate("Form", "Type"))
self.type1_label.setText(_translate("Form", "TextLabel"))
self.type2_label.setText(_translate("Form", "TextLabel"))
self.label_3.setText(_translate("Form", "Weight"))
self.label_2.setText(_translate("Form", "Height"))
self.height_label.setText(_translate("Form", "0.0 m"))
self.weight_label.setText(_translate("Form", "0.0 kg"))
self.label_1.setText(_translate("Form", "Species"))
self.ability1_label.setText(_translate("Form", "TextLabel"))
self.ability2_label.setText(_translate("Form", "TextLabel"))
self.ability3_label.setText(_translate("Form", "TextLabel"))
self.species_label.setText(_translate("Form", "TextLabel"))
self.label_5.setText(_translate("Form", "Abilities"))
self.gender_label.setText(_translate("Form", "TextLabel"))
self.label.setText(_translate("Form", "National No."))
self.nationaldex_label.setText(_translate("Form", "TextLabel"))
self.groupBox.setTitle(_translate("Form", "Stats"))
self.spec_attack_bar.setFormat(_translate("Form", "%v"))
self.label_8.setText(_translate("Form", "Special Attack"))
self.spec_defense_bar.setFormat(_translate("Form", "%v"))
self.label_6.setText(_translate("Form", "HP"))
self.hp_bar.setFormat(_translate("Form", "%v"))
self.speed_bar.setFormat(_translate("Form", "%v"))
self.label_11.setText(_translate("Form", "Speed"))
self.label_10.setText(_translate("Form", "Special Defense"))
self.defense_bar.setFormat(_translate("Form", "%v"))
self.attack_bar.setFormat(_translate("Form", "%v"))
self.label_7.setText(_translate("Form", "Attack"))
self.label_9.setText(_translate("Form", "Defense"))
self.groupBox_2.setTitle(_translate("Form", "Evolution chain"))
self.evolution_bar.setText(_translate("Form", "TextLabel"))

View File

@ -1,118 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/_ui/pokemon.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(400, 359)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth())
Dialog.setSizePolicy(sizePolicy)
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidget = QtWidgets.QTabWidget(Dialog)
self.tabWidget.setObjectName("tabWidget")
self.verticalLayout.addWidget(self.tabWidget)
self.formLayout = QtWidgets.QFormLayout()
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(Dialog)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.pokedex_nr = QtWidgets.QLabel(Dialog)
self.pokedex_nr.setObjectName("pokedex_nr")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.pokedex_nr)
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
self.name = QtWidgets.QComboBox(Dialog)
self.name.setObjectName("name")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.name)
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
self.category = QtWidgets.QLabel(Dialog)
self.category.setObjectName("category")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.category)
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.poketype = QtWidgets.QLabel(Dialog)
self.poketype.setObjectName("poketype")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.poketype)
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setObjectName("label_5")
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_5)
self.height = QtWidgets.QLabel(Dialog)
self.height.setObjectName("height")
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.height)
self.label_6 = QtWidgets.QLabel(Dialog)
self.label_6.setObjectName("label_6")
self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_6)
self.weight = QtWidgets.QLabel(Dialog)
self.weight.setObjectName("weight")
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.weight)
self.label_7 = QtWidgets.QLabel(Dialog)
self.label_7.setObjectName("label_7")
self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.label_7)
self.color = QtWidgets.QLabel(Dialog)
self.color.setObjectName("color")
self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.color)
self.label_8 = QtWidgets.QLabel(Dialog)
self.label_8.setObjectName("label_8")
self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_8)
self.info = QtWidgets.QLabel(Dialog)
self.info.setObjectName("info")
self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.info)
self.verticalLayout.addLayout(self.formLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.prev_button = QtWidgets.QToolButton(Dialog)
self.prev_button.setObjectName("prev_button")
self.horizontalLayout_2.addWidget(self.prev_button)
self.next_button = QtWidgets.QToolButton(Dialog)
self.next_button.setObjectName("next_button")
self.horizontalLayout_2.addWidget(self.next_button)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Retry)
self.buttonBox.setCenterButtons(False)
self.buttonBox.setObjectName("buttonBox")
self.horizontalLayout_2.addWidget(self.buttonBox)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.label_2.setBuddy(self.name)
self.retranslateUi(Dialog)
self.tabWidget.setCurrentIndex(-1)
self.buttonBox.rejected.connect(Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Random Pokémon"))
self.label.setText(_translate("Dialog", "National-Dex"))
self.pokedex_nr.setText(_translate("Dialog", "TextLabel"))
self.label_2.setText(_translate("Dialog", "Name"))
self.label_3.setText(_translate("Dialog", "Kategorie"))
self.category.setText(_translate("Dialog", "TextLabel"))
self.label_4.setText(_translate("Dialog", "Typ"))
self.poketype.setText(_translate("Dialog", "TextLabel"))
self.label_5.setText(_translate("Dialog", "Größe"))
self.height.setText(_translate("Dialog", "TextLabel"))
self.label_6.setText(_translate("Dialog", "Gewicht"))
self.weight.setText(_translate("Dialog", "TextLabel"))
self.label_7.setText(_translate("Dialog", "Farbe"))
self.color.setText(_translate("Dialog", "TextLabel"))
self.label_8.setText(_translate("Dialog", "Mehr..."))
self.info.setText(_translate("Dialog", "TextLabel"))
self.prev_button.setText(_translate("Dialog", "Prev."))
self.next_button.setText(_translate("Dialog", "Next"))

View File

@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './nmreval/src/resources/_ui/pokewindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1526, 991)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.comboBox = QtWidgets.QComboBox(Dialog)
self.comboBox.setObjectName("comboBox")
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
self.comboBox_2 = QtWidgets.QComboBox(Dialog)
self.comboBox_2.setObjectName("comboBox_2")
self.gridLayout.addWidget(self.comboBox_2, 0, 0, 1, 1)
self.splitter = QtWidgets.QSplitter(Dialog)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName("splitter")
self.tableWidget_2 = QtWidgets.QTableWidget(self.splitter)
self.tableWidget_2.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.tableWidget_2.setAlternatingRowColors(True)
self.tableWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.tableWidget_2.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.tableWidget_2.setShowGrid(False)
self.tableWidget_2.setGridStyle(QtCore.Qt.NoPen)
self.tableWidget_2.setObjectName("tableWidget_2")
self.tableWidget_2.setColumnCount(13)
self.tableWidget_2.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(7, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(8, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(9, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(10, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(11, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(12, item)
self.tableWidget_2.horizontalHeader().setDefaultSectionSize(80)
self.tableWidget_2.horizontalHeader().setStretchLastSection(False)
self.tableWidget_2.verticalHeader().setVisible(False)
self.tabWidget = QtWidgets.QTabWidget(self.splitter)
self.tabWidget.setObjectName("tabWidget")
self.gridLayout.addWidget(self.splitter, 2, 0, 1, 2)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2)
self.retranslateUi(Dialog)
self.tabWidget.setCurrentIndex(-1)
self.buttonBox.rejected.connect(Dialog.close) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Gotta catch \'em all!"))
self.tableWidget_2.setSortingEnabled(True)
item = self.tableWidget_2.horizontalHeaderItem(0)
item.setText(_translate("Dialog", "#"))
item = self.tableWidget_2.horizontalHeaderItem(1)
item.setText(_translate("Dialog", "Pokemon"))
item = self.tableWidget_2.horizontalHeaderItem(2)
item.setText(_translate("Dialog", "Type"))
item = self.tableWidget_2.horizontalHeaderItem(3)
item.setText(_translate("Dialog", "Total"))
item = self.tableWidget_2.horizontalHeaderItem(4)
item.setText(_translate("Dialog", "HP"))
item.setToolTip(_translate("Dialog", "Hit Points; Kraftpunkte"))
item = self.tableWidget_2.horizontalHeaderItem(5)
item.setText(_translate("Dialog", "Attack"))
item.setToolTip(_translate("Dialog", "Attacke"))
item = self.tableWidget_2.horizontalHeaderItem(6)
item.setText(_translate("Dialog", "Defense"))
item.setToolTip(_translate("Dialog", "Verteidigung"))
item = self.tableWidget_2.horizontalHeaderItem(7)
item.setText(_translate("Dialog", "Sp. Attack"))
item.setToolTip(_translate("Dialog", "Special Attack; Spezial-Attacke"))
item = self.tableWidget_2.horizontalHeaderItem(8)
item.setText(_translate("Dialog", "Sp. Defense"))
item.setToolTip(_translate("Dialog", "Special Defense; Spezial-Verteidigung"))
item = self.tableWidget_2.horizontalHeaderItem(9)
item.setText(_translate("Dialog", "Speed"))
item.setToolTip(_translate("Dialog", "Initiative"))
item = self.tableWidget_2.horizontalHeaderItem(10)
item.setText(_translate("Dialog", "Height"))
item.setToolTip(_translate("Dialog", "Größe"))
item = self.tableWidget_2.horizontalHeaderItem(11)
item.setText(_translate("Dialog", "Weight"))
item.setToolTip(_translate("Dialog", "Gewicht"))
item = self.tableWidget_2.horizontalHeaderItem(12)
item.setText(_translate("Dialog", "BMI"))
item.setToolTip(_translate("Dialog", "Body-Mass-Index"))

View File

@ -584,6 +584,8 @@ class DataWidget(QtWidgets.QWidget, Ui_DataWidget):
self.propwidget.expansionChanged.connect(self.show_property)
self.proptable.propertyChanged.connect(self.change_property)
self.pokemon_toolbutton.clicked.connect(self.catchthemall)
make_action_icons(self)
def add_graph(self, idd: str, name: str):
@ -645,6 +647,12 @@ class DataWidget(QtWidgets.QWidget, Ui_DataWidget):
def set_name(self, sid, value):
self.tree.set_name(sid, value)
def catchthemall(self):
from gui_qt.lib.pokemon import QPoke
dialog = QPoke( parent=self)
dialog.exec()
@property
def management(self):
return self.tree.management

535
src/gui_qt/lib/pokemon.py Normal file
View File

@ -0,0 +1,535 @@
import sqlite3
import urllib.request
from functools import cache
from PyQt5 import QtWidgets, QtGui, QtCore
from .._py.pokewindow import Ui_Dialog
from .._py.pokeentry import Ui_Form
def get_connection(db):
connection = sqlite3.connect(db)
connection.row_factory = sqlite3.Row
return connection
class QPoke(QtWidgets.QDialog, Ui_Dialog):
types = {None: ('', '')}
stats = {}
def __init__(self, parent=None):
super().__init__(parent=parent)
from importlib.resources import path
with path('resources', 'pokemon.sqlite') as fp:
self._db = str(fp)
PokemonEntry._db = str(fp)
self.setupUi(self)
self._fetch_names()
self.add_pokedexes()
self.tableWidget_2.itemSelectionChanged.connect(self.show_pokemon)
self.comboBox_2.currentIndexChanged.connect(self.collect_pokemon)
self.comboBox.currentIndexChanged.connect(self.collect_pokemon)
self.collect_pokemon()
def _fetch_names(self):
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute(
'SELECT * FROM types'
)
self.comboBox.addItem('All types', -1)
for entry in cursor.fetchall():
self.types[entry['id']] = (entry['name_de'], entry['name_en'])
self.comboBox.addItem(entry['name_en'], entry['id'])
connection.close()
def add_pokedexes(self):
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute('SELECT * FROM pokedex_list')
for entry in cursor.fetchall():
self.comboBox_2.addItem(entry['name_en'], entry['id'])
connection.close()
def fill_list(self, idx: int = 0):
pokedex_id = self.comboBox_2.itemData(idx, QtCore.Qt.ItemDataRole.UserRole)
pokedex = self.get_pokedex(pokedex_id)
self.tableWidget_2.clear()
self.tableWidget_2.setColumnCount(4)
self.tableWidget_2.setRowCount(0)
for pokemon in pokedex:
poke_id = pokemon['species_id']
row_count = self.tableWidget_2.rowCount()
self.tableWidget_2.setRowCount(row_count + 1)
item = QtWidgets.QTableWidgetItem(f'#{pokemon["entry_number"]:04d}')
item.setData(QtCore.Qt.ItemDataRole.UserRole, poke_id)
self.tableWidget_2.setItem(row_count, 0, item)
item = QtWidgets.QTableWidgetItem(pokemon['name_en'])
item.setToolTip(pokemon['name_de'])
self.tableWidget_2.setItem(row_count, 1, item)
poke_type = self.types[pokemon['type1']]
item = QtWidgets.QTableWidgetItem(poke_type[1])
item.setToolTip(poke_type[0])
self.tableWidget_2.setItem(row_count, 2, item)
try:
poke_type = self.types[pokemon['type2']]
item = QtWidgets.QTableWidgetItem(poke_type[1])
item.setToolTip(poke_type[0])
self.tableWidget_2.setItem(row_count, 3, item)
except KeyError:
pass
self.tableWidget_2.resizeColumnsToContents()
def collect_pokemon(self, *args):
pokedex_id = self.comboBox_2.currentData(QtCore.Qt.ItemDataRole.UserRole)
type_id = self.comboBox.currentData(QtCore.Qt.ItemDataRole.UserRole)
connection = get_connection(self._db)
cursor = connection.cursor()
if pokedex_id == 1:
if type_id == -1:
cursor.execute(
'SELECT *, pokemon_list.species_id AS entry_number '
'FROM pokemon_list '
'ORDER BY entry_number'
)
else:
cursor.execute(
'SELECT *, pokemon_list.species_id AS entry_number '
'FROM pokemon_list '
'WHERE pokemon_list.type1 = ? OR pokemon_list.type2 = ? '
'ORDER BY entry_number',
(type_id, type_id)
)
else:
if type_id == -1:
cursor.execute(
'SELECT pokemon_list.*, pp.entry_number '
'FROM pokemon_list '
'JOIN pokedex_pokemon pp ON pp.species_id = pokemon_list.species_id '
'WHERE pp.pokedex_id = ? '
'ORDER BY pp.entry_number',
(pokedex_id,)
)
else:
cursor.execute(
'SELECT pokemon_list.*, pp.entry_number '
'FROM pokemon_list '
'JOIN pokedex_pokemon pp ON pp.species_id = pokemon_list.species_id '
'WHERE pp.pokedex_id = ? AND (pokemon_list.type1 = ? OR pokemon_list.type2 = ?) '
'ORDER BY pp.entry_number',
(pokedex_id, type_id, type_id)
)
result = cursor.fetchall()
connection.close()
self.fill_sorter(result)
def fill_sorter(self, result):
self.tableWidget_2.clearContents()
self.tableWidget_2.setRowCount(0)
for entry in result:
row = self.tableWidget_2.rowCount()
self.tableWidget_2.setRowCount(row+1)
item = QtWidgets.QTableWidgetItem(f"{entry['entry_number']:04d}")
item.setData(QtCore.Qt.ItemDataRole.UserRole, entry['species_id'])
self.tableWidget_2.setItem(row, 0, item)
name_en = entry['name_en']
if entry['full_name_en']:
name_en = entry['full_name_en']
elif entry['form_en']:
name_en += f" {entry['form_en']}"
name_de = entry['name_de']
if entry['full_name_de']:
name_de = entry['full_name_de']
elif entry['form_de']:
name_de += f" {entry['form_de']}"
item = QtWidgets.QTableWidgetItem(name_en)
item.setToolTip(name_de)
self.tableWidget_2.setItem(row, 1, item)
type_en = []
type_de = []
for t_id in ('type1', 'type2'):
t_de, t_en = self.types[entry[t_id]]
if t_en:
type_en.append(t_en)
type_de.append(t_de)
item = QtWidgets.QTableWidgetItem('\n'.join(type_en))
item.setToolTip('\n'.join(type_en))
self.tableWidget_2.setItem(row, 2, item)
total = 0
for i, stat_name in enumerate(('hit_points', 'attack', 'defense', 'sp_atk', 'sp_def', 'speed')):
stat_value = entry[stat_name]
item = QtWidgets.QTableWidgetItem()
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, stat_value)
item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
self.tableWidget_2.setItem(row, i+4, item)
total += stat_value
item = QtWidgets.QTableWidgetItem()
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, total)
item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
self.tableWidget_2.setItem(row, 3, item)
item = QtWidgets.QTableWidgetItem()
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, entry['height'] / 10)
item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
self.tableWidget_2.setItem(row, 10, item)
item = QtWidgets.QTableWidgetItem()
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, entry['weight'] / 10)
item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
self.tableWidget_2.setItem(row, 11, item)
item = QtWidgets.QTableWidgetItem()
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, round(entry['weight']/entry['height']**2 * 10, 2))
item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
self.tableWidget_2.setItem(row, 12, item)
self.tableWidget_2.resizeColumnToContents(1)
def show_pokemon(self):
table = self.sender()
row = table.currentRow()
poke_id = table.item(row, 0).data(QtCore.Qt.ItemDataRole.UserRole)
pokemon_name = table.item(row, 1).text()
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute(
'SELECT p.id FROM pokemon p WHERE p.species_id = ?',
(poke_id,)
)
pokemon = cursor.fetchall()
connection.close()
self.tabWidget.setCurrentIndex(0)
for i in range(1, self.tabWidget.count()):
self.tabWidget.setTabVisible(i, False)
for i, p in enumerate(pokemon):
entry_widget = self.tabWidget.widget(i)
if entry_widget is None:
self.tabWidget.addTab(PokemonEntry(p[0]), '')
self.tabWidget.setTabText(i, pokemon_name)
self.tabWidget.setTabVisible(i, True)
name = self.tabWidget.widget(i).create_pokemon(p[0])
self.tabWidget.setTabText(i, name)
class PokemonEntry(QtWidgets.QWidget, Ui_Form):
_db = ''
def __init__(self, pokemon_id, parent=None):
super().__init__(parent=parent)
self.setupUi(self)
self.bars = [
None, self.hp_bar, self.attack_bar, self.defense_bar, self.spec_attack_bar, self.spec_defense_bar, self.speed_bar
]
self.ability_labels = [None, self.ability1_label, self.ability2_label, self.ability3_label]
self.type_labels = [None, self.type1_label, self.type2_label]
self.create_pokemon(pokemon_id)
def create_pokemon(self, poke_id):
pokemon = self.get_pokemon(poke_id)
species = self.get_species(pokemon['species_id'])
self.nationaldex_label.setText(f"{pokemon['species_id']:04d}")
self.species_label.setText(species['genus_en'])
self.species_label.setToolTip(species['genus_de'])
self.height_label.setText(f"{pokemon['height'] / 10} m")
self.weight_label.setText(f"{pokemon['weight']} kg")
if species['gender_ratio'] == -1:
gender = "Gender unknown"
else:
gender = f"{species['gender_ratio']*12.5:0.2f}% female, {100-species['gender_ratio']*12.5:0.2f}% male"
self.gender_label.setText(gender)
if not QtGui.QPixmapCache.find(str(poke_id)):
image = b''
if pokemon['artwork'] is not None:
try:
res = urllib.request.urlopen(pokemon['artwork'])
image = res.read()
except:
pass
pixmap = QtGui.QPixmap()
pixmap.loadFromData(image)
sc_pixmap = pixmap.scaled(400, 400, QtCore.Qt.AspectRatioMode.KeepAspectRatio)
QtGui.QPixmapCache.insert(str(poke_id), sc_pixmap)
self.artwork_label.setPixmap(QtGui.QPixmapCache.find(str(poke_id)))
stats = self.get_stats(poke_id)
for (stat_id, stat_value) in stats:
self.bars[stat_id].setValue(stat_value)
abilities = self.get_abilities(poke_id)
for lab in self.ability_labels[1:]:
lab.setVisible(False)
for (slot, is_hidden, name_de, name_en) in abilities:
self.ability_labels[slot].setVisible(True)
t = name_en
if is_hidden:
t += ' (hidden ability)'
self.ability_labels[slot].setText(t)
self.ability_labels[slot].setToolTip(name_de)
form, types = self.get_form_and_type(poke_id)
for lab in self.type_labels[1:]:
lab.setVisible(False)
for (type_id, slot) in types:
self.type_labels[slot].setVisible(True)
self.type_labels[slot].setText(QPoke.types[type_id][1])
self.type_labels[slot].setToolTip(QPoke.types[type_id][0])
evolutions = self.make_evolution(pokemon['evolution_id'])
evo_text = []
for e in evolutions:
evo_text.append(f'{e[0]} (#{e[1]:04d}) to {e[2]} (#{e[3]:04d}) \t\t ({e[4]})')
self.evolution_bar.setText('<br>'.join(evo_text))
if form['full_name_en'] is not None:
return form['full_name_en']
elif form['form_en'] is not None:
return f"{species['name_en']} ({form['form_en']})"
else:
return species['name_en']
@cache
def get_pokedex(self, pokedex_id):
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute(
'SELECT pokemon_list.*, pp.entry_number FROM pokemon_list '
'JOIN pokedex_pokemon pp ON pp.species_id = pokemon_list.species_id '
'WHERE pp.pokedex_id = ? '
'ORDER BY pp.entry_number',
(pokedex_id,)
)
res = cursor.fetchall()
connection.close()
return res
@cache
def get_abilities(self, pokemon_id):
conn = get_connection(self._db)
cursor = conn.cursor()
cursor.execute(
'SELECT slot, ís_hidden, name_de, name_en FROM pokemon_ability '
'JOIN main.ability ON pokemon_ability.ability_id = ability.id '
'WHERE pokemon_id = ?',
(pokemon_id,)
)
abilities = cursor.fetchall()
conn.close()
return abilities
@cache
def get_pokemon(self, poke_id):
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute(
'SELECT p.species_id, p.height, p.weight, p.artwork, p.evolution_id FROM pokemon p WHERE p.id = ?',
(poke_id,)
)
pokemon = cursor.fetchone()
connection.close()
return pokemon
@cache
def get_species(self, species_id):
connection = get_connection(self._db)
cursor = connection.cursor()
cursor.execute(
'SELECT s.id, s.name_en, s.name_de, s.genus_de, s.genus_en, s.color_id, s.is_mythical, s.is_legendary, s.generation, s.gender_ratio '
'FROM species s '
'WHERE s.id = ?',
(species_id,)
)
species = cursor.fetchone()
connection.close()
return species
@cache
def get_stats(self, pokemon_id):
conn = get_connection(self._db)
cursor = conn.cursor()
cursor.execute(
'SELECT stat_id, value FROM pokemon_stat WHERE pokemon_id = ?',
(pokemon_id,)
)
stats = cursor.fetchall()
conn.close()
return stats
@cache
def get_form_and_type(self, pokemon_id):
conn = get_connection(self._db)
cursor = conn.cursor()
cursor.execute(
'SELECT id, full_name_en, form_en FROM form WHERE pokemon_id = ? AND is_default = 1',
(pokemon_id,)
)
form = cursor.fetchone()
cursor.execute(
'SELECT type_id, slot FROM form_type WHERE form_id = ?',
(form['id'],)
)
types = cursor.fetchall()
conn.close()
return form, types
@cache
def make_evolution(self, poke_id: int):
steps = []
conn = get_connection(self._db)
cursor = conn.cursor()
cursor.execute('SELECT * FROM evolution_names WHERE id = ?', (poke_id,))
chain = cursor.fetchall()
trigger_texts = [
None,
'Level up',
'Trade',
'',
'Empty spot in party',
'Spin',
'Train in the Tower of Darkness',
'Train in the Tower of Water',
'Land three critical hits in a battle',
'Go somewhere after taking damage',
'',
'Use Psyshield Bash 20 times in Agile Style',
'Use Barb Barrage 20 times in Strong Style',
'Receive 294 recoil damage in battle',
]
special_pokemon = {
24: 'Use Rage Fist 20 times',
317: "Defeat 3 Bisharp that are holding Leader's Crest",
528: 'Collect 999 Coins from Roaming Form',
484: "Walk 1,000 steps in Let's Go mode",
485: "Walk 1,000 steps in Let's Go mode",
495: "Walk 1,000 steps in Let's Go mode",
499: "Walk 1,000 steps in Let's Go mode",
504: "Level up while in multiplayer"
}
condition_text = {
'min_level': lambda x: f"Lv. {x['min_level']}",
'min_happiness': lambda _: f"high Friendship",
'min_beauty': lambda _: f"needs max. Beauty",
'min_affection': lambda x: f"{x['min_affection']} Affection",
'location_en': lambda x: f"at {x['location_en']}",
'held_item_en': lambda x: f"hold {x['held_item_en']}",
'item_en': lambda x: f'Use {x["item_en"]}',
'known_move_en': lambda x: f"know {x['known_move_en']}",
'move_type_en': lambda x: f"know {x['move_type_en']} move",
'party_species_en': lambda x: f"{x['party_species_en']} in party",
'party_type_en': lambda x: f"{x['party_type_en']} in party",
'time_of_day': lambda x: f"at {x['time_of_day']}",
'trade_species_en': lambda x: f"with {x['trade_species_en']}",
'needs_rain': lambda _: 'during rain',
'upside_down': lambda _: 'hold controller upside-down',
'relative_stats': lambda x: {1: 'attack &gt; defense', 0: 'attack = defense', -1: 'attack &lt; defense'}[x['relative_stats']],
}
for c in chain:
lvl0 = c["name_en"]
if c['gender'] == 1:
lvl0 += ' (female)'
elif c['gender'] == 2:
lvl0 += ' (male)'
trig = c['trigger']
if trig == 10:
level_text = [special_pokemon[poke_id]]
else:
level_text = [trigger_texts[trig]]
for k, v in condition_text.items():
if c[k] is not None:
level_text.append(v(c))
steps.append(
(lvl0, c['evolves_from'], c['evolve_en'], c['species_id'], ', '.join(filter(lambda x: x, level_text)))
)
conn.close()
return steps
if __name__ == '__main__':
app = QtWidgets.QApplication([])
sourcedb = 'pokemon.sqlite'
w = QPoke(sourcedb)
w.show()
app.exec()

View File

@ -1,7 +1,7 @@
from __future__ import annotations
from nmreval.nmr.coupling import *
from nmreval.distributions import ColeCole, ColeDavidson, HavriliakNegami, KWW, LogGaussian
from nmreval.distributions import ColeCole, ColeDavidson, HavriliakNegami, KWW, LogGaussian, GGAlpha
from nmreval.utils import pi
from nmreval.utils.text import convert
@ -19,7 +19,7 @@ class QRelaxCalc(QtWidgets.QDialog, Ui_Dialog):
self.graphs = {}
self.specdens = [ColeCole, ColeDavidson, HavriliakNegami, KWW, LogGaussian]
self.specdens = [ColeCole, ColeDavidson, HavriliakNegami, KWW, LogGaussian, GGAlpha]
self.coupling = [Quadrupolar, HomoDipolar, Czjzek]
self.tau_parameter = []

View File

@ -7,7 +7,7 @@ try:
from scipy.integrate import simpson
except ImportError:
from scipy.integrate import simps as simpson
from scipy.special import gammaln
from scipy.special import gammaln, gamma as scipy_gamma
from nmreval.distributions.base import Distribution
from nmreval.math.logfourier import logft
@ -23,7 +23,7 @@ class AbstractGG(Distribution, ABC):
tt = np.atleast_1d(t)
taus, ln_tau = AbstractGG._prepare_integration(tau0)
g_tau = cls.distribution(taus, tau0, *args)
ret_val = np.array([simpson(np.exp(-t_i/taus) * g_tau, ln_tau) for t_i in tt]).squeeze()
ret_val = np.array([simpson(np.exp(-t_i/taus) * g_tau, x=ln_tau) for t_i in tt]).squeeze()
return ret_val
@ -32,31 +32,33 @@ class AbstractGG(Distribution, ABC):
r"""
Calculate spectral density \int G(ln(tau) tau/(1+(w*tau)^2) dln(tau)
"""
w = np.atleast_1d(omega)
taus, ln_tau = AbstractGG._prepare_integration(tau0)
g_tau = cls.distribution(taus, tau0, *args)
_w = np.atleast_1d(omega)
_t = np.atleast_1d(tau0)
ret_val = np.zeros((_w.size, _t.size), dtype=complex)
ret_val = np.zeros_like(omega, dtype=np.complex128)
for (i, tau_i) in enumerate(_t):
taus, ln_tau = AbstractGG._prepare_integration(tau_i)
g_tau = cls.distribution(taus, tau_i, *args)
ret_val.real = np.array([simpson(g_tau * taus / (1 + (w_i*taus)**2), ln_tau) for w_i in w]).squeeze()
ret_val.imag = np.array([simpson(g_tau * w_i * taus / (1 + (w_i*taus)**2), ln_tau) for w_i in w]).squeeze()
ret_val[:, i].real = np.array([simpson(g_tau * taus / (1 + (w_i*taus)**2), x=ln_tau) for w_i in _w])
ret_val[:, i].imag = np.array([simpson(g_tau * w_i * taus / (1 + (w_i*taus)**2), x=ln_tau) for w_i in _w])
return ret_val
return ret_val.squeeze()
@classmethod
def specdens(cls, omega, tau0, *args):
def specdens(cls, omega: float | np.ndarray, tau0: float | np.ndarray, *args) -> float | np.ndarray:
r"""
Calculate spectral density \int G(ln(tau) tau/(1+(w*tau)^2) dln(tau)
"""
w = np.atleast_1d(omega)
_w = np.atleast_1d(omega)
_t = np.atleast_1d(tau0)
ret_val = np.zeros((w.size, _t.size))
ret_val = np.zeros((_w.size, _t.size))
for i, tau_i in enumerate(_t):
taus, ln_tau = AbstractGG._prepare_integration(tau_i, limits=limits, num_steps=num_steps)
for (i, tau_i) in enumerate(_t):
taus, ln_tau = AbstractGG._prepare_integration(tau_i)
g_tau = cls.distribution(taus, tau_i, *args)
ret_val[:, i] = np.array([simpson(g_tau * taus / (1 + (w_i*taus)**2), ln_tau) for w_i in w]).squeeze()
ret_val[:, i] = np.array([simpson(g_tau * taus / (1 + (w_i*taus)**2), x=ln_tau) for w_i in _w])
return ret_val.squeeze()
@ -75,7 +77,6 @@ class AbstractGG(Distribution, ABC):
Returns:
array of taus and array of ln(tau)
"""
ln_tau0 = np.log(tau0)
@ -92,11 +93,17 @@ class GGAlpha(AbstractGG):
@staticmethod
def distribution(taus: float | np.ndarray, tau: float, alpha: float, beta: float) -> float | np.ndarray:
b_to_a = beta / alpha
norm = np.exp(gammaln(b_to_a) - b_to_a * np.log(b_to_a)) / alpha
inv_norm = alpha * np.exp(-gammaln(b_to_a) + b_to_a * np.log(b_to_a))
t_to_t0 = taus / tau
ret_val = np.exp(-b_to_a * t_to_t0**alpha) * t_to_t0**beta
return ret_val / norm
return ret_val * inv_norm
@staticmethod
def mean(tau: float | np.ndarray, alpha: float, beta: float) -> float | np.ndarray:
beta_by_alpha = beta/alpha
inv_alpha = 1/alpha
return tau * (1/beta_by_alpha)**inv_alpha * scipy_gamma(beta_by_alpha + inv_alpha) / scipy_gamma(beta_by_alpha)
# noinspection PyMethodOverriding

View File

@ -106,6 +106,19 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pokemon_toolbutton">
<property name="text">
<string/>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -0,0 +1,439 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>642</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="artwork_label">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="type1_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="type2_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Weight</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="height_label">
<property name="text">
<string>0.0 m</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="weight_label">
<property name="text">
<string>0.0 kg</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Species</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="ability1_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ability2_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ability3_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="species_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Abilities</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="gender_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>National No.</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nationaldex_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Stats</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="3">
<widget class="QProgressBar" name="spec_attack_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>194</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Special Attack</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QProgressBar" name="spec_defense_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>HP</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QProgressBar" name="hp_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QProgressBar" name="speed_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Speed</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Special Defense</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QProgressBar" name="defense_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QProgressBar" name="attack_bar">
<property name="styleSheet">
<string notr="true">QProgressBar{
border: none;
background-color: transparent;
text-align: center;
}
QProgressBar::chunk {
background-color: #009cda;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>190</number>
</property>
<property name="value">
<number>24</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Attack</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Defense</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Evolution chain</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="evolution_bar">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,194 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>359</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Random Pokémon</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>National-Dex</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="pokedex_nr">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Name</string>
</property>
<property name="buddy">
<cstring>name</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="name"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Kategorie</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="category">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Typ</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="poketype">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Größe</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="height">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Gewicht</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="weight">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Farbe</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="color">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Mehr...</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="info">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="prev_button">
<property name="text">
<string>Prev.</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="next_button">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Retry</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1526</width>
<height>991</height>
</rect>
</property>
<property name="windowTitle">
<string>Gotta catch 'em all!</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="comboBox_2"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTableWidget" name="tableWidget_2">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>80</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>#</string>
</property>
</column>
<column>
<property name="text">
<string>Pokemon</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Total</string>
</property>
</column>
<column>
<property name="text">
<string>HP</string>
</property>
<property name="toolTip">
<string>Hit Points; Kraftpunkte</string>
</property>
</column>
<column>
<property name="text">
<string>Attack</string>
</property>
<property name="toolTip">
<string>Attacke</string>
</property>
</column>
<column>
<property name="text">
<string>Defense</string>
</property>
<property name="toolTip">
<string>Verteidigung</string>
</property>
</column>
<column>
<property name="text">
<string>Sp. Attack</string>
</property>
<property name="toolTip">
<string>Special Attack; Spezial-Attacke</string>
</property>
</column>
<column>
<property name="text">
<string>Sp. Defense</string>
</property>
<property name="toolTip">
<string>Special Defense; Spezial-Verteidigung</string>
</property>
</column>
<column>
<property name="text">
<string>Speed</string>
</property>
<property name="toolTip">
<string>Initiative</string>
</property>
</column>
<column>
<property name="text">
<string>Height</string>
</property>
<property name="toolTip">
<string>Größe</string>
</property>
</column>
<column>
<property name="text">
<string>Weight</string>
</property>
<property name="toolTip">
<string>Gewicht</string>
</property>
</column>
<column>
<property name="text">
<string>BMI</string>
</property>
<property name="toolTip">
<string>Body-Mass-Index</string>
</property>
</column>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>762</x>
<y>969</y>
</hint>
<hint type="destinationlabel">
<x>762</x>
<y>495</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Binary file not shown.