35 ): |
35 ): |
36 """ |
36 """ |
37 Constructor |
37 Constructor |
38 |
38 |
39 @param vcsObject reference to the vcs object |
39 @param vcsObject reference to the vcs object |
|
40 @type Subversion |
40 @param browserObject reference to the project browser object |
41 @param browserObject reference to the project browser object |
|
42 @type ProjectBaseBrowser |
41 @param projectObject reference to the project object |
43 @param projectObject reference to the project object |
|
44 @type Project |
42 @param isTranslationsBrowser flag indicating, the helper is requested |
45 @param isTranslationsBrowser flag indicating, the helper is requested |
43 for the translations browser (this needs some special treatment) |
46 for the translations browser (this needs some special treatment) |
44 @param parent parent widget (QWidget) |
47 @type bool |
45 @param name name of this object (string) |
48 @param parent parent widget |
|
49 @type QWidget |
|
50 @param name name of this object |
|
51 @type str |
46 """ |
52 """ |
47 VcsProjectBrowserHelper.__init__( |
53 VcsProjectBrowserHelper.__init__( |
48 self, |
54 self, |
49 vcsObject, |
55 vcsObject, |
50 browserObject, |
56 browserObject, |
60 |
66 |
61 It enables/disables the VCS menu entries depending on the overall |
67 It enables/disables the VCS menu entries depending on the overall |
62 VCS status and the file status. |
68 VCS status and the file status. |
63 |
69 |
64 @param menu reference to the menu to be shown |
70 @param menu reference to the menu to be shown |
|
71 @type QMenu |
65 @param standardItems array of standard items that need |
72 @param standardItems array of standard items that need |
66 activation/deactivation depending on the overall VCS status |
73 activation/deactivation depending on the overall VCS status |
|
74 @type list of QAction |
67 """ |
75 """ |
68 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
76 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
69 for act in self.vcsMenuActions: |
77 for act in self.vcsMenuActions: |
70 act.setEnabled(True) |
78 act.setEnabled(True) |
71 for act in self.vcsAddMenuActions: |
79 for act in self.vcsAddMenuActions: |
96 |
104 |
97 It enables/disables the VCS menu entries depending on the overall |
105 It enables/disables the VCS menu entries depending on the overall |
98 VCS status and the files status. |
106 VCS status and the files status. |
99 |
107 |
100 @param menu reference to the menu to be shown |
108 @param menu reference to the menu to be shown |
|
109 @type QMenu |
101 @param standardItems array of standard items that need |
110 @param standardItems array of standard items that need |
102 activation/deactivation depending on the overall VCS status |
111 activation/deactivation depending on the overall VCS status |
|
112 @type list of QAction |
103 """ |
113 """ |
104 vcsName = self.vcs.vcsName() |
114 vcsName = self.vcs.vcsName() |
105 items = self.browser.getSelectedItems() |
115 items = self.browser.getSelectedItems() |
106 vcsItems = 0 |
116 vcsItems = 0 |
107 # determine number of selected items under VCS control |
117 # determine number of selected items under VCS control |
136 |
146 |
137 It enables/disables the VCS menu entries depending on the overall |
147 It enables/disables the VCS menu entries depending on the overall |
138 VCS status and the directory status. |
148 VCS status and the directory status. |
139 |
149 |
140 @param menu reference to the menu to be shown |
150 @param menu reference to the menu to be shown |
|
151 @type QMenu |
141 @param standardItems array of standard items that need |
152 @param standardItems array of standard items that need |
142 activation/deactivation depending on the overall VCS status |
153 activation/deactivation depending on the overall VCS status |
|
154 @type list of QAction |
143 """ |
155 """ |
144 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
156 if self.browser.currentItem().data(1) == self.vcs.vcsName(): |
145 for act in self.vcsDirMenuActions: |
157 for act in self.vcsDirMenuActions: |
146 act.setEnabled(True) |
158 act.setEnabled(True) |
147 for act in self.vcsAddDirMenuActions: |
159 for act in self.vcsAddDirMenuActions: |
162 |
174 |
163 It enables/disables the VCS menu entries depending on the overall |
175 It enables/disables the VCS menu entries depending on the overall |
164 VCS status and the directory status. |
176 VCS status and the directory status. |
165 |
177 |
166 @param menu reference to the menu to be shown |
178 @param menu reference to the menu to be shown |
|
179 @type QMenu |
167 @param standardItems array of standard items that need |
180 @param standardItems array of standard items that need |
168 activation/deactivation depending on the overall VCS status |
181 activation/deactivation depending on the overall VCS status |
|
182 @type list of QAction |
169 """ |
183 """ |
170 vcsName = self.vcs.vcsName() |
184 vcsName = self.vcs.vcsName() |
171 items = self.browser.getSelectedItems() |
185 items = self.browser.getSelectedItems() |
172 vcsItems = 0 |
186 vcsItems = 0 |
173 # determine number of selected items under VCS control |
187 # determine number of selected items under VCS control |
201 def _addVCSMenu(self, mainMenu): |
215 def _addVCSMenu(self, mainMenu): |
202 """ |
216 """ |
203 Protected method used to add the VCS menu to all project browsers. |
217 Protected method used to add the VCS menu to all project browsers. |
204 |
218 |
205 @param mainMenu reference to the menu to be amended |
219 @param mainMenu reference to the menu to be amended |
|
220 @type QMenu |
206 """ |
221 """ |
207 self.vcsMenuActions = [] |
222 self.vcsMenuActions = [] |
208 self.vcsAddMenuActions = [] |
223 self.vcsAddMenuActions = [] |
209 |
224 |
210 menu = QMenu(self.tr("Version Control")) |
225 menu = QMenu(self.tr("Version Control")) |
390 """ |
405 """ |
391 Protected method used to add the VCS menu for multi selection to all |
406 Protected method used to add the VCS menu for multi selection to all |
392 project browsers. |
407 project browsers. |
393 |
408 |
394 @param mainMenu reference to the menu to be amended |
409 @param mainMenu reference to the menu to be amended |
|
410 @type QMenu |
395 """ |
411 """ |
396 self.vcsMultiMenuActions = [] |
412 self.vcsMultiMenuActions = [] |
397 self.vcsAddMultiMenuActions = [] |
413 self.vcsAddMultiMenuActions = [] |
398 |
414 |
399 menu = QMenu(self.tr("Version Control")) |
415 menu = QMenu(self.tr("Version Control")) |
1106 |
1125 |
1107 def __itemsHaveFiles(self, items): |
1126 def __itemsHaveFiles(self, items): |
1108 """ |
1127 """ |
1109 Private method to check, if items contain file type items. |
1128 Private method to check, if items contain file type items. |
1110 |
1129 |
1111 @param items items to check (list of QTreeWidgetItems) |
1130 @param items items to check |
1112 @return flag indicating items contain file type items (boolean) |
1131 @type list of QTreeWidgetItems |
|
1132 @return flag indicating items contain file type items |
|
1133 @rtype bool |
1113 """ |
1134 """ |
1114 return any(isinstance(itm, ProjectBrowserFileItem) for itm in items) |
1135 return any(isinstance(itm, ProjectBrowserFileItem) for itm in items) |