Wed, 21 Dec 2022 09:59:34 +0100
Adapted some import statements to eric 23.1 and newer.
# -*- coding: utf-8 -*- # Copyright (c) 2020 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing a dialog to edit the flask-migrate configuration. """ from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QDialog from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from .Ui_MigrateConfigDialog import Ui_MigrateConfigDialog class MigrateConfigDialog(QDialog, Ui_MigrateConfigDialog): """ Class implementing a dialog to edit the flask-migrate configuration. """ def __init__(self, configuration, parent=None): """ Constructor @param configuration current pybabel configuration @type dict @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) self.__ericProject = ericApp().getObject("Project") self.migrationsDirectoryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) self.migrationsDirectoryPicker.setDefaultDirectory( self.__ericProject.getProjectPath() ) self.migrationsDirectoryPicker.setFocus(Qt.FocusReason.OtherFocusReason) if ( "migrationsDirectory" in configuration and configuration["migrationsDirectory"] ): self.migrationsDirectoryPicker.setText( self.__ericProject.getAbsoluteUniversalPath( configuration["migrationsDirectory"] ) ) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) def getConfiguration(self): """ Public method to get the entered configuration data. @return pybabel configuration @rtype dict """ configuration = { "migrationsDirectory": self.__ericProject.getRelativeUniversalPath( self.migrationsDirectoryPicker.text() ), } return configuration