Plugins/VcsPlugins/vcsMercurial/HgUserConfigDataDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3366
6084bb3c3911
child 3562
ef3f13a2c599
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
1 # -*- coding: utf-8 -*-
2
3 """
4 Module implementing a dialog to enter some user data.
5 """
6
7 from __future__ import unicode_literals
8
9 from PyQt4.QtGui import QDialog
10
11 from .Ui_HgUserConfigDataDialog import Ui_HgUserConfigDataDialog
12
13
14 class HgUserConfigDataDialog(QDialog, Ui_HgUserConfigDataDialog):
15 """
16 Class implementing a dialog to enter some user data.
17 """
18 def __init__(self, version=(0, 0), parent=None):
19 """
20 Constructor
21
22 @param version Mercurial version info (tuple of two integers)
23 @param parent reference to the parent widget (QWidget)
24 """
25 super(HgUserConfigDataDialog, self).__init__(parent)
26 self.setupUi(self)
27
28 if version >= (1, 8):
29 self.bookmarksCheckBox.setEnabled(False)
30 if version >= (2, 3):
31 self.transplantCheckBox.setEnabled(False)
32
33 msh = self.minimumSizeHint()
34 self.resize(max(self.width(), msh.width()), msh.height())
35
36 def getData(self):
37 """
38 Public method to retrieve the entered data.
39
40 @return tuple with user's first name, last name, email address,
41 list of activated extensions and dictionary with extension data
42 (tuple of three strings, a list of strings and a dictionary with
43 extension name as key)
44 """
45 extensions = []
46 extensionsData = {}
47
48 if self.bookmarksCheckBox.isChecked():
49 extensions.append("bookmarks")
50 if self.fetchCheckBox.isChecked():
51 extensions.append("fetch")
52 if self.gpgCheckBox.isChecked():
53 extensions.append("gpg")
54 if self.purgeCheckBox.isChecked():
55 extensions.append("purge")
56 if self.queuesCheckBox.isChecked():
57 extensions.append("mq")
58 if self.rebaseCheckBox.isChecked():
59 extensions.append("rebase")
60 if self.shelveCheckBox.isChecked():
61 extensions.append("shelve")
62 if self.transplantCheckBox.isChecked():
63 extensions.append("transplant")
64 if self.largefilesCheckBox.isChecked():
65 extensions.append("largefiles")
66 largefilesDataDict = {}
67 lfFileSize = self.lfFileSizeSpinBox.value()
68 if lfFileSize != 10: # default value is 10 MB
69 largefilesDataDict["minsize"] = lfFileSize
70 lfFilePatterns = self.lfFilePatternsEdit.text()
71 if lfFilePatterns:
72 largefilesDataDict["patterns"] = lfFilePatterns.split()
73 if largefilesDataDict:
74 extensionsData["largefiles"] = largefilesDataDict
75
76 return (
77 self.firstNameEdit.text(),
78 self.lastNameEdit.text(),
79 self.emailEdit.text(),
80 extensions,
81 extensionsData,
82 )

eric ide

mercurial