Deprecated PyShell and PyShellWindow, added a snapshot of PyCrust.

Added the new virtual list capabilities to wxListCtrl.

Other odds and ends.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2001-08-14 19:19:48 +00:00
parent 6443de0263
commit c7e7022c2c
35 changed files with 3771 additions and 1641 deletions

View File

@ -9,7 +9,9 @@ EVT_DETAILED_HELP_RANGE, EVT_CONTEXT_MENU, wxHelpEvent,
wxContextMenuEvent, wxContextHelp, wxContextHelpButton, wxTipWindow,
and a demo to show them in action.
Deprecated PyShell and PyShellWindow, added a snapshot of PyCrust.
Added the new virtual list capabilities to wxListCtrl.

View File

@ -23,6 +23,8 @@ import images
_treeList = [
('New since last release', ['ContextHelp',
'PyCrust',
'VirtualListCtrl'
]),
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
@ -58,10 +60,10 @@ _treeList = [
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
'FileBrowseButton', 'GenericButtons', 'wxEditor',
'PyShellWindow', 'ColourSelect', 'ImageBrowser',
'infoframe', 'ColourDB',
'ColourSelect', 'ImageBrowser',
'infoframe', 'ColourDB', 'PyCrust',
]),
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),

16
wxPython/demo/PyCrust.py Normal file
View File

@ -0,0 +1,16 @@
from wxPython.lib.PyCrust import PyCrustShell, PyCrustEditor, PyCrustVersion
#----------------------------------------------------------------------
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % PyCrustVersion.version
def runTest(frame, nb, log):
shell = PyCrustShell.Shell(nb, intro)
return shell.editor
#----------------------------------------------------------------------
overview = PyCrustShell.__doc__

View File

@ -1,21 +0,0 @@
from wxPython.wx import *
from wxPython.lib.shell import PyShell
#----------------------------------------------------------------------
def runTest(frame, nb, log):
testGlobals = {'hello' : 'How are you?'}
win = PyShell(nb, globals=testGlobals)
win.Show(true)
return win
#----------------------------------------------------------------------
overview = """
A simple GUI version of the interactive interpreter.
"""

View File

@ -1,15 +0,0 @@
from wxPython.lib.pyshell import PyShellWindow
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = PyShellWindow(nb, -1)
return win
#----------------------------------------------------------------------
import wxPython.lib.pyshell
overview = wxPython.lib.pyshell.__doc__

View File

@ -0,0 +1,51 @@
from wxPython.wx import *
#----------------------------------------------------------------------
class TestVirtualList(wxListCtrl):
def __init__(self, parent, log):
wxListCtrl.__init__(self, parent, -1,
style=wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES|wxLC_VRULES)
self.log = log
self.InsertColumn(0, "First")
self.InsertColumn(1, "Second")
self.InsertColumn(2, "Third")
self.SetColumnWidth(0, 175)
self.SetColumnWidth(1, 175)
self.SetColumnWidth(2, 175)
self.SetItemCount(1000000)
def OnGetItemText(self, item, col):
return "Item %d, column %d" % (item, col)
def OnGetItemImage(self, item):
return 0
def OnGetItemAttr(self, item):
return None
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestVirtualList(nb, log)
return win
#----------------------------------------------------------------------
overview = """\
"""

View File

@ -22,39 +22,39 @@ musicdata = {
4 : ("Gloria Estefan", "Here We Are", "Rock"),
5 : ("Linda Ronstadt", "Don't Know Much", "Rock"),
6 : ("Michael Bolton", "How Am I Supposed To Live Without You", "Blues"),
7 : ("Paul Young", "Oh Girl", "Rock"),
8 : ("Paula Abdul", "Opposites Attract", "Rock"),
9 : ("Richard Marx", "Should've Known Better", "Rock"),
10: ("Rod Stewart", "Forever Young", "Rock"),
11: ("Roxette", "Dangerous", "Rock"),
12: ("Sheena Easton", "The Lover In Me", "Rock"),
13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"),
14: ("Stevie B.", "Because I Love You", "Rock"),
15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"),
16: ("The Bangles", "Eternal Flame", "Rock"),
17: ("Wilson Phillips", "Release Me", "Rock"),
18: ("Billy Joel", "Blonde Over Blue", "Rock"),
19: ("Billy Joel", "Famous Last Words", "Rock"),
20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"),
21: ("Billy Joel", "The River Of Dreams", "Rock"),
22: ("Billy Joel", "Two Thousand Years", "Rock"),
23: ("Janet Jackson", "Alright", "Rock"),
24: ("Janet Jackson", "Black Cat", "Rock"),
25: ("Janet Jackson", "Come Back To Me", "Rock"),
26: ("Janet Jackson", "Escapade", "Rock"),
27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"),
28: ("Janet Jackson", "Miss You Much", "Rock"),
29: ("Janet Jackson", "Rhythm Nation", "Rock"),
30: ("Janet Jackson", "State Of The World", "Rock"),
31: ("Janet Jackson", "The Knowledge", "Rock"),
32: ("Spyro Gyra", "End of Romanticism", "Jazz"),
33: ("Spyro Gyra", "Heliopolis", "Jazz"),
34: ("Spyro Gyra", "Jubilee", "Jazz"),
35: ("Spyro Gyra", "Little Linda", "Jazz"),
36: ("Spyro Gyra", "Morning Dance", "Jazz"),
37: ("Spyro Gyra", "Song for Lorraine", "Jazz"),
38: ("Yes", "Owner Of A Lonely Heart", "Rock"),
39: ("Yes", "Rhythm Of Love", "Rock"),
## 7 : ("Paul Young", "Oh Girl", "Rock"),
## 8 : ("Paula Abdul", "Opposites Attract", "Rock"),
## 9 : ("Richard Marx", "Should've Known Better", "Rock"),
## 10: ("Rod Stewart", "Forever Young", "Rock"),
## 11: ("Roxette", "Dangerous", "Rock"),
## 12: ("Sheena Easton", "The Lover In Me", "Rock"),
## 13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"),
## 14: ("Stevie B.", "Because I Love You", "Rock"),
## 15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"),
## 16: ("The Bangles", "Eternal Flame", "Rock"),
## 17: ("Wilson Phillips", "Release Me", "Rock"),
## 18: ("Billy Joel", "Blonde Over Blue", "Rock"),
## 19: ("Billy Joel", "Famous Last Words", "Rock"),
## 20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"),
## 21: ("Billy Joel", "The River Of Dreams", "Rock"),
## 22: ("Billy Joel", "Two Thousand Years", "Rock"),
## 23: ("Janet Jackson", "Alright", "Rock"),
## 24: ("Janet Jackson", "Black Cat", "Rock"),
## 25: ("Janet Jackson", "Come Back To Me", "Rock"),
## 26: ("Janet Jackson", "Escapade", "Rock"),
## 27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"),
## 28: ("Janet Jackson", "Miss You Much", "Rock"),
## 29: ("Janet Jackson", "Rhythm Nation", "Rock"),
## 30: ("Janet Jackson", "State Of The World", "Rock"),
## 31: ("Janet Jackson", "The Knowledge", "Rock"),
## 32: ("Spyro Gyra", "End of Romanticism", "Jazz"),
## 33: ("Spyro Gyra", "Heliopolis", "Jazz"),
## 34: ("Spyro Gyra", "Jubilee", "Jazz"),
## 35: ("Spyro Gyra", "Little Linda", "Jazz"),
## 36: ("Spyro Gyra", "Morning Dance", "Jazz"),
## 37: ("Spyro Gyra", "Song for Lorraine", "Jazz"),
## 38: ("Yes", "Owner Of A Lonely Heart", "Rock"),
## 39: ("Yes", "Rhythm Of Love", "Rock"),
}
import images
@ -72,7 +72,7 @@ class TestListCtrlPanel(wxPanel):
idx1 = self.il.Add(bmp)
self.list = wxListCtrl(self, tID,
style=wxLC_REPORT|wxSUNKEN_BORDER)
style=wxLC_REPORT|wxSUNKEN_BORDER)#|wxLC_VRULES|wxLC_HRULES)
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
# Why doesn't this show up on MSW???
@ -103,6 +103,10 @@ class TestListCtrlPanel(wxPanel):
item.SetTextColour(wxBLUE)
self.list.SetItem(item)
item = self.list.GetItem(4)
item.SetTextColour(wxRED)
self.list.SetItem(item)
self.currentItem = 0
EVT_SIZE(self, self.OnSize)
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
@ -159,7 +163,9 @@ class TestListCtrlPanel(wxPanel):
def ColumnSorter(self, key1, key2):
item1 = musicdata[key1][self.col]
item2 = musicdata[key2][self.col]
if item1 == item2: return 0
# when the items are identical, compare someting else to make the sort key unique...
if item1 == item2: return key1 - key2
elif item1 < item2: return -1
else: return 1

View File

