18 |
18 |
19 class MigrateConfigDialog(QDialog, Ui_MigrateConfigDialog): |
19 class MigrateConfigDialog(QDialog, Ui_MigrateConfigDialog): |
20 """ |
20 """ |
21 Class implementing a dialog to edit the flask-migrate configuration. |
21 Class implementing a dialog to edit the flask-migrate configuration. |
22 """ |
22 """ |
|
23 |
23 def __init__(self, configuration, parent=None): |
24 def __init__(self, configuration, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param configuration current pybabel configuration |
28 @param configuration current pybabel configuration |
28 @type dict |
29 @type dict |
29 @param parent reference to the parent widget |
30 @param parent reference to the parent widget |
30 @type QWidget |
31 @type QWidget |
31 """ |
32 """ |
32 super().__init__(parent) |
33 super().__init__(parent) |
33 self.setupUi(self) |
34 self.setupUi(self) |
34 |
35 |
35 self.__ericProject = ericApp().getObject("Project") |
36 self.__ericProject = ericApp().getObject("Project") |
36 |
37 |
37 self.migrationsDirectoryPicker.setMode( |
38 self.migrationsDirectoryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
38 EricPathPickerModes.DIRECTORY_MODE) |
|
39 self.migrationsDirectoryPicker.setDefaultDirectory( |
39 self.migrationsDirectoryPicker.setDefaultDirectory( |
40 self.__ericProject.getProjectPath()) |
40 self.__ericProject.getProjectPath() |
41 |
41 ) |
42 self.migrationsDirectoryPicker.setFocus( |
42 |
43 Qt.FocusReason.OtherFocusReason) |
43 self.migrationsDirectoryPicker.setFocus(Qt.FocusReason.OtherFocusReason) |
44 |
44 |
45 if ( |
45 if ( |
46 "migrationsDirectory" in configuration and |
46 "migrationsDirectory" in configuration |
47 configuration["migrationsDirectory"] |
47 and configuration["migrationsDirectory"] |
48 ): |
48 ): |
49 self.migrationsDirectoryPicker.setText( |
49 self.migrationsDirectoryPicker.setText( |
50 self.__ericProject.getAbsoluteUniversalPath( |
50 self.__ericProject.getAbsoluteUniversalPath( |
51 configuration["migrationsDirectory"])) |
51 configuration["migrationsDirectory"] |
52 |
52 ) |
|
53 ) |
|
54 |
53 msh = self.minimumSizeHint() |
55 msh = self.minimumSizeHint() |
54 self.resize(max(self.width(), msh.width()), msh.height()) |
56 self.resize(max(self.width(), msh.width()), msh.height()) |
55 |
57 |
56 def getConfiguration(self): |
58 def getConfiguration(self): |
57 """ |
59 """ |
58 Public method to get the entered configuration data. |
60 Public method to get the entered configuration data. |
59 |
61 |
60 @return pybabel configuration |
62 @return pybabel configuration |
61 @rtype dict |
63 @rtype dict |
62 """ |
64 """ |
63 configuration = { |
65 configuration = { |
64 "migrationsDirectory": self.__ericProject.getRelativeUniversalPath( |
66 "migrationsDirectory": self.__ericProject.getRelativeUniversalPath( |
65 self.migrationsDirectoryPicker.text()), |
67 self.migrationsDirectoryPicker.text() |
|
68 ), |
66 } |
69 } |
67 |
70 |
68 return configuration |
71 return configuration |