[Idle-dev] CVS: idle CallTips.py,1.7,1.8 CallTipWindow.py,1.5,1.6
Kurt B. Kaiser
kbk@users.sourceforge.net
Thu, 12 Dec 2002 11:15:41 -0800
Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv28086
Modified Files:
CallTips.py CallTipWindow.py
Log Message:
M CallTipWindow.py
M CallTips.py
Calltip fetch was erroring when an Edit window was used without a Shell.
Also, fix CallTipWindow.py so test code will run and add a comment about a
bug which causes the calltip window to override all others.
Index: CallTips.py
===================================================================
RCS file: /cvsroot/idlefork/idle/CallTips.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** CallTips.py 10 Oct 2002 08:25:24 -0000 1.7
--- CallTips.py 12 Dec 2002 19:15:39 -0000 1.8
***************
*** 1,8 ****
"""CallTips.py - An IDLE Extension to Jog Your Memory
! Call Tips are floating windows which display function/method parameter
! information as you open the parameter parenthesis, and which disappear when you
! type the closing parenthesis. Future plans include extending the functionality
! to include class attributes.
"""
--- 1,9 ----
"""CallTips.py - An IDLE Extension to Jog Your Memory
! Call Tips are floating windows which display function, class, and method
! parameter and docstring information when you type an opening parenthesis, and
! which disappear when you type a closing parenthesis.
!
! Future plans include extending the functionality to include class attributes.
"""
***************
*** 83,88 ****
def fetch_tip(self, name):
! interp = self.editwin and self.editwin.flist.pyshell.interp
! rpcclt = interp and interp.rpcclt
if rpcclt:
return rpcclt.remotecall("exec", "get_the_calltip",
--- 84,102 ----
def fetch_tip(self, name):
! """Return the argument list and docstring of a function or class
!
! If there is a Python subprocess, get the calltip there. Otherwise,
! either fetch_tip() is running in the subprocess itself or it was called
! in an IDLE EditorWindow before any script had been run.
!
! The subprocess environment is that of the most recently run script. If
! two unrelated modules are being edited some calltips in the current
! module may be inoperative if the module was not the last to run.
!
! """
! try:
! rpcclt = self.editwin.flist.pyshell.interp.rpcclt
! except:
! rpcclt = None
if rpcclt:
return rpcclt.remotecall("exec", "get_the_calltip",
***************
*** 93,96 ****
--- 107,111 ----
def get_entity(self, name):
+ "Lookup name in a namespace spanning sys.modules and __main.dict__"
if name:
namespace = sys.modules.copy()
***************
*** 113,117 ****
def get_arg_text(ob):
! # Get a string describing the arguments for the given object.
argText = ""
if ob is not None:
--- 128,132 ----
def get_arg_text(ob):
! "Get a string describing the arguments for the given object"
argText = ""
if ob is not None:
Index: CallTipWindow.py
===================================================================
RCS file: /cvsroot/idlefork/idle/CallTipWindow.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** CallTipWindow.py 23 Sep 2002 01:04:05 -0000 1.5
--- CallTipWindow.py 12 Dec 2002 19:15:39 -0000 1.6
***************
*** 1,6 ****
! # A CallTip window class for Tkinter/IDLE.
! # After ToolTip.py, which uses ideas gleaned from PySol
! # Used by the CallTips IDLE extension.
from Tkinter import *
--- 1,8 ----
! """A CallTip window class for Tkinter/IDLE.
! After ToolTip.py, which uses ideas gleaned from PySol
! Used by the CallTips IDLE extension.
!
! """
from Tkinter import *
***************
*** 14,24 ****
def showtip(self, text):
! # SF bug 546078: IDLE calltips cause application error.
! # There were crashes on various Windows flavors, and even a
! # crashing X server on Linux, with very long calltips.
if len(text) >= 79:
text = text[:75] + ' ...'
self.text = text
-
if self.tipwindow or not self.text:
return
--- 16,24 ----
def showtip(self, text):
! " Display text in calltip window"
! # truncate overly long calltip
if len(text) >= 79:
text = text[:75] + ' ...'
self.text = text
if self.tipwindow or not self.text:
return
***************
*** 28,31 ****
--- 28,35 ----
y = y + cy + self.widget.winfo_rooty()
self.tipwindow = tw = Toplevel(self.widget)
+ # XXX 12 Dec 2002 KBK The following command has two effects: It removes
+ # the calltip window border (good) but also causes (at least on
+ # Linux) the calltip to show as a top level window, burning through
+ # any other window dragged over it. Also, shows on all viewports!
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
***************
*** 69,73 ****
text.focus_set()
! # root.mainloop() # not in idle
def calltip_show(self, event):
--- 73,77 ----
text.focus_set()
! root.mainloop()
def calltip_show(self, event):