15 |
15 |
16 class HgShelveDataDialog(QDialog, Ui_HgShelveDataDialog): |
16 class HgShelveDataDialog(QDialog, Ui_HgShelveDataDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to enter the data for a shelve operation. |
18 Class implementing a dialog to enter the data for a shelve operation. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, version, parent=None): |
21 def __init__(self, version, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param version Mercurial version |
25 @param version Mercurial version |
25 @type tuple of three int |
26 @type tuple of three int |
26 @param parent reference to the parent widget |
27 @param parent reference to the parent widget |
27 @type QWidget |
28 @type QWidget |
28 """ |
29 """ |
29 super().__init__(parent) |
30 super().__init__(parent) |
30 self.setupUi(self) |
31 self.setupUi(self) |
31 |
32 |
32 self.__initialDateTime = QDateTime.currentDateTime() |
33 self.__initialDateTime = QDateTime.currentDateTime() |
33 self.dateTimeEdit.setDateTime(self.__initialDateTime) |
34 self.dateTimeEdit.setDateTime(self.__initialDateTime) |
34 |
35 |
35 if version < (5, 0, 0): |
36 if version < (5, 0, 0): |
36 self.keepCheckBox.setChecked(False) |
37 self.keepCheckBox.setChecked(False) |
37 self.keepCheckBox.hide() |
38 self.keepCheckBox.hide() |
38 |
39 |
39 msh = self.minimumSizeHint() |
40 msh = self.minimumSizeHint() |
40 self.resize(max(self.width(), msh.width()), msh.height()) |
41 self.resize(max(self.width(), msh.width()), msh.height()) |
41 |
42 |
42 def getData(self): |
43 def getData(self): |
43 """ |
44 """ |
44 Public method to get the user data. |
45 Public method to get the user data. |
45 |
46 |
46 @return tuple containing the name, date, message, a flag indicating |
47 @return tuple containing the name, date, message, a flag indicating |
47 to add/remove new/missing files and a flag indicating to keep the |
48 to add/remove new/missing files and a flag indicating to keep the |
48 shelved changes in the working directory |
49 shelved changes in the working directory |
49 @rtype tuple of (str, QDateTime, str, bool, bool) |
50 @rtype tuple of (str, QDateTime, str, bool, bool) |
50 """ |
51 """ |
51 dateTime = ( |
52 dateTime = ( |
52 self.dateTimeEdit.dateTime() |
53 self.dateTimeEdit.dateTime() |
53 if self.dateTimeEdit.dateTime() != self.__initialDateTime else |
54 if self.dateTimeEdit.dateTime() != self.__initialDateTime |
54 QDateTime() |
55 else QDateTime() |
55 ) |
56 ) |
56 return ( |
57 return ( |
57 self.nameEdit.text().replace(" ", "_"), |
58 self.nameEdit.text().replace(" ", "_"), |
58 dateTime, |
59 dateTime, |
59 self.messageEdit.text(), |
60 self.messageEdit.text(), |