16 |
16 |
17 |
17 |
18 class SvnCommitDialog(QWidget, Ui_SvnCommitDialog): |
18 class SvnCommitDialog(QWidget, Ui_SvnCommitDialog): |
19 """ |
19 """ |
20 Class implementing a dialog to enter the commit message. |
20 Class implementing a dialog to enter the commit message. |
21 |
21 |
22 @signal accepted() emitted, if the dialog was accepted |
22 @signal accepted() emitted, if the dialog was accepted |
23 @signal rejected() emitted, if the dialog was rejected |
23 @signal rejected() emitted, if the dialog was rejected |
24 """ |
24 """ |
|
25 |
25 accepted = pyqtSignal() |
26 accepted = pyqtSignal() |
26 rejected = pyqtSignal() |
27 rejected = pyqtSignal() |
27 |
28 |
28 def __init__(self, vcs, parent=None): |
29 def __init__(self, vcs, parent=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 |
32 |
32 @param vcs reference to the vcs object |
33 @param vcs reference to the vcs object |
33 @param parent parent widget (QWidget) |
34 @param parent parent widget (QWidget) |
34 """ |
35 """ |
35 super().__init__(parent, Qt.WindowType.Window) |
36 super().__init__(parent, Qt.WindowType.Window) |
36 self.setupUi(self) |
37 self.setupUi(self) |
37 |
38 |
38 self.__vcs = vcs |
39 self.__vcs = vcs |
39 |
40 |
40 project = ericApp().getObject("Project") |
41 project = ericApp().getObject("Project") |
41 pwl, pel = project.getProjectDictionaries() |
42 pwl, pel = project.getProjectDictionaries() |
42 language = project.getProjectSpellLanguage() |
43 language = project.getProjectSpellLanguage() |
43 self.logEdit.setLanguageWithPWL(language, pwl or None, pel or None) |
44 self.logEdit.setLanguageWithPWL(language, pwl or None, pel or None) |
44 |
45 |
45 if vcs.version < (1, 5, 0): |
46 if vcs.version < (1, 5, 0): |
46 self.changeListsGroup.hide() |
47 self.changeListsGroup.hide() |
47 else: |
48 else: |
48 self.changeLists.addItems(sorted(vcs.svnGetChangelists())) |
49 self.changeLists.addItems(sorted(vcs.svnGetChangelists())) |
49 |
50 |
50 def showEvent(self, evt): |
51 def showEvent(self, evt): |
51 """ |
52 """ |
52 Protected method called when the dialog is about to be shown. |
53 Protected method called when the dialog is about to be shown. |
53 |
54 |
54 @param evt the event (QShowEvent) |
55 @param evt the event (QShowEvent) |
55 """ |
56 """ |
56 commitMessages = self.__vcs.vcsCommitMessages() |
57 commitMessages = self.__vcs.vcsCommitMessages() |
57 self.recentComboBox.clear() |
58 self.recentComboBox.clear() |
58 self.recentComboBox.addItem("") |
59 self.recentComboBox.addItem("") |
59 self.recentComboBox.addItems(commitMessages) |
60 self.recentComboBox.addItems(commitMessages) |
60 |
61 |
61 self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) |
62 self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) |
62 |
63 |
63 def logMessage(self): |
64 def logMessage(self): |
64 """ |
65 """ |
65 Public method to retrieve the log message. |
66 Public method to retrieve the log message. |
66 |
67 |
67 @return the log message (string) |
68 @return the log message (string) |
68 """ |
69 """ |
69 msg = self.logEdit.toPlainText() |
70 msg = self.logEdit.toPlainText() |
70 if msg: |
71 if msg: |
71 self.__vcs.vcsAddCommitMessage(msg) |
72 self.__vcs.vcsAddCommitMessage(msg) |
72 return msg |
73 return msg |
73 |
74 |
74 def hasChangelists(self): |
75 def hasChangelists(self): |
75 """ |
76 """ |
76 Public method to check, if the user entered some changelists. |
77 Public method to check, if the user entered some changelists. |
77 |
78 |
78 @return flag indicating availability of changelists (boolean) |
79 @return flag indicating availability of changelists (boolean) |
79 """ |
80 """ |
80 return len(self.changeLists.selectedItems()) > 0 |
81 return len(self.changeLists.selectedItems()) > 0 |
81 |
82 |
82 def changelistsData(self): |
83 def changelistsData(self): |
83 """ |
84 """ |
84 Public method to retrieve the changelists data. |
85 Public method to retrieve the changelists data. |
85 |
86 |
86 @return tuple containing the changelists (list of strings) and a flag |
87 @return tuple containing the changelists (list of strings) and a flag |
87 indicating to keep changelists (boolean) |
88 indicating to keep changelists (boolean) |
88 """ |
89 """ |
89 slists = [line.text().strip() |
90 slists = [ |
90 for line in self.changeLists.selectedItems() |
91 line.text().strip() |
91 if line.text().strip() != ""] |
92 for line in self.changeLists.selectedItems() |
92 |
93 if line.text().strip() != "" |
|
94 ] |
|
95 |
93 if len(slists) == 0: |
96 if len(slists) == 0: |
94 return [], False |
97 return [], False |
95 |
98 |
96 return slists, self.keepChangeListsCheckBox.isChecked() |
99 return slists, self.keepChangeListsCheckBox.isChecked() |
97 |
100 |
98 def on_buttonBox_clicked(self, button): |
101 def on_buttonBox_clicked(self, button): |
99 """ |
102 """ |
100 Private slot called by a button of the button box clicked. |
103 Private slot called by a button of the button box clicked. |
101 |
104 |
102 @param button button that was clicked (QAbstractButton) |
105 @param button button that was clicked (QAbstractButton) |
103 """ |
106 """ |
104 if button == self.buttonBox.button( |
107 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
105 QDialogButtonBox.StandardButton.Cancel |
|
106 ): |
|
107 self.logEdit.clear() |
108 self.logEdit.clear() |
108 |
109 |
109 def on_buttonBox_accepted(self): |
110 def on_buttonBox_accepted(self): |
110 """ |
111 """ |
111 Private slot called by the buttonBox accepted signal. |
112 Private slot called by the buttonBox accepted signal. |
112 """ |
113 """ |
113 self.close() |
114 self.close() |
114 self.accepted.emit() |
115 self.accepted.emit() |
115 |
116 |
116 def on_buttonBox_rejected(self): |
117 def on_buttonBox_rejected(self): |
117 """ |
118 """ |
118 Private slot called by the buttonBox rejected signal. |
119 Private slot called by the buttonBox rejected signal. |
119 """ |
120 """ |
120 self.close() |
121 self.close() |
121 self.rejected.emit() |
122 self.rejected.emit() |
122 |
123 |
123 @pyqtSlot(int) |
124 @pyqtSlot(int) |
124 def on_recentComboBox_activated(self, index): |
125 def on_recentComboBox_activated(self, index): |
125 """ |
126 """ |
126 Private slot to select a commit message from recent ones. |
127 Private slot to select a commit message from recent ones. |
127 |
128 |
128 @param index index of the selected entry |
129 @param index index of the selected entry |
129 @type int |
130 @type int |
130 """ |
131 """ |
131 txt = self.recentComboBox.itemText(index) |
132 txt = self.recentComboBox.itemText(index) |
132 if txt: |
133 if txt: |