diff -r 8413c2429808 -r 64339135bd61 ProjectDjango/DjangoMigrationSelectionDialog.py --- a/ProjectDjango/DjangoMigrationSelectionDialog.py Fri Dec 31 13:17:55 2021 +0100 +++ b/ProjectDjango/DjangoMigrationSelectionDialog.py Wed Sep 21 16:42:20 2022 +0200 @@ -13,21 +13,18 @@ from PyQt6.QtGui import QIcon from PyQt6.QtWidgets import QDialog -from .Ui_DjangoMigrationSelectionDialog import ( - Ui_DjangoMigrationSelectionDialog -) +from .Ui_DjangoMigrationSelectionDialog import Ui_DjangoMigrationSelectionDialog -class DjangoMigrationSelectionDialog(QDialog, - Ui_DjangoMigrationSelectionDialog): +class DjangoMigrationSelectionDialog(QDialog, Ui_DjangoMigrationSelectionDialog): """ Class implementing a dialog to select an application and migration. """ - def __init__(self, migrations, migrationRequired=False, suffix="", - parent=None): + + def __init__(self, migrations, migrationRequired=False, suffix="", parent=None): """ Constructor - + @param migrations dictionary containing the available migrations @type dict @param migrationRequired flag indicating that a migration must be @@ -40,26 +37,27 @@ """ super().__init__(parent) self.setupUi(self) - - self.__appliedIcon = QIcon(os.path.join( - os.path.dirname(__file__), "icons", "applied-{0}".format(suffix) - )) - + + self.__appliedIcon = QIcon( + os.path.join( + os.path.dirname(__file__), "icons", "applied-{0}".format(suffix) + ) + ) + self.__migrationRequired = migrationRequired - + self.__migrations = migrations self.applicationComboBox.addItems(sorted(self.__migrations.keys())) - self.on_applicationComboBox_activated( - self.applicationComboBox.currentText()) - + self.on_applicationComboBox_activated(self.applicationComboBox.currentText()) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + @pyqtSlot(str) def on_applicationComboBox_activated(self, app): """ Private slot to update the migrations combo box. - + @param app name of the selected application @type str """ @@ -71,13 +69,15 @@ self.migrationsComboBox.addItem(self.__appliedIcon, migration) else: self.migrationsComboBox.addItem(migration) - + def getData(self): """ Public method to get the selected data. - + @return tuple containing the selected application name and migration @rtype tuple of two str """ - return (self.applicationComboBox.currentText(), - self.migrationsComboBox.currentText()) + return ( + self.applicationComboBox.currentText(), + self.migrationsComboBox.currentText(), + )