14 from E5Gui import E5MessageBox |
14 from E5Gui import E5MessageBox |
15 from E5Gui.E5Application import e5App |
15 from E5Gui.E5Application import e5App |
16 |
16 |
17 from VCS.ProjectHelper import VcsProjectHelper |
17 from VCS.ProjectHelper import VcsProjectHelper |
18 |
18 |
|
19 from .BookmarksExtension.ProjectHelper import BookmarksProjectHelper |
|
20 |
19 from E5Gui.E5Action import E5Action |
21 from E5Gui.E5Action import E5Action |
20 |
22 |
21 import UI.PixmapCache |
23 import UI.PixmapCache |
22 import Preferences |
24 import Preferences |
23 |
25 |
34 @param projectObject reference to the project object |
36 @param projectObject reference to the project object |
35 @param parent parent widget (QWidget) |
37 @param parent parent widget (QWidget) |
36 @param name name of this object (string) |
38 @param name name of this object (string) |
37 """ |
39 """ |
38 VcsProjectHelper.__init__(self, vcsObject, projectObject, parent, name) |
40 VcsProjectHelper.__init__(self, vcsObject, projectObject, parent, name) |
|
41 |
|
42 # instantiate the extensions |
|
43 self.__extensions = { |
|
44 "bookmarks" : BookmarksProjectHelper(), |
|
45 } |
|
46 |
|
47 def setObjects(self, vcsObject, projectObject): |
|
48 """ |
|
49 Public method to set references to the vcs and project objects. |
|
50 |
|
51 @param vcsObject reference to the vcs object |
|
52 @param projectObject reference to the project object |
|
53 """ |
|
54 self.vcs = vcsObject |
|
55 self.project = projectObject |
|
56 |
|
57 for extension in self.__extensions.values(): |
|
58 extension.setObjects(vcsObject, projectObject) |
39 |
59 |
40 def getActions(self): |
60 def getActions(self): |
41 """ |
61 """ |
42 Public method to get a list of all actions. |
62 Public method to get a list of all actions. |
43 |
63 |
44 @return list of all actions (list of E5Action) |
64 @return list of all actions (list of E5Action) |
45 """ |
65 """ |
46 return self.actions[:] |
66 actions = self.actions[:] |
|
67 for extension in self.__extensions.values(): |
|
68 actions.extend(extension.getActions()) |
|
69 return actions |
47 |
70 |
48 def initActions(self): |
71 def initActions(self): |
49 """ |
72 """ |
50 Public method to generate the action objects. |
73 Public method to generate the action objects. |
51 """ |
74 """ |
827 bisectMenu.addAction(self.hgBisectGoodAct) |
850 bisectMenu.addAction(self.hgBisectGoodAct) |
828 bisectMenu.addAction(self.hgBisectBadAct) |
851 bisectMenu.addAction(self.hgBisectBadAct) |
829 bisectMenu.addAction(self.hgBisectSkipAct) |
852 bisectMenu.addAction(self.hgBisectSkipAct) |
830 bisectMenu.addAction(self.hgBisectResetAct) |
853 bisectMenu.addAction(self.hgBisectResetAct) |
831 |
854 |
|
855 extensionsMenu = QMenu(self.trUtf8("Extensions"), menu) |
|
856 extensionsMenu.aboutToShow.connect(self.__showExtensionMenu) |
|
857 self.extensionMenus = {} |
|
858 for extensionName in self.__extensions: |
|
859 self.extensionMenus[extensionName] = extensionsMenu.addMenu( |
|
860 self.__extensions[extensionName].initMenu(extensionsMenu)) |
|
861 |
832 act = menu.addAction( |
862 act = menu.addAction( |
833 UI.PixmapCache.getIcon( |
863 UI.PixmapCache.getIcon( |
834 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.png")), |
864 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.png")), |
835 self.vcs.vcsName(), self._vcsInfoDisplay) |
865 self.vcs.vcsName(), self._vcsInfoDisplay) |
836 font = act.font() |
866 font = act.font() |
846 menu.addAction(self.hgOutgoingAct) |
876 menu.addAction(self.hgOutgoingAct) |
847 menu.addAction(self.hgPushAct) |
877 menu.addAction(self.hgPushAct) |
848 menu.addSeparator() |
878 menu.addSeparator() |
849 menu.addMenu(bundleMenu) |
879 menu.addMenu(bundleMenu) |
850 menu.addSeparator() |
880 menu.addSeparator() |
|
881 menu.addMenu(extensionsMenu) |
|
882 menu.addSeparator() |
851 menu.addAction(self.vcsNewAct) |
883 menu.addAction(self.vcsNewAct) |
852 menu.addAction(self.vcsExportAct) |
884 menu.addAction(self.vcsExportAct) |
853 menu.addSeparator() |
885 menu.addSeparator() |
854 menu.addAction(self.vcsAddAct) |
886 menu.addAction(self.vcsAddAct) |
855 menu.addAction(self.vcsRemoveAct) |
887 menu.addAction(self.vcsRemoveAct) |
887 menu.addMenu(specialsMenu) |
919 menu.addMenu(specialsMenu) |
888 menu.addSeparator() |
920 menu.addSeparator() |
889 menu.addAction(self.vcsPropsAct) |
921 menu.addAction(self.vcsPropsAct) |
890 menu.addSeparator() |
922 menu.addSeparator() |
891 menu.addAction(self.hgConfigAct) |
923 menu.addAction(self.hgConfigAct) |
|
924 |
|
925 def __showExtensionMenu(self): |
|
926 """ |
|
927 Private slot showing the extensions menu. |
|
928 """ |
|
929 for extensionName in self.extensionMenus: |
|
930 self.extensionMenus[extensionName].setEnabled( |
|
931 self.vcs.isExtensionActive(extensionName)) |
892 |
932 |
893 def __hgExtendedDiff(self): |
933 def __hgExtendedDiff(self): |
894 """ |
934 """ |
895 Private slot used to perform a hg diff with the selection of revisions. |
935 Private slot used to perform a hg diff with the selection of revisions. |
896 """ |
936 """ |