228 for act in self.vcsAddDirMultiMenuActions: |
243 for act in self.vcsAddDirMultiMenuActions: |
229 act.setEnabled(True) |
244 act.setEnabled(True) |
230 for act in standardItems: |
245 for act in standardItems: |
231 act.setEnabled(True) |
246 act.setEnabled(True) |
232 self.__showExtensionMenu("dirMultiMenu", controlled) |
247 self.__showExtensionMenu("dirMultiMenu", controlled) |
233 |
248 |
234 ########################################################################### |
249 ########################################################################### |
235 ## Private menu generation methods below |
250 ## Private menu generation methods below |
236 ########################################################################### |
251 ########################################################################### |
237 |
252 |
238 def __addExtensionsMenu(self, menu, key): |
253 def __addExtensionsMenu(self, menu, key): |
239 """ |
254 """ |
240 Private method to add an extension menu entry. |
255 Private method to add an extension menu entry. |
241 |
256 |
242 @param menu menu to add it to (QMenu) |
257 @param menu menu to add it to (QMenu) |
243 @param key menu key (string, one of 'mainMenu', 'multiMenu', |
258 @param key menu key (string, one of 'mainMenu', 'multiMenu', |
244 'backMenu', 'dirMenu' or 'dirMultiMenu') |
259 'backMenu', 'dirMenu' or 'dirMultiMenu') |
245 @return reference to the menu action (QAction) |
260 @return reference to the menu action (QAction) |
246 """ |
261 """ |
247 act = None |
262 act = None |
248 if key in ['mainMenu', 'multiMenu', 'backMenu', 'dirMenu', |
263 if key in ["mainMenu", "multiMenu", "backMenu", "dirMenu", "dirMultiMenu"]: |
249 'dirMultiMenu']: |
|
250 extensionsMenu = QMenu(self.tr("Extensions"), menu) |
264 extensionsMenu = QMenu(self.tr("Extensions"), menu) |
251 extensionsMenu.setTearOffEnabled(True) |
265 extensionsMenu.setTearOffEnabled(True) |
252 for extensionMenuTitle in sorted(self.__extensionMenuTitles): |
266 for extensionMenuTitle in sorted(self.__extensionMenuTitles): |
253 extensionName = self.__extensionMenuTitles[extensionMenuTitle] |
267 extensionName = self.__extensionMenuTitles[extensionMenuTitle] |
254 if key in self.__extensionMenus[extensionName]: |
268 if key in self.__extensionMenus[extensionName]: |
255 extensionsMenu.addMenu( |
269 extensionsMenu.addMenu(self.__extensionMenus[extensionName][key]) |
256 self.__extensionMenus[extensionName][key]) |
|
257 if not extensionsMenu.isEmpty(): |
270 if not extensionsMenu.isEmpty(): |
258 if not menu.isEmpty(): |
271 if not menu.isEmpty(): |
259 menu.addSeparator() |
272 menu.addSeparator() |
260 act = menu.addMenu(extensionsMenu) |
273 act = menu.addMenu(extensionsMenu) |
261 return act |
274 return act |
262 |
275 |
263 ########################################################################### |
276 ########################################################################### |
264 ## Protected menu generation methods below |
277 ## Protected menu generation methods below |
265 ########################################################################### |
278 ########################################################################### |
266 |
279 |
267 def _addVCSMenu(self, mainMenu): |
280 def _addVCSMenu(self, mainMenu): |
268 """ |
281 """ |
269 Protected method used to add the VCS menu to all project browsers. |
282 Protected method used to add the VCS menu to all project browsers. |
270 |
283 |
271 @param mainMenu reference to the menu to be amended |
284 @param mainMenu reference to the menu to be amended |
272 """ |
285 """ |
273 self.vcsMenuActions = [] |
286 self.vcsMenuActions = [] |
274 self.vcsAddMenuActions = [] |
287 self.vcsAddMenuActions = [] |
275 |
288 |
276 menu = QMenu(self.tr("Version Control")) |
289 menu = QMenu(self.tr("Version Control")) |
277 |
290 |
278 act = menu.addAction( |
291 act = menu.addAction( |
279 UI.PixmapCache.getIcon( |
292 UI.PixmapCache.getIcon( |
280 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
293 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.svg") |
281 "mercurial.svg")), |
294 ), |
282 self.vcs.vcsName(), self._VCSInfoDisplay) |
295 self.vcs.vcsName(), |
|
296 self._VCSInfoDisplay, |
|
297 ) |
283 font = act.font() |
298 font = act.font() |
284 font.setBold(True) |
299 font.setBold(True) |
285 act.setFont(font) |
300 act.setFont(font) |
286 menu.addSeparator() |
301 menu.addSeparator() |
287 |
302 |
288 act = menu.addAction( |
303 act = menu.addAction( |
289 UI.PixmapCache.getIcon("vcsCommit"), |
304 UI.PixmapCache.getIcon("vcsCommit"), |
290 self.tr('Commit changes to repository...'), |
305 self.tr("Commit changes to repository..."), |
291 self._VCSCommit) |
306 self._VCSCommit, |
292 self.vcsMenuActions.append(act) |
307 ) |
293 self.__addExtensionsMenu(menu, 'mainMenu') |
308 self.vcsMenuActions.append(act) |
294 menu.addSeparator() |
309 self.__addExtensionsMenu(menu, "mainMenu") |
295 act = menu.addAction( |
310 menu.addSeparator() |
296 UI.PixmapCache.getIcon("vcsAdd"), |
311 act = menu.addAction( |
297 self.tr('Add to repository'), |
312 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd |
298 self._VCSAdd) |
313 ) |
299 self.vcsAddMenuActions.append(act) |
314 self.vcsAddMenuActions.append(act) |
300 act = menu.addAction( |
315 act = menu.addAction( |
301 UI.PixmapCache.getIcon("vcsRemove"), |
316 UI.PixmapCache.getIcon("vcsRemove"), |
302 self.tr('Remove from repository (and disk)'), |
317 self.tr("Remove from repository (and disk)"), |
303 self._VCSRemove) |
318 self._VCSRemove, |
|
319 ) |
304 self.vcsMenuActions.append(act) |
320 self.vcsMenuActions.append(act) |
305 act = menu.addAction( |
321 act = menu.addAction( |
306 UI.PixmapCache.getIcon("vcsRemove"), |
322 UI.PixmapCache.getIcon("vcsRemove"), |
307 self.tr('Remove from repository only'), |
323 self.tr("Remove from repository only"), |
308 self.__HgForget) |
324 self.__HgForget, |
309 self.vcsMenuActions.append(act) |
325 ) |
310 menu.addSeparator() |
326 self.vcsMenuActions.append(act) |
311 act = menu.addAction(self.tr('Copy'), self.__HgCopy) |
327 menu.addSeparator() |
312 self.vcsMenuActions.append(act) |
328 act = menu.addAction(self.tr("Copy"), self.__HgCopy) |
313 act = menu.addAction(self.tr('Move'), self.__HgMove) |
329 self.vcsMenuActions.append(act) |
|
330 act = menu.addAction(self.tr("Move"), self.__HgMove) |
314 self.vcsMenuActions.append(act) |
331 self.vcsMenuActions.append(act) |
315 menu.addSeparator() |
332 menu.addSeparator() |
316 act = menu.addAction( |
333 act = menu.addAction( |
317 UI.PixmapCache.getIcon("vcsLog"), |
334 UI.PixmapCache.getIcon("vcsLog"), |
318 self.tr('Show log browser'), self._VCSLogBrowser) |
335 self.tr("Show log browser"), |
319 self.vcsMenuActions.append(act) |
336 self._VCSLogBrowser, |
320 menu.addSeparator() |
337 ) |
321 act = menu.addAction( |
338 self.vcsMenuActions.append(act) |
322 UI.PixmapCache.getIcon("vcsStatus"), |
339 menu.addSeparator() |
323 self.tr('Show status'), self._VCSStatus) |
340 act = menu.addAction( |
|
341 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus |
|
342 ) |
324 self.vcsMenuActions.append(act) |
343 self.vcsMenuActions.append(act) |
325 menu.addSeparator() |
344 menu.addSeparator() |
326 act = menu.addAction( |
345 act = menu.addAction( |
327 UI.PixmapCache.getIcon("vcsDiff"), |
346 UI.PixmapCache.getIcon("vcsDiff"), |
328 self.tr('Show differences'), self._VCSDiff) |
347 self.tr("Show differences"), |
|
348 self._VCSDiff, |
|
349 ) |
329 self.vcsMenuActions.append(act) |
350 self.vcsMenuActions.append(act) |
330 act = menu.addAction( |
351 act = menu.addAction( |
331 UI.PixmapCache.getIcon("vcsSbsDiff"), |
352 UI.PixmapCache.getIcon("vcsSbsDiff"), |
332 self.tr('Show differences side-by-side'), self.__HgSbsDiff) |
353 self.tr("Show differences side-by-side"), |
|
354 self.__HgSbsDiff, |
|
355 ) |
333 self.vcsMenuActions.append(act) |
356 self.vcsMenuActions.append(act) |
334 act = menu.addAction( |
357 act = menu.addAction( |
335 UI.PixmapCache.getIcon("vcsDiff"), |
358 UI.PixmapCache.getIcon("vcsDiff"), |
336 self.tr('Show differences (extended)'), |
359 self.tr("Show differences (extended)"), |
337 self.__HgExtendedDiff) |
360 self.__HgExtendedDiff, |
|
361 ) |
338 self.vcsMenuActions.append(act) |
362 self.vcsMenuActions.append(act) |
339 act = menu.addAction( |
363 act = menu.addAction( |
340 UI.PixmapCache.getIcon("vcsSbsDiff"), |
364 UI.PixmapCache.getIcon("vcsSbsDiff"), |
341 self.tr('Show differences side-by-side (extended)'), |
365 self.tr("Show differences side-by-side (extended)"), |
342 self.__HgSbsExtendedDiff) |
366 self.__HgSbsExtendedDiff, |
|
367 ) |
343 self.vcsMenuActions.append(act) |
368 self.vcsMenuActions.append(act) |
344 self.annotateAct = menu.addAction( |
369 self.annotateAct = menu.addAction( |
345 self.tr('Show annotated file'), |
370 self.tr("Show annotated file"), self.__HgAnnotate |
346 self.__HgAnnotate) |
371 ) |
347 self.vcsMenuActions.append(self.annotateAct) |
372 self.vcsMenuActions.append(self.annotateAct) |
348 menu.addSeparator() |
373 menu.addSeparator() |
349 act = menu.addAction( |
374 act = menu.addAction( |
350 UI.PixmapCache.getIcon("vcsRevert"), |
375 UI.PixmapCache.getIcon("vcsRevert"), |
351 self.tr('Revert changes'), self.__HgRevert) |
376 self.tr("Revert changes"), |
352 self.vcsMenuActions.append(act) |
377 self.__HgRevert, |
353 act = menu.addAction( |
378 ) |
354 self.tr('Conflicts resolved'), self.__HgResolved) |
379 self.vcsMenuActions.append(act) |
355 self.vcsMenuActions.append(act) |
380 act = menu.addAction(self.tr("Conflicts resolved"), self.__HgResolved) |
356 act = menu.addAction( |
381 self.vcsMenuActions.append(act) |
357 self.tr('Conflicts unresolved'), self.__HgUnresolved) |
382 act = menu.addAction(self.tr("Conflicts unresolved"), self.__HgUnresolved) |
358 self.vcsMenuActions.append(act) |
383 self.vcsMenuActions.append(act) |
359 act = menu.addAction( |
384 act = menu.addAction(self.tr("Re-Merge"), self.__HgReMerge) |
360 self.tr('Re-Merge'), self.__HgReMerge) |
385 self.vcsMenuActions.append(act) |
361 self.vcsMenuActions.append(act) |
386 menu.addSeparator() |
362 menu.addSeparator() |
387 menu.addAction( |
363 menu.addAction(self.tr('Select all local file entries'), |
388 self.tr("Select all local file entries"), self.browser.selectLocalEntries |
364 self.browser.selectLocalEntries) |
389 ) |
365 menu.addAction(self.tr('Select all versioned file entries'), |
390 menu.addAction( |
366 self.browser.selectVCSEntries) |
391 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries |
367 menu.addAction(self.tr('Select all local directory entries'), |
392 ) |
368 self.browser.selectLocalDirEntries) |
393 menu.addAction( |
369 menu.addAction(self.tr('Select all versioned directory entries'), |
394 self.tr("Select all local directory entries"), |
370 self.browser.selectVCSDirEntries) |
395 self.browser.selectLocalDirEntries, |
|
396 ) |
|
397 menu.addAction( |
|
398 self.tr("Select all versioned directory entries"), |
|
399 self.browser.selectVCSDirEntries, |
|
400 ) |
371 menu.addSeparator() |
401 menu.addSeparator() |
372 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
402 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
373 |
403 |
374 mainMenu.addSeparator() |
404 mainMenu.addSeparator() |
375 mainMenu.addMenu(menu) |
405 mainMenu.addMenu(menu) |
376 self.menu = menu |
406 self.menu = menu |
377 |
407 |
378 def _addVCSMenuMulti(self, mainMenu): |
408 def _addVCSMenuMulti(self, mainMenu): |
379 """ |
409 """ |
380 Protected method used to add the VCS menu for multi selection to all |
410 Protected method used to add the VCS menu for multi selection to all |
381 project browsers. |
411 project browsers. |
382 |
412 |
383 @param mainMenu reference to the menu to be amended |
413 @param mainMenu reference to the menu to be amended |
384 """ |
414 """ |
385 self.vcsMultiMenuActions = [] |
415 self.vcsMultiMenuActions = [] |
386 self.vcsAddMultiMenuActions = [] |
416 self.vcsAddMultiMenuActions = [] |
387 |
417 |
388 menu = QMenu(self.tr("Version Control")) |
418 menu = QMenu(self.tr("Version Control")) |
389 |
419 |
390 act = menu.addAction( |
420 act = menu.addAction( |
391 UI.PixmapCache.getIcon( |
421 UI.PixmapCache.getIcon( |
392 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
422 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.svg") |
393 "mercurial.svg")), |
423 ), |
394 self.vcs.vcsName(), self._VCSInfoDisplay) |
424 self.vcs.vcsName(), |
|
425 self._VCSInfoDisplay, |
|
426 ) |
395 font = act.font() |
427 font = act.font() |
396 font.setBold(True) |
428 font.setBold(True) |
397 act.setFont(font) |
429 act.setFont(font) |
398 menu.addSeparator() |
430 menu.addSeparator() |
399 |
431 |
400 act = menu.addAction( |
432 act = menu.addAction( |
401 UI.PixmapCache.getIcon("vcsCommit"), |
433 UI.PixmapCache.getIcon("vcsCommit"), |
402 self.tr('Commit changes to repository...'), |
434 self.tr("Commit changes to repository..."), |
403 self._VCSCommit) |
435 self._VCSCommit, |
|
436 ) |
404 self.vcsMultiMenuActions.append(act) |
437 self.vcsMultiMenuActions.append(act) |
405 self.__addExtensionsMenu(menu, 'multiMenu') |
438 self.__addExtensionsMenu(menu, "multiMenu") |
406 menu.addSeparator() |
439 menu.addSeparator() |
407 act = menu.addAction( |
440 act = menu.addAction( |
408 UI.PixmapCache.getIcon("vcsAdd"), |
441 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd |
409 self.tr('Add to repository'), self._VCSAdd) |
442 ) |
410 self.vcsAddMultiMenuActions.append(act) |
443 self.vcsAddMultiMenuActions.append(act) |
411 act = menu.addAction( |
444 act = menu.addAction( |
412 UI.PixmapCache.getIcon("vcsRemove"), |
445 UI.PixmapCache.getIcon("vcsRemove"), |
413 self.tr('Remove from repository (and disk)'), |
446 self.tr("Remove from repository (and disk)"), |
414 self._VCSRemove) |
447 self._VCSRemove, |
|
448 ) |
415 self.vcsMultiMenuActions.append(act) |
449 self.vcsMultiMenuActions.append(act) |
416 act = menu.addAction( |
450 act = menu.addAction( |
417 UI.PixmapCache.getIcon("vcsRemove"), |
451 UI.PixmapCache.getIcon("vcsRemove"), |
418 self.tr('Remove from repository only'), |
452 self.tr("Remove from repository only"), |
419 self.__HgForget) |
453 self.__HgForget, |
|
454 ) |
420 self.vcsMultiMenuActions.append(act) |
455 self.vcsMultiMenuActions.append(act) |
421 menu.addSeparator() |
456 menu.addSeparator() |
422 act = menu.addAction( |
457 act = menu.addAction( |
423 UI.PixmapCache.getIcon("vcsStatus"), |
458 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus |
424 self.tr('Show status'), self._VCSStatus) |
459 ) |
425 self.vcsMultiMenuActions.append(act) |
460 self.vcsMultiMenuActions.append(act) |
426 menu.addSeparator() |
461 menu.addSeparator() |
427 act = menu.addAction( |
462 act = menu.addAction( |
428 UI.PixmapCache.getIcon("vcsDiff"), |
463 UI.PixmapCache.getIcon("vcsDiff"), |
429 self.tr('Show differences'), self._VCSDiff) |
464 self.tr("Show differences"), |
|
465 self._VCSDiff, |
|
466 ) |
430 self.vcsMultiMenuActions.append(act) |
467 self.vcsMultiMenuActions.append(act) |
431 act = menu.addAction( |
468 act = menu.addAction( |
432 UI.PixmapCache.getIcon("vcsDiff"), |
469 UI.PixmapCache.getIcon("vcsDiff"), |
433 self.tr('Show differences (extended)'), |
470 self.tr("Show differences (extended)"), |
434 self.__HgExtendedDiff) |
471 self.__HgExtendedDiff, |
|
472 ) |
435 self.vcsMultiMenuActions.append(act) |
473 self.vcsMultiMenuActions.append(act) |
436 menu.addSeparator() |
474 menu.addSeparator() |
437 act = menu.addAction( |
475 act = menu.addAction( |
438 UI.PixmapCache.getIcon("vcsRevert"), |
476 UI.PixmapCache.getIcon("vcsRevert"), |
439 self.tr('Revert changes'), self.__HgRevert) |
477 self.tr("Revert changes"), |
|
478 self.__HgRevert, |
|
479 ) |
440 self.vcsMultiMenuActions.append(act) |
480 self.vcsMultiMenuActions.append(act) |
441 act = menu.addAction( |
481 act = menu.addAction(self.tr("Conflicts resolved"), self.__HgResolved) |
442 self.tr('Conflicts resolved'), self.__HgResolved) |
|
443 self.vcsMultiMenuActions.append(act) |
482 self.vcsMultiMenuActions.append(act) |
444 act = menu.addAction( |
483 act = menu.addAction(self.tr("Conflicts unresolved"), self.__HgUnresolved) |
445 self.tr('Conflicts unresolved'), self.__HgUnresolved) |
|
446 self.vcsMultiMenuActions.append(act) |
484 self.vcsMultiMenuActions.append(act) |
447 act = menu.addAction( |
485 act = menu.addAction(self.tr("Re-Merge"), self.__HgReMerge) |
448 self.tr('Re-Merge'), self.__HgReMerge) |
|
449 self.vcsMultiMenuActions.append(act) |
486 self.vcsMultiMenuActions.append(act) |
450 menu.addSeparator() |
487 menu.addSeparator() |
451 menu.addAction(self.tr('Select all local file entries'), |
488 menu.addAction( |
452 self.browser.selectLocalEntries) |
489 self.tr("Select all local file entries"), self.browser.selectLocalEntries |
453 menu.addAction(self.tr('Select all versioned file entries'), |
490 ) |
454 self.browser.selectVCSEntries) |
491 menu.addAction( |
455 menu.addAction(self.tr('Select all local directory entries'), |
492 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries |
456 self.browser.selectLocalDirEntries) |
493 ) |
457 menu.addAction(self.tr('Select all versioned directory entries'), |
494 menu.addAction( |
458 self.browser.selectVCSDirEntries) |
495 self.tr("Select all local directory entries"), |
|
496 self.browser.selectLocalDirEntries, |
|
497 ) |
|
498 menu.addAction( |
|
499 self.tr("Select all versioned directory entries"), |
|
500 self.browser.selectVCSDirEntries, |
|
501 ) |
459 menu.addSeparator() |
502 menu.addSeparator() |
460 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
503 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
461 |
504 |
462 mainMenu.addSeparator() |
505 mainMenu.addSeparator() |
463 mainMenu.addMenu(menu) |
506 mainMenu.addMenu(menu) |
464 self.menuMulti = menu |
507 self.menuMulti = menu |
465 |
508 |
466 def _addVCSMenuBack(self, mainMenu): |
509 def _addVCSMenuBack(self, mainMenu): |
467 """ |
510 """ |
468 Protected method used to add the VCS menu to all project browsers. |
511 Protected method used to add the VCS menu to all project browsers. |
469 |
512 |
470 @param mainMenu reference to the menu to be amended |
513 @param mainMenu reference to the menu to be amended |
471 """ |
514 """ |
472 menu = QMenu(self.tr("Version Control")) |
515 menu = QMenu(self.tr("Version Control")) |
473 |
516 |
474 act = menu.addAction( |
517 act = menu.addAction( |
475 UI.PixmapCache.getIcon( |
518 UI.PixmapCache.getIcon( |
476 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
519 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.svg") |
477 "mercurial.svg")), |
520 ), |
478 self.vcs.vcsName(), self._VCSInfoDisplay) |
521 self.vcs.vcsName(), |
|
522 self._VCSInfoDisplay, |
|
523 ) |
479 font = act.font() |
524 font = act.font() |
480 font.setBold(True) |
525 font.setBold(True) |
481 act.setFont(font) |
526 act.setFont(font) |
482 menu.addSeparator() |
527 menu.addSeparator() |
483 |
528 |
484 menu.addAction(self.tr('Select all local file entries'), |
529 menu.addAction( |
485 self.browser.selectLocalEntries) |
530 self.tr("Select all local file entries"), self.browser.selectLocalEntries |
486 menu.addAction(self.tr('Select all versioned file entries'), |
531 ) |
487 self.browser.selectVCSEntries) |
532 menu.addAction( |
488 menu.addAction(self.tr('Select all local directory entries'), |
533 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries |
489 self.browser.selectLocalDirEntries) |
534 ) |
490 menu.addAction(self.tr('Select all versioned directory entries'), |
535 menu.addAction( |
491 self.browser.selectVCSDirEntries) |
536 self.tr("Select all local directory entries"), |
|
537 self.browser.selectLocalDirEntries, |
|
538 ) |
|
539 menu.addAction( |
|
540 self.tr("Select all versioned directory entries"), |
|
541 self.browser.selectVCSDirEntries, |
|
542 ) |
492 menu.addSeparator() |
543 menu.addSeparator() |
493 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
544 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
494 |
545 |
495 mainMenu.addSeparator() |
546 mainMenu.addSeparator() |
496 mainMenu.addMenu(menu) |
547 mainMenu.addMenu(menu) |
497 self.menuBack = menu |
548 self.menuBack = menu |
498 |
549 |
499 def _addVCSMenuDir(self, mainMenu): |
550 def _addVCSMenuDir(self, mainMenu): |
500 """ |
551 """ |
501 Protected method used to add the VCS menu to all project browsers. |
552 Protected method used to add the VCS menu to all project browsers. |
502 |
553 |
503 @param mainMenu reference to the menu to be amended |
554 @param mainMenu reference to the menu to be amended |
504 """ |
555 """ |
505 if mainMenu is None: |
556 if mainMenu is None: |
506 return |
557 return |
507 |
558 |
508 self.vcsDirMenuActions = [] |
559 self.vcsDirMenuActions = [] |
509 self.vcsAddDirMenuActions = [] |
560 self.vcsAddDirMenuActions = [] |
510 |
561 |
511 menu = QMenu(self.tr("Version Control")) |
562 menu = QMenu(self.tr("Version Control")) |
512 |
563 |
513 act = menu.addAction( |
564 act = menu.addAction( |
514 UI.PixmapCache.getIcon( |
565 UI.PixmapCache.getIcon( |
515 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
566 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.svg") |
516 "mercurial.svg")), |
567 ), |
517 self.vcs.vcsName(), self._VCSInfoDisplay) |
568 self.vcs.vcsName(), |
|
569 self._VCSInfoDisplay, |
|
570 ) |
518 font = act.font() |
571 font = act.font() |
519 font.setBold(True) |
572 font.setBold(True) |
520 act.setFont(font) |
573 act.setFont(font) |
521 menu.addSeparator() |
574 menu.addSeparator() |
522 |
575 |
523 act = menu.addAction( |
576 act = menu.addAction( |
524 UI.PixmapCache.getIcon("vcsCommit"), |
577 UI.PixmapCache.getIcon("vcsCommit"), |
525 self.tr('Commit changes to repository...'), |
578 self.tr("Commit changes to repository..."), |
526 self._VCSCommit) |
579 self._VCSCommit, |
527 self.vcsDirMenuActions.append(act) |
580 ) |
528 self.__addExtensionsMenu(menu, 'dirMenu') |
581 self.vcsDirMenuActions.append(act) |
529 menu.addSeparator() |
582 self.__addExtensionsMenu(menu, "dirMenu") |
530 act = menu.addAction( |
583 menu.addSeparator() |
531 UI.PixmapCache.getIcon("vcsAdd"), |
584 act = menu.addAction( |
532 self.tr('Add to repository'), self._VCSAdd) |
585 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd |
|
586 ) |
533 self.vcsAddDirMenuActions.append(act) |
587 self.vcsAddDirMenuActions.append(act) |
534 act = menu.addAction( |
588 act = menu.addAction( |
535 UI.PixmapCache.getIcon("vcsRemove"), |
589 UI.PixmapCache.getIcon("vcsRemove"), |
536 self.tr('Remove from repository (and disk)'), |
590 self.tr("Remove from repository (and disk)"), |
537 self._VCSRemove) |
591 self._VCSRemove, |
538 self.vcsDirMenuActions.append(act) |
592 ) |
539 menu.addSeparator() |
593 self.vcsDirMenuActions.append(act) |
540 act = menu.addAction(self.tr('Copy'), self.__HgCopy) |
594 menu.addSeparator() |
541 self.vcsDirMenuActions.append(act) |
595 act = menu.addAction(self.tr("Copy"), self.__HgCopy) |
542 act = menu.addAction(self.tr('Move'), self.__HgMove) |
596 self.vcsDirMenuActions.append(act) |
|
597 act = menu.addAction(self.tr("Move"), self.__HgMove) |
543 self.vcsDirMenuActions.append(act) |
598 self.vcsDirMenuActions.append(act) |
544 menu.addSeparator() |
599 menu.addSeparator() |
545 act = menu.addAction( |
600 act = menu.addAction( |
546 UI.PixmapCache.getIcon("vcsLog"), |
601 UI.PixmapCache.getIcon("vcsLog"), |
547 self.tr('Show log browser'), self._VCSLogBrowser) |
602 self.tr("Show log browser"), |
548 self.vcsDirMenuActions.append(act) |
603 self._VCSLogBrowser, |
549 menu.addSeparator() |
604 ) |
550 act = menu.addAction( |
605 self.vcsDirMenuActions.append(act) |
551 UI.PixmapCache.getIcon("vcsStatus"), |
606 menu.addSeparator() |
552 self.tr('Show status'), self._VCSStatus) |
607 act = menu.addAction( |
|
608 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus |
|
609 ) |
553 self.vcsDirMenuActions.append(act) |
610 self.vcsDirMenuActions.append(act) |
554 menu.addSeparator() |
611 menu.addSeparator() |
555 act = menu.addAction( |
612 act = menu.addAction( |
556 UI.PixmapCache.getIcon("vcsDiff"), |
613 UI.PixmapCache.getIcon("vcsDiff"), |
557 self.tr('Show differences'), self._VCSDiff) |
614 self.tr("Show differences"), |
|
615 self._VCSDiff, |
|
616 ) |
558 self.vcsDirMenuActions.append(act) |
617 self.vcsDirMenuActions.append(act) |
559 act = menu.addAction( |
618 act = menu.addAction( |
560 UI.PixmapCache.getIcon("vcsDiff"), |
619 UI.PixmapCache.getIcon("vcsDiff"), |
561 self.tr('Show differences (extended)'), |
620 self.tr("Show differences (extended)"), |
562 self.__HgExtendedDiff) |
621 self.__HgExtendedDiff, |
|
622 ) |
563 self.vcsDirMenuActions.append(act) |
623 self.vcsDirMenuActions.append(act) |
564 menu.addSeparator() |
624 menu.addSeparator() |
565 act = menu.addAction( |
625 act = menu.addAction( |
566 UI.PixmapCache.getIcon("vcsRevert"), |
626 UI.PixmapCache.getIcon("vcsRevert"), |
567 self.tr('Revert changes'), self.__HgRevert) |
627 self.tr("Revert changes"), |
568 self.vcsDirMenuActions.append(act) |
628 self.__HgRevert, |
569 act = menu.addAction( |
629 ) |
570 self.tr('Conflicts resolved'), self.__HgResolved) |
630 self.vcsDirMenuActions.append(act) |
571 self.vcsDirMenuActions.append(act) |
631 act = menu.addAction(self.tr("Conflicts resolved"), self.__HgResolved) |
572 act = menu.addAction( |
632 self.vcsDirMenuActions.append(act) |
573 self.tr('Conflicts unresolved'), self.__HgUnresolved) |
633 act = menu.addAction(self.tr("Conflicts unresolved"), self.__HgUnresolved) |
574 self.vcsDirMenuActions.append(act) |
634 self.vcsDirMenuActions.append(act) |
575 act = menu.addAction( |
635 act = menu.addAction(self.tr("Re-Merge"), self.__HgReMerge) |
576 self.tr('Re-Merge'), self.__HgReMerge) |
636 self.vcsDirMenuActions.append(act) |
577 self.vcsDirMenuActions.append(act) |
637 menu.addSeparator() |
578 menu.addSeparator() |
638 menu.addAction( |
579 menu.addAction(self.tr('Select all local file entries'), |
639 self.tr("Select all local file entries"), self.browser.selectLocalEntries |
580 self.browser.selectLocalEntries) |
640 ) |
581 menu.addAction(self.tr('Select all versioned file entries'), |
641 menu.addAction( |
582 self.browser.selectVCSEntries) |
642 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries |
583 menu.addAction(self.tr('Select all local directory entries'), |
643 ) |
584 self.browser.selectLocalDirEntries) |
644 menu.addAction( |
585 menu.addAction(self.tr('Select all versioned directory entries'), |
645 self.tr("Select all local directory entries"), |
586 self.browser.selectVCSDirEntries) |
646 self.browser.selectLocalDirEntries, |
|
647 ) |
|
648 menu.addAction( |
|
649 self.tr("Select all versioned directory entries"), |
|
650 self.browser.selectVCSDirEntries, |
|
651 ) |
587 menu.addSeparator() |
652 menu.addSeparator() |
588 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
653 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
589 |
654 |
590 mainMenu.addSeparator() |
655 mainMenu.addSeparator() |
591 mainMenu.addMenu(menu) |
656 mainMenu.addMenu(menu) |
592 self.menuDir = menu |
657 self.menuDir = menu |
593 |
658 |
594 def _addVCSMenuDirMulti(self, mainMenu): |
659 def _addVCSMenuDirMulti(self, mainMenu): |
595 """ |
660 """ |
596 Protected method used to add the VCS menu to all project browsers. |
661 Protected method used to add the VCS menu to all project browsers. |
597 |
662 |
598 @param mainMenu reference to the menu to be amended |
663 @param mainMenu reference to the menu to be amended |
599 """ |
664 """ |
600 if mainMenu is None: |
665 if mainMenu is None: |
601 return |
666 return |
602 |
667 |
603 self.vcsDirMultiMenuActions = [] |
668 self.vcsDirMultiMenuActions = [] |
604 self.vcsAddDirMultiMenuActions = [] |
669 self.vcsAddDirMultiMenuActions = [] |
605 |
670 |
606 menu = QMenu(self.tr("Version Control")) |
671 menu = QMenu(self.tr("Version Control")) |
607 |
672 |
608 act = menu.addAction( |
673 act = menu.addAction( |
609 UI.PixmapCache.getIcon( |
674 UI.PixmapCache.getIcon( |
610 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
675 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.svg") |
611 "mercurial.svg")), |
676 ), |
612 self.vcs.vcsName(), self._VCSInfoDisplay) |
677 self.vcs.vcsName(), |
|
678 self._VCSInfoDisplay, |
|
679 ) |
613 font = act.font() |
680 font = act.font() |
614 font.setBold(True) |
681 font.setBold(True) |
615 act.setFont(font) |
682 act.setFont(font) |
616 menu.addSeparator() |
683 menu.addSeparator() |
617 |
684 |
618 act = menu.addAction( |
685 act = menu.addAction( |
619 UI.PixmapCache.getIcon("vcsCommit"), |
686 UI.PixmapCache.getIcon("vcsCommit"), |
620 self.tr('Commit changes to repository...'), |
687 self.tr("Commit changes to repository..."), |
621 self._VCSCommit) |
688 self._VCSCommit, |
|
689 ) |
622 self.vcsDirMultiMenuActions.append(act) |
690 self.vcsDirMultiMenuActions.append(act) |
623 self.__addExtensionsMenu(menu, 'dirMultiMenu') |
691 self.__addExtensionsMenu(menu, "dirMultiMenu") |
624 menu.addSeparator() |
692 menu.addSeparator() |
625 act = menu.addAction( |
693 act = menu.addAction( |
626 UI.PixmapCache.getIcon("vcsAdd"), |
694 UI.PixmapCache.getIcon("vcsAdd"), self.tr("Add to repository"), self._VCSAdd |
627 self.tr('Add to repository'), self._VCSAdd) |
695 ) |
628 self.vcsAddDirMultiMenuActions.append(act) |
696 self.vcsAddDirMultiMenuActions.append(act) |
629 act = menu.addAction( |
697 act = menu.addAction( |
630 UI.PixmapCache.getIcon("vcsRemove"), |
698 UI.PixmapCache.getIcon("vcsRemove"), |
631 self.tr('Remove from repository (and disk)'), |
699 self.tr("Remove from repository (and disk)"), |
632 self._VCSRemove) |
700 self._VCSRemove, |
|
701 ) |
633 self.vcsDirMultiMenuActions.append(act) |
702 self.vcsDirMultiMenuActions.append(act) |
634 menu.addSeparator() |
703 menu.addSeparator() |
635 act = menu.addAction( |
704 act = menu.addAction( |
636 UI.PixmapCache.getIcon("vcsStatus"), |
705 UI.PixmapCache.getIcon("vcsStatus"), self.tr("Show status"), self._VCSStatus |
637 self.tr('Show status'), self._VCSStatus) |
706 ) |
638 self.vcsDirMultiMenuActions.append(act) |
707 self.vcsDirMultiMenuActions.append(act) |
639 menu.addSeparator() |
708 menu.addSeparator() |
640 act = menu.addAction( |
709 act = menu.addAction( |
641 UI.PixmapCache.getIcon("vcsDiff"), |
710 UI.PixmapCache.getIcon("vcsDiff"), |
642 self.tr('Show differences'), self._VCSDiff) |
711 self.tr("Show differences"), |
|
712 self._VCSDiff, |
|
713 ) |
643 self.vcsDirMultiMenuActions.append(act) |
714 self.vcsDirMultiMenuActions.append(act) |
644 act = menu.addAction( |
715 act = menu.addAction( |
645 UI.PixmapCache.getIcon("vcsDiff"), |
716 UI.PixmapCache.getIcon("vcsDiff"), |
646 self.tr('Show differences (extended)'), |
717 self.tr("Show differences (extended)"), |
647 self.__HgExtendedDiff) |
718 self.__HgExtendedDiff, |
|
719 ) |
648 self.vcsDirMultiMenuActions.append(act) |
720 self.vcsDirMultiMenuActions.append(act) |
649 menu.addSeparator() |
721 menu.addSeparator() |
650 act = menu.addAction( |
722 act = menu.addAction( |
651 UI.PixmapCache.getIcon("vcsRevert"), |
723 UI.PixmapCache.getIcon("vcsRevert"), |
652 self.tr('Revert changes'), self.__HgRevert) |
724 self.tr("Revert changes"), |
|
725 self.__HgRevert, |
|
726 ) |
653 self.vcsDirMultiMenuActions.append(act) |
727 self.vcsDirMultiMenuActions.append(act) |
654 act = menu.addAction( |
728 act = menu.addAction(self.tr("Conflicts resolved"), self.__HgResolved) |
655 self.tr('Conflicts resolved'), self.__HgResolved) |
|
656 self.vcsDirMultiMenuActions.append(act) |
729 self.vcsDirMultiMenuActions.append(act) |
657 act = menu.addAction( |
730 act = menu.addAction(self.tr("Conflicts unresolved"), self.__HgUnresolved) |
658 self.tr('Conflicts unresolved'), self.__HgUnresolved) |
|
659 self.vcsDirMultiMenuActions.append(act) |
731 self.vcsDirMultiMenuActions.append(act) |
660 act = menu.addAction( |
732 act = menu.addAction(self.tr("Re-Merge"), self.__HgReMerge) |
661 self.tr('Re-Merge'), self.__HgReMerge) |
|
662 self.vcsDirMultiMenuActions.append(act) |
733 self.vcsDirMultiMenuActions.append(act) |
663 menu.addSeparator() |
734 menu.addSeparator() |
664 menu.addAction(self.tr('Select all local file entries'), |
735 menu.addAction( |
665 self.browser.selectLocalEntries) |
736 self.tr("Select all local file entries"), self.browser.selectLocalEntries |
666 menu.addAction(self.tr('Select all versioned file entries'), |
737 ) |
667 self.browser.selectVCSEntries) |
738 menu.addAction( |
668 menu.addAction(self.tr('Select all local directory entries'), |
739 self.tr("Select all versioned file entries"), self.browser.selectVCSEntries |
669 self.browser.selectLocalDirEntries) |
740 ) |
670 menu.addAction(self.tr('Select all versioned directory entries'), |
741 menu.addAction( |
671 self.browser.selectVCSDirEntries) |
742 self.tr("Select all local directory entries"), |
|
743 self.browser.selectLocalDirEntries, |
|
744 ) |
|
745 menu.addAction( |
|
746 self.tr("Select all versioned directory entries"), |
|
747 self.browser.selectVCSDirEntries, |
|
748 ) |
672 menu.addSeparator() |
749 menu.addSeparator() |
673 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
750 menu.addAction(self.tr("Configure..."), self.__HgConfigure) |
674 |
751 |
675 mainMenu.addSeparator() |
752 mainMenu.addSeparator() |
676 mainMenu.addMenu(menu) |
753 mainMenu.addMenu(menu) |
677 self.menuDirMulti = menu |
754 self.menuDirMulti = menu |
678 |
755 |
679 ########################################################################### |
756 ########################################################################### |
680 ## Menu handling methods below |
757 ## Menu handling methods below |
681 ########################################################################### |
758 ########################################################################### |
682 |
759 |
683 def __HgRevert(self): |
760 def __HgRevert(self): |
684 """ |
761 """ |
685 Private slot called by the context menu to revert changes made. |
762 Private slot called by the context menu to revert changes made. |
686 """ |
763 """ |
687 names = [] |
764 names = [] |