]> granicus.if.org Git - python/commitdiff
Fix for #731643: allow "lookup in documentation" to also work if the
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 6 May 2003 14:28:31 +0000 (14:28 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 6 May 2003 14:28:31 +0000 (14:28 +0000)
interactive window is frontmost.

Mac/Tools/IDE/PyConsole.py
Mac/Tools/IDE/PyEdit.py
Mac/Tools/IDE/PythonIDEMain.py
Mac/Tools/IDE/Wapplication.py

index 2bad07df1b344471c9ea2e33749e149978c0565b..8d4446910baaa9e42a47bd15e7618b66f741abd5 100644 (file)
@@ -236,7 +236,9 @@ class PyConsole(W.Window):
                prefs.console.tabsettings = self.consoletext.gettabsettings()
                prefs.save()
 
-
+       def getselectedtext(self):
+               return self.consoletext.getselectedtext()
+       
 class OutputTextWidget(W.EditText):
        
        def domenu_save_as(self, *args):
index 6cac553fcccde12d280b9661bede3fda9695061f..89f97ca00867a42a2bc32bcd08b85f2166e7d17f 100644 (file)
@@ -168,6 +168,9 @@ class Editor(W.Window):
        
        def setselection(self, selstart, selend):
                self.editgroup.editor.setselection(selstart, selend)
+               
+       def getselectedtext(self):
+               return self.editgroup.editor.getselectedtext()
        
        def getfilename(self):
                if self.path:
index 1414995552acfea3ff6796436c9ea17f9ab7c571..5987c10d79a5779f5e03a0581a5cee283c533a3c 100644 (file)
@@ -414,10 +414,10 @@ class PythonIDE(Wapplication.Application):
                        W.Message("AppleHelp Error: %s" % `arg`)
                        
        def _getsearchstring(self):
-               import PyEdit
-               editor = PyEdit.findeditor(None, fromtop=1)
-               if editor:
-                       text = editor.getselectedtext()
+               # First we get the frontmost window
+               front = self.getfrontwindow()
+               if front and hasattr(front, 'getselectedtext'):
+                       text = front.getselectedtext()
                        if text:
                                return text
                # This is a cop-out. We should have disabled the menus
index abeee605abad5a403b15f1ed3c5b81c683e5cfd2..ada441986b07718a5be21e78fb41e3546baf810e 100644 (file)
@@ -131,6 +131,12 @@ class Application(FrameWork.Application):
                                handler = getattr(window, attr)
                                apply(handler, args)
                                return 1
+                               
+       def getfrontwindow(self):
+               wid = MyFrontWindow()
+               if wid and self._windows.has_key(wid):
+                       return self._windows[wid]
+               return None
        
        def appendwindow(self, wid, window):
                self._windows[wid] = window