mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Fix for #731643: allow "lookup in documentation" to also work if the
interactive window is frontmost.
This commit is contained in:
parent
c7c78ae531
commit
9a79182316
4 changed files with 16 additions and 5 deletions
|
|
@ -236,6 +236,8 @@ class PyConsole(W.Window):
|
|||
prefs.console.tabsettings = self.consoletext.gettabsettings()
|
||||
prefs.save()
|
||||
|
||||
def getselectedtext(self):
|
||||
return self.consoletext.getselectedtext()
|
||||
|
||||
class OutputTextWidget(W.EditText):
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,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:
|
||||
return self.path
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -132,6 +132,12 @@ class Application(FrameWork.Application):
|
|||
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
|
||||
self.makeopenwindowsmenu()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue