19 |
19 |
20 class HgExportDialog(QDialog, Ui_HgExportDialog): |
20 class HgExportDialog(QDialog, Ui_HgExportDialog): |
21 """ |
21 """ |
22 Class implementing a dialog to enter data for the Mercurial export command. |
22 Class implementing a dialog to enter data for the Mercurial export command. |
23 """ |
23 """ |
|
24 |
24 def __init__(self, bookmarksList, bookmarkAvailable, parent=None): |
25 def __init__(self, bookmarksList, bookmarkAvailable, parent=None): |
25 """ |
26 """ |
26 Constructor |
27 Constructor |
27 |
28 |
28 @param bookmarksList list of defined bookmarks |
29 @param bookmarksList list of defined bookmarks |
29 @type list of str |
30 @type list of str |
30 @param bookmarkAvailable flag indicating the availability of the |
31 @param bookmarkAvailable flag indicating the availability of the |
31 "--bookmark" option |
32 "--bookmark" option |
32 @type bool |
33 @type bool |
33 @param parent reference to the parent widget |
34 @param parent reference to the parent widget |
34 @type QWidget |
35 @type QWidget |
35 """ |
36 """ |
36 super().__init__(parent) |
37 super().__init__(parent) |
37 self.setupUi(self) |
38 self.setupUi(self) |
38 |
39 |
39 self.directoryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
40 self.directoryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
40 |
41 |
41 self.buttonBox.button( |
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
42 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
43 |
43 |
|
44 # set default values for directory and pattern |
44 # set default values for directory and pattern |
45 self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") |
45 self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") |
46 self.directoryPicker.setText(QDir.tempPath()) |
46 self.directoryPicker.setText(QDir.tempPath()) |
47 |
47 |
48 self.bookmarkCombo.addItem("") |
48 self.bookmarkCombo.addItem("") |
49 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
49 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
50 self.bookmarkCombo.setEnabled(bookmarkAvailable) |
50 self.bookmarkCombo.setEnabled(bookmarkAvailable) |
51 |
51 |
52 def __updateOK(self): |
52 def __updateOK(self): |
53 """ |
53 """ |
54 Private slot to update the OK button. |
54 Private slot to update the OK button. |
55 """ |
55 """ |
56 enabled = True |
56 enabled = True |
57 |
57 |
58 if ( |
58 if ( |
59 self.directoryPicker.text() == "" or |
59 self.directoryPicker.text() == "" |
60 self.patternEdit.text() == "" or |
60 or self.patternEdit.text() == "" |
61 (self.changesetsEdit.toPlainText() == "" and |
61 or ( |
62 self.bookmarkCombo.currentText() == "") |
62 self.changesetsEdit.toPlainText() == "" |
|
63 and self.bookmarkCombo.currentText() == "" |
|
64 ) |
63 ): |
65 ): |
64 enabled = False |
66 enabled = False |
65 |
67 |
66 self.buttonBox.button( |
68 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
67 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
69 |
68 |
|
69 @pyqtSlot(str) |
70 @pyqtSlot(str) |
70 def on_directoryPicker_textChanged(self, txt): |
71 def on_directoryPicker_textChanged(self, txt): |
71 """ |
72 """ |
72 Private slot to react on changes of the export directory edit. |
73 Private slot to react on changes of the export directory edit. |
73 |
74 |
74 @param txt contents of the line edit (string) |
75 @param txt contents of the line edit (string) |
75 """ |
76 """ |
76 self.__updateOK() |
77 self.__updateOK() |
77 |
78 |
78 @pyqtSlot(str) |
79 @pyqtSlot(str) |
79 def on_patternEdit_textChanged(self, txt): |
80 def on_patternEdit_textChanged(self, txt): |
80 """ |
81 """ |
81 Private slot to react on changes of the export file name pattern edit. |
82 Private slot to react on changes of the export file name pattern edit. |
82 |
83 |
83 @param txt contents of the line edit (string) |
84 @param txt contents of the line edit (string) |
84 """ |
85 """ |
85 self.__updateOK() |
86 self.__updateOK() |
86 |
87 |
87 @pyqtSlot() |
88 @pyqtSlot() |
88 def on_changesetsEdit_textChanged(self): |
89 def on_changesetsEdit_textChanged(self): |
89 """ |
90 """ |
90 Private slot to react on changes of the changesets edit. |
91 Private slot to react on changes of the changesets edit. |
91 """ |
92 """ |
92 self.__updateOK() |
93 self.__updateOK() |
93 |
94 |
94 def getParameters(self): |
95 def getParameters(self): |
95 """ |
96 """ |
96 Public method to retrieve the export data. |
97 Public method to retrieve the export data. |
97 |
98 |
98 @return tuple naming the output file name, the list of revisions to |
99 @return tuple naming the output file name, the list of revisions to |
99 export, the name of a bookmarked branch and flags indicating to |
100 export, the name of a bookmarked branch and flags indicating to |
100 compare against the second parent, to treat all files as text, |
101 compare against the second parent, to treat all files as text, |
101 to omit dates in the diff headers and to use the git extended |
102 to omit dates in the diff headers and to use the git extended |
102 diff format |
103 diff format |
103 @rtype tuple of (str, list of str, str, bool, bool, bool, bool) |
104 @rtype tuple of (str, list of str, str, bool, bool, bool, bool) |
104 """ |
105 """ |
105 return ( |
106 return ( |
106 os.path.join( |
107 os.path.join(self.directoryPicker.text(), self.patternEdit.text()), |
107 self.directoryPicker.text(), |
|
108 self.patternEdit.text()), |
|
109 self.changesetsEdit.toPlainText().splitlines(), |
108 self.changesetsEdit.toPlainText().splitlines(), |
110 self.bookmarkCombo.currentText(), |
109 self.bookmarkCombo.currentText(), |
111 self.switchParentCheckBox.isChecked(), |
110 self.switchParentCheckBox.isChecked(), |
112 self.textCheckBox.isChecked(), |
111 self.textCheckBox.isChecked(), |
113 self.datesCheckBox.isChecked(), |
112 self.datesCheckBox.isChecked(), |
114 self.gitCheckBox.isChecked() |
113 self.gitCheckBox.isChecked(), |
115 ) |
114 ) |