35 def __init__(self, vcs, parent=None): |
35 def __init__(self, vcs, parent=None): |
36 """ |
36 """ |
37 Constructor |
37 Constructor |
38 |
38 |
39 @param vcs reference to the vcs object |
39 @param vcs reference to the vcs object |
40 @param parent parent widget (QWidget) |
40 @type Hg |
|
41 @param parent parent widget |
|
42 @type QWidget |
41 """ |
43 """ |
42 super().__init__(parent) |
44 super().__init__(parent) |
43 self.setupUi(self) |
45 self.setupUi(self) |
44 |
46 |
45 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
47 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
75 |
77 |
76 def closeEvent(self, e): |
78 def closeEvent(self, e): |
77 """ |
79 """ |
78 Protected slot implementing a close event handler. |
80 Protected slot implementing a close event handler. |
79 |
81 |
80 @param e close event (QCloseEvent) |
82 @param e close event |
|
83 @type QCloseEvent |
81 """ |
84 """ |
82 if self.__hgClient.isExecuting(): |
85 if self.__hgClient.isExecuting(): |
83 self.__hgClient.cancel() |
86 self.__hgClient.cancel() |
84 |
87 |
85 self.__position = self.pos() |
88 self.__position = self.pos() |
111 |
114 |
112 def __generateShelveEntry(self, name, age, message, fileStatistics, totals): |
115 def __generateShelveEntry(self, name, age, message, fileStatistics, totals): |
113 """ |
116 """ |
114 Private method to generate the shelve items. |
117 Private method to generate the shelve items. |
115 |
118 |
116 @param name name of the shelve (string) |
119 @param name name of the shelve |
117 @param age age of the shelve (string) |
120 @type str |
118 @param message shelve message (string) |
121 @param age age of the shelve |
119 @param fileStatistics per file change statistics (tuple of |
122 @type str |
120 four strings with file name, number of changes, number of |
123 @param message shelve message |
121 added lines and number of deleted lines) |
124 @type str |
122 @param totals overall statistics (tuple of three strings with |
125 @param fileStatistics per file change statistics (tuple containing the |
123 number of changed files, number of added lines and number |
126 file name, the number of changes, the number of added lines and the |
124 of deleted lines) |
127 number of deleted lines) |
|
128 @type tuple of (str, str, str, str) |
|
129 @param totals overall statistics (tuple containing the number of changed files, |
|
130 the number of added lines and the number of deleted lines) |
|
131 @type tuple of (str, str, str) |
125 """ |
132 """ |
126 itm = QTreeWidgetItem(self.shelveList, [name, age, message]) |
133 itm = QTreeWidgetItem(self.shelveList, [name, age, message]) |
127 itm.setData(0, self.__fileStatisticsRole, fileStatistics) |
134 itm.setData(0, self.__fileStatisticsRole, fileStatistics) |
128 itm.setData(0, self.__totalStatisticsRole, totals) |
135 itm.setData(0, self.__totalStatisticsRole, totals) |
129 |
136 |
235 |
242 |
236 def __showError(self, out): |
243 def __showError(self, out): |
237 """ |
244 """ |
238 Private slot to show some error. |
245 Private slot to show some error. |
239 |
246 |
240 @param out error to be shown (string) |
247 @param out error to be shown |
|
248 @type str |
241 """ |
249 """ |
242 self.errorGroup.show() |
250 self.errorGroup.show() |
243 self.errors.insertPlainText(out) |
251 self.errors.insertPlainText(out) |
244 self.errors.ensureCursorVisible() |
252 self.errors.ensureCursorVisible() |
245 |
253 |
246 @pyqtSlot(QAbstractButton) |
254 @pyqtSlot(QAbstractButton) |
247 def on_buttonBox_clicked(self, button): |
255 def on_buttonBox_clicked(self, button): |
248 """ |
256 """ |
249 Private slot called by a button of the button box clicked. |
257 Private slot called by a button of the button box clicked. |
250 |
258 |
251 @param button button that was clicked (QAbstractButton) |
259 @param button button that was clicked |
|
260 @type QAbstractButton |
252 """ |
261 """ |
253 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
262 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
254 self.close() |
263 self.close() |
255 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
264 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
256 self.cancelled = True |
265 self.cancelled = True |
261 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
270 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
262 def on_shelveList_currentItemChanged(self, current, previous): |
271 def on_shelveList_currentItemChanged(self, current, previous): |
263 """ |
272 """ |
264 Private slot called, when the current item of the shelve list changes. |
273 Private slot called, when the current item of the shelve list changes. |
265 |
274 |
266 @param current reference to the new current item (QTreeWidgetItem) |
275 @param current reference to the new current item |
267 @param previous reference to the old current item (QTreeWidgetItem) |
276 @type QTreeWidgetItem |
|
277 @param previous reference to the old current item |
|
278 @type QTreeWidgetItem |
268 """ |
279 """ |
269 self.statisticsList.clear() |
280 self.statisticsList.clear() |
270 if current: |
281 if current: |
271 for dataSet in current.data(0, self.__fileStatisticsRole): |
282 for dataSet in current.data(0, self.__fileStatisticsRole): |
272 QTreeWidgetItem(self.statisticsList, list(dataSet)) |
283 QTreeWidgetItem(self.statisticsList, list(dataSet)) |
291 @pyqtSlot(QPoint) |
302 @pyqtSlot(QPoint) |
292 def on_shelveList_customContextMenuRequested(self, pos): |
303 def on_shelveList_customContextMenuRequested(self, pos): |
293 """ |
304 """ |
294 Private slot to show the context menu of the shelve list. |
305 Private slot to show the context menu of the shelve list. |
295 |
306 |
296 @param pos position of the mouse pointer (QPoint) |
307 @param pos position of the mouse pointer |
|
308 @type QPoint |
297 """ |
309 """ |
298 selectedItemsCount = len(self.shelveList.selectedItems()) |
310 selectedItemsCount = len(self.shelveList.selectedItems()) |
299 self.__unshelveAct.setEnabled(selectedItemsCount == 1) |
311 self.__unshelveAct.setEnabled(selectedItemsCount == 1) |
300 self.__deleteAct.setEnabled(selectedItemsCount > 0) |
312 self.__deleteAct.setEnabled(selectedItemsCount > 0) |
301 |
313 |