PyCrust updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,7 +6,7 @@ __cvsid__ = "$Id$"
|
|||||||
__version__ = "$Revision$"[11:-2]
|
__version__ = "$Revision$"[11:-2]
|
||||||
|
|
||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
from PyCrust.crust import CrustFrame
|
from crust import CrustFrame
|
||||||
|
|
||||||
|
|
||||||
class App(wxApp):
|
class App(wxApp):
|
||||||
@@ -14,7 +14,7 @@ class App(wxApp):
|
|||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
locals = {'__app__': 'PyCrust Standalone Application'}
|
locals = {'__app__': 'PyCrust Standalone Application'}
|
||||||
self.crustFrame = CrustFrame(locals=locals)
|
self.crustFrame = CrustFrame(locals=locals, size=(800,600))
|
||||||
self.crustFrame.Show(true)
|
self.crustFrame.Show(true)
|
||||||
self.SetTopWindow(self.crustFrame)
|
self.SetTopWindow(self.crustFrame)
|
||||||
# Add the application object to the sys module's namespace.
|
# Add the application object to the sys module's namespace.
|
||||||
|
@@ -8,14 +8,14 @@ __version__ = "$Revision$"[11:-2]
|
|||||||
# We use this object to get more introspection when run standalone.
|
# We use this object to get more introspection when run standalone.
|
||||||
application = None
|
application = None
|
||||||
|
|
||||||
from PyCrust import filling
|
import filling
|
||||||
|
|
||||||
# These are imported just to have something interesting to inspect.
|
# These are imported just to have something interesting to inspect.
|
||||||
from PyCrust import crust
|
import crust
|
||||||
from PyCrust import interpreter
|
import interpreter
|
||||||
from PyCrust import introspect
|
import introspect
|
||||||
from PyCrust import pseudo
|
import pseudo
|
||||||
from PyCrust import shell
|
import shell
|
||||||
import sys
|
import sys
|
||||||
from wxPython import wx
|
from wxPython import wx
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ __cvsid__ = "$Id$"
|
|||||||
__version__ = "$Revision$"[11:-2]
|
__version__ = "$Revision$"[11:-2]
|
||||||
|
|
||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
from PyCrust.shell import ShellFrame
|
from shell import ShellFrame
|
||||||
|
|
||||||
|
|
||||||
class App(wxApp):
|
class App(wxApp):
|
||||||
@@ -14,7 +14,7 @@ class App(wxApp):
|
|||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
locals = {'__app__': 'PyShell Standalone Application'}
|
locals = {'__app__': 'PyShell Standalone Application'}
|
||||||
self.shellFrame = ShellFrame(locals=locals)
|
self.shellFrame = ShellFrame(locals=locals, size=(800,600))
|
||||||
self.shellFrame.Show(true)
|
self.shellFrame.Show(true)
|
||||||
self.SetTopWindow(self.shellFrame)
|
self.SetTopWindow(self.shellFrame)
|
||||||
# Add the application object to the sys module's namespace.
|
# Add the application object to the sys module's namespace.
|
||||||
|
@@ -52,9 +52,9 @@ class CrustFrame(wxFrame, ShellMenu):
|
|||||||
"""Create a PyCrust CrustFrame instance."""
|
"""Create a PyCrust CrustFrame instance."""
|
||||||
wxFrame.__init__(self, parent, id, title, pos, size, style)
|
wxFrame.__init__(self, parent, id, title, pos, size, style)
|
||||||
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
|
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
|
||||||
intro += '\nSponsored by Orbtech.com <EFBFBD> Your Source For Python Development Services'
|
intro += '\nSponsored by Orbtech.com - Your Source For Python Development Services'
|
||||||
self.CreateStatusBar()
|
self.CreateStatusBar()
|
||||||
self.SetStatusText(intro)
|
self.SetStatusText(intro.replace('\n', ', '))
|
||||||
if wxPlatform == '__WXMSW__':
|
if wxPlatform == '__WXMSW__':
|
||||||
import os
|
import os
|
||||||
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')
|
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')
|
||||||
|
@@ -87,16 +87,10 @@ def getCallTip(command='', locals=None):
|
|||||||
dropSelf = 1
|
dropSelf = 1
|
||||||
elif inspect.isclass(object):
|
elif inspect.isclass(object):
|
||||||
# Get the __init__ method function for the class.
|
# Get the __init__ method function for the class.
|
||||||
try:
|
constructor = getConstructor(object)
|
||||||
object = object.__init__.im_func
|
|
||||||
dropSelf = 1
|
|
||||||
except AttributeError:
|
|
||||||
for base in object.__bases__:
|
|
||||||
constructor = _find_constructor(base)
|
|
||||||
if constructor is not None:
|
if constructor is not None:
|
||||||
object = constructor
|
object = constructor
|
||||||
dropSelf = 1
|
dropSelf = 1
|
||||||
break
|
|
||||||
name = object.__name__
|
name = object.__name__
|
||||||
tip1 = ''
|
tip1 = ''
|
||||||
if inspect.isbuiltin(object):
|
if inspect.isbuiltin(object):
|
||||||
@@ -131,6 +125,17 @@ def getCallTip(command='', locals=None):
|
|||||||
else:
|
else:
|
||||||
return ''
|
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):
|
def getRoot(command, terminator=None):
|
||||||
"""Return the rightmost root portion of an arbitrary Python command.
|
"""Return the rightmost root portion of an arbitrary Python command.
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
"""The PyCrust Shell is an interactive text control in which a user types in
|
"""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
|
commands to be sent to the interpreter. This particular shell is based on
|
||||||
wxPython's wxStyledTextCtrl. The latest files are always available at the
|
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>"
|
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||||
__cvsid__ = "$Id$"
|
__cvsid__ = "$Id$"
|
||||||
@@ -782,6 +783,7 @@ class Shell(wxStyledTextCtrl):
|
|||||||
data = wxTextDataObject()
|
data = wxTextDataObject()
|
||||||
if wxTheClipboard.GetData(data):
|
if wxTheClipboard.GetData(data):
|
||||||
command = data.GetText()
|
command = data.GetText()
|
||||||
|
command = command.rstrip()
|
||||||
command = self.fixLineEndings(command)
|
command = self.fixLineEndings(command)
|
||||||
command = self.lstripPrompt(text=command)
|
command = self.lstripPrompt(text=command)
|
||||||
command = command.replace(os.linesep + sys.ps2, '\n')
|
command = command.replace(os.linesep + sys.ps2, '\n')
|
||||||
@@ -984,9 +986,9 @@ class ShellFrame(wxFrame, ShellMenu):
|
|||||||
"""Create a PyCrust ShellFrame instance."""
|
"""Create a PyCrust ShellFrame instance."""
|
||||||
wxFrame.__init__(self, parent, id, title, pos, size, style)
|
wxFrame.__init__(self, parent, id, title, pos, size, style)
|
||||||
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
|
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
|
||||||
intro += '\nSponsored by Orbtech.com <EFBFBD> Your Source For Python Development Services'
|
intro += '\nSponsored by Orbtech.com - Your Source For Python Development Services'
|
||||||
self.CreateStatusBar()
|
self.CreateStatusBar()
|
||||||
self.SetStatusText(intro)
|
self.SetStatusText(intro.replace('\n', ', '))
|
||||||
if wxPlatform == '__WXMSW__':
|
if wxPlatform == '__WXMSW__':
|
||||||
import os
|
import os
|
||||||
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')
|
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')
|
||||||
|
Reference in New Issue
Block a user