From af7e29cc478da73b76f828a7bc779988704d4ac8 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 10 Dec 2001 22:45:02 +0000 Subject: [PATCH] PyCrust updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wxPython/lib/PyCrust/PyCrustApp.py | 8 +++--- wxPython/wxPython/lib/PyCrust/PyFillingApp.py | 14 +++++------ wxPython/wxPython/lib/PyCrust/PyShellApp.py | 10 ++++---- wxPython/wxPython/lib/PyCrust/crust.py | 4 +-- wxPython/wxPython/lib/PyCrust/introspect.py | 25 +++++++++++-------- wxPython/wxPython/lib/PyCrust/shell.py | 8 +++--- 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py index 135b86a116..1dcb1a668c 100755 --- a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py @@ -6,15 +6,15 @@ __cvsid__ = "$Id$" __version__ = "$Revision$"[11:-2] from wxPython.wx import * -from PyCrust.crust import CrustFrame +from crust import CrustFrame class App(wxApp): """PyCrust standalone application.""" - + def OnInit(self): locals = {'__app__': 'PyCrust Standalone Application'} - self.crustFrame = CrustFrame(locals=locals) + self.crustFrame = CrustFrame(locals=locals, size=(800,600)) self.crustFrame.Show(true) self.SetTopWindow(self.crustFrame) # Add the application object to the sys module's namespace. @@ -33,4 +33,4 @@ def main(): if __name__ == '__main__': main() - + diff --git a/wxPython/wxPython/lib/PyCrust/PyFillingApp.py b/wxPython/wxPython/lib/PyCrust/PyFillingApp.py index 62cea73e1c..61d3db5cb0 100755 --- a/wxPython/wxPython/lib/PyCrust/PyFillingApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyFillingApp.py @@ -8,14 +8,14 @@ __version__ = "$Revision$"[11:-2] # We use this object to get more introspection when run standalone. application = None -from PyCrust import filling +import filling # These are imported just to have something interesting to inspect. -from PyCrust import crust -from PyCrust import interpreter -from PyCrust import introspect -from PyCrust import pseudo -from PyCrust import shell +import crust +import interpreter +import introspect +import pseudo +import shell import sys from wxPython import wx @@ -32,4 +32,4 @@ def main(): if __name__ == '__main__': main() - \ No newline at end of file + diff --git a/wxPython/wxPython/lib/PyCrust/PyShellApp.py b/wxPython/wxPython/lib/PyCrust/PyShellApp.py index 9b3f945fa8..b0a5af63c6 100755 --- a/wxPython/wxPython/lib/PyCrust/PyShellApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyShellApp.py @@ -6,15 +6,15 @@ __cvsid__ = "$Id$" __version__ = "$Revision$"[11:-2] from wxPython.wx import * -from PyCrust.shell import ShellFrame +from shell import ShellFrame class App(wxApp): """PyShell standalone application.""" - + def OnInit(self): locals = {'__app__': 'PyShell Standalone Application'} - self.shellFrame = ShellFrame(locals=locals) + self.shellFrame = ShellFrame(locals=locals, size=(800,600)) self.shellFrame.Show(true) self.SetTopWindow(self.shellFrame) # Add the application object to the sys module's namespace. @@ -33,5 +33,5 @@ def main(): if __name__ == '__main__': main() - - \ No newline at end of file + + diff --git a/wxPython/wxPython/lib/PyCrust/crust.py b/wxPython/wxPython/lib/PyCrust/crust.py index a97ac7fba7..5bb78f3d94 100644 --- a/wxPython/wxPython/lib/PyCrust/crust.py +++ b/wxPython/wxPython/lib/PyCrust/crust.py @@ -52,9 +52,9 @@ class CrustFrame(wxFrame, ShellMenu): """Create a PyCrust CrustFrame instance.""" wxFrame.__init__(self, parent, id, title, pos, size, style) intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION - intro += '\nSponsored by Orbtech.com – Your Source For Python Development Services' + intro += '\nSponsored by Orbtech.com - Your Source For Python Development Services' self.CreateStatusBar() - self.SetStatusText(intro) + self.SetStatusText(intro.replace('\n', ', ')) if wxPlatform == '__WXMSW__': import os filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico') diff --git a/wxPython/wxPython/lib/PyCrust/introspect.py b/wxPython/wxPython/lib/PyCrust/introspect.py index 4139ec66c8..237ed198e5 100644 --- a/wxPython/wxPython/lib/PyCrust/introspect.py +++ b/wxPython/wxPython/lib/PyCrust/introspect.py @@ -87,16 +87,10 @@ def getCallTip(command='', locals=None): dropSelf = 1 elif inspect.isclass(object): # Get the __init__ method function for the class. - try: - object = object.__init__.im_func + constructor = getConstructor(object) + if constructor is not None: + object = constructor dropSelf = 1 - except AttributeError: - for base in object.__bases__: - constructor = _find_constructor(base) - if constructor is not None: - object = constructor - dropSelf = 1 - break name = object.__name__ tip1 = '' if inspect.isbuiltin(object): @@ -131,6 +125,17 @@ def getCallTip(command='', locals=None): else: return '' +def getConstructor(object): + """Return constructor for class object, or None if there isn't one.""" + try: + return object.__init__.im_func + except AttributeError: + for base in object.__bases__: + constructor = getConstructor(base) + if constructor is not None: + return constructor + return None + def getRoot(command, terminator=None): """Return the rightmost root portion of an arbitrary Python command. @@ -167,4 +172,4 @@ def getRoot(command, terminator=None): return root - \ No newline at end of file + diff --git a/wxPython/wxPython/lib/PyCrust/shell.py b/wxPython/wxPython/lib/PyCrust/shell.py index 8fe9f1caa0..02744d9e3b 100644 --- a/wxPython/wxPython/lib/PyCrust/shell.py +++ b/wxPython/wxPython/lib/PyCrust/shell.py @@ -1,7 +1,8 @@ """The PyCrust Shell is an interactive text control in which a user types in commands to be sent to the interpreter. This particular shell is based on wxPython's wxStyledTextCtrl. The latest files are always available at the -SourceForge project page at http://sourceforge.net/projects/pycrust/.""" +SourceForge project page at http://sourceforge.net/projects/pycrust/. +Sponsored by Orbtech.com - Your Source For Python Development Services""" __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" @@ -782,6 +783,7 @@ class Shell(wxStyledTextCtrl): data = wxTextDataObject() if wxTheClipboard.GetData(data): command = data.GetText() + command = command.rstrip() command = self.fixLineEndings(command) command = self.lstripPrompt(text=command) command = command.replace(os.linesep + sys.ps2, '\n') @@ -984,9 +986,9 @@ class ShellFrame(wxFrame, ShellMenu): """Create a PyCrust ShellFrame instance.""" wxFrame.__init__(self, parent, id, title, pos, size, style) intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION - intro += '\nSponsored by Orbtech.com – Your Source For Python Development Services' + intro += '\nSponsored by Orbtech.com - Your Source For Python Development Services' self.CreateStatusBar() - self.SetStatusText(intro) + self.SetStatusText(intro.replace('\n', ', ')) if wxPlatform == '__WXMSW__': import os filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')