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