@ -30,7 +30,6 @@ wxStyledTextEditor also supports setting markers in the margin...
you want in your application. Cut, Copy, Paste, Drag and Drop of
text works, as well as virtually unlimited Undo and Redo
capabilities, (right click to try it out.)
"""
if wxPlatform == '__WXMSW__':
@ -168,6 +167,22 @@ def runTest(frame, nb, log):
ed.SetStyling(10, wxSTC_INDIC1_MASK)
ed.SetStyling(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK)
# some test stuff...
if 1:
print "GetTextLength(): ", ed.GetTextLength(), len(ed.GetText())
print "GetText(): ", repr(ed.GetText())
print
print "GetStyledText(98, 104): ", repr(ed.GetStyledText(98, 104)), len(ed.GetStyledText(98, 104))
print
print "GetCurLine(): ", repr(ed.GetCurLine())
print
print "GetLine(1): ", repr(ed.GetLine(1))
print
ed.SetSelection(25, 35)
print "GetSelectedText(): ", repr(ed.GetSelectedText())
print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35))
ed.GotoPos(0)
return p

View File

@ -33,6 +33,9 @@ class TestPanel(wxPanel):
size=(200, 100), style=wxTE_MULTILINE)
t3.SetInsertionPoint(0)
EVT_TEXT(self, 30, self.EvtText)
b = wxButton(self, -1, "Test Replace")
EVT_BUTTON(self, b.GetId(), self.OnTestReplace)
self.tc = t3
l4 = wxStaticText(self, -1, "Rich Text")
t4 = wxTextCtrl(self, 40, "If supported by the native control, this is red, and this is a different font.",
@ -47,11 +50,11 @@ class TestPanel(wxPanel):
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
## print 'a2', sys.getrefcount(f)
sizer = wxFlexGridSizer(cols=2, hgap=6, vgap=6)
sizer.AddMany([ l1, t1,
l2, t2,
l3, t3,
l4, t4,
sizer = wxFlexGridSizer(cols=3, hgap=6, vgap=6)
sizer.AddMany([ l1, t1, (0,0),
l2, t2, (0,0),
l3, t3, b,
l4, t4, (0,0),
])
border = wxBoxSizer(wxVERTICAL)
border.Add(sizer, 0, wxALL, 25)
@ -68,6 +71,11 @@ class TestPanel(wxPanel):
event.Skip()
def OnTestReplace(self, evt):
self.tc.Replace(4, 8, "DOES")
#self.tc.Remove(4, 8)
#---------------------------------------------------------------------------
def runTest(frame, nb, log):

View File

@ -204,7 +204,7 @@ if os.name == 'nt':
'advapi32', 'wsock32']
cflags = [] #['/GX-'] # workaround for internal compiler error in MSVC 5
cflags = [] #['/GX-'] # workaround for internal compiler error in MSVC on some machines
lflags = None

View File

@ -270,6 +270,7 @@ enum {
wxTE_MULTILINE,
wxTE_AUTO_SCROLL,
wxTE_NO_VSCROLL,
wxTE_AUTO_URL,
wxCB_SIMPLE,
wxCB_DROPDOWN,
wxCB_SORT,
@ -813,6 +814,7 @@ enum wxEventType {
wxEVT_COMMAND_SPINCTRL_UPDATED,
wxEVT_COMMAND_TEXT_UPDATED,
wxEVT_COMMAND_TEXT_ENTER,
wxEVT_COMMAND_TEXT_URL,
wxEVT_COMMAND_MENU_SELECTED,
wxEVT_COMMAND_SLIDER_UPDATED,
wxEVT_COMMAND_RADIOBOX_SELECTED,

View File

@ -362,6 +362,9 @@ def EVT_TEXT(win, id, func):
def EVT_TEXT_ENTER(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER, func)
def EVT_TEXT_URL(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TEXT_URL, func)
def EVT_MENU(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func)
@ -544,58 +547,6 @@ def EVT_CALCULATE_LAYOUT(win, func):
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func)
# wxListCtrl
def EVT_LIST_BEGIN_DRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
def EVT_LIST_BEGIN_RDRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
def EVT_LIST_END_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
def EVT_LIST_DELETE_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
def EVT_LIST_GET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
def EVT_LIST_SET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_KEY_DOWN(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
def EVT_LIST_INSERT_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func)
def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func)
def EVT_LIST_ITEM_ACTIVATED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func)
#wxSplitterWindow
def EVT_SPLITTER_SASH_POS_CHANGING(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, func)

View File

@ -37,60 +37,9 @@
%pragma(python) code = "import wx"
//----------------------------------------------------------------------
//----------------------------------------------------------------------
enum {
wxLIST_MASK_TEXT,
wxLIST_MASK_IMAGE,
wxLIST_MASK_DATA,
wxLIST_MASK_WIDTH,
wxLIST_MASK_FORMAT,
wxLIST_MASK_STATE,
wxLIST_STATE_DONTCARE,
wxLIST_STATE_DROPHILITED,
wxLIST_STATE_FOCUSED,
wxLIST_STATE_SELECTED,
wxLIST_STATE_CUT,
wxLIST_HITTEST_ABOVE,
wxLIST_HITTEST_BELOW,
wxLIST_HITTEST_NOWHERE,
wxLIST_HITTEST_ONITEMICON,
wxLIST_HITTEST_ONITEMLABEL,
wxLIST_HITTEST_ONITEMRIGHT,
wxLIST_HITTEST_ONITEMSTATEICON,
wxLIST_HITTEST_TOLEFT,
wxLIST_HITTEST_TORIGHT,
wxLIST_HITTEST_ONITEM,
wxLIST_NEXT_ABOVE,
wxLIST_NEXT_ALL,
wxLIST_NEXT_BELOW,
wxLIST_NEXT_LEFT,
wxLIST_NEXT_RIGHT,
wxLIST_ALIGN_DEFAULT,
wxLIST_ALIGN_LEFT,
wxLIST_ALIGN_TOP,
wxLIST_ALIGN_SNAP_TO_GRID,
wxLIST_AUTOSIZE,
wxLIST_AUTOSIZE_USEHEADER,
wxLIST_RECT_BOUNDS,
wxLIST_RECT_ICON,
wxLIST_RECT_LABEL,
wxLIST_FIND_UP,
wxLIST_FIND_DOWN,
wxLIST_FIND_LEFT,
wxLIST_FIND_RIGHT,
};
enum wxListColumnFormat
{
wxLIST_FORMAT_LEFT,
wxLIST_FORMAT_RIGHT,
wxLIST_FORMAT_CENTRE,
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
};
enum {
/* List control event types */
@ -107,46 +56,177 @@ enum {
wxEVT_COMMAND_LIST_KEY_DOWN,
wxEVT_COMMAND_LIST_INSERT_ITEM,
wxEVT_COMMAND_LIST_COL_CLICK,
wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK,
wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
wxEVT_COMMAND_LIST_CACHE_HINT,
};
%pragma(python) code = "
def EVT_LIST_BEGIN_DRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
def EVT_LIST_BEGIN_RDRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
def EVT_LIST_END_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
def EVT_LIST_DELETE_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
def EVT_LIST_GET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
def EVT_LIST_SET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_KEY_DOWN(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
def EVT_LIST_INSERT_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func)
def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func)
def EVT_LIST_ITEM_ACTIVATED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func)
def EVT_LIST_CACHE_HINT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_CACHE_HINT, func)
"
enum {
/* Style flags */
wxLC_VRULES,
wxLC_HRULES,
wxLC_ICON,
wxLC_SMALL_ICON,
wxLC_LIST,
wxLC_REPORT,
wxLC_ALIGN_TOP,
wxLC_ALIGN_LEFT,
wxLC_AUTOARRANGE,
wxLC_USER_TEXT,
wxLC_VIRTUAL,
wxLC_EDIT_LABELS,
wxLC_NO_HEADER,
wxLC_NO_SORT_HEADER,
wxLC_SINGLE_SEL,
wxLC_SORT_ASCENDING,
wxLC_SORT_DESCENDING,
wxLC_MASK_TYPE,
wxLC_MASK_ALIGN,
wxLC_MASK_SORT,
wxLC_HRULES,
wxLC_VRULES,
wxLC_VIRTUAL,
};
enum {
// Mask flags
wxLIST_MASK_STATE,
wxLIST_MASK_TEXT,
wxLIST_MASK_IMAGE,
wxLIST_MASK_DATA,
wxLIST_SET_ITEM,
wxLIST_MASK_WIDTH,
wxLIST_MASK_FORMAT,
// State flags
wxLIST_STATE_DONTCARE,
wxLIST_STATE_DROPHILITED,
wxLIST_STATE_FOCUSED,
wxLIST_STATE_SELECTED,
wxLIST_STATE_CUT,
// Hit test flags
wxLIST_HITTEST_ABOVE,
wxLIST_HITTEST_BELOW,
wxLIST_HITTEST_NOWHERE,
wxLIST_HITTEST_ONITEMICON,
wxLIST_HITTEST_ONITEMLABEL,
wxLIST_HITTEST_ONITEMRIGHT,
wxLIST_HITTEST_ONITEMSTATEICON,
wxLIST_HITTEST_TOLEFT,
wxLIST_HITTEST_TORIGHT,
wxLIST_HITTEST_ONITEM,
// Flags for GetNextItem
wxLIST_NEXT_ABOVE,
wxLIST_NEXT_ALL,
wxLIST_NEXT_BELOW,
wxLIST_NEXT_LEFT,
wxLIST_NEXT_RIGHT,
// Alignment flags
wxLIST_ALIGN_DEFAULT,
wxLIST_ALIGN_LEFT,
wxLIST_ALIGN_TOP,
wxLIST_ALIGN_SNAP_TO_GRID,
// Autosize values for SetColumnWidth
wxLIST_AUTOSIZE = -1,
wxLIST_AUTOSIZE_USEHEADER = -2,
// Flag values for GetItemRect
wxLIST_RECT_BOUNDS,
wxLIST_RECT_ICON,
wxLIST_RECT_LABEL,
// Flag values for FindItem (MSW only)
wxLIST_FIND_UP,
wxLIST_FIND_DOWN,
wxLIST_FIND_LEFT,
wxLIST_FIND_RIGHT,
};
enum wxListColumnFormat
{
wxLIST_FORMAT_LEFT,
wxLIST_FORMAT_RIGHT,
wxLIST_FORMAT_CENTRE,
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
};
class wxListItemAttr
{
public:
// ctors
wxListItemAttr();
//wxListItemAttr(const wxColour& colText,
// const wxColour& colBack,
// const wxFont& font)
// : m_colText(colText), m_colBack(colBack), m_font(font) { }
//wxListItemAttr();
wxListItemAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont);
// setters
void SetTextColour(const wxColour& colText);
@ -252,45 +332,76 @@ public:
};
class wxListCtrl : public wxControl {
%{
class wxPyListCtrl : public wxListCtrl {
DECLARE_ABSTRACT_CLASS(wxPyListCtrl);
public:
wxListCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
char* name = "listCtrl");
wxPyListCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
char* name) :
wxListCtrl(parent, id, pos, size, style, validator, name) {}
DEC_PYCALLBACK_STRING_LONGLONG(OnGetItemText);
DEC_PYCALLBACK_INT_LONG(OnGetItemImage);
DEC_PYCALLBACK_LISTATTR_LONG(OnGetItemAttr);
PYPRIVATE;
};
IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl);
IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText);
IMP_PYCALLBACK_INT_LONG(wxPyListCtrl, wxListCtrl, OnGetItemImage);
IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr);
%}
%name(wxListCtrl)class wxPyListCtrl : public wxControl {
public:
wxPyListCtrl(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
char* name = "listCtrl");
void _setSelf(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
%pragma(python) addtomethod = "__init__:self._setSelf(self, wxListCtrl)"
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
void AssignImageList(wxImageList* imageList, int which);
%pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
bool DeleteItem(long item);
bool DeleteAllItems();
bool DeleteColumn(int col);
bool DeleteAllColumns(void);
void ClearAll(void);
#ifdef __WXMSW__
wxTextCtrl* EditLabel(long item);
bool EndEditLabel(bool cancel);
wxTextCtrl* GetEditControl();
#else
void EditLabel(long item);
#endif
bool EnsureVisible(long item);
long FindItem(long start, const wxString& str, bool partial = FALSE);
%name(FindItemData)long FindItem(long start, long data);
%name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
int direction);
bool GetColumn(int col, wxListItem& item);
int GetColumnWidth(int col);
int GetCountPerPage();
wxImageList* GetImageList(int which);
long GetItemData(long item);
// Set the control colours
bool SetForegroundColour(const wxColour& col);
bool SetBackgroundColour(const wxColour& col);
// Gets information about this column
bool GetColumn(int col, wxListItem& item) const;
// Sets information about this column
bool SetColumn(int col, wxListItem& item) ;
// Gets the column width
int GetColumnWidth(int col) const;
// Sets the column width
bool SetColumnWidth(int col, int width) ;
// Gets the number of items that can fit vertically in the
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage() const;
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl() const;
//bool GetItem(wxListItem& info) const ;
%addmethods {
// Gets information about the item
%new wxListItem* GetItem(long itemId, int col=0) {
wxListItem* info = new wxListItem;
info->m_itemId = itemId;
@ -307,12 +418,45 @@ public:
return val
"
// Sets information about the item
bool SetItem(wxListItem& info) ;
// Sets a string field at a particular column
%name(SetStringItem)long SetItem(long index, int col, const wxString& label, int imageId = -1);
// Gets the item state
int GetItemState(long item, long stateMask) const ;
// Sets the item state
bool SetItemState(long item, long state, long stateMask) ;
// Sets the item image
bool SetItemImage(long item, int image, int selImage) ;
// Gets the item text
wxString GetItemText(long item) const ;
// Sets the item text
void SetItemText(long item, const wxString& str) ;
// Gets the item data
long GetItemData(long item) const ;
// Sets the item data
bool SetItemData(long item, long data) ;
//bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ;
//bool GetItemPosition(long item, wxPoint& pos) const ;
%addmethods {
// Gets the item position
%new wxPoint* GetItemPosition(long item) {
wxPoint* pos = new wxPoint;
self->GetItemPosition(item, *pos);
return pos;
}
// Gets the item rectangle
%new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
wxRect* rect= new wxRect;
self->GetItemRect(item, *rect, code);
@ -320,60 +464,158 @@ public:
}
}
int GetItemState(long item, long stateMask);
int GetItemCount();
int GetItemSpacing(bool isSmall);
wxString GetItemText(long item);
long GetNextItem(long item,
int geometry = wxLIST_NEXT_ALL,
int state = wxLIST_STATE_DONTCARE);
int GetSelectedItemCount();
#ifdef __WXMSW__
wxColour GetTextColour();
// Sets the item position
bool SetItemPosition(long item, const wxPoint& pos) ;
// Gets the number of items in the list control
int GetItemCount() const;
// Gets the number of columns in the list control
int GetColumnCount() const { return m_colCount; }
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// view, otherwise the large icon view.
int GetItemSpacing(bool isSmall) const;
// Gets the number of selected items in the list control
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
#endif
long GetTopItem();
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
// Set the whole window style
void SetWindowStyleFlag(long style) ;
// Searches for an item, starting from 'item'.
// item can be -1 to find the first item that matches the
// specified flags.
// Returns the item or -1 if unsuccessful.
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ;
// Gets one of the three image lists
wxImageList *GetImageList(int which) const ;
// Sets the image list
void SetImageList(wxImageList *imageList, int which) ;
void AssignImageList(wxImageList *imageList, int which) ;
%pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
// returns true if it is a virtual list control
bool IsVirtual() const;
// refresh items selectively (only useful for virtual list controls)
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
// Arranges the items
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
// Deletes an item
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems() ;
// Deletes a column
bool DeleteColumn(int col);
// Deletes all columns
bool DeleteAllColumns();
// Clears items, and columns if there are any.
void ClearAll();
// Edit the label
wxTextCtrl* EditLabel(long item /*, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)*/);
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
// Ensures this item is visible
bool EnsureVisible(long item) ;
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.
%name(FindItemData)long FindItem(long start, long data);
// Find an item nearest this position in the specified direction, starting from
// the item after 'start' or the beginning if 'start' is -1.
%name(FindItemAtPos)long FindItem(long start, const wxPoint& pt, int direction);
// Determines which item (if any) is at the specified point,
// giving details in the second return value (see wxLIST_HITTEST_... flags above)
long HitTest(const wxPoint& point, int& OUTPUT);
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
long InsertItem(wxListItem& info);
// Insert a string item
%name(InsertStringItem)long InsertItem(long index, const wxString& label);
// Insert an image item
%name(InsertImageItem)long InsertItem(long index, int imageIndex);
// Insert an image/string item
%name(InsertImageStringItem)long InsertItem(long index, const wxString& label, int imageIndex);
// For list view mode (only), inserts a column.
%name(InsertColumnInfo)long InsertColumn(long col, wxListItem& info);
long InsertColumn(long col, const wxString& heading,
long InsertColumn(long col,
const wxString& heading,
int format = wxLIST_FORMAT_LEFT,
int width = -1);
long InsertItem(wxListItem& info);
%name(InsertStringItem) long InsertItem(long index, const wxString& label);
%name(InsertImageItem) long InsertItem(long index, int imageIndex);
%name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
int imageIndex);
// set the number of items in a virtual list control
void SetItemCount(long count);
// Scrolls the list control. If in icon, small icon or report view mode,
// x specifies the number of pixels to scroll. If in list view mode, x
// specifies the number of columns to scroll.
// If in icon, small icon or list view mode, y specifies the number of pixels
// to scroll. If in report view mode, y specifies the number of lines to scroll.
bool ScrollList(int dx, int dy);
void SetBackgroundColour(const wxColour& col);
bool SetColumn(int col, wxListItem& item);
bool SetColumnWidth(int col, int width);
void SetImageList(wxImageList* imageList, int which);
bool SetItem(wxListItem& info);
%name(SetStringItem)long SetItem(long index, int col, const wxString& label,
int imageId = -1);
bool SetItemData(long item, long data);
bool SetItemImage(long item, int image, int selImage);
bool SetItemPosition(long item, const wxPoint& pos);
bool SetItemState(long item, long state, long stateMask);
void SetItemText(long item, const wxString& text);
void SetSingleStyle(long style, bool add = TRUE);
void SetWindowStyleFlag(long style);
// bool SortItems(wxListCtrlCompare fn, long data);
%addmethods {
// Sort items.
// func is a function which takes 2 long arguments: item1, item2.
// item1 is the long data associated with a first item (NOT the index).
// item2 is the long data associated with a second item (NOT the index).
// The return value is a negative number if the first item should precede the second
// item, a positive number of the second item should precede the first,
// or zero if the two items are equivalent.
bool SortItems(PyObject* func) {
if (!PyCallable_Check(func))
return FALSE;
return self->SortItems(wxPyListCtrl_SortItems, (long)func);
}
}
};
%{
int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
int retval = 0;

View File

@ -446,6 +446,17 @@ public:
int GetInterval();
};
//---------------------------------------------------------------------------
class wxTextUrlEvent : public wxCommandEvent
{
public:
wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
long start, long end);
const wxMouseEvent& GetMouseEvent();
long GetURLStart();
long GetURLEnd();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

View File

@ -623,6 +623,10 @@ public:
void CalcBoundingBox(int x, int y);
void ResetBoundingBox();
#ifdef __WXMSW__
long GetHDC();
#endif
};

View File

@ -1176,19 +1176,19 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
wxDataFormat CBNAME(); \
wxDataFormat base_##CBNAME();
#define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
wxDataFormat CBNAME(size_t a); \
wxDataFormat base_##CBNAME(size_t a);
#define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
wxDataFormat CLASS::CBNAME(size_t a) { \
wxDataFormat rval; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
wxDataFormat* ptr; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
if (ro) { \
if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
rval = *ptr; \
@ -1278,6 +1278,94 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
wxString CBNAME(long a, long b) const; \
wxString base_##CBNAME(long a, long b)const ;
#define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
wxString CLASS::CBNAME(long a, long b) const { \
wxString rval; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
if (ro) { \
PyObject* str = PyObject_Str(ro); \
rval = PyString_AsString(str); \
Py_DECREF(ro); Py_DECREF(str); \
} \
} \
else \
rval = PCLASS::CBNAME(a,b); \
wxPySaveThread(doSave); \
return rval; \
} \
wxString CLASS::base_##CBNAME(long a, long b) const { \
return PCLASS::CBNAME(a,b); \
}
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_INT_LONG(CBNAME) \
int CBNAME(long a) const; \
int base_##CBNAME(long a)const ;
#define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
int CLASS::CBNAME(long a) const { \
int rval=-1; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
if (ro) { \
rval = PyInt_AsLong(ro); \
Py_DECREF(ro); \
} \
} \
else \
rval = PCLASS::CBNAME(a); \
wxPySaveThread(doSave); \
return rval; \
} \
int CLASS::base_##CBNAME(long a) const { \
return PCLASS::CBNAME(a); \
}
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
wxListItemAttr* CBNAME(long a); \
wxListItemAttr* base_##CBNAME(long a);
#define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
wxListItemAttr *CLASS::CBNAME(long a) { \
wxListItemAttr *rval = NULL; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
wxListItemAttr* ptr; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
if (ro) { \
if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
rval = ptr; \
Py_DECREF(ro); \
} \
} \
else \
rval = PCLASS::CBNAME(a); \
wxPySaveThread(doSave); \
return rval; \
} \
wxListItemAttr *CLASS::base_##CBNAME(long a) { \
return PCLASS::CBNAME(a); \
}
//---------------------------------------------------------------------------
#endif

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,58 @@ from events import *
from controls import *
import wx
def EVT_LIST_BEGIN_DRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
def EVT_LIST_BEGIN_RDRAG(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
def EVT_LIST_END_LABEL_EDIT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
def EVT_LIST_DELETE_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
def EVT_LIST_GET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
def EVT_LIST_SET_INFO(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_KEY_DOWN(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
def EVT_LIST_INSERT_ITEM(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func)
def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func)
def EVT_LIST_ITEM_ACTIVATED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func)
def EVT_LIST_CACHE_HINT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_CACHE_HINT, func)
class wxListItemAttrPtr :
def __init__(self,this):
self.this = this
@ -315,13 +367,127 @@ class wxListCtrlPtr(wxControlPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def Arrange(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_Arrange,(self,) + _args, _kwargs)
def _setSelf(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl__setSelf,(self,) + _args, _kwargs)
return val
def SetForegroundColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetForegroundColour,(self,) + _args, _kwargs)
return val
def SetBackgroundColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetBackgroundColour,(self,) + _args, _kwargs)
return val
def GetColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs)
return val
def SetColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetColumn,(self,) + _args, _kwargs)
return val
def GetColumnWidth(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetColumnWidth,(self,) + _args, _kwargs)
return val
def SetColumnWidth(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetColumnWidth,(self,) + _args, _kwargs)
return val
def GetCountPerPage(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetCountPerPage,(self,) + _args, _kwargs)
return val
def GetEditControl(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetEditControl,(self,) + _args, _kwargs)
return val
def GetItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
return val
def SetItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItem,(self,) + _args, _kwargs)
return val
def SetStringItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetStringItem,(self,) + _args, _kwargs)
return val
def GetItemState(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemState,(self,) + _args, _kwargs)
return val
def SetItemState(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemState,(self,) + _args, _kwargs)
return val
def SetItemImage(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemImage,(self,) + _args, _kwargs)
return val
def GetItemText(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemText,(self,) + _args, _kwargs)
return val
def SetItemText(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemText,(self,) + _args, _kwargs)
return val
def GetItemData(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemData,(self,) + _args, _kwargs)
return val
def SetItemData(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemData,(self,) + _args, _kwargs)
return val
def GetItemPosition(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemPosition,(self,) + _args, _kwargs)
if val: val = wxPointPtr(val) ; val.thisown = 1
return val
def GetItemRect(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemRect,(self,) + _args, _kwargs)
if val: val = wxRectPtr(val) ; val.thisown = 1
return val
def SetItemPosition(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemPosition,(self,) + _args, _kwargs)
return val
def GetItemCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemCount,(self,) + _args, _kwargs)
return val
def GetColumnCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetColumnCount,(self,) + _args, _kwargs)
return val
def GetItemSpacing(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemSpacing,(self,) + _args, _kwargs)
return val
def GetSelectedItemCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetSelectedItemCount,(self,) + _args, _kwargs)
return val
def GetTextColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetTextColour,(self,) + _args, _kwargs)
if val: val = wxColourPtr(val) ; val.thisown = 1
return val
def SetTextColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetTextColour,(self,) + _args, _kwargs)
return val
def GetTopItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetTopItem,(self,) + _args, _kwargs)
return val
def SetSingleStyle(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetSingleStyle,(self,) + _args, _kwargs)
return val
def SetWindowStyleFlag(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetWindowStyleFlag,(self,) + _args, _kwargs)
return val
def GetNextItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetNextItem,(self,) + _args, _kwargs)
return val
def GetImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetImageList,(self,) + _args, _kwargs)
return val
def SetImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetImageList,(self,) + _args, _kwargs)
return val
def AssignImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_AssignImageList,(self,) + _args, _kwargs)
_args[0].thisown = 0
return val
def IsVirtual(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_IsVirtual,(self,) + _args, _kwargs)
return val
def RefreshItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_RefreshItem,(self,) + _args, _kwargs)
return val
def RefreshItems(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_RefreshItems,(self,) + _args, _kwargs)
return val
def Arrange(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_Arrange,(self,) + _args, _kwargs)
return val
def DeleteItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_DeleteItem,(self,) + _args, _kwargs)
return val
@ -343,9 +509,6 @@ class wxListCtrlPtr(wxControlPtr):
def EndEditLabel(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_EndEditLabel,(self,) + _args, _kwargs)
return val
def GetEditControl(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetEditControl,(self,) + _args, _kwargs)
return val
def EnsureVisible(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_EnsureVisible,(self,) + _args, _kwargs)
return val
@ -358,69 +521,9 @@ class wxListCtrlPtr(wxControlPtr):
def FindItemAtPos(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_FindItemAtPos,(self,) + _args, _kwargs)
return val
def GetColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs)
return val
def GetColumnWidth(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetColumnWidth,(self,) + _args, _kwargs)
return val
def GetCountPerPage(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetCountPerPage,(self,) + _args, _kwargs)
return val
def GetImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetImageList,(self,) + _args, _kwargs)
return val
def GetItemData(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemData,(self,) + _args, _kwargs)
return val
def GetItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
return val
def GetItemPosition(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemPosition,(self,) + _args, _kwargs)
if val: val = wxPointPtr(val) ; val.thisown = 1
return val
def GetItemRect(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemRect,(self,) + _args, _kwargs)
if val: val = wxRectPtr(val) ; val.thisown = 1
return val
def GetItemState(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemState,(self,) + _args, _kwargs)
return val
def GetItemCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemCount,(self,) + _args, _kwargs)
return val
def GetItemSpacing(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemSpacing,(self,) + _args, _kwargs)
return val
def GetItemText(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetItemText,(self,) + _args, _kwargs)
return val
def GetNextItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetNextItem,(self,) + _args, _kwargs)
return val
def GetSelectedItemCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetSelectedItemCount,(self,) + _args, _kwargs)
return val
def GetTextColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetTextColour,(self,) + _args, _kwargs)
if val: val = wxColourPtr(val) ; val.thisown = 1
return val
def SetTextColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetTextColour,(self,) + _args, _kwargs)
return val
def GetTopItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_GetTopItem,(self,) + _args, _kwargs)
return val
def HitTest(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_HitTest,(self,) + _args, _kwargs)
return val
def InsertColumnInfo(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertColumnInfo,(self,) + _args, _kwargs)
return val
def InsertColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertColumn,(self,) + _args, _kwargs)
return val
def InsertItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertItem,(self,) + _args, _kwargs)
return val
@ -433,48 +536,18 @@ class wxListCtrlPtr(wxControlPtr):
def InsertImageStringItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertImageStringItem,(self,) + _args, _kwargs)
return val
def InsertColumnInfo(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertColumnInfo,(self,) + _args, _kwargs)
return val
def InsertColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_InsertColumn,(self,) + _args, _kwargs)
return val
def SetItemCount(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemCount,(self,) + _args, _kwargs)
return val
def ScrollList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_ScrollList,(self,) + _args, _kwargs)
return val
def SetBackgroundColour(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetBackgroundColour,(self,) + _args, _kwargs)
return val
def SetColumn(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetColumn,(self,) + _args, _kwargs)
return val
def SetColumnWidth(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetColumnWidth,(self,) + _args, _kwargs)
return val
def SetImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetImageList,(self,) + _args, _kwargs)
return val
def SetItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItem,(self,) + _args, _kwargs)
return val
def SetStringItem(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetStringItem,(self,) + _args, _kwargs)
return val
def SetItemData(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemData,(self,) + _args, _kwargs)
return val
def SetItemImage(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemImage,(self,) + _args, _kwargs)
return val
def SetItemPosition(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemPosition,(self,) + _args, _kwargs)
return val
def SetItemState(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemState,(self,) + _args, _kwargs)
return val
def SetItemText(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetItemText,(self,) + _args, _kwargs)
return val
def SetSingleStyle(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetSingleStyle,(self,) + _args, _kwargs)
return val
def SetWindowStyleFlag(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SetWindowStyleFlag,(self,) + _args, _kwargs)
return val
def SortItems(self, *_args, **_kwargs):
val = apply(controls2c.wxListCtrl_SortItems,(self,) + _args, _kwargs)
return val
@ -491,6 +564,7 @@ class wxListCtrl(wxListCtrlPtr):
self.this = apply(controls2c.new_wxListCtrl,_args,_kwargs)
self.thisown = 1
#wx._StdWindowCallbacks(self)
self._setSelf(self, wxListCtrl)
@ -838,12 +912,49 @@ class wxTreeCtrl(wxTreeCtrlPtr):
#-------------- VARIABLE WRAPPERS ------------------
wxEVT_COMMAND_LIST_BEGIN_DRAG = controls2c.wxEVT_COMMAND_LIST_BEGIN_DRAG
wxEVT_COMMAND_LIST_BEGIN_RDRAG = controls2c.wxEVT_COMMAND_LIST_BEGIN_RDRAG
wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = controls2c.wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
wxEVT_COMMAND_LIST_END_LABEL_EDIT = controls2c.wxEVT_COMMAND_LIST_END_LABEL_EDIT
wxEVT_COMMAND_LIST_DELETE_ITEM = controls2c.wxEVT_COMMAND_LIST_DELETE_ITEM
wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = controls2c.wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
wxEVT_COMMAND_LIST_GET_INFO = controls2c.wxEVT_COMMAND_LIST_GET_INFO
wxEVT_COMMAND_LIST_SET_INFO = controls2c.wxEVT_COMMAND_LIST_SET_INFO
wxEVT_COMMAND_LIST_ITEM_SELECTED = controls2c.wxEVT_COMMAND_LIST_ITEM_SELECTED
wxEVT_COMMAND_LIST_ITEM_DESELECTED = controls2c.wxEVT_COMMAND_LIST_ITEM_DESELECTED
wxEVT_COMMAND_LIST_KEY_DOWN = controls2c.wxEVT_COMMAND_LIST_KEY_DOWN
wxEVT_COMMAND_LIST_INSERT_ITEM = controls2c.wxEVT_COMMAND_LIST_INSERT_ITEM
wxEVT_COMMAND_LIST_COL_CLICK = controls2c.wxEVT_COMMAND_LIST_COL_CLICK
wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = controls2c.wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = controls2c.wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
wxEVT_COMMAND_LIST_ITEM_ACTIVATED = controls2c.wxEVT_COMMAND_LIST_ITEM_ACTIVATED
wxEVT_COMMAND_LIST_CACHE_HINT = controls2c.wxEVT_COMMAND_LIST_CACHE_HINT
wxLC_VRULES = controls2c.wxLC_VRULES
wxLC_HRULES = controls2c.wxLC_HRULES
wxLC_ICON = controls2c.wxLC_ICON
wxLC_SMALL_ICON = controls2c.wxLC_SMALL_ICON
wxLC_LIST = controls2c.wxLC_LIST
wxLC_REPORT = controls2c.wxLC_REPORT
wxLC_ALIGN_TOP = controls2c.wxLC_ALIGN_TOP
wxLC_ALIGN_LEFT = controls2c.wxLC_ALIGN_LEFT
wxLC_AUTOARRANGE = controls2c.wxLC_AUTOARRANGE
wxLC_VIRTUAL = controls2c.wxLC_VIRTUAL
wxLC_EDIT_LABELS = controls2c.wxLC_EDIT_LABELS
wxLC_NO_HEADER = controls2c.wxLC_NO_HEADER
wxLC_NO_SORT_HEADER = controls2c.wxLC_NO_SORT_HEADER
wxLC_SINGLE_SEL = controls2c.wxLC_SINGLE_SEL
wxLC_SORT_ASCENDING = controls2c.wxLC_SORT_ASCENDING
wxLC_SORT_DESCENDING = controls2c.wxLC_SORT_DESCENDING
wxLC_MASK_TYPE = controls2c.wxLC_MASK_TYPE
wxLC_MASK_ALIGN = controls2c.wxLC_MASK_ALIGN
wxLC_MASK_SORT = controls2c.wxLC_MASK_SORT
wxLIST_MASK_STATE = controls2c.wxLIST_MASK_STATE
wxLIST_MASK_TEXT = controls2c.wxLIST_MASK_TEXT
wxLIST_MASK_IMAGE = controls2c.wxLIST_MASK_IMAGE
wxLIST_MASK_DATA = controls2c.wxLIST_MASK_DATA
wxLIST_SET_ITEM = controls2c.wxLIST_SET_ITEM
wxLIST_MASK_WIDTH = controls2c.wxLIST_MASK_WIDTH
wxLIST_MASK_FORMAT = controls2c.wxLIST_MASK_FORMAT
wxLIST_MASK_STATE = controls2c.wxLIST_MASK_STATE
wxLIST_STATE_DONTCARE = controls2c.wxLIST_STATE_DONTCARE
wxLIST_STATE_DROPHILITED = controls2c.wxLIST_STATE_DROPHILITED
wxLIST_STATE_FOCUSED = controls2c.wxLIST_STATE_FOCUSED
@ -881,42 +992,6 @@ wxLIST_FORMAT_LEFT = controls2c.wxLIST_FORMAT_LEFT
wxLIST_FORMAT_RIGHT = controls2c.wxLIST_FORMAT_RIGHT
wxLIST_FORMAT_CENTRE = controls2c.wxLIST_FORMAT_CENTRE
wxLIST_FORMAT_CENTER = controls2c.wxLIST_FORMAT_CENTER
wxEVT_COMMAND_LIST_BEGIN_DRAG = controls2c.wxEVT_COMMAND_LIST_BEGIN_DRAG
wxEVT_COMMAND_LIST_BEGIN_RDRAG = controls2c.wxEVT_COMMAND_LIST_BEGIN_RDRAG
wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = controls2c.wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
wxEVT_COMMAND_LIST_END_LABEL_EDIT = controls2c.wxEVT_COMMAND_LIST_END_LABEL_EDIT
wxEVT_COMMAND_LIST_DELETE_ITEM = controls2c.wxEVT_COMMAND_LIST_DELETE_ITEM
wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = controls2c.wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
wxEVT_COMMAND_LIST_GET_INFO = controls2c.wxEVT_COMMAND_LIST_GET_INFO
wxEVT_COMMAND_LIST_SET_INFO = controls2c.wxEVT_COMMAND_LIST_SET_INFO
wxEVT_COMMAND_LIST_ITEM_SELECTED = controls2c.wxEVT_COMMAND_LIST_ITEM_SELECTED
wxEVT_COMMAND_LIST_ITEM_DESELECTED = controls2c.wxEVT_COMMAND_LIST_ITEM_DESELECTED
wxEVT_COMMAND_LIST_KEY_DOWN = controls2c.wxEVT_COMMAND_LIST_KEY_DOWN
wxEVT_COMMAND_LIST_INSERT_ITEM = controls2c.wxEVT_COMMAND_LIST_INSERT_ITEM
wxEVT_COMMAND_LIST_COL_CLICK = controls2c.wxEVT_COMMAND_LIST_COL_CLICK
wxEVT_COMMAND_LIST_ITEM_ACTIVATED = controls2c.wxEVT_COMMAND_LIST_ITEM_ACTIVATED
wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = controls2c.wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = controls2c.wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
wxLC_ICON = controls2c.wxLC_ICON
wxLC_SMALL_ICON = controls2c.wxLC_SMALL_ICON
wxLC_LIST = controls2c.wxLC_LIST
wxLC_REPORT = controls2c.wxLC_REPORT
wxLC_ALIGN_TOP = controls2c.wxLC_ALIGN_TOP
wxLC_ALIGN_LEFT = controls2c.wxLC_ALIGN_LEFT
wxLC_AUTOARRANGE = controls2c.wxLC_AUTOARRANGE
wxLC_USER_TEXT = controls2c.wxLC_USER_TEXT
wxLC_EDIT_LABELS = controls2c.wxLC_EDIT_LABELS
wxLC_NO_HEADER = controls2c.wxLC_NO_HEADER
wxLC_NO_SORT_HEADER = controls2c.wxLC_NO_SORT_HEADER
wxLC_SINGLE_SEL = controls2c.wxLC_SINGLE_SEL
wxLC_SORT_ASCENDING = controls2c.wxLC_SORT_ASCENDING
wxLC_SORT_DESCENDING = controls2c.wxLC_SORT_DESCENDING
wxLC_MASK_TYPE = controls2c.wxLC_MASK_TYPE
wxLC_MASK_ALIGN = controls2c.wxLC_MASK_ALIGN
wxLC_MASK_SORT = controls2c.wxLC_MASK_SORT
wxLC_HRULES = controls2c.wxLC_HRULES
wxLC_VRULES = controls2c.wxLC_VRULES
wxLC_VIRTUAL = controls2c.wxLC_VIRTUAL
wxTreeItemIcon_Normal = controls2c.wxTreeItemIcon_Normal
wxTreeItemIcon_Selected = controls2c.wxTreeItemIcon_Selected
wxTreeItemIcon_Expanded = controls2c.wxTreeItemIcon_Expanded

View File

@ -6514,6 +6514,153 @@ static PyObject *_wrap_wxTimerEvent_GetInterval(PyObject *self, PyObject *args,
return _resultobj;
}
static void *SwigwxTextUrlEventTowxCommandEvent(void *ptr) {
wxTextUrlEvent *src;
wxCommandEvent *dest;
src = (wxTextUrlEvent *) ptr;
dest = (wxCommandEvent *) src;
return (void *) dest;
}
static void *SwigwxTextUrlEventTowxEvent(void *ptr) {
wxTextUrlEvent *src;
wxEvent *dest;
src = (wxTextUrlEvent *) ptr;
dest = (wxEvent *) src;
return (void *) dest;
}
static void *SwigwxTextUrlEventTowxObject(void *ptr) {
wxTextUrlEvent *src;
wxObject *dest;
src = (wxTextUrlEvent *) ptr;
dest = (wxObject *) src;
return (void *) dest;
}
#define new_wxTextUrlEvent(_swigarg0,_swigarg1,_swigarg2,_swigarg3) (new wxTextUrlEvent(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
static PyObject *_wrap_new_wxTextUrlEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxTextUrlEvent * _result;
int _arg0;
wxMouseEvent * _arg1;
long _arg2;
long _arg3;
PyObject * _argo1 = 0;
char *_kwnames[] = { "id","evtMouse","start","end", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"iOll:new_wxTextUrlEvent",_kwnames,&_arg0,&_argo1,&_arg2,&_arg3))
return NULL;
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxMouseEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxTextUrlEvent. Expected _wxMouseEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxTextUrlEvent *)new_wxTextUrlEvent(_arg0,*_arg1,_arg2,_arg3);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxTextUrlEvent_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define wxTextUrlEvent_GetMouseEvent(_swigobj) (_swigobj->GetMouseEvent())
static PyObject *_wrap_wxTextUrlEvent_GetMouseEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxMouseEvent * _result;
wxTextUrlEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTextUrlEvent_GetMouseEvent",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTextUrlEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTextUrlEvent_GetMouseEvent. Expected _wxTextUrlEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
const wxMouseEvent & _result_ref = wxTextUrlEvent_GetMouseEvent(_arg0);
_result = (wxMouseEvent *) &_result_ref;
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
}{ _resultobj = wxPyMake_wxObject(_result); }
return _resultobj;
}
#define wxTextUrlEvent_GetURLStart(_swigobj) (_swigobj->GetURLStart())
static PyObject *_wrap_wxTextUrlEvent_GetURLStart(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
wxTextUrlEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTextUrlEvent_GetURLStart",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTextUrlEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTextUrlEvent_GetURLStart. Expected _wxTextUrlEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (long )wxTextUrlEvent_GetURLStart(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("l",_result);
return _resultobj;
}
#define wxTextUrlEvent_GetURLEnd(_swigobj) (_swigobj->GetURLEnd())
static PyObject *_wrap_wxTextUrlEvent_GetURLEnd(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
wxTextUrlEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTextUrlEvent_GetURLEnd",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTextUrlEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTextUrlEvent_GetURLEnd. Expected _wxTextUrlEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (long )wxTextUrlEvent_GetURLEnd(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("l",_result);
return _resultobj;
}
static void *SwigwxPyEventTowxEvent(void *ptr) {
wxPyEvent *src;
wxEvent *dest;
@ -6800,6 +6947,10 @@ static PyMethodDef eventscMethods[] = {
{ "wxPyEvent_SetSelf", (PyCFunction) _wrap_wxPyEvent_SetSelf, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxPyEvent", (PyCFunction) _wrap_delete_wxPyEvent, METH_VARARGS | METH_KEYWORDS },
{ "new_wxPyEvent", (PyCFunction) _wrap_new_wxPyEvent, METH_VARARGS | METH_KEYWORDS },
{ "wxTextUrlEvent_GetURLEnd", (PyCFunction) _wrap_wxTextUrlEvent_GetURLEnd, METH_VARARGS | METH_KEYWORDS },
{ "wxTextUrlEvent_GetURLStart", (PyCFunction) _wrap_wxTextUrlEvent_GetURLStart, METH_VARARGS | METH_KEYWORDS },
{ "wxTextUrlEvent_GetMouseEvent", (PyCFunction) _wrap_wxTextUrlEvent_GetMouseEvent, METH_VARARGS | METH_KEYWORDS },
{ "new_wxTextUrlEvent", (PyCFunction) _wrap_new_wxTextUrlEvent, METH_VARARGS | METH_KEYWORDS },
{ "wxTimerEvent_GetInterval", (PyCFunction) _wrap_wxTimerEvent_GetInterval, METH_VARARGS | METH_KEYWORDS },
{ "new_wxTimerEvent", (PyCFunction) _wrap_new_wxTimerEvent, METH_VARARGS | METH_KEYWORDS },
{ "wxWindowDestroyEvent_GetWindow", (PyCFunction) _wrap_wxWindowDestroyEvent_GetWindow, METH_VARARGS | METH_KEYWORDS },
@ -7012,6 +7163,7 @@ static PyMethodDef eventscMethods[] = {
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxEvent","_wxPyCommandEvent",SwigwxPyCommandEventTowxEvent},
{ "_wxEvent","_wxPyEvent",SwigwxPyEventTowxEvent},
{ "_wxEvent","_wxTextUrlEvent",SwigwxTextUrlEventTowxEvent},
{ "_wxEvent","_wxTimerEvent",SwigwxTimerEventTowxEvent},
{ "_wxEvent","_wxWindowDestroyEvent",SwigwxWindowDestroyEventTowxEvent},
{ "_wxEvent","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxEvent},
@ -7071,6 +7223,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_uint","_wxWindowID",0},
{ "_wxChar","_char",0},
{ "_wxCommandEvent","_wxPyCommandEvent",SwigwxPyCommandEventTowxCommandEvent},
{ "_wxCommandEvent","_wxTextUrlEvent",SwigwxTextUrlEventTowxCommandEvent},
{ "_wxCommandEvent","_wxWindowDestroyEvent",SwigwxWindowDestroyEventTowxCommandEvent},
{ "_wxCommandEvent","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxCommandEvent},
{ "_wxCommandEvent","_wxNotifyEvent",SwigwxNotifyEventTowxCommandEvent},
@ -7096,6 +7249,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_unsigned_short","_short",0},
{ "_wxObject","_wxPyCommandEvent",SwigwxPyCommandEventTowxObject},
{ "_wxObject","_wxPyEvent",SwigwxPyEventTowxObject},
{ "_wxObject","_wxTextUrlEvent",SwigwxTextUrlEventTowxObject},
{ "_wxObject","_wxTimerEvent",SwigwxTimerEventTowxObject},
{ "_wxObject","_wxWindowDestroyEvent",SwigwxWindowDestroyEventTowxObject},
{ "_wxObject","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxObject},

View File

@ -942,6 +942,29 @@ class wxTimerEvent(wxTimerEventPtr):
class wxTextUrlEventPtr(wxCommandEventPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetMouseEvent(self, *_args, **_kwargs):
val = apply(eventsc.wxTextUrlEvent_GetMouseEvent,(self,) + _args, _kwargs)
return val
def GetURLStart(self, *_args, **_kwargs):
val = apply(eventsc.wxTextUrlEvent_GetURLStart,(self,) + _args, _kwargs)
return val
def GetURLEnd(self, *_args, **_kwargs):
val = apply(eventsc.wxTextUrlEvent_GetURLEnd,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxTextUrlEvent instance at %s>" % (self.this,)
class wxTextUrlEvent(wxTextUrlEventPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(eventsc.new_wxTextUrlEvent,_args,_kwargs)
self.thisown = 1
class wxPyEventPtr(wxEventPtr):
def __init__(self,this):
self.this = this

View File

@ -8515,6 +8515,34 @@ static PyObject *_wrap_wxDC_ResetBoundingBox(PyObject *self, PyObject *args, PyO
return _resultobj;
}
#define wxDC_GetHDC(_swigobj) (_swigobj->GetHDC())
static PyObject *_wrap_wxDC_GetHDC(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
wxDC * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDC_GetHDC",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC_GetHDC. Expected _wxDC_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (long )wxDC_GetHDC(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("l",_result);
return _resultobj;
}
static void *SwigwxMemoryDCTowxDC(void *ptr) {
wxMemoryDC *src;
wxDC *dest;
@ -10770,6 +10798,7 @@ static PyMethodDef gdicMethods[] = {
{ "new_wxScreenDC", (PyCFunction) _wrap_new_wxScreenDC, METH_VARARGS | METH_KEYWORDS },
{ "wxMemoryDC_SelectObject", (PyCFunction) _wrap_wxMemoryDC_SelectObject, METH_VARARGS | METH_KEYWORDS },
{ "new_wxMemoryDC", (PyCFunction) _wrap_new_wxMemoryDC, METH_VARARGS | METH_KEYWORDS },
{ "wxDC_GetHDC", (PyCFunction) _wrap_wxDC_GetHDC, METH_VARARGS | METH_KEYWORDS },
{ "wxDC_ResetBoundingBox", (PyCFunction) _wrap_wxDC_ResetBoundingBox, METH_VARARGS | METH_KEYWORDS },
{ "wxDC_CalcBoundingBox", (PyCFunction) _wrap_wxDC_CalcBoundingBox, METH_VARARGS | METH_KEYWORDS },
{ "wxDC_SetAxisOrientation", (PyCFunction) _wrap_wxDC_SetAxisOrientation, METH_VARARGS | METH_KEYWORDS },

View File

@ -821,6 +821,9 @@ class wxDCPtr(wxObjectPtr):
def ResetBoundingBox(self, *_args, **_kwargs):
val = apply(gdic.wxDC_ResetBoundingBox,(self,) + _args, _kwargs)
return val
def GetHDC(self, *_args, **_kwargs):
val = apply(gdic.wxDC_GetHDC,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxDC instance at %s>" % (self.this,)
class wxDC(wxDCPtr):

View File

@ -5411,6 +5411,176 @@ static PyObject *_wrap_wxWindow_SetHelpText(PyObject *self, PyObject *args, PyOb
return _resultobj;
}
#define wxWindow_ScrollLines(_swigobj,_swigarg0) (_swigobj->ScrollLines(_swigarg0))
static PyObject *_wrap_wxWindow_ScrollLines(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","lines", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxWindow_ScrollLines",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_ScrollLines. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_ScrollLines(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxWindow_ScrollPages(_swigobj,_swigarg0) (_swigobj->ScrollPages(_swigarg0))
static PyObject *_wrap_wxWindow_ScrollPages(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","pages", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxWindow_ScrollPages",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_ScrollPages. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_ScrollPages(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxWindow_LineUp(_swigobj) (_swigobj->LineUp())
static PyObject *_wrap_wxWindow_LineUp(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_LineUp",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_LineUp. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_LineUp(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxWindow_LineDown(_swigobj) (_swigobj->LineDown())
static PyObject *_wrap_wxWindow_LineDown(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_LineDown",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_LineDown. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_LineDown(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxWindow_PageUp(_swigobj) (_swigobj->PageUp())
static PyObject *_wrap_wxWindow_PageUp(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_PageUp",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_PageUp. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_PageUp(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxWindow_PageDown(_swigobj) (_swigobj->PageDown())
static PyObject *_wrap_wxWindow_PageDown(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxWindow * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_PageDown",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_PageDown. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxWindow_PageDown(_arg0);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
static void *SwigwxPanelTowxWindow(void *ptr) {
wxPanel *src;
wxWindow *dest;
@ -10611,6 +10781,12 @@ static PyMethodDef windowscMethods[] = {
{ "wxPanel_GetDefaultItem", (PyCFunction) _wrap_wxPanel_GetDefaultItem, METH_VARARGS | METH_KEYWORDS },
{ "wxPanel_InitDialog", (PyCFunction) _wrap_wxPanel_InitDialog, METH_VARARGS | METH_KEYWORDS },
{ "new_wxPanel", (PyCFunction) _wrap_new_wxPanel, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_PageDown", (PyCFunction) _wrap_wxWindow_PageDown, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_PageUp", (PyCFunction) _wrap_wxWindow_PageUp, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_LineDown", (PyCFunction) _wrap_wxWindow_LineDown, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_LineUp", (PyCFunction) _wrap_wxWindow_LineUp, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_ScrollPages", (PyCFunction) _wrap_wxWindow_ScrollPages, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_ScrollLines", (PyCFunction) _wrap_wxWindow_ScrollLines, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_SetHelpText", (PyCFunction) _wrap_wxWindow_SetHelpText, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_GetHelpText", (PyCFunction) _wrap_wxWindow_GetHelpText, METH_VARARGS | METH_KEYWORDS },
{ "wxWindow_Thaw", (PyCFunction) _wrap_wxWindow_Thaw, METH_VARARGS | METH_KEYWORDS },

View File

@ -520,6 +520,24 @@ class wxWindowPtr(wxEvtHandlerPtr):
def SetHelpText(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_SetHelpText,(self,) + _args, _kwargs)
return val
def ScrollLines(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_ScrollLines,(self,) + _args, _kwargs)
return val
def ScrollPages(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_ScrollPages,(self,) + _args, _kwargs)
return val
def LineUp(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_LineUp,(self,) + _args, _kwargs)
return val
def LineDown(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_LineDown,(self,) + _args, _kwargs)
return val
def PageUp(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_PageUp,(self,) + _args, _kwargs)
return val
def PageDown(self, *_args, **_kwargs):
val = apply(windowsc.wxWindow_PageDown,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxWindow instance at %s>" % (self.this,)
# replaces broken shadow method

View File

@ -389,6 +389,14 @@ public:
wxString GetHelpText();
void SetHelpText(const wxString& helpText);
bool ScrollLines(int lines);
bool ScrollPages(int pages);
bool LineUp();
bool LineDown();
bool PageUp();
bool PageDown();
// // Properties list
// %pragma(python) addtoclass = "

View File

@ -0,0 +1,148 @@
#!/usr/bin/env python
"""PyCrust is a python shell application.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
from wxPython.wx import *
from PyCrustVersion import version
from PyCrustShell import Shell
class Frame(wxFrame):
"""Main window for the PyCrust application."""
def __init__(self, parent, id, title):
"""Create the main frame object for the application."""
wxFrame.__init__(self, parent, id, title)
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % version
self.CreateStatusBar()
self.SetStatusText(intro)
self.createMenus()
# Create the shell, which will create a default editor and
# a default interpreter.
self.shell = Shell(editorParent=self, introText=intro)
# Override the editor so that status messages go to the status bar.
self.shell.editor.setStatusText = self.SetStatusText
def createMenus(self):
m = self.fileMenu = wxMenu()
m.AppendSeparator()
m.Append(wxID_EXIT, 'E&xit', 'Exit PyCrust')
m = self.editMenu = wxMenu()
m.Append(wxID_UNDO, '&Undo \tCtrl+Z', 'Undo the last action')
m.Append(wxID_REDO, '&Redo \tCtrl+Y', 'Redo the last undone action')
m.AppendSeparator()
m.Append(wxID_CUT, 'Cu&t \tCtrl+X', 'Cut the selection')
m.Append(wxID_COPY, '&Copy \tCtrl+C', 'Copy the selection')
m.Append(wxID_PASTE, '&Paste \tCtrl+V', 'Paste')
m.AppendSeparator()
m.Append(wxID_CLEAR, 'Cle&ar \tDel', 'Delete the selection')
m.Append(wxID_SELECTALL, 'Select A&ll \tCtrl+A', 'Select all text')
m = self.helpMenu = wxMenu()
m.AppendSeparator()
m.Append(wxID_ABOUT, '&About...', 'About PyCrust')
b = self.menuBar = wxMenuBar()
b.Append(self.fileMenu, '&File')
b.Append(self.editMenu, '&Edit')
b.Append(self.helpMenu, '&Help')
self.SetMenuBar(b)
EVT_MENU(self, wxID_EXIT, self.OnExit)
EVT_MENU(self, wxID_UNDO, self.OnUndo)
EVT_MENU(self, wxID_REDO, self.OnRedo)
EVT_MENU(self, wxID_CUT, self.OnCut)
EVT_MENU(self, wxID_COPY, self.OnCopy)
EVT_MENU(self, wxID_PASTE, self.OnPaste)
EVT_MENU(self, wxID_CLEAR, self.OnClear)
EVT_MENU(self, wxID_SELECTALL, self.OnSelectAll)
EVT_MENU(self, wxID_ABOUT, self.OnAbout)
EVT_UPDATE_UI(self, wxID_UNDO, self.OnUpdateMenu)
EVT_UPDATE_UI(self, wxID_REDO, self.OnUpdateMenu)
EVT_UPDATE_UI(self, wxID_CUT, self.OnUpdateMenu)
EVT_UPDATE_UI(self, wxID_COPY, self.OnUpdateMenu)
EVT_UPDATE_UI(self, wxID_PASTE, self.OnUpdateMenu)
EVT_UPDATE_UI(self, wxID_CLEAR, self.OnUpdateMenu)
def OnExit(self, event):
self.Close(true)
def OnUndo(self, event):
self.shell.editor.Undo()
def OnRedo(self, event):
self.shell.editor.Redo()
def OnCut(self, event):
self.shell.editor.Cut()
def OnCopy(self, event):
self.shell.editor.Copy()
def OnPaste(self, event):
self.shell.editor.Paste()
def OnClear(self, event):
self.shell.editor.Clear()
def OnSelectAll(self, event):
self.shell.editor.SelectAll()
def OnAbout(self, event):
"""Display an About PyCrust window."""
title = 'About PyCrust'
text = 'PyCrust %s\n\n' % version + \
'Yet another Python shell, only flakier.\n\n' + \
'Half-baked by Patrick K. O\'Brien,\n' + \
'the other half is still in the oven.'
dialog = wxMessageDialog(self, text, title, wxOK | wxICON_INFORMATION)
dialog.ShowModal()
dialog.Destroy()
def OnUpdateMenu(self, event):
"""Update menu items based on which should be enabled/disabled."""
id = event.GetId()
if id == wxID_UNDO:
event.Enable(self.shell.editor.CanUndo())
elif id == wxID_REDO:
event.Enable(self.shell.editor.CanRedo())
elif id == wxID_CUT:
event.Enable(self.shell.editor.CanCut())
elif id == wxID_COPY:
event.Enable(self.shell.editor.CanCopy())
elif id == wxID_PASTE:
event.Enable(self.shell.editor.CanPaste())
elif id == wxID_CLEAR:
event.Enable(self.shell.editor.CanCut())
class App(wxApp):
def OnInit(self):
parent = None
id = -1
title = 'PyCrust'
self.frame = Frame(parent, id, title)
self.frame.Show(true)
self.SetTopWindow(self.frame)
return true
def main():
import sys
application = App(0)
# Add the application object to the sys module's namespace.
# This allows a shell user to do:
# >>> import sys
# >>> sys.application.whatever
sys.application = application
application.MainLoop()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,349 @@
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
from wxPython.wx import *
from wxPython.stc import *
import keyword
import sys
if wxPlatform == '__WXMSW__':
faces = { 'times' : 'Times New Roman',
'mono' : 'Courier New',
'helv' : 'Lucida Console',
'lucida' : 'Lucida Console',
'other' : 'Comic Sans MS',
'size' : 8,
'lnsize' : 7,
'backcol': '#FFFFFF',
}
else: # GTK
faces = { 'times' : 'Times',
'mono' : 'Courier',
'helv' : 'Helvetica',
'other' : 'new century schoolbook',
'size' : 9,
'lnsize' : 8,
'backcol': '#FFFFFF',
}
class Editor(wxStyledTextCtrl):
"""PyCrust Editor based on wxStyledTextCtrl."""
revision = __version__
def __init__(self, parent, id):
"""Create a PyCrust editor object based on wxStyledTextCtrl."""
wxStyledTextCtrl.__init__(self, parent, id, style=wxCLIP_CHILDREN)
# Commands get pushed to a method determined by the outer shell.
#self.shellPush = pushMethod
# Keep track of the most recent prompt starting and ending positions.
self.promptPos = [0, 0]
# Keep track of multi-line commands.
self.more = 0
# Configure various defaults and user preferences.
self.config()
# Assign handlers for keyboard events.
EVT_KEY_DOWN(self, self.OnKeyDown)
EVT_CHAR(self, self.OnChar)
def config(self):
"""Configure editor based on user preferences."""
self.SetMarginType(1, wxSTC_MARGIN_NUMBER)
self.SetMarginWidth(1, 40)
self.SetLexer(wxSTC_LEX_PYTHON)
self.SetKeyWords(0, ' '.join(keyword.kwlist))
self.setStyles(faces)
self.SetViewWhiteSpace(0)
self.SetTabWidth(4)
self.SetUseTabs(0)
# Do we want to automatically pop up command completion options?
self.autoComplete = 1
self.autoCompleteCaseInsensitive = 1
self.AutoCompSetIgnoreCase(self.autoCompleteCaseInsensitive)
# De we want to automatically pop up command argument help?
self.autoCallTip = 1
self.CallTipSetBackground(wxColour(255, 255, 232))
def setStyles(self, faces):
"""Configure font size, typeface and color for lexer."""
# Default style
self.StyleSetSpec(wxSTC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
self.StyleClearAll()
# Built in styles
self.StyleSetSpec(wxSTC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(mono)s,size:%(lnsize)d" % faces)
self.StyleSetSpec(wxSTC_STYLE_CONTROLCHAR, "face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_STYLE_BRACELIGHT, "fore:#0000FF,back:#FFFF88")
self.StyleSetSpec(wxSTC_STYLE_BRACEBAD, "fore:#FF0000,back:#FFFF88")
# Python styles
self.StyleSetSpec(wxSTC_P_DEFAULT, "face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_COMMENTLINE, "fore:#007F00,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_NUMBER, "")
self.StyleSetSpec(wxSTC_P_STRING, "fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_CHARACTER, "fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_WORD, "fore:#00007F,bold")
self.StyleSetSpec(wxSTC_P_TRIPLE, "fore:#7F0000")
self.StyleSetSpec(wxSTC_P_TRIPLEDOUBLE, "fore:#000033,back:#FFFFE8")
self.StyleSetSpec(wxSTC_P_CLASSNAME, "fore:#0000FF,bold")
self.StyleSetSpec(wxSTC_P_DEFNAME, "fore:#007F7F,bold")
self.StyleSetSpec(wxSTC_P_OPERATOR, "")
self.StyleSetSpec(wxSTC_P_IDENTIFIER, "")
self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F")
self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)
def OnKeyDown(self, event):
"""Key down event handler.
The main goal here is to not allow modifications to previous
lines of text.
"""
key = event.KeyCode()
currpos = self.GetCurrentPos()
stoppos = self.promptPos[1]
# If the auto-complete window is up let it do its thing.
if self.AutoCompActive():
event.Skip()
# Return is used to submit a command to the interpreter.
elif key == WXK_RETURN:
if self.CallTipActive: self.CallTipCancel()
self.processLine()
# Home needs to be aware of the prompt.
elif key == WXK_HOME:
if currpos >= stoppos:
self.SetCurrentPos(stoppos)
self.SetAnchor(stoppos)
else:
event.Skip()
# Basic navigation keys should work anywhere.
elif key in (WXK_END, WXK_LEFT, WXK_RIGHT, WXK_UP, WXK_DOWN, \
WXK_PRIOR, WXK_NEXT):
event.Skip()
# Don't backspace over the latest prompt.
elif key == WXK_BACK:
if currpos > stoppos:
event.Skip()
# Only allow these keys after the latest prompt.
elif key in (WXK_TAB, WXK_DELETE):
if currpos >= stoppos:
event.Skip()
# Don't toggle between insert mode and overwrite mode.
elif key == WXK_INSERT:
pass
else:
event.Skip()
def OnChar(self, event):
"""Keypress event handler.
The main goal here is to not allow modifications to previous
lines of text.
"""
key = event.KeyCode()
currpos = self.GetCurrentPos()
stoppos = self.promptPos[1]
if currpos >= stoppos:
if key == 46:
# "." The dot or period key activates auto completion.
# Get the command between the prompt and the cursor.
# Add a dot to the end of the command.
command = self.GetTextRange(stoppos, currpos) + '.'
self.write('.')
if self.autoComplete: self.autoCompleteShow(command)
elif key == 40:
# "(" The left paren activates a call tip and cancels
# an active auto completion.
if self.AutoCompActive(): self.AutoCompCancel()
# Get the command between the prompt and the cursor.
# Add the '(' to the end of the command.
command = self.GetTextRange(stoppos, currpos) + '('
self.write('(')
if self.autoCallTip: self.autoCallTipShow(command)
else:
# Allow the normal event handling to take place.
event.Skip()
else:
pass
def setStatusText(self, text):
"""Display status information."""
# This method will most likely be replaced by the enclosing app
# to do something more interesting, like write to a status bar.
print text
def autoCompleteShow(self, command):
"""Display auto-completion popup list."""
list = self.getAutoCompleteList(command)
if list:
options = ' '.join(list)
offset = 0
self.AutoCompShow(offset, options)
def getAutoCompleteList(self, command):
"""Return list of auto-completion options for command."""
# This method needs to be replaced by the enclosing app
# to get the proper auto complete list from the interpreter.
return []
def autoCallTipShow(self, command):
"""Display argument spec and docstring in a popup bubble thingie."""
if self.CallTipActive: self.CallTipCancel()
tip = self.getCallTip(command)
if tip:
offset = self.GetCurrentPos()
self.CallTipShow(offset, tip)
def getCallTip(self, command):
"""Return arguments and docstring for command."""
# This method needs to be replaced by the enclosing app
# to get the proper auto complete list from the interpreter.
return ''
def processLine(self):
"""Process the line of text at which the user hit Enter."""
# The user hit ENTER and we need to decide what to do. They could be
# sitting on any line in the editor.
# Grab information about the current line.
thepos = self.GetCurrentPos()
theline = self.GetCurrentLine()
thetext = self.GetCurLine()[0]
command = self.getCommand(thetext)
# Go to the very bottom of the editor.
endpos = self.GetTextLength()
self.SetCurrentPos(endpos)
endline = self.GetCurrentLine()
# If they hit RETURN on the last line, execute the command.
if theline == endline:
self.push(command)
# Otherwise, replace the last line with the new line.
else:
# If the new line contains a command (even an invalid one).
if command:
startpos = self.PositionFromLine(endline)
self.SetSelection(startpos, endpos)
self.ReplaceSelection('')
self.prompt()
self.write(command)
# Otherwise, put the cursor back where we started.
else:
self.SetCurrentPos(thepos)
self.SetAnchor(thepos)
def getCommand(self, text):
"""Extract a command from text which may include a shell prompt.
The command may not necessarily be valid Python syntax.
"""
# XXX Need to extract real prompts here. Need to keep track of the
# prompt every time a command is issued. Do this in the interpreter
# with a line number, prompt, command dictionary. For the history, perhaps.
ps1 = str(sys.ps1)
ps1size = len(ps1)
ps2 = str(sys.ps2)
ps2size = len(ps2)
text = text.rstrip()
# Strip the prompt off the front of text leaving just the command.
if text[:ps1size] == ps1:
command = text[ps1size:]
elif text[:ps2size] == ps2:
command = text[ps2size:]
else:
command = ''
return command
def push(self, command):
"""Start a new line, send command to the shell, display a prompt."""
self.write('\n')
self.more = self.shellPush(command)
self.prompt()
# Keep the undo feature from undoing previous responses. The only
# thing that can be undone is stuff typed after the prompt, before
# hitting enter. After they hit enter it becomes permanent.
self.EmptyUndoBuffer()
def clear(self):
"""Delete all text from the editor."""
self.ClearAll()
def prompt(self):
"""Display appropriate prompt for the context, either ps1 or ps2.
If this is a continuation line, autoindent as necessary.
"""
if self.more:
prompt = str(sys.ps2)
else:
prompt = str(sys.ps1)
pos = self.GetCurLine()[1]
if pos > 0: self.write('\n')
self.promptPos[0] = self.GetCurrentPos()
self.write(prompt)
self.promptPos[1] = self.GetCurrentPos()
# XXX Add some autoindent magic here if more.
if self.more:
self.write('\t') # Temporary hack indentation.
self.EnsureCaretVisible()
self.ScrollToColumn(0)
def readIn(self):
"""Replacement for stdin."""
prompt = 'Please enter your response:'
dialog = wxTextEntryDialog(None, prompt, \
'Input Dialog (Standard)', '')
try:
if dialog.ShowModal() == wxID_OK:
text = dialog.GetValue()
self.write(text + '\n')
return text
finally:
dialog.Destroy()
return ''
def readRaw(self, prompt='Please enter your response:'):
"""Replacement for raw_input."""
dialog = wxTextEntryDialog(None, prompt, \
'Input Dialog (Raw)', '')
try:
if dialog.ShowModal() == wxID_OK:
text = dialog.GetValue()
return text
finally:
dialog.Destroy()
return ''
def write(self, text):
"""Display text in the editor."""
self.AddText(text)
self.EnsureCaretVisible()
#self.ScrollToColumn(0)
def writeOut(self, text):
"""Replacement for stdout."""
self.write(text)
def writeErr(self, text):
"""Replacement for stderr."""
self.write(text)
def CanCut(self):
"""Return true if text is selected and can be cut."""
return self.GetSelectionStart() != self.GetSelectionEnd()
def CanCopy(self):
"""Return true if text is selected and can be copied."""
return self.GetSelectionStart() != self.GetSelectionEnd()

View File

@ -0,0 +1,81 @@
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
import os
import sys
from code import InteractiveInterpreter
import introspect
class Interpreter(InteractiveInterpreter):
"""PyCrust Interpreter based on code.InteractiveInterpreter."""
revision = __version__
def __init__(self, locals=None, rawin=None,
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
"""Create an interactive interpreter object."""
InteractiveInterpreter.__init__(self, locals=locals)
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
if rawin is not None:
import __builtin__
__builtin__.raw_input = rawin
del __builtin__
copyright = 'Type "copyright", "credits" or "license" for more information.'
self.introText = 'Python %s on %s\n%s' % \
(sys.version, sys.platform, copyright)
try:
sys.ps1
except AttributeError:
sys.ps1 = '>>> '
try:
sys.ps2
except AttributeError:
sys.ps2 = '... '
self.more = 0
self.commandBuffer = [] # List of lists to support recursive push().
self.commandHistory = []
self.startupScript = os.environ.get('PYTHONSTARTUP')
def push(self, command):
"""Send command to the interpreter to be executed.
Because this may be called recursively, we append a new list
onto the commandBuffer list and then append commands into that.
If the passed in command is part of a multi-line command we keep
appending the pieces to the last list in commandBuffer until we
have a complete command, then, finally, we delete that last list.
"""
if not self.more: self.commandBuffer.append([])
self.commandBuffer[-1].append(command)
source = '\n'.join(self.commandBuffer[-1])
self.more = self.runsource(source)
if not self.more: del self.commandBuffer[-1]
return self.more
def runsource(self, source):
"""Compile and run source code in the interpreter."""
stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
sys.stdin = self.stdin
sys.stdout = self.stdout
sys.stderr = self.stderr
more = InteractiveInterpreter.runsource(self, source)
sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
return more
def getAutoCompleteList(self, command=''):
"""Return list of auto-completion options for a command.
The list of options will be based on the locals namespace."""
return introspect.getAutoCompleteList(command, self.locals)
def getCallTip(self, command=''):
"""Return call tip text for a command.
The call tip information will be based on the locals namespace."""
return introspect.getCallTip(command, self.locals)

View File

@ -0,0 +1,180 @@
"""
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
import os
from PyCrustVersion import version
class Shell:
"""PyCrust Shell manages the Editor and Interpreter."""
name = 'PyCrust Shell'
revision = __version__
def __init__(self, editorParent=None, introText='', editor=None, interp=None):
"""Create a PyCrust shell object to manage the editor and interpreter."""
try:
eval('crap')
except:
pass
self.introText = introText
# Create a default editor if one isn't provided.
if editor == None:
from PyCrustEditor import Editor
self.editor = Editor(editorParent, id=-1)
else:
self.editor = editor
# Link the editor to the shell so that the shell is a conduit for
# pushing commands to the interpreter.
self.editor.shellPush = self.shellPush
# Create a default interpreter if one isn't provided.
if interp == None:
from PyCrustInterp import Interpreter
from pseudo import PseudoFileIn, PseudoFileOut, PseudoFileErr
self.stdin = PseudoFileIn(self.editor.readIn)
self.stdout = PseudoFileOut(self.editor.writeOut)
self.stderr = PseudoFileErr(self.editor.writeErr)
# Override the default locals so we have something interesting.
locals = {'__name__': 'PyCrust',
'__doc__': 'PyCrust, The Python Shell.',
'__version__': version,
}
self.interp = Interpreter(locals=locals,
rawin=self.editor.readRaw,
stdin=self.stdin,
stdout=self.stdout,
stderr=self.stderr)
else:
self.interp = interp
# XXX redo this using hasattr() or something so that we can link
# these if a provided editor has this method.
if editor == None or editor == self:
# Override so the auto complete list comes from the interpreter.
self.editor.getAutoCompleteList = self.interp.getAutoCompleteList
# Override so the call tip comes from the interpreter.
self.editor.getCallTip = self.interp.getCallTip
# Keep track of whether the interpreter needs more.
self.more = 0
try:
self.showIntro(self.introText)
except:
pass
try:
self.setBuiltinKeywords()
except:
pass
try:
self.setLocalShell()
except:
pass
# Do this last so the user has complete control over their
# environment. They can override anything they want.
try:
self.execStartupScript(self.interp.startupScript)
except:
pass
def destroy(self):
del self.editor
del self.stdin
del self.stdout
del self.stderr
del self.interp
def showIntro(self, text=''):
"""Display introductory text in the shell editor."""
if text:
if text[-1] != '\n': text += '\n'
self.editor.write(text)
try:
self.editor.write(self.interp.introText)
except AttributeError:
pass
def setBuiltinKeywords(self):
"""Create pseudo keywords as part of builtins.
This is a rather clever hack that sets "close", "exit" and "quit"
to a PseudoKeyword object so that we can make them do what we want.
In this case what we want is to call our self.quit() method.
The user can type "close", "exit" or "quit" without the final parens.
"""
import __builtin__
from pseudo import PseudoKeyword
__builtin__.close = __builtin__.exit = __builtin__.quit = \
PseudoKeyword(self.quit)
def quit(self):
"""Quit the application."""
# XXX Good enough for now but later we want to send a close event.
# In the close event handler we can prompt to make sure they want to quit.
# Other applications, like PythonCard, may choose to hide rather than
# quit so we should just post the event and let the surrounding app
# decide what it wants to do.
self.editor.write('Click on the close button to leave the application.')
def setLocalShell(self):
"""Add 'shell' to locals."""
self.interp.locals['shell'] = self
def execStartupScript(self, startupScript):
"""Execute the user's PYTHONSTARTUP script if they have one."""
if startupScript and os.path.isfile(startupScript):
startupText = 'Startup script executed: ' + startupScript
self.editor.push('print %s;execfile(%s)' % \
(`startupText`, `startupScript`))
else:
self.editor.push('')
def run(self, command, prompt=1, verbose=1):
"""Execute command within the shell as if it was typed in directly.
>>> shell.run('print "this"')
>>> print "this"
this
>>>
"""
command = command.rstrip()
if prompt: self.editor.prompt()
if verbose: self.editor.write(command)
self.editor.push(command)
def runfile(self, filename):
"""Execute all commands in file as if they were typed into the shell."""
file = open(filename)
try:
self.editor.prompt()
for command in file.readlines():
if command[:6] == 'shell.': # Run shell methods silently.
self.run(command, prompt=0, verbose=0)
else:
self.run(command, prompt=0, verbose=1)
finally:
file.close()
def push(self, command):
"""Send command to the interpreter for execution."""
self.more = self.interp.push(command)
return self.more
shellPush = push
def ask(self, prompt='Please enter your response:'):
"""Get response from the user."""
return raw_input(prompt=prompt)
def pause(self):
"""Halt execution pending a response from the user."""
self.ask('Press enter to continue:')
def clear(self):
"""Delete all text from the shell editor."""
self.editor.clear()

View File

@ -0,0 +1,10 @@
"""Provides an object representing the current "version" or "release" of
PyCrust as a whole. Individual classes, such as the shell, editor and
interpreter, each have a revision property based on the CVS $Revision$."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
version = '0.5'

View File

@ -0,0 +1 @@
# Orbtech python package.

View File

@ -0,0 +1,140 @@
"""Provides a variety of introspective-type support functions for things
like call tips and command auto completion."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "August 8, 2001"
__version__ = "$Revision$"[11:-2]
import inspect
import string
def getAutoCompleteList(command='', locals=None):
"""Return list of auto-completion options for command.
The list of options will be based on the locals namespace."""
# Get the proper chunk of code from the command.
root = getRoot(command, terminator='.')
try:
object = eval(root, locals)
attributes = getAttributes(object)
return attributes
except:
return []
def getAttributes(object):
"""Return list of unique attributes, including inherited, for an object."""
attributes = []
dict = {}
# Remove duplicates from the attribute list.
for item in getAllAttributes(object):
dict[item] = None
attributes += dict.keys()
attributes.sort()
return attributes
def getAllAttributes(object):
"""Return list of all attributes, including inherited, for an object.
Recursively walk through a class and all base classes.
"""
attributes = []
try:
attributes += dir(object)
if hasattr(object, '__class__'):
attributes += getAllAttributes(object.__class__)
if hasattr(object, '__bases__'):
for base in object.__bases__:
attributes += getAllAttributes(base)
finally:
return attributes
def getCallTip(command='', locals=None):
"""Return call tip text for a command.
The call tip information will be based on the locals namespace."""
# Get the proper chunk of code from the command.
root = getRoot(command, terminator='(')
try:
object = eval(root, locals)
except:
return ''
dropSelf = 0
if hasattr(object, '__name__'): # Make sure this is a useable object.
# Switch to the object that has the information we need.
if inspect.ismethod(object):
# Get the function from the object otherwise inspec.getargspec()
# complains that the object isn't a Python function.
object = object.im_func
dropSelf = 1
elif inspect.isclass(object):
# Get the __init__ method for the class.
try:
object = object.__init__.im_func
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__
if inspect.isbuiltin(object):
# Builtin functions don't have an argspec that we can get.
tip1 = ''
else:
# tip1 is a string like: "getCallTip(command='', locals=None)"
argspec = apply(inspect.formatargspec, inspect.getargspec(object))
if dropSelf:
# The first parameter to a method is a reference to the
# instance, usually coded as "self", and is passed
# automatically by Python and therefore we want to drop it.
temp = argspec.split(',')
if len(temp) == 1: # No other arguments.
argspec = '()'
else: # Drop the first argument.
argspec = '(' + ','.join(temp[1:]).lstrip()
tip1 = name + argspec
doc = inspect.getdoc(object)
if doc:
# tip2 is the first separated line of the docstring, like:
# "Return call tip text for a command."
# tip3 is the rest of the docstring, like:
# "The call tip information will be based on ... <snip>
docpieces = doc.split('\n\n')
tip2 = docpieces[0]
tip3 = '\n\n'.join(docpieces[1:])
tip = '%s\n\n%s\n\n%s' % (tip1, tip2, tip3)
else:
tip = tip1
return tip.strip()
else:
return ''
def getRoot(command, terminator=None):
"""Return the rightmost root portion of an arbitrary Python command.
The command would normally terminate with a "(" or ".". Anything after
the terminator will be dropped, allowing you to get back to the root.
"""
root = ''
validChars = "._" + string.uppercase + string.lowercase + string.digits
# Remove all whitespace from the command.
command = ''.join(command.split())
# Deal with the terminator.
if terminator:
pieces = command.split(terminator)
if len(pieces) > 1:
# Drop the final terminator and anything that follows.
command = terminator.join(pieces[:-1])
# Go backward through the command until we hit an "invalid" character.
i = len(command)
while i and command[i-1] in validChars:
i -= 1
# Grab everything from the "invalid" character to the end.
root = command[i:]
return root

View File

@ -0,0 +1,90 @@
"""Provides a variety of classes to create pseudo keywords and pseudo files."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__date__ = "July 1, 2001"
__version__ = "$Revision$"[11:-2]
class PseudoKeyword:
"""A callable class that calls a method passed as a parameter.
Good for creating a pseudo keyword in the python runtime
environment. The keyword is really an object that has a repr()
that calls itself which calls the method that was passed in the
init of the object. All this just to avoid having to type in the
closing parens on a method. So, for example:
>>> quit = PseudoKeyword(SomeObject.someMethod)
>>> quit
SomeObject.someMethod gets executed as if it had been called
directly and the user didn't have to type the parens, like
"quit()". This technique is most applicable for pseudo keywords
like quit, exit and help.
If SomeObject.someMethod can take parameters, they can still be
passed by using the keyword in the traditional way with parens.
"""
def __init__(self, method):
"""Create a callable object that executes method when called."""
# XXX Should probably check that this is a callable object.
self.method = method
def __call__(self, *args, **kwds):
self.method(*args, **kwds)
def __repr__(self):
self()
return ''
class PseudoFile:
def __init__(self):
"""Create a file-like object."""
pass
def readline(self):
pass
def write(self, s):
pass
def writelines(self, l):
map(self.write, l)
def flush(self):
pass
def isatty(self):
pass
class PseudoFileIn(PseudoFile):
def __init__(self, readline):
self.readline = readline
def isatty(self):
return 1
class PseudoFileOut(PseudoFile):
def __init__(self, write):
self.write = write
def isatty(self):
return 1
class PseudoFileErr(PseudoFile):
def __init__(self, write):
self.write = write
def isatty(self):
return 1

View File

@ -20,6 +20,10 @@ There is still much to be done to improve this class, such as line
buffering/recall, autoindent, calltips, autocomplete, fixing the colourizer,
etc... But it's a good start.
8-10-2001 THIS MODULE IS NOW DEPRECATED. Please see the most excellent
PyCrust package instead.
"""

View File

@ -17,11 +17,14 @@ History:
input prompts and output styles added to customized demo
some html cleanups
04-oct-1999 [rpd] Changed to use the new sizers
05-oct-1990 [als] changes inspired by code.InteractiveInterpreter()
05-oct-1999 [als] changes inspired by code.InteractiveInterpreter()
from Python Library. if i knew about this class earlier,
i would rather inherit from it.
renamed to wxPyShell.py since i've renounced the 8.3 scheme
8-10-2001 THIS MODULE IS NOW DEPRECATED. Please see the most excellent
PyCrust package instead.
"""
__version__ ="$Revision$"
# $RCSfile$