randomize
This commit is contained in:
parent
fa84b0382e
commit
86f285fba5
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'untitled2.ui'
|
||||
# Form implementation generated from reading ui file './nmreval/src/resources/_ui/pokeentry.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
@ -21,13 +21,26 @@ class Ui_Form(object):
|
||||
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.formLayout = QtWidgets.QFormLayout()
|
||||
self.formLayout.setContentsMargins(3, 3, 3, 3)
|
||||
self.formLayout.setVerticalSpacing(12)
|
||||
self.formLayout.setObjectName("formLayout")
|
||||
self.label = QtWidgets.QLabel(Form)
|
||||
self.label.setObjectName("label")
|
||||
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
|
||||
self.nationaldex_label = QtWidgets.QLabel(Form)
|
||||
self.nationaldex_label.setObjectName("nationaldex_label")
|
||||
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.nationaldex_label)
|
||||
self.label_1 = QtWidgets.QLabel(Form)
|
||||
self.label_1.setObjectName("label_1")
|
||||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_1)
|
||||
self.species_label = QtWidgets.QLabel(Form)
|
||||
self.species_label.setObjectName("species_label")
|
||||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.species_label)
|
||||
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.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_4)
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.type1_label = QtWidgets.QLabel(Form)
|
||||
@ -36,24 +49,11 @@ class Ui_Form(object):
|
||||
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.formLayout.setLayout(2, QtWidgets.QFormLayout.FieldRole, self.verticalLayout_2)
|
||||
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.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_5)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.ability1_label = QtWidgets.QLabel(Form)
|
||||
@ -65,24 +65,23 @@ class Ui_Form(object):
|
||||
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.formLayout.setLayout(3, QtWidgets.QFormLayout.FieldRole, self.verticalLayout)
|
||||
self.label_2 = QtWidgets.QLabel(Form)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_2)
|
||||
self.height_label = QtWidgets.QLabel(Form)
|
||||
self.height_label.setObjectName("height_label")
|
||||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.height_label)
|
||||
self.label_3 = QtWidgets.QLabel(Form)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_3)
|
||||
self.weight_label = QtWidgets.QLabel(Form)
|
||||
self.weight_label.setObjectName("weight_label")
|
||||
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.weight_label)
|
||||
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.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.gender_label)
|
||||
self.verticalLayout_4.addLayout(self.formLayout)
|
||||
self.groupBox = QtWidgets.QGroupBox(Form)
|
||||
self.groupBox.setFlat(True)
|
||||
self.groupBox.setObjectName("groupBox")
|
||||
@ -206,13 +205,21 @@ class Ui_Form(object):
|
||||
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.tableWidget = QtWidgets.QTableWidget(self.groupBox_2)
|
||||
self.tableWidget.setStyleSheet("background-color: transparent;")
|
||||
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.tableWidget.setShowGrid(False)
|
||||
self.tableWidget.setGridStyle(QtCore.Qt.NoPen)
|
||||
self.tableWidget.setWordWrap(False)
|
||||
self.tableWidget.setObjectName("tableWidget")
|
||||
self.tableWidget.setColumnCount(0)
|
||||
self.tableWidget.setRowCount(0)
|
||||
self.tableWidget.horizontalHeader().setVisible(False)
|
||||
self.tableWidget.verticalHeader().setVisible(False)
|
||||
self.verticalLayout_3.addWidget(self.tableWidget)
|
||||
self.verticalLayout_4.addWidget(self.groupBox_2)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout_4.addItem(spacerItem)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
@ -221,22 +228,22 @@ class Ui_Form(object):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Form.setWindowTitle(_translate("Form", "Form"))
|
||||
self.artwork_label.setText(_translate("Form", "TextLabel"))
|
||||
self.label.setText(_translate("Form", "National No."))
|
||||
self.nationaldex_label.setText(_translate("Form", "TextLabel"))
|
||||
self.label_1.setText(_translate("Form", "Species"))
|
||||
self.species_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.label_5.setText(_translate("Form", "Abilities"))
|
||||
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.label_2.setText(_translate("Form", "Height"))
|
||||
self.height_label.setText(_translate("Form", "0.0 m"))
|
||||
self.label_3.setText(_translate("Form", "Weight"))
|
||||
self.weight_label.setText(_translate("Form", "0.0 kg"))
|
||||
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"))
|
||||
@ -251,4 +258,3 @@ class Ui_Form(object):
|
||||
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"))
|
||||
|
@ -14,15 +14,29 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1526, 991)
|
||||
Dialog.resize(1687, 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.pushButton = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton.setObjectName("pushButton")
|
||||
self.gridLayout.addWidget(self.pushButton, 0, 2, 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.comboBox = QtWidgets.QComboBox(Dialog)
|
||||
self.comboBox.setObjectName("comboBox")
|
||||
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.gridLayout.addItem(spacerItem, 0, 4, 1, 1)
|
||||
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
|
||||
self.buttonBox.setSizePolicy(sizePolicy)
|
||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.gridLayout.addWidget(self.buttonBox, 0, 3, 1, 1)
|
||||
self.splitter = QtWidgets.QSplitter(Dialog)
|
||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.splitter.setObjectName("splitter")
|
||||
@ -66,12 +80,9 @@ class Ui_Dialog(object):
|
||||
self.tableWidget_2.horizontalHeader().setStretchLastSection(False)
|
||||
self.tableWidget_2.verticalHeader().setVisible(False)
|
||||
self.tabWidget = QtWidgets.QTabWidget(self.splitter)
|
||||
self.tabWidget.setMinimumSize(QtCore.QSize(418, 0))
|
||||
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.gridLayout.addWidget(self.splitter, 1, 0, 1, 5)
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
self.tabWidget.setCurrentIndex(-1)
|
||||
@ -81,6 +92,7 @@ class Ui_Dialog(object):
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Gotta catch \'em all!"))
|
||||
self.pushButton.setText(_translate("Dialog", "Random"))
|
||||
self.tableWidget_2.setSortingEnabled(True)
|
||||
item = self.tableWidget_2.horizontalHeaderItem(0)
|
||||
item.setText(_translate("Dialog", "#"))
|
||||
|
@ -3,8 +3,10 @@ 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
|
||||
from numpy.random import randint
|
||||
|
||||
from gui_qt._py.pokewindow import Ui_Dialog
|
||||
from gui_qt._py.pokeentry import Ui_Form
|
||||
|
||||
|
||||
def get_connection(db):
|
||||
@ -37,6 +39,8 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.comboBox_2.currentIndexChanged.connect(self.collect_pokemon)
|
||||
self.comboBox.currentIndexChanged.connect(self.collect_pokemon)
|
||||
|
||||
self.pushButton.clicked.connect(self.randomize)
|
||||
|
||||
self.collect_pokemon()
|
||||
|
||||
def _fetch_names(self):
|
||||
@ -157,6 +161,7 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
item = QtWidgets.QTableWidgetItem(f"{entry['entry_number']:04d}")
|
||||
item.setData(QtCore.Qt.ItemDataRole.UserRole, entry['species_id'])
|
||||
item.setData(QtCore.Qt.ItemDataRole.UserRole+1, entry['pokemon_id'])
|
||||
self.tableWidget_2.setItem(row, 0, item)
|
||||
|
||||
name_en = entry['name_en']
|
||||
@ -183,7 +188,7 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
type_en.append(t_en)
|
||||
type_de.append(t_de)
|
||||
|
||||
item = QtWidgets.QTableWidgetItem('\n'.join(type_en))
|
||||
item = QtWidgets.QTableWidgetItem(' / '.join(type_en))
|
||||
item.setToolTip('\n'.join(type_en))
|
||||
self.tableWidget_2.setItem(row, 2, item)
|
||||
|
||||
@ -217,12 +222,20 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.tableWidget_2.setItem(row, 12, item)
|
||||
|
||||
self.tableWidget_2.resizeColumnToContents(1)
|
||||
self.tableWidget_2.resizeColumnToContents(2)
|
||||
self.tableWidget_2.setSortingEnabled(True)
|
||||
|
||||
def show_pokemon(self):
|
||||
table = self.sender()
|
||||
row = table.currentRow()
|
||||
poke_id = table.item(row, 0).data(QtCore.Qt.ItemDataRole.UserRole)
|
||||
def randomize(self):
|
||||
select = randint(0, self.tableWidget_2.rowCount())
|
||||
self.show_pokemon(select)
|
||||
|
||||
def show_pokemon(self, row: int = None):
|
||||
table = self.tableWidget_2
|
||||
if row is None:
|
||||
row = table.currentRow()
|
||||
|
||||
species_id = table.item(row, 0).data(QtCore.Qt.ItemDataRole.UserRole)
|
||||
poke_id = table.item(row, 0).data(QtCore.Qt.ItemDataRole.UserRole+1)
|
||||
pokemon_name = table.item(row, 1).text()
|
||||
|
||||
connection = get_connection(self._db)
|
||||
@ -230,7 +243,7 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
cursor.execute(
|
||||
'SELECT p.id FROM pokemon p WHERE p.species_id = ?',
|
||||
(poke_id,)
|
||||
(species_id,)
|
||||
)
|
||||
|
||||
pokemon = cursor.fetchall()
|
||||
@ -240,9 +253,14 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
for i in range(1, self.tabWidget.count()):
|
||||
self.tabWidget.setTabVisible(i, False)
|
||||
|
||||
widget_idx = 0
|
||||
|
||||
for i, p in enumerate(pokemon):
|
||||
entry_widget = self.tabWidget.widget(i)
|
||||
|
||||
if poke_id == p[0]:
|
||||
widget_idx = i
|
||||
|
||||
if entry_widget is None:
|
||||
self.tabWidget.addTab(PokemonEntry(p[0]), '')
|
||||
|
||||
@ -250,12 +268,13 @@ class QPoke(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.tabWidget.setTabVisible(i, True)
|
||||
name = self.tabWidget.widget(i).create_pokemon(p[0])
|
||||
self.tabWidget.setTabText(i, name)
|
||||
self.tabWidget.setCurrentIndex(widget_idx)
|
||||
|
||||
|
||||
class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
_db = ''
|
||||
|
||||
def __init__(self, pokemon_id, parent=None):
|
||||
def __init__(self, pokemon_id: int, parent=None):
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.setupUi(self)
|
||||
@ -278,7 +297,7 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
self.species_label.setToolTip(species['genus_de'])
|
||||
|
||||
self.height_label.setText(f"{pokemon['height'] / 10} m")
|
||||
self.weight_label.setText(f"{pokemon['weight']} kg")
|
||||
self.weight_label.setText(f"{pokemon['weight'] / 10} kg")
|
||||
|
||||
if species['gender_ratio'] == -1:
|
||||
gender = "Gender unknown"
|
||||
@ -329,10 +348,23 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
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))
|
||||
|
||||
self.tableWidget.clear()
|
||||
self.tableWidget.setColumnCount(4)
|
||||
self.tableWidget.setRowCount(len(evolutions))
|
||||
|
||||
for i, e in enumerate(evolutions):
|
||||
item = QtWidgets.QTableWidgetItem(f'{e[0]} (#{e[1]:04d})')
|
||||
self.tableWidget.setItem(i, 0, item)
|
||||
item = QtWidgets.QTableWidgetItem('to')
|
||||
self.tableWidget.setItem(i, 1, item)
|
||||
item = QtWidgets.QTableWidgetItem(f'{e[2]} (#{e[3]:04d})')
|
||||
self.tableWidget.setItem(i, 2, item)
|
||||
item = QtWidgets.QTableWidgetItem(f'{e[4]}')
|
||||
self.tableWidget.setItem(i, 3, item)
|
||||
|
||||
self.tableWidget.resizeColumnsToContents()
|
||||
self.tableWidget.resizeRowsToContents()
|
||||
|
||||
if form['full_name_en'] is not None:
|
||||
return form['full_name_en']
|
||||
@ -441,7 +473,6 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
|
||||
return form, types
|
||||
|
||||
|
||||
@cache
|
||||
def make_evolution(self, poke_id: int):
|
||||
steps = []
|
||||
@ -451,6 +482,7 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
|
||||
cursor.execute('SELECT * FROM evolution_names WHERE id = ?', (poke_id,))
|
||||
chain = cursor.fetchall()
|
||||
conn.close()
|
||||
|
||||
trigger_texts = [
|
||||
None,
|
||||
@ -500,7 +532,6 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
}
|
||||
|
||||
for c in chain:
|
||||
|
||||
lvl0 = c["name_en"]
|
||||
if c['gender'] == 1:
|
||||
lvl0 += ' (female)'
|
||||
@ -522,17 +553,4 @@ class PokemonEntry(QtWidgets.QWidget, Ui_Form):
|
||||
(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()
|
||||
|
@ -25,10 +25,50 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<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="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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>Species</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="species_label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@ -57,51 +97,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
<string>Abilities</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 name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -130,44 +132,41 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="species_label">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="height_label">
|
||||
<property name="text">
|
||||
<string>Abilities</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<string>0.0 m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Weight</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="6" column="0">
|
||||
<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>
|
||||
@ -414,24 +413,46 @@ QProgressBar::chunk {
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="evolution_bar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: transparent;</string>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::NoPen</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1526</width>
|
||||
<width>1687</width>
|
||||
<height>991</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -14,13 +14,46 @@
|
||||
<string>Gotta catch 'em all!</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -150,19 +183,18 @@
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>418</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<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/>
|
||||
|
Loading…
Reference in New Issue
Block a user