eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py

changeset 8108
a42ae6be4cc3
parent 7970
c4ee8a81584c
child 8143
2c730d5fd177
equal deleted inserted replaced
8107:7d3932bde11b 8108:a42ae6be4cc3
240 240
241 @param pos position the context menu was requetsed at 241 @param pos position the context menu was requetsed at
242 @type QPoint 242 @type QPoint
243 """ 243 """
244 itm = self.bookmarksList.itemAt(pos) 244 itm = self.bookmarksList.itemAt(pos)
245 if itm is not None: 245 if itm is not None and self.__bookmarksDefined:
246 menu = QMenu(self.bookmarksList) 246 menu = QMenu(self.bookmarksList)
247 menu.addAction( 247 menu.addAction(
248 UI.PixmapCache.getIcon("vcsSwitch"), 248 UI.PixmapCache.getIcon("vcsSwitch"),
249 self.tr("Switch to"), self.__switchTo) 249 self.tr("Switch to"), self.__switchTo)
250 menu.addSeparator() 250 menu.addSeparator()
261 act.setEnabled(self.vcs.canPull()) 261 act.setEnabled(self.vcs.canPull())
262 act = menu.addAction( 262 act = menu.addAction(
263 UI.PixmapCache.getIcon("pushBookmark"), 263 UI.PixmapCache.getIcon("pushBookmark"),
264 self.tr("Push"), self.__pushBookmark) 264 self.tr("Push"), self.__pushBookmark)
265 act.setEnabled(self.vcs.canPush()) 265 act.setEnabled(self.vcs.canPush())
266 menu.addSeparator()
267 act = menu.addAction(
268 UI.PixmapCache.getIcon("pushBookmark"),
269 self.tr("Push Current"), self.__pushCurrentBookmark)
270 act.setEnabled(self.vcs.canPush())
271 if self.vcs.version >= (5, 7):
272 act = menu.addAction(
273 UI.PixmapCache.getIcon("pushBookmark"),
274 self.tr("Push All"), self.__pushAllBookmarks)
275 act.setEnabled(self.vcs.canPush())
276
266 menu.popup(self.bookmarksList.mapToGlobal(pos)) 277 menu.popup(self.bookmarksList.mapToGlobal(pos))
267 278
268 def __switchTo(self): 279 def __switchTo(self):
269 """ 280 """
270 Private slot to switch the working directory to the selected revision. 281 Private slot to switch the working directory to the selected revision.
336 itm = self.bookmarksList.currentItem() 347 itm = self.bookmarksList.currentItem()
337 bookmark = itm.text(3).strip() 348 bookmark = itm.text(3).strip()
338 if bookmark: 349 if bookmark:
339 self.vcs.hgBookmarkPush(bookmark=bookmark) 350 self.vcs.hgBookmarkPush(bookmark=bookmark)
340 self.on_refreshButton_clicked() 351 self.on_refreshButton_clicked()
352
353 def __pushCurrentBookmark(self):
354 """
355 Private slot to push the current bookmark.
356 """
357 self.vcs.hgBookmarkPush(current=True)
358 self.on_refreshButton_clicked()
359
360 def __pushAllBookmarks(self):
361 """
362 Private slot to push all bookmarks.
363 """
364 self.vcs.hgBookmarkPush(allBookmarks=True)
365 self.on_refreshButton_clicked()

eric ide

mercurial