diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-05-06 14:28:31 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-05-06 14:28:31 (GMT) |
commit | 9a79182316f6297018221873d1932889b427ac84 (patch) | |
tree | bc03dba82120c0279c1c49b5f95a7af64c784b63 | |
parent | c7c78ae531ef6fab5ad354e616ee73c4a52ac422 (diff) | |
download | cpython-9a79182316f6297018221873d1932889b427ac84.zip cpython-9a79182316f6297018221873d1932889b427ac84.tar.gz cpython-9a79182316f6297018221873d1932889b427ac84.tar.bz2 |
Fix for #731643: allow "lookup in documentation" to also work if the
interactive window is frontmost.
-rw-r--r-- | Mac/Tools/IDE/PyConsole.py | 4 | ||||
-rw-r--r-- | Mac/Tools/IDE/PyEdit.py | 3 | ||||
-rw-r--r-- | Mac/Tools/IDE/PythonIDEMain.py | 8 | ||||
-rw-r--r-- | Mac/Tools/IDE/Wapplication.py | 6 |
4 files changed, 16 insertions, 5 deletions
diff --git a/Mac/Tools/IDE/PyConsole.py b/Mac/Tools/IDE/PyConsole.py index 2bad07d..8d44469 100644 --- a/Mac/Tools/IDE/PyConsole.py +++ b/Mac/Tools/IDE/PyConsole.py @@ -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): diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py index 6cac553..89f97ca 100644 --- a/Mac/Tools/IDE/PyEdit.py +++ b/Mac/Tools/IDE/PyEdit.py @@ -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: diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py index 1414995..5987c10 100644 --- a/Mac/Tools/IDE/PythonIDEMain.py +++ b/Mac/Tools/IDE/PythonIDEMain.py @@ -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 diff --git a/Mac/Tools/IDE/Wapplication.py b/Mac/Tools/IDE/Wapplication.py index abeee60..ada4419 100644 --- a/Mac/Tools/IDE/Wapplication.py +++ b/Mac/Tools/IDE/Wapplication.py @@ -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 |