src/eric7/DataViews/PyCoverageJsonReportDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
21 class PyCoverageJsonReportDialog(QDialog, Ui_PyCoverageJsonReportDialog): 21 class PyCoverageJsonReportDialog(QDialog, Ui_PyCoverageJsonReportDialog):
22 """ 22 """
23 Class implementing a dialog to enter the parameters for a coverage JSON 23 Class implementing a dialog to enter the parameters for a coverage JSON
24 report. 24 report.
25 """ 25 """
26
26 def __init__(self, defaultDirectory, parent=None): 27 def __init__(self, defaultDirectory, parent=None):
27 """ 28 """
28 Constructor 29 Constructor
29 30
30 @param defaultDirectory default directory for selecting the output 31 @param defaultDirectory default directory for selecting the output
31 directory 32 directory
32 @type str 33 @type str
33 @param parent reference to the parent widget (defaults to None) 34 @param parent reference to the parent widget (defaults to None)
34 @type QWidget (optional) 35 @type QWidget (optional)
35 """ 36 """
36 super().__init__(parent) 37 super().__init__(parent)
37 self.setupUi(self) 38 self.setupUi(self)
38 39
39 self.outputFilePicker.setMode( 40 self.outputFilePicker.setMode(
40 EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) 41 EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE
42 )
41 self.outputFilePicker.setDefaultDirectory(defaultDirectory) 43 self.outputFilePicker.setDefaultDirectory(defaultDirectory)
42 self.outputFilePicker.setFilters( 44 self.outputFilePicker.setFilters(self.tr("JSON Files (*.json);;All Files (*)"))
43 self.tr("JSON Files (*.json);;All Files (*)")) 45 self.outputFilePicker.setText(os.path.join(defaultDirectory, "coverage.json"))
44 self.outputFilePicker.setText( 46
45 os.path.join(defaultDirectory, "coverage.json"))
46
47 msh = self.minimumSizeHint() 47 msh = self.minimumSizeHint()
48 self.resize(max(self.width(), msh.width()), msh.height()) 48 self.resize(max(self.width(), msh.width()), msh.height())
49 49
50 @pyqtSlot(str) 50 @pyqtSlot(str)
51 def on_outputFilePicker_textChanged(self, filename): 51 def on_outputFilePicker_textChanged(self, filename):
52 """ 52 """
53 Private slot handling a change of the output file. 53 Private slot handling a change of the output file.
54 54
55 @param filename current text of the file picker 55 @param filename current text of the file picker
56 @type str 56 @type str
57 """ 57 """
58 self.buttonBox.button( 58 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
59 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(filename)) 59 bool(filename)
60 60 )
61
61 def getData(self): 62 def getData(self):
62 """ 63 """
63 Public method to get the entered data. 64 Public method to get the entered data.
64 65
65 @return tuple containing the output file and a flag indicating the 66 @return tuple containing the output file and a flag indicating the
66 creation of a compact JSON file 67 creation of a compact JSON file
67 68
68 @rtype tuple of (str, bool) 69 @rtype tuple of (str, bool)
69 """ 70 """
70 return ( 71 return (
71 self.outputFilePicker.currentText(), 72 self.outputFilePicker.currentText(),
72 self.compactCheckBox.isChecked(), 73 self.compactCheckBox.isChecked(),

eric ide

mercurial