Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 396
b967825e73c6
parent 248
f4561c24989a
child 425
ca5e65413fc5
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sun Jul 18 15:34:37 2010 +0200
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Thu Jul 22 19:54:31 2010 +0200
@@ -251,6 +251,9 @@
         self.__menu.addSeparator()
         self.__menu.addAction(UI.PixmapCache.getIcon("print.png"),
             self.trUtf8('Print'), self.__contextMenuPrintFile)
+        self.__menu.addSeparator()
+        self.copyPathAct = self.__menu.addAction(self.trUtf8("Copy Path to Clipboard"), 
+            self.__contextMenuCopyPathToClipboard)
         
     def __showContextMenu(self, coord, index):
         """
@@ -263,6 +266,7 @@
             self.contextMenuEditor = self.widget(index)
             if self.contextMenuEditor:
                 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified())
+                self.copyPathAct.setEnabled(bool(self.contextMenuEditor.getFileName()))
             self.projectMenuAct.setEnabled(e5App().getObject("Project").isOpen())
             
             self.contextMenuIndex = index
@@ -555,6 +559,16 @@
         """
         if self.contextMenuEditor:
             self.vm.printEditor(self.contextMenuEditor)
+    
+    def __contextMenuCopyPathToClipboard(self):
+        """
+        Private method to copy the file name of the editor to the clipboard.
+        """
+        if self.contextMenuEditor:
+            fn = self.contextMenuEditor.getFileName()
+            if fn:
+                cb = QApplication.clipboard()
+                cb.setText(fn)
         
     def __contextMenuMoveLeft(self):
         """
@@ -1084,4 +1098,4 @@
         for tw in self.tabWidgets:
             if id(tw) == id_:
                 return tw
-        return None
\ No newline at end of file
+        return None

eric ide

mercurial