ViewManager/ViewManager.py

changeset 365
0686ac00256e
parent 335
5ad648828e2e
child 372
237c3fe739f5
diff -r 8bda0881a970 -r 0686ac00256e ViewManager/ViewManager.py
--- a/ViewManager/ViewManager.py	Fri Jun 25 18:24:29 2010 +0200
+++ b/ViewManager/ViewManager.py	Sat Jun 26 13:34:06 2010 +0200
@@ -144,6 +144,8 @@
         
         self.__cooperationClient = None
         
+        self.__lastFocusWidget = None
+        
     def setReferences(self, ui, dbs):
         """
         Public method to set some references needed later on.
@@ -3755,6 +3757,9 @@
             self.copyActGrp.setEnabled(False)
             self.viewActGrp.setEnabled(False)
             self.searchActGrp.setEnabled(False)
+        
+        if isinstance(old, (Editor, Shell, Terminal)):
+            self.__lastFocusWidget = old
     
     ##################################################################
     ## Below are the action methods for the edit menu
@@ -5026,3 +5031,24 @@
             fn = aw.getFileName()
             if fn and e5App().getObject("Project").isProjectFile(fn):
                 aw.cancelSharedEdit()
+    
+    #######################################################################
+    ## Symbols viewer related methods
+    #######################################################################
+    
+    def insertSymbol(self, txt):
+        """
+        Private slot to insert a symbol text into the active window.
+        
+        @param txt text to be inserted (string)
+        """
+        if self.__lastFocusWidget == e5App().getObject("Shell"):
+            e5App().getObject("Shell").insert(txt)
+        elif self.__lastFocusWidget == e5App().getObject("Terminal"):
+            e5App().getObject("Terminal").insert(txt)
+        else:
+            aw = self.activeWindow()
+            if aw is not None:
+                curline, curindex = aw.getCursorPosition()
+                aw.insert(txt)
+                aw.setCursorPosition(curline, curindex + len(txt))

eric ide

mercurial