|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 """ |
|
4 Module implementing a dialog to enter some user data. |
|
5 """ |
|
6 |
|
7 from PyQt4.QtGui import QDialog |
|
8 |
|
9 from .Ui_HgUserConfigDataDialog import Ui_HgUserConfigDataDialog |
|
10 |
|
11 |
|
12 class HgUserConfigDataDialog(QDialog, Ui_HgUserConfigDataDialog): |
|
13 """ |
|
14 Class implementing a dialog to enter some user data. |
|
15 """ |
|
16 def __init__(self, version=(0, 0), parent=None): |
|
17 """ |
|
18 Constructor |
|
19 |
|
20 @param parent reference to the parent widget (QWidget) |
|
21 """ |
|
22 super().__init__(parent) |
|
23 self.setupUi(self) |
|
24 |
|
25 if version >= (1, 8): |
|
26 self.bookmarksCheckBox.setEnabled(False) |
|
27 if version >= (2, 3): |
|
28 self.transplantCheckBox.setEnabled(False) |
|
29 |
|
30 self.resize(self.width(), self.minimumSizeHint().height()) |
|
31 |
|
32 def getData(self): |
|
33 """ |
|
34 Public method to retrieve the entered data. |
|
35 |
|
36 @return tuple with user's first name, last name, email address and |
|
37 list of activated extensions (tuple of three strings and a list |
|
38 of strings) |
|
39 """ |
|
40 extensions = [] |
|
41 |
|
42 if self.bookmarksCheckBox.isChecked(): |
|
43 extensions.append("bookmarks") |
|
44 if self.fetchCheckBox.isChecked(): |
|
45 extensions.append("fetch") |
|
46 if self.gpgCheckBox.isChecked(): |
|
47 extensions.append("gpg") |
|
48 if self.purgeCheckBox.isChecked(): |
|
49 extensions.append("purge") |
|
50 if self.queuesCheckBox.isChecked(): |
|
51 extensions.append("mq") |
|
52 if self.rebaseCheckBox.isChecked(): |
|
53 extensions.append("rebase") |
|
54 if self.transplantCheckBox.isChecked(): |
|
55 extensions.append("transplant") |
|
56 |
|
57 return ( |
|
58 self.firstNameEdit.text(), |
|
59 self.lastNameEdit.text(), |
|
60 self.emailEdit.text(), |
|
61 extensions, |
|
62 ) |