Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 396
b967825e73c6
parent 248
f4561c24989a
child 425
ca5e65413fc5
equal deleted inserted replaced
393:5175a3a636e1 396:b967825e73c6
249 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveProject.png"), 249 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveProject.png"),
250 self.trUtf8('Save to Project'), self.__contextMenuSaveToProject) 250 self.trUtf8('Save to Project'), self.__contextMenuSaveToProject)
251 self.__menu.addSeparator() 251 self.__menu.addSeparator()
252 self.__menu.addAction(UI.PixmapCache.getIcon("print.png"), 252 self.__menu.addAction(UI.PixmapCache.getIcon("print.png"),
253 self.trUtf8('Print'), self.__contextMenuPrintFile) 253 self.trUtf8('Print'), self.__contextMenuPrintFile)
254 self.__menu.addSeparator()
255 self.copyPathAct = self.__menu.addAction(self.trUtf8("Copy Path to Clipboard"),
256 self.__contextMenuCopyPathToClipboard)
254 257
255 def __showContextMenu(self, coord, index): 258 def __showContextMenu(self, coord, index):
256 """ 259 """
257 Private slot to show the tab context menu. 260 Private slot to show the tab context menu.
258 261
261 """ 264 """
262 if self.editors: 265 if self.editors:
263 self.contextMenuEditor = self.widget(index) 266 self.contextMenuEditor = self.widget(index)
264 if self.contextMenuEditor: 267 if self.contextMenuEditor:
265 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified()) 268 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified())
269 self.copyPathAct.setEnabled(bool(self.contextMenuEditor.getFileName()))
266 self.projectMenuAct.setEnabled(e5App().getObject("Project").isOpen()) 270 self.projectMenuAct.setEnabled(e5App().getObject("Project").isOpen())
267 271
268 self.contextMenuIndex = index 272 self.contextMenuIndex = index
269 self.leftMenuAct.setEnabled(index > 0) 273 self.leftMenuAct.setEnabled(index > 0)
270 self.rightMenuAct.setEnabled(index < self.count() - 1) 274 self.rightMenuAct.setEnabled(index < self.count() - 1)
553 """ 557 """
554 Private method to print the selected tab. 558 Private method to print the selected tab.
555 """ 559 """
556 if self.contextMenuEditor: 560 if self.contextMenuEditor:
557 self.vm.printEditor(self.contextMenuEditor) 561 self.vm.printEditor(self.contextMenuEditor)
562
563 def __contextMenuCopyPathToClipboard(self):
564 """
565 Private method to copy the file name of the editor to the clipboard.
566 """
567 if self.contextMenuEditor:
568 fn = self.contextMenuEditor.getFileName()
569 if fn:
570 cb = QApplication.clipboard()
571 cb.setText(fn)
558 572
559 def __contextMenuMoveLeft(self): 573 def __contextMenuMoveLeft(self):
560 """ 574 """
561 Private method to move a tab one position to the left. 575 Private method to move a tab one position to the left.
562 """ 576 """

eric ide

mercurial