--- a/ProjectFlask/FlaskMigrateExtension/MigrateProjectExtension.py Sat May 29 15:04:41 2021 +0200 +++ b/ProjectFlask/FlaskMigrateExtension/MigrateProjectExtension.py Sun May 30 17:33:37 2021 +0200 @@ -10,12 +10,12 @@ import os import glob -from PyQt5.QtCore import pyqtSlot, QObject, QProcess -from PyQt5.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit +from PyQt6.QtCore import pyqtSlot, QObject, QProcess +from PyQt6.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit -from E5Gui import E5MessageBox -from E5Gui.E5Application import e5App -from E5Gui.E5Action import E5Action +from EricWidgets import EricMessageBox +from EricWidgets.EricApplication import ericApp +from EricGui.EricAction import EricAction import Utilities @@ -43,7 +43,7 @@ self.__plugin = plugin self.__project = project - self.__e5project = e5App().getObject("Project") + self.__ericProject = ericApp().getObject("Project") self.__migrationSummaryDialog = None @@ -53,7 +53,7 @@ """ self.actions = [] - self.migrateConfigAct = E5Action( + self.migrateConfigAct = EricAction( self.tr('Configure Migrate'), self.tr('C&onfigure Migrate'), 0, 0, @@ -69,7 +69,7 @@ self.__configureMigrate) self.actions.append(self.migrateConfigAct) - self.migrateInstallAct = E5Action( + self.migrateInstallAct = EricAction( self.tr('Install flask-migrate'), self.tr('Install &flask-migrate'), 0, 0, @@ -86,7 +86,7 @@ self.__installFlaskMigrate) self.actions.append(self.migrateInstallAct) - self.migrateAvailabilityAct = E5Action( + self.migrateAvailabilityAct = EricAction( self.tr('Check flask-migrate Availability'), self.tr('Check flask-migrate &Availability'), 0, 0, @@ -105,7 +105,7 @@ ## action to initialize the database migration system ######################################################### - self.migrateInitAct = E5Action( + self.migrateInitAct = EricAction( self.tr('Initialize Migrations'), self.tr('&Initialize Migrations'), 0, 0, @@ -125,7 +125,7 @@ ## action to create a new database migration ######################################################### - self.migrateCreateAct = E5Action( + self.migrateCreateAct = EricAction( self.tr('Create Migration'), self.tr('&Create Migration'), 0, 0, @@ -145,7 +145,7 @@ ## action to up- and downgrade a databse ######################################################### - self.upgradeDatabaseAct = E5Action( + self.upgradeDatabaseAct = EricAction( self.tr('Upgrade Database'), self.tr('&Upgrade Database'), 0, 0, @@ -160,7 +160,7 @@ self.upgradeDatabase) self.actions.append(self.upgradeDatabaseAct) - self.downgradeDatabaseAct = E5Action( + self.downgradeDatabaseAct = EricAction( self.tr('Downgrade Database'), self.tr('&Downgrade Database'), 0, 0, @@ -179,7 +179,7 @@ ## actions to show migrations history information ######################################################### - self.migrationSummaryAct = E5Action( + self.migrationSummaryAct = EricAction( self.tr('Show Migrations Summary'), self.tr('Show Migrations &Summary'), 0, 0, @@ -195,7 +195,7 @@ self.__showMigrationsSummary) self.actions.append(self.migrationSummaryAct) - self.migrationHistoryAct = E5Action( + self.migrationHistoryAct = EricAction( self.tr('Show Migrations History'), self.tr('Show Migrations &History'), 0, 0, @@ -271,7 +271,8 @@ detector = os.path.join( os.path.dirname(__file__), "FlaskMigrateDetector.py") proc = QProcess() - proc.setProcessChannelMode(QProcess.MergedChannels) + proc.setProcessChannelMode( + QProcess.ProcessChannelMode.MergedChannels) proc.start(interpreter, [detector]) finished = proc.waitForFinished(30000) if finished and proc.exitCode() == 0: @@ -297,17 +298,17 @@ "migrationsDirectory") if migrations: if abspath: - migrations = self.__e5project.getAbsoluteUniversalPath( + migrations = self.__ericProject.getAbsoluteUniversalPath( migrations) else: workdir = self.__project.getApplication()[0] migrations = os.path.relpath( - self.__e5project.getAbsoluteUniversalPath(migrations), + self.__ericProject.getAbsoluteUniversalPath(migrations), workdir ) else: if abspath: - migrations = self.__e5project.getAbsoluteUniversalPath( + migrations = self.__ericProject.getAbsoluteUniversalPath( "migrations") return migrations @@ -333,7 +334,7 @@ config = self.__project.getData("flask-migrate", "") dlg = MigrateConfigDialog(config) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: config = dlg.getConfiguration() self.__project.setData("flask-migrate", "", config) @@ -354,11 +355,11 @@ venvName = self.__project.getVirtualEnvironment() if venvName: interpreter = self.__project.getFullCommand("python") - pip = e5App().getObject("Pip") + pip = ericApp().getObject("Pip") pip.installPackages(["flask-migrate"], interpreter=interpreter) self.determineCapability() else: - E5MessageBox.critical( + EricMessageBox.critical( None, self.tr("Install flask-migrate"), self.tr("The 'flask-migrate' extension could not be installed" @@ -376,7 +377,7 @@ if self.__project.hasCapability("flask-migrate") else self.tr("The 'flask-migrate' extension is not installed.") ) - E5MessageBox.information( + EricMessageBox.information( None, self.tr("flask-migrate Availability"), msg) @@ -399,7 +400,7 @@ if migrations: args += ["--directory", migrations] - multidb = E5MessageBox.yesNo( + multidb = EricMessageBox.yesNo( None, self.tr("Multiple Databases"), self.tr("""Shall the support for multiple databases be""" @@ -419,9 +420,9 @@ ): for fileName in files: fullName = os.path.join(root, fileName) - self.__e5project.appendFile(fullName) + self.__ericProject.appendFile(fullName) - browser = (e5App().getObject("ProjectBrowser") + browser = (ericApp().getObject("ProjectBrowser") .getProjectBrowser("others")) alembic = os.path.join( self.__migrationsDirectory(abspath=True), @@ -447,7 +448,7 @@ None, title, self.tr("Enter a short message for the migration:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok: args = ["migrate"] if migrations: @@ -466,7 +467,7 @@ self.__migrationsDirectory(abspath=True), "versions", "*.py") for fileName in glob.iglob(versionsPattern): - self.__e5project.appendFile(fileName) + self.__ericProject.appendFile(fileName) ######################################################### ## slots to up- and downgrade a databse