10 |
10 |
11 from .Ui_HgRepoConfigDataDialog import Ui_HgRepoConfigDataDialog |
11 from .Ui_HgRepoConfigDataDialog import Ui_HgRepoConfigDataDialog |
12 |
12 |
13 import UI.PixmapCache |
13 import UI.PixmapCache |
14 |
14 |
|
15 from .LargefilesExtension import getDefaults as getLargefilesDefaults |
|
16 |
15 |
17 |
16 class HgRepoConfigDataDialog(QDialog, Ui_HgRepoConfigDataDialog): |
18 class HgRepoConfigDataDialog(QDialog, Ui_HgRepoConfigDataDialog): |
17 """ |
19 """ |
18 Class implementing a dialog to enter data needed for the initial creation |
20 Class implementing a dialog to enter data needed for the initial creation |
19 of a repository configuration file (hgrc). |
21 of a repository configuration file (hgrc). |
20 """ |
22 """ |
21 def __init__(self, parent=None): |
23 def __init__(self, withLargefiles=False, largefilesData=None, parent=None): |
22 """ |
24 """ |
23 Constructor |
25 Constructor |
24 |
26 |
|
27 @param withLargefiles flag indicating to configure the largefiles |
|
28 section (boolean) |
|
29 @param largefilesData dictionary with data for the largefiles |
|
30 section (dict) |
25 @param parent reference to the parent widget (QWidget) |
31 @param parent reference to the parent widget (QWidget) |
26 """ |
32 """ |
27 super().__init__(parent) |
33 super().__init__(parent) |
28 self.setupUi(self) |
34 self.setupUi(self) |
29 |
35 |
30 self.defaultShowPasswordButton.setIcon( |
36 self.defaultShowPasswordButton.setIcon( |
31 UI.PixmapCache.getIcon("showPassword.png")) |
37 UI.PixmapCache.getIcon("showPassword.png")) |
32 self.defaultPushShowPasswordButton.setIcon( |
38 self.defaultPushShowPasswordButton.setIcon( |
33 UI.PixmapCache.getIcon("showPassword.png")) |
39 UI.PixmapCache.getIcon("showPassword.png")) |
|
40 |
|
41 self.__withLargefiles = withLargefiles |
|
42 if withLargefiles: |
|
43 if largefilesData is None: |
|
44 largefilesData = getLargefilesDefaults() |
|
45 self.lfFileSizeSpinBox.setValue(largefilesData["minsize"]) |
|
46 self.lfFilePatternsEdit.setText( |
|
47 " ".join(largefilesData["pattern"])) |
|
48 else: |
|
49 self.largefilesGroup.setVisible(False) |
34 |
50 |
35 self.resize(self.width(), self.minimumSizeHint().height()) |
51 self.resize(self.width(), self.minimumSizeHint().height()) |
36 |
52 |
37 @pyqtSlot(bool) |
53 @pyqtSlot(bool) |
38 def on_defaultShowPasswordButton_clicked(self, checked): |
54 def on_defaultShowPasswordButton_clicked(self, checked): |
90 defaultPushUrl = "" |
106 defaultPushUrl = "" |
91 else: |
107 else: |
92 defaultPushUrl = defaultPushUrl.toString() |
108 defaultPushUrl = defaultPushUrl.toString() |
93 |
109 |
94 return defaultUrl, defaultPushUrl |
110 return defaultUrl, defaultPushUrl |
|
111 |
|
112 def getLargefilesData(self): |
|
113 """ |
|
114 Public method to get the data for the largefiles extension. |
|
115 |
|
116 @return tuple with the minimum file size (integer) and file patterns |
|
117 (list of string). None as value denote to use the default value. |
|
118 """ |
|
119 if self.__withLargefiles: |
|
120 lfDefaults = getLargefilesDefaults() |
|
121 if self.lfFileSizeSpinBox.value() == lfDefaults["minsize"]: |
|
122 minsize = None |
|
123 else: |
|
124 minsize = self.lfFileSizeSpinBox.value() |
|
125 patterns = self.lfFilePatternsEdit.text().split() |
|
126 if set(patterns) == set(lfDefaults["pattern"]): |
|
127 patterns = None |
|
128 |
|
129 return minsize, patterns |
|
130 else: |
|
131 return None, None |