21 Constructor |
23 Constructor |
22 |
24 |
23 @param project reference to the Django project object |
25 @param project reference to the Django project object |
24 @param parent reference to the parent widget (QWidget) |
26 @param parent reference to the parent widget (QWidget) |
25 """ |
27 """ |
26 super(DjangoDumpdataDataDialog, self).__init__(parent) |
28 super().__init__(parent) |
27 self.setupUi(self) |
29 self.setupUi(self) |
28 |
30 |
29 self.__project = project |
31 self.__project = project |
30 |
32 |
31 apps = self.__project.getRecentApplications() |
33 apps = self.__project.getRecentApplications() |
33 self.excludeCombo.addItems(apps) |
35 self.excludeCombo.addItems(apps) |
34 self.excludeCombo.setEditText("") |
36 self.excludeCombo.setEditText("") |
35 |
37 |
36 self.formatCombo.addItem(self.tr("JSON"), "json") |
38 self.formatCombo.addItem(self.tr("JSON"), "json") |
37 self.formatCombo.addItem(self.tr("XML"), "xml") |
39 self.formatCombo.addItem(self.tr("XML"), "xml") |
38 try: |
40 with contextlib.suppress(ImportError): |
39 import yaml # __IGNORE_WARNING__ |
41 import yaml # __IGNORE_WARNING__ |
40 self.formatCombo.addItem(self.tr("YAML"), "yaml") |
42 self.formatCombo.addItem(self.tr("YAML"), "yaml") |
41 except ImportError: |
|
42 pass |
|
43 |
43 |
44 msh = self.minimumSizeHint() |
44 msh = self.minimumSizeHint() |
45 self.resize(max(self.width(), msh.width()), msh.height()) |
45 self.resize(max(self.width(), msh.width()), msh.height()) |
46 |
46 |
47 def getData(self): |
47 def getData(self): |
58 appls = applStr.split() |
58 appls = applStr.split() |
59 else: |
59 else: |
60 appls = [] |
60 appls = [] |
61 |
61 |
62 exclStr = self.excludeCombo.currentText() |
62 exclStr = self.excludeCombo.currentText() |
63 if exclStr: |
63 excl = exclStr.split() if exclStr else [] |
64 excl = exclStr.split() |
|
65 else: |
|
66 excl = [] |
|
67 |
64 |
68 dumpFormat = self.formatCombo.itemData(self.formatCombo.currentIndex()) |
65 dumpFormat = self.formatCombo.itemData(self.formatCombo.currentIndex()) |
69 |
66 |
70 return appls, excl, dumpFormat, self.indentationSpinBox.value() |
67 return appls, excl, dumpFormat, self.indentationSpinBox.value() |