61 |
61 |
62 self.__extensionMenuTitles = {} |
62 self.__extensionMenuTitles = {} |
63 for extension in self.__extensions: |
63 for extension in self.__extensions: |
64 self.__extensionMenuTitles[ |
64 self.__extensionMenuTitles[ |
65 self.__extensions[extension].menuTitle()] = extension |
65 self.__extensions[extension].menuTitle()] = extension |
|
66 |
|
67 self.__toolbarManager = None |
66 |
68 |
67 def setObjects(self, vcsObject, projectObject): |
69 def setObjects(self, vcsObject, projectObject): |
68 """ |
70 """ |
69 Public method to set references to the vcs and project objects. |
71 Public method to set references to the vcs and project objects. |
70 |
72 |
76 |
78 |
77 for extension in self.__extensions.values(): |
79 for extension in self.__extensions.values(): |
78 extension.setObjects(vcsObject, projectObject) |
80 extension.setObjects(vcsObject, projectObject) |
79 |
81 |
80 self.vcs.iniFileChanged.connect(self.__checkActions) |
82 self.vcs.iniFileChanged.connect(self.__checkActions) |
|
83 |
|
84 title = self.__toolbar.windowTitle() |
|
85 if self.vcs.version >= (3, 9): |
|
86 self.actions.append(self.hgBookmarkPullCurrentAct) |
|
87 self.__toolbarManager.addAction(self.hgBookmarkPullCurrentAct, |
|
88 title) |
|
89 |
|
90 if self.vcs.version >= (3, 8): |
|
91 self.actions.append(self.hgBookmarkPushCurrentAct) |
|
92 self.__toolbarManager.addAction(self.hgBookmarkPushCurrentAct, |
|
93 title) |
81 |
94 |
82 def getProject(self): |
95 def getProject(self): |
83 """ |
96 """ |
84 Public method to get a reference to the project object. |
97 Public method to get a reference to the project object. |
85 |
98 |
1152 """local repository.</p>""" |
1165 """local repository.</p>""" |
1153 )) |
1166 )) |
1154 self.hgBookmarkPullAct.triggered.connect(self.__hgBookmarkPull) |
1167 self.hgBookmarkPullAct.triggered.connect(self.__hgBookmarkPull) |
1155 self.actions.append(self.hgBookmarkPullAct) |
1168 self.actions.append(self.hgBookmarkPullAct) |
1156 |
1169 |
|
1170 self.hgBookmarkPullCurrentAct = E5Action( |
|
1171 self.tr('Pull current bookmark'), |
|
1172 UI.PixmapCache.getIcon("pullBookmark.png"), |
|
1173 self.tr('Pull current bookmark'), |
|
1174 0, 0, self, 'mercurial_pull_current_bookmark') |
|
1175 self.hgBookmarkPullCurrentAct.setStatusTip(self.tr( |
|
1176 'Pull the current bookmark from a remote repository' |
|
1177 )) |
|
1178 self.hgBookmarkPullCurrentAct.setWhatsThis(self.tr( |
|
1179 """<b>Pull current bookmark</b>""" |
|
1180 """<p>This pulls the current bookmark from a remote""" |
|
1181 """ repository into the local repository.</p>""" |
|
1182 )) |
|
1183 self.hgBookmarkPullCurrentAct.triggered.connect( |
|
1184 self.__hgBookmarkPullCurrent) |
|
1185 |
1157 self.hgBookmarkOutgoingAct = E5Action( |
1186 self.hgBookmarkOutgoingAct = E5Action( |
1158 self.tr('Show outgoing bookmarks'), |
1187 self.tr('Show outgoing bookmarks'), |
1159 UI.PixmapCache.getIcon("outgoingBookmark.png"), |
1188 UI.PixmapCache.getIcon("outgoingBookmark.png"), |
1160 self.tr('Show outgoing bookmarks'), |
1189 self.tr('Show outgoing bookmarks'), |
1161 0, 0, self, 'mercurial_outgoing_bookmarks') |
1190 0, 0, self, 'mercurial_outgoing_bookmarks') |
1185 """remote repository.</p>""" |
1214 """remote repository.</p>""" |
1186 )) |
1215 )) |
1187 self.hgBookmarkPushAct.triggered.connect(self.__hgBookmarkPush) |
1216 self.hgBookmarkPushAct.triggered.connect(self.__hgBookmarkPush) |
1188 self.actions.append(self.hgBookmarkPushAct) |
1217 self.actions.append(self.hgBookmarkPushAct) |
1189 |
1218 |
|
1219 self.hgBookmarkPushCurrentAct = E5Action( |
|
1220 self.tr('Push current bookmark'), |
|
1221 UI.PixmapCache.getIcon("pushBookmark.png"), |
|
1222 self.tr('Push current bookmark'), |
|
1223 0, 0, self, 'mercurial_push_current_bookmark') |
|
1224 self.hgBookmarkPushCurrentAct.setStatusTip(self.tr( |
|
1225 'Push the current bookmark to a remote repository' |
|
1226 )) |
|
1227 self.hgBookmarkPushCurrentAct.setWhatsThis(self.tr( |
|
1228 """<b>Push current bookmark</b>""" |
|
1229 """<p>This pushes the current bookmark from the local""" |
|
1230 """ repository to a remote repository.</p>""" |
|
1231 )) |
|
1232 self.hgBookmarkPushCurrentAct.triggered.connect( |
|
1233 self.__hgBookmarkPushCurrent) |
|
1234 |
1190 def __checkActions(self): |
1235 def __checkActions(self): |
1191 """ |
1236 """ |
1192 Private slot to set the enabled status of actions. |
1237 Private slot to set the enabled status of actions. |
1193 """ |
1238 """ |
1194 self.hgPullAct.setEnabled(self.vcs.canPull()) |
1239 self.hgPullAct.setEnabled(self.vcs.canPull()) |
1195 self.hgIncomingAct.setEnabled(self.vcs.canPull()) |
1240 self.hgIncomingAct.setEnabled(self.vcs.canPull()) |
1196 self.hgBookmarkPullAct.setEnabled(self.vcs.canPull()) |
1241 self.hgBookmarkPullAct.setEnabled(self.vcs.canPull()) |
1197 self.hgBookmarkIncomingAct.setEnabled(self.vcs.canPull()) |
1242 self.hgBookmarkIncomingAct.setEnabled(self.vcs.canPull()) |
|
1243 if self.vcs.version >= (3, 9): |
|
1244 self.hgBookmarkPullCurrentAct.setEnabled(self.vcs.canPull()) |
1198 |
1245 |
1199 self.hgPushAct.setEnabled(self.vcs.canPush()) |
1246 self.hgPushAct.setEnabled(self.vcs.canPush()) |
1200 self.hgPushBranchAct.setEnabled(self.vcs.canPush()) |
1247 self.hgPushBranchAct.setEnabled(self.vcs.canPush()) |
1201 self.hgPushForcedAct.setEnabled(self.vcs.canPush()) |
1248 self.hgPushForcedAct.setEnabled(self.vcs.canPush()) |
1202 self.hgOutgoingAct.setEnabled(self.vcs.canPush()) |
1249 self.hgOutgoingAct.setEnabled(self.vcs.canPush()) |
1203 self.hgBookmarkPushAct.setEnabled(self.vcs.canPush()) |
1250 self.hgBookmarkPushAct.setEnabled(self.vcs.canPush()) |
1204 self.hgBookmarkOutgoingAct.setEnabled(self.vcs.canPush()) |
1251 self.hgBookmarkOutgoingAct.setEnabled(self.vcs.canPush()) |
|
1252 if self.vcs.version >= (3, 8): |
|
1253 self.hgBookmarkPushCurrentAct.setEnabled(self.vcs.canPull()) |
1205 |
1254 |
1206 def initMenu(self, menu): |
1255 def initMenu(self, menu): |
1207 """ |
1256 """ |
1208 Public method to generate the VCS menu. |
1257 Public method to generate the VCS menu. |
1209 |
1258 |
1292 bookmarksMenu.addSeparator() |
1341 bookmarksMenu.addSeparator() |
1293 bookmarksMenu.addAction(self.hgBookmarksListAct) |
1342 bookmarksMenu.addAction(self.hgBookmarksListAct) |
1294 bookmarksMenu.addSeparator() |
1343 bookmarksMenu.addSeparator() |
1295 bookmarksMenu.addAction(self.hgBookmarkIncomingAct) |
1344 bookmarksMenu.addAction(self.hgBookmarkIncomingAct) |
1296 bookmarksMenu.addAction(self.hgBookmarkPullAct) |
1345 bookmarksMenu.addAction(self.hgBookmarkPullAct) |
|
1346 if self.vcs.version >= (3, 9): |
|
1347 bookmarksMenu.addAction(self.hgBookmarkPullCurrentAct) |
1297 bookmarksMenu.addSeparator() |
1348 bookmarksMenu.addSeparator() |
1298 bookmarksMenu.addAction(self.hgBookmarkOutgoingAct) |
1349 bookmarksMenu.addAction(self.hgBookmarkOutgoingAct) |
1299 bookmarksMenu.addAction(self.hgBookmarkPushAct) |
1350 bookmarksMenu.addAction(self.hgBookmarkPushAct) |
|
1351 if self.vcs.version >= (3, 8): |
|
1352 bookmarksMenu.addAction(self.hgBookmarkPushCurrentAct) |
1300 self.subMenus.append(bookmarksMenu) |
1353 self.subMenus.append(bookmarksMenu) |
1301 |
1354 |
1302 self.__extensionsMenu = QMenu(self.tr("Extensions"), menu) |
1355 self.__extensionsMenu = QMenu(self.tr("Extensions"), menu) |
1303 self.__extensionsMenu.setTearOffEnabled(True) |
1356 self.__extensionsMenu.setTearOffEnabled(True) |
1304 self.__extensionsMenu.aboutToShow.connect(self.__showExtensionMenu) |
1357 self.__extensionsMenu.aboutToShow.connect(self.__showExtensionMenu) |
1404 |
1457 |
1405 @param ui reference to the main window (UserInterface) |
1458 @param ui reference to the main window (UserInterface) |
1406 @param toolbarManager reference to a toolbar manager object |
1459 @param toolbarManager reference to a toolbar manager object |
1407 (E5ToolBarManager) |
1460 (E5ToolBarManager) |
1408 """ |
1461 """ |
|
1462 self.__toolbarManager = toolbarManager |
|
1463 |
1409 self.__toolbar = QToolBar(self.tr("Mercurial"), ui) |
1464 self.__toolbar = QToolBar(self.tr("Mercurial"), ui) |
1410 self.__toolbar.setIconSize(UI.Config.ToolBarIconSize) |
1465 self.__toolbar.setIconSize(UI.Config.ToolBarIconSize) |
1411 self.__toolbar.setObjectName("MercurialToolbar") |
1466 self.__toolbar.setObjectName("MercurialToolbar") |
1412 self.__toolbar.setToolTip(self.tr('Mercurial')) |
1467 self.__toolbar.setToolTip(self.tr('Mercurial')) |
1413 |
1468 |
1913 """ |
1968 """ |
1914 Private slot used to pull a bookmark from a remote repository. |
1969 Private slot used to pull a bookmark from a remote repository. |
1915 """ |
1970 """ |
1916 self.vcs.hgBookmarkPull(self.project.getProjectPath()) |
1971 self.vcs.hgBookmarkPull(self.project.getProjectPath()) |
1917 |
1972 |
|
1973 def __hgBookmarkPullCurrent(self): |
|
1974 """ |
|
1975 Private slot used to pull the current bookmark from a remote |
|
1976 repository. |
|
1977 """ |
|
1978 self.vcs.hgBookmarkPull(self.project.getProjectPath(), current=True) |
|
1979 |
1918 def __hgBookmarkPush(self): |
1980 def __hgBookmarkPush(self): |
1919 """ |
1981 """ |
1920 Private slot used to push a bookmark to a remote repository. |
1982 Private slot used to push a bookmark to a remote repository. |
1921 """ |
1983 """ |
1922 self.vcs.hgBookmarkPush(self.project.getProjectPath()) |
1984 self.vcs.hgBookmarkPush(self.project.getProjectPath()) |
|
1985 |
|
1986 def __hgBookmarkPushCurrent(self): |
|
1987 """ |
|
1988 Private slot used to push the current bookmark to a remote repository. |
|
1989 """ |
|
1990 self.vcs.hgBookmarkPush(self.project.getProjectPath(), current=True) |