34 ): |
34 ): |
35 """ |
35 """ |
36 Constructor |
36 Constructor |
37 |
37 |
38 @param vcsObject reference to the vcs object |
38 @param vcsObject reference to the vcs object |
|
39 @type Hg |
39 @param browserObject reference to the project browser object |
40 @param browserObject reference to the project browser object |
|
41 @type ProjectBaseBrowser |
40 @param projectObject reference to the project object |
42 @param projectObject reference to the project object |
|
43 @type Project |
41 @param isTranslationsBrowser flag indicating, the helper is requested |
44 @param isTranslationsBrowser flag indicating, the helper is requested |
42 for the translations browser (this needs some special treatment) |
45 for the translations browser (this needs some special treatment) |
43 @param parent parent widget (QWidget) |
46 @type bool |
44 @param name name of this object (string) |
47 @param parent parent widget |
|
48 @type QWidget |
|
49 @param name name of this object |
|
50 @type str |
45 """ |
51 """ |
46 from .LargefilesExtension.ProjectBrowserHelper import ( |
52 from .LargefilesExtension.ProjectBrowserHelper import ( |
47 LargefilesProjectBrowserHelper, |
53 LargefilesProjectBrowserHelper, |
48 ) |
54 ) |
49 from .ShelveExtension.ProjectBrowserHelper import ShelveProjectBrowserHelper |
55 from .ShelveExtension.ProjectBrowserHelper import ShelveProjectBrowserHelper |
78 |
84 |
79 def __showExtensionMenu(self, key, controlled): |
85 def __showExtensionMenu(self, key, controlled): |
80 """ |
86 """ |
81 Private slot showing the extensions menu. |
87 Private slot showing the extensions menu. |
82 |
88 |
83 @param key menu key (string, one of 'mainMenu', 'multiMenu', |
89 @param key menu key (one of 'mainMenu', 'multiMenu', 'backMenu', 'dirMenu' |
84 'backMenu', 'dirMenu' or 'dirMultiMenu') |
90 or 'dirMultiMenu') |
|
91 @type str |
85 @param controlled flag indicating to show the menu for a |
92 @param controlled flag indicating to show the menu for a |
86 version controlled entry or a non-version controlled entry |
93 version controlled entry or a non-version controlled entry |
87 (boolean) |
94 @type bool |
88 """ |
95 """ |
89 for extensionName in self.__extensionMenus: |
96 for extensionName in self.__extensionMenus: |
90 if key in self.__extensionMenus[extensionName]: |
97 if key in self.__extensionMenus[extensionName]: |
91 self.__extensionMenus[extensionName][key].setEnabled( |
98 self.__extensionMenus[extensionName][key].setEnabled( |
92 self.vcs.isExtensionActive(extensionName) |
99 self.vcs.isExtensionActive(extensionName) |
106 |
113 |
107 It enables/disables the VCS menu entries depending on the overall |
114 It enables/disables the VCS menu entries depending on the overall |
108 VCS status and the file status. |
115 VCS status and the file status. |
109 |
116 |
110 @param menu reference to the menu to be shown |
117 @param menu reference to the menu to be shown |
|
118 @type QMenu |
111 @param standardItems array of standard items that need |
119 @param standardItems array of standard items that need |
112 activation/deactivation depending on the overall VCS status |
120 activation/deactivation depending on the overall VCS status |
|
121 @type list of QAction |
113 """ |
122 """ |
114 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
123 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
115 controlled = True |
124 controlled = True |
116 for act in self.vcsMenuActions: |
125 for act in self.vcsMenuActions: |
117 act.setEnabled(True) |
126 act.setEnabled(True) |
141 |
150 |
142 It enables/disables the VCS menu entries depending on the overall |
151 It enables/disables the VCS menu entries depending on the overall |
143 VCS status and the files status. |
152 VCS status and the files status. |
144 |
153 |
145 @param menu reference to the menu to be shown |
154 @param menu reference to the menu to be shown |
|
155 @type QMenu |
146 @param standardItems array of standard items that need |
156 @param standardItems array of standard items that need |
147 activation/deactivation depending on the overall VCS status |
157 activation/deactivation depending on the overall VCS status |
|
158 @type list of QAction |
148 """ |
159 """ |
149 vcsName = self.vcs.vcsName() |
160 vcsName = self.vcs.vcsName() |
150 items = self.browser.getSelectedItems() |
161 items = self.browser.getSelectedItems() |
151 vcsItems = 0 |
162 vcsItems = 0 |
152 # determine number of selected items under VCS control |
163 # determine number of selected items under VCS control |
182 |
193 |
183 It enables/disables the VCS menu entries depending on the overall |
194 It enables/disables the VCS menu entries depending on the overall |
184 VCS status and the directory status. |
195 VCS status and the directory status. |
185 |
196 |
186 @param menu reference to the menu to be shown |
197 @param menu reference to the menu to be shown |
|
198 @type QMenu |
187 @param standardItems array of standard items that need |
199 @param standardItems array of standard items that need |
188 activation/deactivation depending on the overall VCS status |
200 activation/deactivation depending on the overall VCS status |
|
201 @type list of QAction |
189 """ |
202 """ |
190 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
203 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
191 controlled = True |
204 controlled = True |
192 for act in self.vcsDirMenuActions: |
205 for act in self.vcsDirMenuActions: |
193 act.setEnabled(True) |
206 act.setEnabled(True) |
211 |
224 |
212 It enables/disables the VCS menu entries depending on the overall |
225 It enables/disables the VCS menu entries depending on the overall |
213 VCS status and the directory status. |
226 VCS status and the directory status. |
214 |
227 |
215 @param menu reference to the menu to be shown |
228 @param menu reference to the menu to be shown |
216 @param standardItems array of standard items that need |
229 @type QMenu |
|
230 @param standardItems list of standard items that need |
217 activation/deactivation depending on the overall VCS status |
231 activation/deactivation depending on the overall VCS status |
|
232 @type list of QAction |
218 """ |
233 """ |
219 vcsName = self.vcs.vcsName() |
234 vcsName = self.vcs.vcsName() |
220 items = self.browser.getSelectedItems() |
235 items = self.browser.getSelectedItems() |
221 vcsItems = 0 |
236 vcsItems = 0 |
222 # determine number of selected items under VCS control |
237 # determine number of selected items under VCS control |
252 |
267 |
253 def __addExtensionsMenu(self, menu, key): |
268 def __addExtensionsMenu(self, menu, key): |
254 """ |
269 """ |
255 Private method to add an extension menu entry. |
270 Private method to add an extension menu entry. |
256 |
271 |
257 @param menu menu to add it to (QMenu) |
272 @param menu menu to add it to |
258 @param key menu key (string, one of 'mainMenu', 'multiMenu', |
273 @type QMenu |
259 'backMenu', 'dirMenu' or 'dirMultiMenu') |
274 @param key menu key (one of 'mainMenu', 'multiMenu', 'backMenu', 'dirMenu' |
260 @return reference to the menu action (QAction) |
275 or 'dirMultiMenu') |
|
276 @type str |
|
277 @return reference to the menu action |
|
278 @rtype QAction |
261 """ |
279 """ |
262 act = None |
280 act = None |
263 if key in ["mainMenu", "multiMenu", "backMenu", "dirMenu", "dirMultiMenu"]: |
281 if key in ["mainMenu", "multiMenu", "backMenu", "dirMenu", "dirMultiMenu"]: |
264 extensionsMenu = QMenu(self.tr("Extensions"), menu) |
282 extensionsMenu = QMenu(self.tr("Extensions"), menu) |
265 extensionsMenu.setTearOffEnabled(True) |
283 extensionsMenu.setTearOffEnabled(True) |
280 def _addVCSMenu(self, mainMenu): |
298 def _addVCSMenu(self, mainMenu): |
281 """ |
299 """ |
282 Protected method used to add the VCS menu to all project browsers. |
300 Protected method used to add the VCS menu to all project browsers. |
283 |
301 |
284 @param mainMenu reference to the menu to be amended |
302 @param mainMenu reference to the menu to be amended |
|
303 @type QMenu |
285 """ |
304 """ |
286 self.vcsMenuActions = [] |
305 self.vcsMenuActions = [] |
287 self.vcsAddMenuActions = [] |
306 self.vcsAddMenuActions = [] |
288 |
307 |
289 menu = QMenu(self.tr("Version Control")) |
308 menu = QMenu(self.tr("Version Control")) |
422 """ |
441 """ |
423 Protected method used to add the VCS menu for multi selection to all |
442 Protected method used to add the VCS menu for multi selection to all |
424 project browsers. |
443 project browsers. |
425 |
444 |
426 @param mainMenu reference to the menu to be amended |
445 @param mainMenu reference to the menu to be amended |
|
446 @type QMenu |
427 """ |
447 """ |
428 self.vcsMultiMenuActions = [] |
448 self.vcsMultiMenuActions = [] |
429 self.vcsAddMultiMenuActions = [] |
449 self.vcsAddMultiMenuActions = [] |
430 |
450 |
431 menu = QMenu(self.tr("Version Control")) |
451 menu = QMenu(self.tr("Version Control")) |