ProjectDjango/DjangoRunTestServerDataDialog.py

branch
eric7
changeset 180
64339135bd61
parent 175
30cb5e553e7e
child 181
2f5c3487139c
equal deleted inserted replaced
179:8413c2429808 180:64339135bd61
21 21
22 class DjangoRunTestServerDataDialog(QDialog, Ui_DjangoRunTestServerDataDialog): 22 class DjangoRunTestServerDataDialog(QDialog, Ui_DjangoRunTestServerDataDialog):
23 """ 23 """
24 Class implementing a dialog to enter the data for the 'loaddata' command. 24 Class implementing a dialog to enter the data for the 'loaddata' command.
25 """ 25 """
26
26 def __init__(self, project, parent=None): 27 def __init__(self, project, parent=None):
27 """ 28 """
28 Constructor 29 Constructor
29 30
30 @param project reference to the Django project object 31 @param project reference to the Django project object
31 @type Project 32 @type Project
32 @param parent reference to the parent widget 33 @param parent reference to the parent widget
33 @type QWidget 34 @type QWidget
34 """ 35 """
35 super().__init__(parent) 36 super().__init__(parent)
36 self.setupUi(self) 37 self.setupUi(self)
37 38
38 fileFilters = self.tr("JSON Files (*.json);;XML Files (*.xml);;") 39 fileFilters = self.tr("JSON Files (*.json);;XML Files (*.xml);;")
39 with contextlib.suppress(ImportError): 40 with contextlib.suppress(ImportError):
40 import yaml # __IGNORE_WARNING__ 41 import yaml # __IGNORE_WARNING__
42
41 fileFilters += self.tr("YAML Files (*.yaml);;") 43 fileFilters += self.tr("YAML Files (*.yaml);;")
42 fileFilters += self.tr("All Files (*)") 44 fileFilters += self.tr("All Files (*)")
43 45
44 self.fixturePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 46 self.fixturePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
45 self.fixturePicker.setFilters(fileFilters) 47 self.fixturePicker.setFilters(fileFilters)
46 48
47 self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open")) 49 self.fixtureFileButton.setIcon(UI.PixmapCache.getIcon("open"))
48 50
49 self.__project = project 51 self.__project = project
50 52
51 self.buttonBox.button( 53 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
52 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 54
53
54 msh = self.minimumSizeHint() 55 msh = self.minimumSizeHint()
55 self.resize(max(self.width(), msh.width()), msh.height()) 56 self.resize(max(self.width(), msh.width()), msh.height())
56 57
57 @pyqtSlot(str) 58 @pyqtSlot(str)
58 def on_fixturesPicker_textChanged(self, txt): 59 def on_fixturesPicker_textChanged(self, txt):
59 """ 60 """
60 Private slot to handle a change of the fixtures text. 61 Private slot to handle a change of the fixtures text.
61 62
62 @param txt text of the line edit 63 @param txt text of the line edit
63 @type str 64 @type str
64 """ 65 """
65 self.buttonBox.button( 66 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt))
66 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) 67
67
68 def getData(self): 68 def getData(self):
69 """ 69 """
70 Public method to get the data entered into the dialog. 70 Public method to get the data entered into the dialog.
71 71
72 @return list of fixtures 72 @return list of fixtures
73 @rtype list of str 73 @rtype list of str
74 """ 74 """
75 fixturesStr = self.fixturePicker.text() 75 fixturesStr = self.fixturePicker.text()
76 fixtures = fixturesStr.split() 76 fixtures = fixturesStr.split()
77 77
78 return fixtures 78 return fixtures

eric ide

mercurial