ProjectDjango/DjangoLoaddataDataDialog.py

branch
eric7
changeset 172
ea7980ded4f3
parent 169
b8f263e05c39
child 175
30cb5e553e7e
equal deleted inserted replaced
171:af99f0984f20 172:ea7980ded4f3
7 Module implementing a dialog to enter the data for the 'loaddata' command. 7 Module implementing a dialog to enter the data for the 'loaddata' command.
8 """ 8 """
9 9
10 import contextlib 10 import contextlib
11 11
12 from PyQt5.QtCore import pyqtSlot 12 from PyQt6.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 13 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
14 14
15 from E5Gui import E5FileDialog 15 from EricWidgets import EricFileDialog
16 16
17 from .Ui_DjangoLoaddataDataDialog import Ui_DjangoLoaddataDataDialog 17 from .Ui_DjangoLoaddataDataDialog import Ui_DjangoLoaddataDataDialog
18 18
19 import Utilities 19 import Utilities
20 import UI.PixmapCache 20 import UI.PixmapCache
27 def __init__(self, project, parent=None): 27 def __init__(self, project, parent=None):
28 """ 28 """
29 Constructor 29 Constructor
30 30
31 @param project reference to the Django project object 31 @param project reference to the Django project object
32 @param parent reference to the parent widget (QWidget) 32 @type Project
33 @param parent reference to the parent widget
34 @type QWidget
33 """ 35 """
34 super().__init__(parent) 36 super().__init__(parent)
35 self.setupUi(self) 37 self.setupUi(self)
36 38
37 self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open")) 39 self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open"))
38 40
39 self.__project = project 41 self.__project = project
40 42
41 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) 43 self.buttonBox.button(
44 QDialogButtonBox.StandardButton.Ok).setEnabled(False)
42 45
43 msh = self.minimumSizeHint() 46 msh = self.minimumSizeHint()
44 self.resize(max(self.width(), msh.width()), msh.height()) 47 self.resize(max(self.width(), msh.width()), msh.height())
45 48
46 @pyqtSlot(str) 49 @pyqtSlot(str)
48 """ 51 """
49 Private slot to handle a change of the fixtures text. 52 Private slot to handle a change of the fixtures text.
50 53
51 @param txt text of the line edit (string) 54 @param txt text of the line edit (string)
52 """ 55 """
53 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) 56 self.buttonBox.button(
57 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt))
54 58
55 @pyqtSlot() 59 @pyqtSlot()
56 def on_fixtureFileButton_clicked(self): 60 def on_fixtureFileButton_clicked(self):
57 """ 61 """
58 Private slot to select a fixture file via a file selection dialog. 62 Private slot to select a fixture file via a file selection dialog.
61 with contextlib.suppress(ImportError): 65 with contextlib.suppress(ImportError):
62 import yaml # __IGNORE_WARNING__ 66 import yaml # __IGNORE_WARNING__
63 fileFilters += self.tr("YAML Files (*.yaml);;") 67 fileFilters += self.tr("YAML Files (*.yaml);;")
64 fileFilters += self.tr("All Files (*)") 68 fileFilters += self.tr("All Files (*)")
65 69
66 fixtureFiles = E5FileDialog.getOpenFileNames( 70 fixtureFiles = EricFileDialog.getOpenFileNames(
67 self, 71 self,
68 self.tr("Select fixture file"), 72 self.tr("Select fixture file"),
69 self.__project.getProjectPath(), 73 self.__project.getProjectPath(),
70 fileFilters) 74 fileFilters)
71 75

eric ide

mercurial