src/eric7/Plugins/VcsPlugins/vcsSubversion/ProjectBrowserHelper.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
21 21
22 class SvnProjectBrowserHelper(VcsProjectBrowserHelper): 22 class SvnProjectBrowserHelper(VcsProjectBrowserHelper):
23 """ 23 """
24 Class implementing the VCS project browser helper for subversion. 24 Class implementing the VCS project browser helper for subversion.
25 """ 25 """
26 def __init__(self, vcsObject, browserObject, projectObject, 26
27 isTranslationsBrowser, parent=None, name=None): 27 def __init__(
28 self,
29 vcsObject,
30 browserObject,
31 projectObject,
32 isTranslationsBrowser,
33 parent=None,
34 name=None,
35 ):
28 """ 36 """
29 Constructor 37 Constructor
30 38
31 @param vcsObject reference to the vcs object 39 @param vcsObject reference to the vcs object
32 @param browserObject reference to the project browser object 40 @param browserObject reference to the project browser object
33 @param projectObject reference to the project object 41 @param projectObject reference to the project object
34 @param isTranslationsBrowser flag indicating, the helper is requested 42 @param isTranslationsBrowser flag indicating, the helper is requested
35 for the translations browser (this needs some special treatment) 43 for the translations browser (this needs some special treatment)
36 @param parent parent widget (QWidget) 44 @param parent parent widget (QWidget)
37 @param name name of this object (string) 45 @param name name of this object (string)
38 """ 46 """
39 VcsProjectBrowserHelper.__init__(self, vcsObject, browserObject, 47 VcsProjectBrowserHelper.__init__(
40 projectObject, isTranslationsBrowser, 48 self,
41 parent, name) 49 vcsObject,
42 50 browserObject,
51 projectObject,
52 isTranslationsBrowser,
53 parent,
54 name,
55 )
56
43 def showContextMenu(self, menu, standardItems): 57 def showContextMenu(self, menu, standardItems):
44 """ 58 """
45 Public slot called before the context menu is shown. 59 Public slot called before the context menu is shown.
46 60
47 It enables/disables the VCS menu entries depending on the overall 61 It enables/disables the VCS menu entries depending on the overall
48 VCS status and the file status. 62 VCS status and the file status.
49 63
50 @param menu reference to the menu to be shown 64 @param menu reference to the menu to be shown
51 @param standardItems array of standard items that need 65 @param standardItems array of standard items that need
52 activation/deactivation depending on the overall VCS status 66 activation/deactivation depending on the overall VCS status
53 """ 67 """
54 if self.browser.currentItem().data(1) == self.vcs.vcsName(): 68 if self.browser.currentItem().data(1) == self.vcs.vcsName():
56 act.setEnabled(True) 70 act.setEnabled(True)
57 for act in self.vcsAddMenuActions: 71 for act in self.vcsAddMenuActions:
58 act.setEnabled(False) 72 act.setEnabled(False)
59 for act in standardItems: 73 for act in standardItems:
60 act.setEnabled(False) 74 act.setEnabled(False)
61 if not hasattr(self.browser.currentItem(), 'fileName'): 75 if not hasattr(self.browser.currentItem(), "fileName"):
62 self.blameAct.setEnabled(False) 76 self.blameAct.setEnabled(False)
63 else: 77 else:
64 for act in self.vcsMenuActions: 78 for act in self.vcsMenuActions:
65 act.setEnabled(False) 79 act.setEnabled(False)
66 for act in self.vcsAddMenuActions: 80 for act in self.vcsAddMenuActions:
72 name = self.browser.currentItem().dirName() 86 name = self.browser.currentItem().dirName()
73 if not os.path.isdir(name): 87 if not os.path.isdir(name):
74 self.vcsMenuAddTree.setEnabled(False) 88 self.vcsMenuAddTree.setEnabled(False)
75 for act in standardItems: 89 for act in standardItems:
76 act.setEnabled(True) 90 act.setEnabled(True)
77 91
78 def showContextMenuMulti(self, menu, standardItems): 92 def showContextMenuMulti(self, menu, standardItems):
79 """ 93 """
80 Public slot called before the context menu (multiple selections) is 94 Public slot called before the context menu (multiple selections) is
81 shown. 95 shown.
82 96
83 It enables/disables the VCS menu entries depending on the overall 97 It enables/disables the VCS menu entries depending on the overall
84 VCS status and the files status. 98 VCS status and the files status.
85 99
86 @param menu reference to the menu to be shown 100 @param menu reference to the menu to be shown
87 @param standardItems array of standard items that need 101 @param standardItems array of standard items that need
88 activation/deactivation depending on the overall VCS status 102 activation/deactivation depending on the overall VCS status
89 """ 103 """
90 vcsName = self.vcs.vcsName() 104 vcsName = self.vcs.vcsName()
92 vcsItems = 0 106 vcsItems = 0
93 # determine number of selected items under VCS control 107 # determine number of selected items under VCS control
94 for itm in items: 108 for itm in items:
95 if itm.data(1) == vcsName: 109 if itm.data(1) == vcsName:
96 vcsItems += 1 110 vcsItems += 1
97 111
98 if vcsItems > 0: 112 if vcsItems > 0:
99 if vcsItems != len(items): 113 if vcsItems != len(items):
100 for act in self.vcsMultiMenuActions: 114 for act in self.vcsMultiMenuActions:
101 act.setEnabled(False) 115 act.setEnabled(False)
102 else: 116 else:
109 else: 123 else:
110 for act in self.vcsMultiMenuActions: 124 for act in self.vcsMultiMenuActions:
111 act.setEnabled(False) 125 act.setEnabled(False)
112 for act in self.vcsAddMultiMenuActions: 126 for act in self.vcsAddMultiMenuActions:
113 act.setEnabled(True) 127 act.setEnabled(True)
114 if ( 128 if 1 in self.browser.specialMenuEntries and self.__itemsHaveFiles(items):
115 1 in self.browser.specialMenuEntries and
116 self.__itemsHaveFiles(items)
117 ):
118 self.vcsMultiMenuAddTree.setEnabled(False) 129 self.vcsMultiMenuAddTree.setEnabled(False)
119 for act in standardItems: 130 for act in standardItems:
120 act.setEnabled(True) 131 act.setEnabled(True)
121 132
122 def showContextMenuDir(self, menu, standardItems): 133 def showContextMenuDir(self, menu, standardItems):
123 """ 134 """
124 Public slot called before the context menu is shown. 135 Public slot called before the context menu is shown.
125 136
126 It enables/disables the VCS menu entries depending on the overall 137 It enables/disables the VCS menu entries depending on the overall
127 VCS status and the directory status. 138 VCS status and the directory status.
128 139
129 @param menu reference to the menu to be shown 140 @param menu reference to the menu to be shown
130 @param standardItems array of standard items that need 141 @param standardItems array of standard items that need
131 activation/deactivation depending on the overall VCS status 142 activation/deactivation depending on the overall VCS status
132 """ 143 """
133 if self.browser.currentItem().data(1) == self.vcs.vcsName(): 144 if self.browser.currentItem().data(1) == self.vcs.vcsName():
142 act.setEnabled(False) 153 act.setEnabled(False)
143 for act in self.vcsAddDirMenuActions: 154 for act in self.vcsAddDirMenuActions:
144 act.setEnabled(True) 155 act.setEnabled(True)
145 for act in standardItems: 156 for act in standardItems:
146 act.setEnabled(True) 157 act.setEnabled(True)
147 158
148 def showContextMenuDirMulti(self, menu, standardItems): 159 def showContextMenuDirMulti(self, menu, standardItems):
149 """ 160 """
150 Public slot called before the context menu is shown. 161 Public slot called before the context menu is shown.
151 162
152 It enables/disables the VCS menu entries depending on the overall 163 It enables/disables the VCS menu entries depending on the overall
153 VCS status and the directory status. 164 VCS status and the directory status.
154 165
155 @param menu reference to the menu to be shown 166 @param menu reference to the menu to be shown
156 @param standardItems array of standard items that need 167 @param standardItems array of standard items that need
157 activation/deactivation depending on the overall VCS status 168 activation/deactivation depending on the overall VCS status
158 """ 169 """
159 vcsName = self.vcs.vcsName() 170 vcsName = self.vcs.vcsName()
161 vcsItems = 0 172 vcsItems = 0
162 # determine number of selected items under VCS control 173 # determine number of selected items under VCS control
163 for itm in items: 174 for itm in items:
164 if itm.data(1) == vcsName: 175 if itm.data(1) == vcsName:
165 vcsItems += 1 176 vcsItems += 1
166 177
167 if vcsItems > 0: 178 if vcsItems > 0:
168 if vcsItems != len(items): 179 if vcsItems != len(items):
169 for act in self.vcsDirMultiMenuActions: 180 for act in self.vcsDirMultiMenuActions:
170 act.setEnabled(False) 181 act.setEnabled(False)
171 else: 182 else:
188 ########################################################################### 199 ###########################################################################
189 200
190 def _addVCSMenu(self, mainMenu): 201 def _addVCSMenu(self, mainMenu):
191 """ 202 """
192 Protected method used to add the VCS menu to all project browsers. 203 Protected method used to add the VCS menu to all project browsers.
193 204
194 @param mainMenu reference to the menu to be amended 205 @param mainMenu reference to the menu to be amended
195 """ 206 """
196 self.vcsMenuActions = [] 207 self.vcsMenuActions = []
197 self.vcsAddMenuActions = [] 208 self.vcsAddMenuActions = []
198 209
199 menu = QMenu(self.tr("Version Control")) 210 menu = QMenu(self.tr("Version Control"))
200 211
201 act = menu.addAction( 212 act = menu.addAction(
202 UI.PixmapCache.getIcon( 213 UI.PixmapCache.getIcon(
203 os.path.join("VcsPlugins", "vcsSubversion", "icons", 214 os.path.join("VcsPlugins", "vcsSubversion", "icons", "subversion.svg")
204 "subversion.svg")), 215 ),
205 self.vcs.vcsName(), self._VCSInfoDisplay) 216 self.vcs.vcsName(),
217 self._VCSInfoDisplay,
218 )
206 font = act.font() 219 font = act.font()
207 font.setBold(True) 220 font.setBold(True)
208 act.setFont(font) 221 act.setFont(font)
209 menu.addSeparator() 222 menu.addSeparator()
210 223
211 act = menu.addAction( 224 act = menu.addAction(
212 UI.PixmapCache.getIcon("vcsUpdate"), 225 UI.PixmapCache.getIcon("vcsUpdate"),
213 self.tr('Update from repository'), self._VCSUpdate) 226 self.tr("Update from repository"),
227 self._VCSUpdate,
228 )
214 self.vcsMenuActions.append(act) 229 self.vcsMenuActions.append(act)
215 act = menu.addAction( 230 act = menu.addAction(
216 UI.PixmapCache.getIcon("vcsCommit"), 231 UI.PixmapCache.getIcon("vcsCommit"),
217 self.tr('Commit changes to repository...'), 232 self.tr("Commit changes to repository..."),
218 self._VCSCommit) 233 self._VCSCommit,
219 self.vcsMenuActions.append(act) 234 )
220 menu.addSeparator() 235 self.vcsMenuActions.append(act)
221 act = menu.addAction( 236 menu.addSeparator()
222 UI.PixmapCache.getIcon("vcsAdd"), 237 act = menu.addAction(
223 self.tr('Add to repository'), 238 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd
224 self._VCSAdd) 239 )
225 self.vcsAddMenuActions.append(act) 240 self.vcsAddMenuActions.append(act)
226 if 1 in self.browser.specialMenuEntries: 241 if 1 in self.browser.specialMenuEntries:
227 self.vcsMenuAddTree = menu.addAction( 242 self.vcsMenuAddTree = menu.addAction(
228 UI.PixmapCache.getIcon("vcsAdd"), 243 UI.PixmapCache.getIcon("vcsAdd"),
229 self.tr('Add tree to repository'), 244 self.tr("Add tree to repository"),
230 self._VCSAddTree) 245 self._VCSAddTree,
246 )
231 self.vcsAddMenuActions.append(self.vcsMenuAddTree) 247 self.vcsAddMenuActions.append(self.vcsMenuAddTree)
232 act = menu.addAction( 248 act = menu.addAction(
233 UI.PixmapCache.getIcon("vcsRemove"), 249 UI.PixmapCache.getIcon("vcsRemove"),
234 self.tr('Remove from repository (and disk)'), 250 self.tr("Remove from repository (and disk)"),
235 self._VCSRemove) 251 self._VCSRemove,
236 self.vcsMenuActions.append(act) 252 )
237 menu.addSeparator() 253 self.vcsMenuActions.append(act)
238 act = menu.addAction(self.tr('Copy'), self.__SVNCopy) 254 menu.addSeparator()
239 self.vcsMenuActions.append(act) 255 act = menu.addAction(self.tr("Copy"), self.__SVNCopy)
240 act = menu.addAction(self.tr('Move'), self.__SVNMove) 256 self.vcsMenuActions.append(act)
257 act = menu.addAction(self.tr("Move"), self.__SVNMove)
241 self.vcsMenuActions.append(act) 258 self.vcsMenuActions.append(act)
242 if self.vcs.version >= (1, 5, 0): 259 if self.vcs.version >= (1, 5, 0):
243 menu.addSeparator() 260 menu.addSeparator()
244 act = menu.addAction( 261 act = menu.addAction(
245 self.tr("Add to Changelist"), 262 self.tr("Add to Changelist"), self.__SVNAddToChangelist
246 self.__SVNAddToChangelist) 263 )
247 self.vcsMenuActions.append(act) 264 self.vcsMenuActions.append(act)
248 act = menu.addAction( 265 act = menu.addAction(
249 self.tr("Remove from Changelist"), 266 self.tr("Remove from Changelist"), self.__SVNRemoveFromChangelist
250 self.__SVNRemoveFromChangelist) 267 )
251 self.vcsMenuActions.append(act) 268 self.vcsMenuActions.append(act)
252 menu.addSeparator() 269 menu.addSeparator()
253 act = menu.addAction( 270 act = menu.addAction(
254 UI.PixmapCache.getIcon("vcsLog"), 271 UI.PixmapCache.getIcon("vcsLog"),
255 self.tr('Show log browser'), self._VCSLogBrowser) 272 self.tr("Show log browser"),
256 self.vcsMenuActions.append(act) 273 self._VCSLogBrowser,
257 menu.addSeparator() 274 )
258 act = menu.addAction( 275 self.vcsMenuActions.append(act)
259 UI.PixmapCache.getIcon("vcsStatus"), 276 menu.addSeparator()
260 self.tr('Show status'), self._VCSStatus) 277 act = menu.addAction(
261 self.vcsMenuActions.append(act) 278 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus
262 menu.addSeparator() 279 )
263 act = menu.addAction( 280 self.vcsMenuActions.append(act)
264 UI.PixmapCache.getIcon("vcsDiff"), 281 menu.addSeparator()
265 self.tr('Show differences'), self._VCSDiff) 282 act = menu.addAction(
283 UI.PixmapCache.getIcon("vcsDiff"),
284 self.tr("Show differences"),
285 self._VCSDiff,
286 )
266 self.vcsMenuActions.append(act) 287 self.vcsMenuActions.append(act)
267 act = menu.addAction( 288 act = menu.addAction(
268 UI.PixmapCache.getIcon("vcsSbsDiff"), 289 UI.PixmapCache.getIcon("vcsSbsDiff"),
269 self.tr('Show differences side-by-side'), self.__SVNSbsDiff) 290 self.tr("Show differences side-by-side"),
270 self.vcsMenuActions.append(act) 291 self.__SVNSbsDiff,
271 act = menu.addAction( 292 )
272 UI.PixmapCache.getIcon("vcsDiff"), 293 self.vcsMenuActions.append(act)
273 self.tr('Show differences (extended)'), 294 act = menu.addAction(
274 self.__SVNExtendedDiff) 295 UI.PixmapCache.getIcon("vcsDiff"),
296 self.tr("Show differences (extended)"),
297 self.__SVNExtendedDiff,
298 )
275 self.vcsMenuActions.append(act) 299 self.vcsMenuActions.append(act)
276 act = menu.addAction( 300 act = menu.addAction(
277 UI.PixmapCache.getIcon("vcsSbsDiff"), 301 UI.PixmapCache.getIcon("vcsSbsDiff"),
278 self.tr('Show differences side-by-side (extended)'), 302 self.tr("Show differences side-by-side (extended)"),
279 self.__SVNSbsExtendedDiff) 303 self.__SVNSbsExtendedDiff,
280 self.vcsMenuActions.append(act) 304 )
281 act = menu.addAction( 305 self.vcsMenuActions.append(act)
282 UI.PixmapCache.getIcon("vcsDiff"), 306 act = menu.addAction(
283 self.tr('Show differences (URLs)'), 307 UI.PixmapCache.getIcon("vcsDiff"),
284 self.__SVNUrlDiff) 308 self.tr("Show differences (URLs)"),
285 self.vcsMenuActions.append(act) 309 self.__SVNUrlDiff,
286 self.blameAct = menu.addAction( 310 )
287 self.tr('Show annotated file'), 311 self.vcsMenuActions.append(act)
288 self.__SVNBlame) 312 self.blameAct = menu.addAction(self.tr("Show annotated file"), self.__SVNBlame)
289 self.vcsMenuActions.append(self.blameAct) 313 self.vcsMenuActions.append(self.blameAct)
290 menu.addSeparator() 314 menu.addSeparator()
291 act = menu.addAction( 315 act = menu.addAction(
292 UI.PixmapCache.getIcon("vcsRevert"), 316 UI.PixmapCache.getIcon("vcsRevert"),
293 self.tr('Revert changes'), self._VCSRevert) 317 self.tr("Revert changes"),
294 self.vcsMenuActions.append(act) 318 self._VCSRevert,
295 act = menu.addAction( 319 )
296 UI.PixmapCache.getIcon("vcsMerge"), 320 self.vcsMenuActions.append(act)
297 self.tr('Merge changes'), self._VCSMerge) 321 act = menu.addAction(
298 self.vcsMenuActions.append(act) 322 UI.PixmapCache.getIcon("vcsMerge"), self.tr("Merge changes"), self._VCSMerge
299 act = menu.addAction( 323 )
300 self.tr('Conflicts resolved'), self.__SVNResolve) 324 self.vcsMenuActions.append(act)
325 act = menu.addAction(self.tr("Conflicts resolved"), self.__SVNResolve)
301 self.vcsMenuActions.append(act) 326 self.vcsMenuActions.append(act)
302 if self.vcs.version >= (1, 2, 0): 327 if self.vcs.version >= (1, 2, 0):
303 menu.addSeparator() 328 menu.addSeparator()
304 act = menu.addAction( 329 act = menu.addAction(
305 UI.PixmapCache.getIcon("vcsLock"), 330 UI.PixmapCache.getIcon("vcsLock"), self.tr("Lock"), self.__SVNLock
306 self.tr('Lock'), self.__SVNLock) 331 )
332 self.vcsMenuActions.append(act)
333 act = menu.addAction(
334 UI.PixmapCache.getIcon("vcsUnlock"), self.tr("Unlock"), self.__SVNUnlock
335 )
307 self.vcsMenuActions.append(act) 336 self.vcsMenuActions.append(act)
308 act = menu.addAction( 337 act = menu.addAction(
309 UI.PixmapCache.getIcon("vcsUnlock"), 338 UI.PixmapCache.getIcon("vcsUnlock"),
310 self.tr('Unlock'), self.__SVNUnlock) 339 self.tr("Break Lock"),
340 self.__SVNBreakLock,
341 )
311 self.vcsMenuActions.append(act) 342 self.vcsMenuActions.append(act)
312 act = menu.addAction( 343 act = menu.addAction(
313 UI.PixmapCache.getIcon("vcsUnlock"), 344 UI.PixmapCache.getIcon("vcsUnlock"),
314 self.tr('Break Lock'), self.__SVNBreakLock) 345 self.tr("Steal Lock"),
315 self.vcsMenuActions.append(act) 346 self.__SVNStealLock,
316 act = menu.addAction( 347 )
317 UI.PixmapCache.getIcon("vcsUnlock"), 348 self.vcsMenuActions.append(act)
318 self.tr('Steal Lock'), self.__SVNStealLock) 349 menu.addSeparator()
319 self.vcsMenuActions.append(act) 350 act = menu.addAction(self.tr("Set Property"), self.__SVNSetProp)
320 menu.addSeparator() 351 self.vcsMenuActions.append(act)
321 act = menu.addAction(self.tr('Set Property'), self.__SVNSetProp) 352 act = menu.addAction(self.tr("List Properties"), self.__SVNListProps)
322 self.vcsMenuActions.append(act) 353 self.vcsMenuActions.append(act)
323 act = menu.addAction( 354 act = menu.addAction(self.tr("Delete Property"), self.__SVNDelProp)
324 self.tr('List Properties'), self.__SVNListProps) 355 self.vcsMenuActions.append(act)
325 self.vcsMenuActions.append(act) 356 menu.addSeparator()
326 act = menu.addAction(self.tr('Delete Property'), self.__SVNDelProp) 357 menu.addAction(
327 self.vcsMenuActions.append(act) 358 self.tr("Select all local file entries"), self.browser.selectLocalEntries
328 menu.addSeparator() 359 )
329 menu.addAction(self.tr('Select all local file entries'), 360 menu.addAction(
330 self.browser.selectLocalEntries) 361 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries
331 menu.addAction(self.tr('Select all versioned file entries'), 362 )
332 self.browser.selectVCSEntries) 363 menu.addAction(
333 menu.addAction(self.tr('Select all local directory entries'), 364 self.tr("Select all local directory entries"),
334 self.browser.selectLocalDirEntries) 365 self.browser.selectLocalDirEntries,
335 menu.addAction(self.tr('Select all versioned directory entries'), 366 )
336 self.browser.selectVCSDirEntries) 367 menu.addAction(
368 self.tr("Select all versioned directory entries"),
369 self.browser.selectVCSDirEntries,
370 )
337 menu.addSeparator() 371 menu.addSeparator()
338 menu.addAction(self.tr("Configure..."), self.__SVNConfigure) 372 menu.addAction(self.tr("Configure..."), self.__SVNConfigure)
339 373
340 mainMenu.addSeparator() 374 mainMenu.addSeparator()
341 mainMenu.addMenu(menu) 375 mainMenu.addMenu(menu)
342 self.menu = menu 376 self.menu = menu
343 377
344 def _addVCSMenuMulti(self, mainMenu): 378 def _addVCSMenuMulti(self, mainMenu):
345 """ 379 """
346 Protected method used to add the VCS menu for multi selection to all 380 Protected method used to add the VCS menu for multi selection to all
347 project browsers. 381 project browsers.
348 382
349 @param mainMenu reference to the menu to be amended 383 @param mainMenu reference to the menu to be amended
350 """ 384 """
351 self.vcsMultiMenuActions = [] 385 self.vcsMultiMenuActions = []
352 self.vcsAddMultiMenuActions = [] 386 self.vcsAddMultiMenuActions = []
353 387
354 menu = QMenu(self.tr("Version Control")) 388 menu = QMenu(self.tr("Version Control"))
355 389
356 act = menu.addAction( 390 act = menu.addAction(
357 UI.PixmapCache.getIcon( 391 UI.PixmapCache.getIcon(
358 os.path.join("VcsPlugins", "vcsSubversion", "icons", 392 os.path.join("VcsPlugins", "vcsSubversion", "icons", "subversion.svg")
359 "subversion.svg")), 393 ),
360 self.vcs.vcsName(), self._VCSInfoDisplay) 394 self.vcs.vcsName(),
395 self._VCSInfoDisplay,
396 )
361 font = act.font() 397 font = act.font()
362 font.setBold(True) 398 font.setBold(True)
363 act.setFont(font) 399 act.setFont(font)
364 menu.addSeparator() 400 menu.addSeparator()
365 401
366 act = menu.addAction( 402 act = menu.addAction(
367 UI.PixmapCache.getIcon("vcsUpdate"), 403 UI.PixmapCache.getIcon("vcsUpdate"),
368 self.tr('Update from repository'), self._VCSUpdate) 404 self.tr("Update from repository"),
405 self._VCSUpdate,
406 )
369 self.vcsMultiMenuActions.append(act) 407 self.vcsMultiMenuActions.append(act)
370 act = menu.addAction( 408 act = menu.addAction(
371 UI.PixmapCache.getIcon("vcsCommit"), 409 UI.PixmapCache.getIcon("vcsCommit"),
372 self.tr('Commit changes to repository...'), 410 self.tr("Commit changes to repository..."),
373 self._VCSCommit) 411 self._VCSCommit,
374 self.vcsMultiMenuActions.append(act) 412 )
375 menu.addSeparator() 413 self.vcsMultiMenuActions.append(act)
376 act = menu.addAction( 414 menu.addSeparator()
377 UI.PixmapCache.getIcon("vcsAdd"), 415 act = menu.addAction(
378 self.tr('Add to repository'), self._VCSAdd) 416 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd
417 )
379 self.vcsAddMultiMenuActions.append(act) 418 self.vcsAddMultiMenuActions.append(act)
380 if 1 in self.browser.specialMenuEntries: 419 if 1 in self.browser.specialMenuEntries:
381 self.vcsMultiMenuAddTree = menu.addAction( 420 self.vcsMultiMenuAddTree = menu.addAction(
382 UI.PixmapCache.getIcon("vcsAdd"), 421 UI.PixmapCache.getIcon("vcsAdd"),
383 self.tr('Add tree to repository'), self._VCSAddTree) 422 self.tr("Add tree to repository"),
423 self._VCSAddTree,
424 )
384 self.vcsAddMultiMenuActions.append(self.vcsMultiMenuAddTree) 425 self.vcsAddMultiMenuActions.append(self.vcsMultiMenuAddTree)
385 act = menu.addAction( 426 act = menu.addAction(
386 UI.PixmapCache.getIcon("vcsRemove"), 427 UI.PixmapCache.getIcon("vcsRemove"),
387 self.tr('Remove from repository (and disk)'), 428 self.tr("Remove from repository (and disk)"),
388 self._VCSRemove) 429 self._VCSRemove,
430 )
389 self.vcsMultiMenuActions.append(act) 431 self.vcsMultiMenuActions.append(act)
390 if self.vcs.version >= (1, 5, 0): 432 if self.vcs.version >= (1, 5, 0):
391 menu.addSeparator() 433 menu.addSeparator()
392 act = menu.addAction( 434 act = menu.addAction(
393 self.tr("Add to Changelist"), 435 self.tr("Add to Changelist"), self.__SVNAddToChangelist
394 self.__SVNAddToChangelist) 436 )
395 self.vcsMenuActions.append(act) 437 self.vcsMenuActions.append(act)
396 act = menu.addAction( 438 act = menu.addAction(
397 self.tr("Remove from Changelist"), 439 self.tr("Remove from Changelist"), self.__SVNRemoveFromChangelist
398 self.__SVNRemoveFromChangelist) 440 )
399 self.vcsMenuActions.append(act) 441 self.vcsMenuActions.append(act)
400 menu.addSeparator() 442 menu.addSeparator()
401 act = menu.addAction( 443 act = menu.addAction(
402 UI.PixmapCache.getIcon("vcsStatus"), 444 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus
403 self.tr('Show status'), self._VCSStatus) 445 )
404 self.vcsMultiMenuActions.append(act) 446 self.vcsMultiMenuActions.append(act)
405 menu.addSeparator() 447 menu.addSeparator()
406 act = menu.addAction( 448 act = menu.addAction(
407 UI.PixmapCache.getIcon("vcsDiff"), 449 UI.PixmapCache.getIcon("vcsDiff"),
408 self.tr('Show differences'), self._VCSDiff) 450 self.tr("Show differences"),
409 self.vcsMultiMenuActions.append(act) 451 self._VCSDiff,
410 act = menu.addAction( 452 )
411 UI.PixmapCache.getIcon("vcsDiff"), 453 self.vcsMultiMenuActions.append(act)
412 self.tr('Show differences (extended)'), 454 act = menu.addAction(
413 self.__SVNExtendedDiff) 455 UI.PixmapCache.getIcon("vcsDiff"),
414 self.vcsMultiMenuActions.append(act) 456 self.tr("Show differences (extended)"),
415 act = menu.addAction( 457 self.__SVNExtendedDiff,
416 UI.PixmapCache.getIcon("vcsDiff"), 458 )
417 self.tr('Show differences (URLs)'), 459 self.vcsMultiMenuActions.append(act)
418 self.__SVNUrlDiff) 460 act = menu.addAction(
461 UI.PixmapCache.getIcon("vcsDiff"),
462 self.tr("Show differences (URLs)"),
463 self.__SVNUrlDiff,
464 )
419 self.vcsMultiMenuActions.append(act) 465 self.vcsMultiMenuActions.append(act)
420 menu.addSeparator() 466 menu.addSeparator()
421 act = menu.addAction( 467 act = menu.addAction(
422 UI.PixmapCache.getIcon("vcsRevert"), 468 UI.PixmapCache.getIcon("vcsRevert"),
423 self.tr('Revert changes'), self._VCSRevert) 469 self.tr("Revert changes"),
424 self.vcsMultiMenuActions.append(act) 470 self._VCSRevert,
425 act = menu.addAction( 471 )
426 self.tr('Conflicts resolved'), self.__SVNResolve) 472 self.vcsMultiMenuActions.append(act)
473 act = menu.addAction(self.tr("Conflicts resolved"), self.__SVNResolve)
427 self.vcsMultiMenuActions.append(act) 474 self.vcsMultiMenuActions.append(act)
428 if self.vcs.version >= (1, 2, 0): 475 if self.vcs.version >= (1, 2, 0):
429 menu.addSeparator() 476 menu.addSeparator()
430 act = menu.addAction( 477 act = menu.addAction(
431 UI.PixmapCache.getIcon("vcsLock"), 478 UI.PixmapCache.getIcon("vcsLock"), self.tr("Lock"), self.__SVNLock
432 self.tr('Lock'), self.__SVNLock) 479 )
433 self.vcsMultiMenuActions.append(act) 480 self.vcsMultiMenuActions.append(act)
434 act = menu.addAction( 481 act = menu.addAction(
482 UI.PixmapCache.getIcon("vcsUnlock"), self.tr("Unlock"), self.__SVNUnlock
483 )
484 self.vcsMultiMenuActions.append(act)
485 act = menu.addAction(
435 UI.PixmapCache.getIcon("vcsUnlock"), 486 UI.PixmapCache.getIcon("vcsUnlock"),
436 self.tr('Unlock'), self.__SVNUnlock) 487 self.tr("Break Lock"),
488 self.__SVNBreakLock,
489 )
437 self.vcsMultiMenuActions.append(act) 490 self.vcsMultiMenuActions.append(act)
438 act = menu.addAction( 491 act = menu.addAction(
439 UI.PixmapCache.getIcon("vcsUnlock"), 492 UI.PixmapCache.getIcon("vcsUnlock"),
440 self.tr('Break Lock'), self.__SVNBreakLock) 493 self.tr("Steal Lock"),
494 self.__SVNStealLock,
495 )
441 self.vcsMultiMenuActions.append(act) 496 self.vcsMultiMenuActions.append(act)
442 act = menu.addAction( 497 menu.addSeparator()
443 UI.PixmapCache.getIcon("vcsUnlock"), 498 act = menu.addAction(self.tr("Set Property"), self.__SVNSetProp)
444 self.tr('Steal Lock'), self.__SVNStealLock) 499 self.vcsMultiMenuActions.append(act)
445 self.vcsMultiMenuActions.append(act) 500 act = menu.addAction(self.tr("List Properties"), self.__SVNListProps)
446 menu.addSeparator() 501 self.vcsMultiMenuActions.append(act)
447 act = menu.addAction(self.tr('Set Property'), self.__SVNSetProp) 502 act = menu.addAction(self.tr("Delete Property"), self.__SVNDelProp)
448 self.vcsMultiMenuActions.append(act) 503 self.vcsMultiMenuActions.append(act)
449 act = menu.addAction( 504 menu.addSeparator()
450 self.tr('List Properties'), self.__SVNListProps) 505 menu.addAction(
451 self.vcsMultiMenuActions.append(act) 506 self.tr("Select all local file entries"), self.browser.selectLocalEntries
452 act = menu.addAction(self.tr('Delete Property'), self.__SVNDelProp) 507 )
453 self.vcsMultiMenuActions.append(act) 508 menu.addAction(
454 menu.addSeparator() 509 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries
455 menu.addAction(self.tr('Select all local file entries'), 510 )
456 self.browser.selectLocalEntries) 511 menu.addAction(
457 menu.addAction(self.tr('Select all versioned file entries'), 512 self.tr("Select all local directory entries"),
458 self.browser.selectVCSEntries) 513 self.browser.selectLocalDirEntries,
459 menu.addAction(self.tr('Select all local directory entries'), 514 )
460 self.browser.selectLocalDirEntries) 515 menu.addAction(
461 menu.addAction(self.tr('Select all versioned directory entries'), 516 self.tr("Select all versioned directory entries"),
462 self.browser.selectVCSDirEntries) 517 self.browser.selectVCSDirEntries,
518 )
463 menu.addSeparator() 519 menu.addSeparator()
464 menu.addAction(self.tr("Configure..."), self.__SVNConfigure) 520 menu.addAction(self.tr("Configure..."), self.__SVNConfigure)
465 521
466 mainMenu.addSeparator() 522 mainMenu.addSeparator()
467 mainMenu.addMenu(menu) 523 mainMenu.addMenu(menu)
468 self.menuMulti = menu 524 self.menuMulti = menu
469 525
470 def _addVCSMenuBack(self, mainMenu): 526 def _addVCSMenuBack(self, mainMenu):
471 """ 527 """
472 Protected method used to add the VCS menu to all project browsers. 528 Protected method used to add the VCS menu to all project browsers.
473 529
474 @param mainMenu reference to the menu to be amended 530 @param mainMenu reference to the menu to be amended
475 """ 531 """
476 menu = QMenu(self.tr("Version Control")) 532 menu = QMenu(self.tr("Version Control"))
477 533
478 act = menu.addAction( 534 act = menu.addAction(
479 UI.PixmapCache.getIcon( 535 UI.PixmapCache.getIcon(
480 os.path.join("VcsPlugins", "vcsSubversion", "icons", 536 os.path.join("VcsPlugins", "vcsSubversion", "icons", "subversion.svg")
481 "subversion.svg")), 537 ),
482 self.vcs.vcsName(), self._VCSInfoDisplay) 538 self.vcs.vcsName(),
539 self._VCSInfoDisplay,
540 )
483 font = act.font() 541 font = act.font()
484 font.setBold(True) 542 font.setBold(True)
485 act.setFont(font) 543 act.setFont(font)
486 menu.addSeparator() 544 menu.addSeparator()
487 545
488 menu.addAction(self.tr('Select all local file entries'), 546 menu.addAction(
489 self.browser.selectLocalEntries) 547 self.tr("Select all local file entries"), self.browser.selectLocalEntries
490 menu.addAction(self.tr('Select all versioned file entries'), 548 )
491 self.browser.selectVCSEntries) 549 menu.addAction(
492 menu.addAction(self.tr('Select all local directory entries'), 550 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries
493 self.browser.selectLocalDirEntries) 551 )
494 menu.addAction(self.tr('Select all versioned directory entries'), 552 menu.addAction(
495 self.browser.selectVCSDirEntries) 553 self.tr("Select all local directory entries"),
554 self.browser.selectLocalDirEntries,
555 )
556 menu.addAction(
557 self.tr("Select all versioned directory entries"),
558 self.browser.selectVCSDirEntries,
559 )
496 menu.addSeparator() 560 menu.addSeparator()
497 menu.addAction(self.tr("Configure..."), self.__SVNConfigure) 561 menu.addAction(self.tr("Configure..."), self.__SVNConfigure)
498 562
499 mainMenu.addSeparator() 563 mainMenu.addSeparator()
500 mainMenu.addMenu(menu) 564 mainMenu.addMenu(menu)
501 self.menuBack = menu 565 self.menuBack = menu
502 566
503 def _addVCSMenuDir(self, mainMenu): 567 def _addVCSMenuDir(self, mainMenu):
504 """ 568 """
505 Protected method used to add the VCS menu to all project browsers. 569 Protected method used to add the VCS menu to all project browsers.
506 570
507 @param mainMenu reference to the menu to be amended 571 @param mainMenu reference to the menu to be amended
508 """ 572 """
509 if mainMenu is None: 573 if mainMenu is None:
510 return 574 return
511 575
512 self.vcsDirMenuActions = [] 576 self.vcsDirMenuActions = []
513 self.vcsAddDirMenuActions = [] 577 self.vcsAddDirMenuActions = []
514 578
515 menu = QMenu(self.tr("Version Control")) 579 menu = QMenu(self.tr("Version Control"))
516 580
517 act = menu.addAction( 581 act = menu.addAction(
518 UI.PixmapCache.getIcon( 582 UI.PixmapCache.getIcon(
519 os.path.join("VcsPlugins", "vcsSubversion", "icons", 583 os.path.join("VcsPlugins", "vcsSubversion", "icons", "subversion.svg")
520 "subversion.svg")), 584 ),
521 self.vcs.vcsName(), self._VCSInfoDisplay) 585 self.vcs.vcsName(),
586 self._VCSInfoDisplay,
587 )
522 font = act.font() 588 font = act.font()
523 font.setBold(True) 589 font.setBold(True)
524 act.setFont(font) 590 act.setFont(font)
525 menu.addSeparator() 591 menu.addSeparator()
526 592
527 act = menu.addAction( 593 act = menu.addAction(
528 UI.PixmapCache.getIcon("vcsUpdate"), 594 UI.PixmapCache.getIcon("vcsUpdate"),
529 self.tr('Update from repository'), self._VCSUpdate) 595 self.tr("Update from repository"),
596 self._VCSUpdate,
597 )
530 self.vcsDirMenuActions.append(act) 598 self.vcsDirMenuActions.append(act)
531 act = menu.addAction( 599 act = menu.addAction(
532 UI.PixmapCache.getIcon("vcsCommit"), 600 UI.PixmapCache.getIcon("vcsCommit"),
533 self.tr('Commit changes to repository...'), 601 self.tr("Commit changes to repository..."),
534 self._VCSCommit) 602 self._VCSCommit,
535 self.vcsDirMenuActions.append(act) 603 )
536 menu.addSeparator() 604 self.vcsDirMenuActions.append(act)
537 act = menu.addAction( 605 menu.addSeparator()
538 UI.PixmapCache.getIcon("vcsAdd"), 606 act = menu.addAction(
539 self.tr('Add to repository'), self._VCSAdd) 607 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd
608 )
540 self.vcsAddDirMenuActions.append(act) 609 self.vcsAddDirMenuActions.append(act)
541 act = menu.addAction( 610 act = menu.addAction(
542 UI.PixmapCache.getIcon("vcsRemove"), 611 UI.PixmapCache.getIcon("vcsRemove"),
543 self.tr('Remove from repository (and disk)'), 612 self.tr("Remove from repository (and disk)"),
544 self._VCSRemove) 613 self._VCSRemove,
545 self.vcsDirMenuActions.append(act) 614 )
546 menu.addSeparator() 615 self.vcsDirMenuActions.append(act)
547 act = menu.addAction(self.tr('Copy'), self.__SVNCopy) 616 menu.addSeparator()
548 self.vcsDirMenuActions.append(act) 617 act = menu.addAction(self.tr("Copy"), self.__SVNCopy)
549 act = menu.addAction(self.tr('Move'), self.__SVNMove) 618 self.vcsDirMenuActions.append(act)
619 act = menu.addAction(self.tr("Move"), self.__SVNMove)
550 self.vcsDirMenuActions.append(act) 620 self.vcsDirMenuActions.append(act)
551 if self.vcs.version >= (1, 5, 0): 621 if self.vcs.version >= (1, 5, 0):
552 menu.addSeparator() 622 menu.addSeparator()
553 act = menu.addAction( 623 act = menu.addAction(
554 self.tr("Add to Changelist"), 624 self.tr("Add to Changelist"), self.__SVNAddToChangelist
555 self.__SVNAddToChangelist) 625 )
556 self.vcsMenuActions.append(act) 626 self.vcsMenuActions.append(act)
557 act = menu.addAction( 627 act = menu.addAction(
558 self.tr("Remove from Changelist"), 628 self.tr("Remove from Changelist"), self.__SVNRemoveFromChangelist
559 self.__SVNRemoveFromChangelist) 629 )
560 self.vcsMenuActions.append(act) 630 self.vcsMenuActions.append(act)
561 menu.addSeparator() 631 menu.addSeparator()
562 act = menu.addAction( 632 act = menu.addAction(
563 UI.PixmapCache.getIcon("vcsLog"), 633 UI.PixmapCache.getIcon("vcsLog"),
564 self.tr('Show log browser'), self._VCSLogBrowser) 634 self.tr("Show log browser"),
565 self.vcsDirMenuActions.append(act) 635 self._VCSLogBrowser,
566 menu.addSeparator() 636 )
567 act = menu.addAction( 637 self.vcsDirMenuActions.append(act)
568 UI.PixmapCache.getIcon("vcsStatus"), 638 menu.addSeparator()
569 self.tr('Show status'), self._VCSStatus) 639 act = menu.addAction(
570 self.vcsDirMenuActions.append(act) 640 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus
571 menu.addSeparator() 641 )
572 act = menu.addAction( 642 self.vcsDirMenuActions.append(act)
573 UI.PixmapCache.getIcon("vcsDiff"), 643 menu.addSeparator()
574 self.tr('Show differences'), self._VCSDiff) 644 act = menu.addAction(
575 self.vcsDirMenuActions.append(act) 645 UI.PixmapCache.getIcon("vcsDiff"),
576 act = menu.addAction( 646 self.tr("Show differences"),
577 UI.PixmapCache.getIcon("vcsDiff"), 647 self._VCSDiff,
578 self.tr('Show differences (extended)'), 648 )
579 self.__SVNExtendedDiff) 649 self.vcsDirMenuActions.append(act)
580 self.vcsDirMenuActions.append(act) 650 act = menu.addAction(
581 act = menu.addAction( 651 UI.PixmapCache.getIcon("vcsDiff"),
582 UI.PixmapCache.getIcon("vcsDiff"), 652 self.tr("Show differences (extended)"),
583 self.tr('Show differences (URLs)'), 653 self.__SVNExtendedDiff,
584 self.__SVNUrlDiff) 654 )
655 self.vcsDirMenuActions.append(act)
656 act = menu.addAction(
657 UI.PixmapCache.getIcon("vcsDiff"),
658 self.tr("Show differences (URLs)"),
659 self.__SVNUrlDiff,
660 )
585 self.vcsDirMenuActions.append(act) 661 self.vcsDirMenuActions.append(act)
586 menu.addSeparator() 662 menu.addSeparator()
587 act = menu.addAction( 663 act = menu.addAction(
588 UI.PixmapCache.getIcon("vcsRevert"), 664 UI.PixmapCache.getIcon("vcsRevert"),
589 self.tr('Revert changes'), self._VCSRevert) 665 self.tr("Revert changes"),
590 self.vcsDirMenuActions.append(act) 666 self._VCSRevert,
591 act = menu.addAction( 667 )
592 UI.PixmapCache.getIcon("vcsMerge"), 668 self.vcsDirMenuActions.append(act)
593 self.tr('Merge changes'), self._VCSMerge) 669 act = menu.addAction(
594 self.vcsDirMenuActions.append(act) 670 UI.PixmapCache.getIcon("vcsMerge"), self.tr("Merge changes"), self._VCSMerge
595 act = menu.addAction( 671 )
596 self.tr('Conflicts resolved'), self.__SVNResolve) 672 self.vcsDirMenuActions.append(act)
597 self.vcsDirMenuActions.append(act) 673 act = menu.addAction(self.tr("Conflicts resolved"), self.__SVNResolve)
598 menu.addSeparator() 674 self.vcsDirMenuActions.append(act)
599 act = menu.addAction(self.tr('Set Property'), self.__SVNSetProp) 675 menu.addSeparator()
600 self.vcsDirMenuActions.append(act) 676 act = menu.addAction(self.tr("Set Property"), self.__SVNSetProp)
601 act = menu.addAction( 677 self.vcsDirMenuActions.append(act)
602 self.tr('List Properties'), self.__SVNListProps) 678 act = menu.addAction(self.tr("List Properties"), self.__SVNListProps)
603 self.vcsDirMenuActions.append(act) 679 self.vcsDirMenuActions.append(act)
604 act = menu.addAction(self.tr('Delete Property'), self.__SVNDelProp) 680 act = menu.addAction(self.tr("Delete Property"), self.__SVNDelProp)
605 self.vcsDirMenuActions.append(act) 681 self.vcsDirMenuActions.append(act)
606 menu.addSeparator() 682 menu.addSeparator()
607 menu.addAction(self.tr('Select all local file entries'), 683 menu.addAction(
608 self.browser.selectLocalEntries) 684 self.tr("Select all local file entries"), self.browser.selectLocalEntries
609 menu.addAction(self.tr('Select all versioned file entries'), 685 )
610 self.browser.selectVCSEntries) 686 menu.addAction(
611 menu.addAction(self.tr('Select all local directory entries'), 687 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries
612 self.browser.selectLocalDirEntries) 688 )
613 menu.addAction(self.tr('Select all versioned directory entries'), 689 menu.addAction(
614 self.browser.selectVCSDirEntries) 690 self.tr("Select all local directory entries"),
691 self.browser.selectLocalDirEntries,
692 )
693 menu.addAction(
694 self.tr("Select all versioned directory entries"),
695 self.browser.selectVCSDirEntries,
696 )
615 menu.addSeparator() 697 menu.addSeparator()
616 menu.addAction(self.tr("Configure..."), self.__SVNConfigure) 698 menu.addAction(self.tr("Configure..."), self.__SVNConfigure)
617 699
618 mainMenu.addSeparator() 700 mainMenu.addSeparator()
619 mainMenu.addMenu(menu) 701 mainMenu.addMenu(menu)
620 self.menuDir = menu 702 self.menuDir = menu
621 703
622 def _addVCSMenuDirMulti(self, mainMenu): 704 def _addVCSMenuDirMulti(self, mainMenu):
623 """ 705 """
624 Protected method used to add the VCS menu to all project browsers. 706 Protected method used to add the VCS menu to all project browsers.
625 707
626 @param mainMenu reference to the menu to be amended 708 @param mainMenu reference to the menu to be amended
627 """ 709 """
628 if mainMenu is None: 710 if mainMenu is None:
629 return 711 return
630 712
631 self.vcsDirMultiMenuActions = [] 713 self.vcsDirMultiMenuActions = []
632 self.vcsAddDirMultiMenuActions = [] 714 self.vcsAddDirMultiMenuActions = []
633 715
634 menu = QMenu(self.tr("Version Control")) 716 menu = QMenu(self.tr("Version Control"))
635 717
636 act = menu.addAction( 718 act = menu.addAction(
637 UI.PixmapCache.getIcon( 719 UI.PixmapCache.getIcon(
638 os.path.join("VcsPlugins", "vcsSubversion", "icons", 720 os.path.join("VcsPlugins", "vcsSubversion", "icons", "subversion.svg")
639 "subversion.svg")), 721 ),
640 self.vcs.vcsName(), self._VCSInfoDisplay) 722 self.vcs.vcsName(),
723 self._VCSInfoDisplay,
724 )
641 font = act.font() 725 font = act.font()
642 font.setBold(True) 726 font.setBold(True)
643 act.setFont(font) 727 act.setFont(font)
644 menu.addSeparator() 728 menu.addSeparator()
645 729
646 act = menu.addAction( 730 act = menu.addAction(
647 UI.PixmapCache.getIcon("vcsUpdate"), 731 UI.PixmapCache.getIcon("vcsUpdate"),
648 self.tr('Update from repository'), self._VCSUpdate) 732 self.tr("Update from repository"),
733 self._VCSUpdate,
734 )
649 self.vcsDirMultiMenuActions.append(act) 735 self.vcsDirMultiMenuActions.append(act)
650 act = menu.addAction( 736 act = menu.addAction(
651 UI.PixmapCache.getIcon("vcsCommit"), 737 UI.PixmapCache.getIcon("vcsCommit"),
652 self.tr('Commit changes to repository...'), 738 self.tr("Commit changes to repository..."),
653 self._VCSCommit) 739 self._VCSCommit,
654 self.vcsDirMultiMenuActions.append(act) 740 )
655 menu.addSeparator() 741 self.vcsDirMultiMenuActions.append(act)
656 act = menu.addAction( 742 menu.addSeparator()
657 UI.PixmapCache.getIcon("vcsAdd"), 743 act = menu.addAction(
658 self.tr('Add to repository'), self._VCSAdd) 744 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd
745 )
659 self.vcsAddDirMultiMenuActions.append(act) 746 self.vcsAddDirMultiMenuActions.append(act)
660 act = menu.addAction( 747 act = menu.addAction(
661 UI.PixmapCache.getIcon("vcsRemove"), 748 UI.PixmapCache.getIcon("vcsRemove"),
662 self.tr('Remove from repository (and disk)'), 749 self.tr("Remove from repository (and disk)"),
663 self._VCSRemove) 750 self._VCSRemove,
751 )
664 self.vcsDirMultiMenuActions.append(act) 752 self.vcsDirMultiMenuActions.append(act)
665 if self.vcs.version >= (1, 5, 0): 753 if self.vcs.version >= (1, 5, 0):
666 menu.addSeparator() 754 menu.addSeparator()
667 act = menu.addAction( 755 act = menu.addAction(
668 self.tr("Add to Changelist"), 756 self.tr("Add to Changelist"), self.__SVNAddToChangelist
669 self.__SVNAddToChangelist) 757 )
670 self.vcsMenuActions.append(act) 758 self.vcsMenuActions.append(act)
671 act = menu.addAction( 759 act = menu.addAction(
672 self.tr("Remove from Changelist"), 760 self.tr("Remove from Changelist"), self.__SVNRemoveFromChangelist
673 self.__SVNRemoveFromChangelist) 761 )
674 self.vcsMenuActions.append(act) 762 self.vcsMenuActions.append(act)
675 menu.addSeparator() 763 menu.addSeparator()
676 act = menu.addAction( 764 act = menu.addAction(
677 UI.PixmapCache.getIcon("vcsStatus"), 765 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus
678 self.tr('Show status'), self._VCSStatus) 766 )
679 self.vcsDirMultiMenuActions.append(act) 767 self.vcsDirMultiMenuActions.append(act)
680 menu.addSeparator() 768 menu.addSeparator()
681 act = menu.addAction( 769 act = menu.addAction(
682 UI.PixmapCache.getIcon("vcsDiff"), 770 UI.PixmapCache.getIcon("vcsDiff"),
683 self.tr('Show differences'), self._VCSDiff) 771 self.tr("Show differences"),
684 self.vcsDirMultiMenuActions.append(act) 772 self._VCSDiff,
685 act = menu.addAction( 773 )
686 UI.PixmapCache.getIcon("vcsDiff"), 774 self.vcsDirMultiMenuActions.append(act)
687 self.tr('Show differences (extended)'), 775 act = menu.addAction(
688 self.__SVNExtendedDiff) 776 UI.PixmapCache.getIcon("vcsDiff"),
689 self.vcsDirMultiMenuActions.append(act) 777 self.tr("Show differences (extended)"),
690 act = menu.addAction( 778 self.__SVNExtendedDiff,
691 UI.PixmapCache.getIcon("vcsDiff"), 779 )
692 self.tr('Show differences (URLs)'), 780 self.vcsDirMultiMenuActions.append(act)
693 self.__SVNUrlDiff) 781 act = menu.addAction(
782 UI.PixmapCache.getIcon("vcsDiff"),
783 self.tr("Show differences (URLs)"),
784 self.__SVNUrlDiff,
785 )
694 self.vcsDirMultiMenuActions.append(act) 786 self.vcsDirMultiMenuActions.append(act)
695 menu.addSeparator() 787 menu.addSeparator()
696 act = menu.addAction( 788 act = menu.addAction(
697 UI.PixmapCache.getIcon("vcsRevert"), 789 UI.PixmapCache.getIcon("vcsRevert"),
698 self.tr('Revert changes'), self._VCSRevert) 790 self.tr("Revert changes"),
699 self.vcsDirMultiMenuActions.append(act) 791 self._VCSRevert,
700 act = menu.addAction( 792 )
701 UI.PixmapCache.getIcon("vcsMerge"), 793 self.vcsDirMultiMenuActions.append(act)
702 self.tr('Merge changes'), self._VCSMerge) 794 act = menu.addAction(
703 self.vcsDirMultiMenuActions.append(act) 795 UI.PixmapCache.getIcon("vcsMerge"), self.tr("Merge changes"), self._VCSMerge
704 act = menu.addAction( 796 )
705 self.tr('Conflicts resolved'), self.__SVNResolve) 797 self.vcsDirMultiMenuActions.append(act)
706 self.vcsDirMultiMenuActions.append(act) 798 act = menu.addAction(self.tr("Conflicts resolved"), self.__SVNResolve)
707 menu.addSeparator() 799 self.vcsDirMultiMenuActions.append(act)
708 act = menu.addAction(self.tr('Set Property'), self.__SVNSetProp) 800 menu.addSeparator()
709 self.vcsDirMultiMenuActions.append(act) 801 act = menu.addAction(self.tr("Set Property"), self.__SVNSetProp)
710 act = menu.addAction( 802 self.vcsDirMultiMenuActions.append(act)
711 self.tr('List Properties'), self.__SVNListProps) 803 act = menu.addAction(self.tr("List Properties"), self.__SVNListProps)
712 self.vcsDirMultiMenuActions.append(act) 804 self.vcsDirMultiMenuActions.append(act)
713 act = menu.addAction(self.tr('Delete Property'), self.__SVNDelProp) 805 act = menu.addAction(self.tr("Delete Property"), self.__SVNDelProp)
714 self.vcsDirMultiMenuActions.append(act) 806 self.vcsDirMultiMenuActions.append(act)
715 menu.addSeparator() 807 menu.addSeparator()
716 menu.addAction(self.tr('Select all local file entries'), 808 menu.addAction(
717 self.browser.selectLocalEntries) 809 self.tr("Select all local file entries"), self.browser.selectLocalEntries
718 menu.addAction(self.tr('Select all versioned file entries'), 810 )
719 self.browser.selectVCSEntries) 811 menu.addAction(
720 menu.addAction(self.tr('Select all local directory entries'), 812 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries
721 self.browser.selectLocalDirEntries) 813 )
722 menu.addAction(self.tr('Select all versioned directory entries'), 814 menu.addAction(
723 self.browser.selectVCSDirEntries) 815 self.tr("Select all local directory entries"),
816 self.browser.selectLocalDirEntries,
817 )
818 menu.addAction(
819 self.tr("Select all versioned directory entries"),
820 self.browser.selectVCSDirEntries,
821 )
724 menu.addSeparator() 822 menu.addSeparator()
725 menu.addAction(self.tr("Configure..."), self.__SVNConfigure) 823 menu.addAction(self.tr("Configure..."), self.__SVNConfigure)
726 824
727 mainMenu.addSeparator() 825 mainMenu.addSeparator()
728 mainMenu.addMenu(menu) 826 mainMenu.addMenu(menu)
729 self.menuDirMulti = menu 827 self.menuDirMulti = menu
730 828
731 ########################################################################### 829 ###########################################################################
732 # Menu handling methods below 830 # Menu handling methods below
733 ########################################################################### 831 ###########################################################################
734 832
735 def __SVNCopy(self): 833 def __SVNCopy(self):
736 """ 834 """
737 Private slot called by the context menu to copy the selected file. 835 Private slot called by the context menu to copy the selected file.
738 """ 836 """
739 itm = self.browser.currentItem() 837 itm = self.browser.currentItem()
740 try: 838 try:
741 fn = itm.fileName() 839 fn = itm.fileName()
742 except AttributeError: 840 except AttributeError:
743 fn = itm.dirName() 841 fn = itm.dirName()
744 self.vcs.svnCopy(fn, self.project) 842 self.vcs.svnCopy(fn, self.project)
745 843
746 def __SVNMove(self): 844 def __SVNMove(self):
747 """ 845 """
748 Private slot called by the context menu to move the selected file. 846 Private slot called by the context menu to move the selected file.
749 """ 847 """
750 itm = self.browser.currentItem() 848 itm = self.browser.currentItem()
760 self.browser.closeSourceWindow.emit(fn) 858 self.browser.closeSourceWindow.emit(fn)
761 else: 859 else:
762 for mf in movefiles: 860 for mf in movefiles:
763 self.browser.closeSourceWindow.emit(mf) 861 self.browser.closeSourceWindow.emit(mf)
764 self.browser.project.startFileSystemMonitoring() 862 self.browser.project.startFileSystemMonitoring()
765 863
766 def __SVNResolve(self): 864 def __SVNResolve(self):
767 """ 865 """
768 Private slot called by the context menu to resolve conflicts of a file. 866 Private slot called by the context menu to resolve conflicts of a file.
769 """ 867 """
770 names = [] 868 names = []
772 try: 870 try:
773 names.append(itm.fileName()) 871 names.append(itm.fileName())
774 except AttributeError: 872 except AttributeError:
775 names.append(itm.dirName()) 873 names.append(itm.dirName())
776 self.vcs.vcsResolved(names) 874 self.vcs.vcsResolved(names)
777 875
778 def __SVNListProps(self): 876 def __SVNListProps(self):
779 """ 877 """
780 Private slot called by the context menu to list the subversion 878 Private slot called by the context menu to list the subversion
781 properties of a file. 879 properties of a file.
782 """ 880 """
785 try: 883 try:
786 names.append(itm.fileName()) 884 names.append(itm.fileName())
787 except AttributeError: 885 except AttributeError:
788 names.append(itm.dirName()) 886 names.append(itm.dirName())
789 self.vcs.svnListProps(names) 887 self.vcs.svnListProps(names)
790 888
791 def __SVNSetProp(self): 889 def __SVNSetProp(self):
792 """ 890 """
793 Private slot called by the context menu to set a subversion property 891 Private slot called by the context menu to set a subversion property
794 of a file. 892 of a file.
795 """ 893 """
798 try: 896 try:
799 names.append(itm.fileName()) 897 names.append(itm.fileName())
800 except AttributeError: 898 except AttributeError:
801 names.append(itm.dirName()) 899 names.append(itm.dirName())
802 self.vcs.svnSetProp(names) 900 self.vcs.svnSetProp(names)
803 901
804 def __SVNDelProp(self): 902 def __SVNDelProp(self):
805 """ 903 """
806 Private slot called by the context menu to delete a subversion 904 Private slot called by the context menu to delete a subversion
807 property of a file. 905 property of a file.
808 """ 906 """
811 try: 909 try:
812 names.append(itm.fileName()) 910 names.append(itm.fileName())
813 except AttributeError: 911 except AttributeError:
814 names.append(itm.dirName()) 912 names.append(itm.dirName())
815 self.vcs.svnDelProp(names) 913 self.vcs.svnDelProp(names)
816 914
817 def __SVNExtendedDiff(self): 915 def __SVNExtendedDiff(self):
818 """ 916 """
819 Private slot called by the context menu to show the difference of a 917 Private slot called by the context menu to show the difference of a
820 file to the repository. 918 file to the repository.
821 919
822 This gives the chance to enter the revisions to compare. 920 This gives the chance to enter the revisions to compare.
823 """ 921 """
824 names = [] 922 names = []
825 for itm in self.browser.getSelectedItems(): 923 for itm in self.browser.getSelectedItems():
826 try: 924 try:
827 names.append(itm.fileName()) 925 names.append(itm.fileName())
828 except AttributeError: 926 except AttributeError:
829 names.append(itm.dirName()) 927 names.append(itm.dirName())
830 self.vcs.svnExtendedDiff(names) 928 self.vcs.svnExtendedDiff(names)
831 929
832 def __SVNUrlDiff(self): 930 def __SVNUrlDiff(self):
833 """ 931 """
834 Private slot called by the context menu to show the difference of a 932 Private slot called by the context menu to show the difference of a
835 file of two repository URLs. 933 file of two repository URLs.
836 934
837 This gives the chance to enter the repository URLs to compare. 935 This gives the chance to enter the repository URLs to compare.
838 """ 936 """
839 names = [] 937 names = []
840 for itm in self.browser.getSelectedItems(): 938 for itm in self.browser.getSelectedItems():
841 try: 939 try:
842 names.append(itm.fileName()) 940 names.append(itm.fileName())
843 except AttributeError: 941 except AttributeError:
844 names.append(itm.dirName()) 942 names.append(itm.dirName())
845 self.vcs.svnUrlDiff(names) 943 self.vcs.svnUrlDiff(names)
846 944
847 def __SVNSbsDiff(self): 945 def __SVNSbsDiff(self):
848 """ 946 """
849 Private slot called by the context menu to show the difference of a 947 Private slot called by the context menu to show the difference of a
850 file to the repository side-by-side. 948 file to the repository side-by-side.
851 """ 949 """
852 itm = self.browser.currentItem() 950 itm = self.browser.currentItem()
853 fn = itm.fileName() 951 fn = itm.fileName()
854 self.vcs.vcsSbsDiff(fn) 952 self.vcs.vcsSbsDiff(fn)
855 953
856 def __SVNSbsExtendedDiff(self): 954 def __SVNSbsExtendedDiff(self):
857 """ 955 """
858 Private slot called by the context menu to show the difference of a 956 Private slot called by the context menu to show the difference of a
859 file to the repository side-by-side. 957 file to the repository side-by-side.
860 958
861 It allows the selection of revisions to compare. 959 It allows the selection of revisions to compare.
862 """ 960 """
863 itm = self.browser.currentItem() 961 itm = self.browser.currentItem()
864 fn = itm.fileName() 962 fn = itm.fileName()
865 self.vcs.vcsSbsDiff(fn, extended=True) 963 self.vcs.vcsSbsDiff(fn, extended=True)
866 964
867 def __SVNBlame(self): 965 def __SVNBlame(self):
868 """ 966 """
869 Private slot called by the context menu to show the blame of a file. 967 Private slot called by the context menu to show the blame of a file.
870 """ 968 """
871 itm = self.browser.currentItem() 969 itm = self.browser.currentItem()
872 fn = itm.fileName() 970 fn = itm.fileName()
873 self.vcs.svnBlame(fn) 971 self.vcs.svnBlame(fn)
874 972
875 def __SVNLock(self): 973 def __SVNLock(self):
876 """ 974 """
877 Private slot called by the context menu to lock files in the 975 Private slot called by the context menu to lock files in the
878 repository. 976 repository.
879 """ 977 """
882 try: 980 try:
883 names.append(itm.fileName()) 981 names.append(itm.fileName())
884 except AttributeError: 982 except AttributeError:
885 names.append(itm.dirName()) 983 names.append(itm.dirName())
886 self.vcs.svnLock(names) 984 self.vcs.svnLock(names)
887 985
888 def __SVNUnlock(self): 986 def __SVNUnlock(self):
889 """ 987 """
890 Private slot called by the context menu to unlock files in the 988 Private slot called by the context menu to unlock files in the
891 repository. 989 repository.
892 """ 990 """
895 try: 993 try:
896 names.append(itm.fileName()) 994 names.append(itm.fileName())
897 except AttributeError: 995 except AttributeError:
898 names.append(itm.dirName()) 996 names.append(itm.dirName())
899 self.vcs.svnUnlock(names) 997 self.vcs.svnUnlock(names)
900 998
901 def __SVNBreakLock(self): 999 def __SVNBreakLock(self):
902 """ 1000 """
903 Private slot called by the context menu to break lock files in the 1001 Private slot called by the context menu to break lock files in the
904 repository. 1002 repository.
905 """ 1003 """
908 try: 1006 try:
909 names.append(itm.fileName()) 1007 names.append(itm.fileName())
910 except AttributeError: 1008 except AttributeError:
911 names.append(itm.dirName()) 1009 names.append(itm.dirName())
912 self.vcs.svnUnlock(names, breakIt=True) 1010 self.vcs.svnUnlock(names, breakIt=True)
913 1011
914 def __SVNStealLock(self): 1012 def __SVNStealLock(self):
915 """ 1013 """
916 Private slot called by the context menu to steal lock files in the 1014 Private slot called by the context menu to steal lock files in the
917 repository. 1015 repository.
918 """ 1016 """
921 try: 1019 try:
922 names.append(itm.fileName()) 1020 names.append(itm.fileName())
923 except AttributeError: 1021 except AttributeError:
924 names.append(itm.dirName()) 1022 names.append(itm.dirName())
925 self.vcs.svnLock(names, stealIt=True) 1023 self.vcs.svnLock(names, stealIt=True)
926 1024
927 def __SVNConfigure(self): 1025 def __SVNConfigure(self):
928 """ 1026 """
929 Private method to open the configuration dialog. 1027 Private method to open the configuration dialog.
930 """ 1028 """
931 ericApp().getObject("UserInterface").showPreferences( 1029 ericApp().getObject("UserInterface").showPreferences("zzz_subversionPage")
932 "zzz_subversionPage") 1030
933
934 def __SVNAddToChangelist(self): 1031 def __SVNAddToChangelist(self):
935 """ 1032 """
936 Private slot called by the context menu to add files to a changelist. 1033 Private slot called by the context menu to add files to a changelist.
937 """ 1034 """
938 names = [] 1035 names = []
940 try: 1037 try:
941 names.append(itm.fileName()) 1038 names.append(itm.fileName())
942 except AttributeError: 1039 except AttributeError:
943 names.append(itm.dirName()) 1040 names.append(itm.dirName())
944 self.vcs.svnAddToChangelist(names) 1041 self.vcs.svnAddToChangelist(names)
945 1042
946 def __SVNRemoveFromChangelist(self): 1043 def __SVNRemoveFromChangelist(self):
947 """ 1044 """
948 Private slot called by the context menu to remove files from their 1045 Private slot called by the context menu to remove files from their
949 changelist. 1046 changelist.
950 """ 1047 """
957 self.vcs.svnRemoveFromChangelist(names) 1054 self.vcs.svnRemoveFromChangelist(names)
958 1055
959 ########################################################################### 1056 ###########################################################################
960 # Some private utility methods below 1057 # Some private utility methods below
961 ########################################################################### 1058 ###########################################################################
962 1059
963 def __itemsHaveFiles(self, items): 1060 def __itemsHaveFiles(self, items):
964 """ 1061 """
965 Private method to check, if items contain file type items. 1062 Private method to check, if items contain file type items.
966 1063
967 @param items items to check (list of QTreeWidgetItems) 1064 @param items items to check (list of QTreeWidgetItems)
968 @return flag indicating items contain file type items (boolean) 1065 @return flag indicating items contain file type items (boolean)
969 """ 1066 """
970 return any(isinstance(itm, ProjectBrowserFileItem) for itm in items) 1067 return any(isinstance(itm, ProjectBrowserFileItem) for itm in items)

eric ide

mercurial