PyCrust updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4309b812ef
commit
af7e29cc47
@ -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()
|
||||
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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 <pobrien@orbtech.com>"
|
||||
__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')
|
||||
|
Loading…
Reference in New Issue
Block a user