Initial version
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
767
utils/wxPython/src/_extras.py
Normal file
767
utils/wxPython/src/_extras.py
Normal file
@@ -0,0 +1,767 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: _extra.py
|
||||
# Purpose: This file is appended to the shadow class file generated
|
||||
# by SWIG. We add some unSWIGable things here.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 6/30/97
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# This gives this module's dictionary to the C++ extension code...
|
||||
|
||||
_wxSetDictionary(vars())
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
# Helper function to link python methods to wxWindows virtual
|
||||
# functions by name.
|
||||
|
||||
def _checkForCallback(obj, name, event, theID=-1):
|
||||
try: cb = getattr(obj, name)
|
||||
except: pass
|
||||
else: obj.Connect(theID, -1, event, cb)
|
||||
|
||||
def _StdWindowCallbacks(win):
|
||||
_checkForCallback(win, "OnChar", wxEVT_CHAR)
|
||||
_checkForCallback(win, "OnSize", wxEVT_SIZE)
|
||||
_checkForCallback(win, "OnEraseBackground", wxEVT_ERASE_BACKGROUND)
|
||||
_checkForCallback(win, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED)
|
||||
_checkForCallback(win, "OnInitDialog", wxEVT_INIT_DIALOG)
|
||||
_checkForCallback(win, "OnIdle", wxEVT_IDLE)
|
||||
_checkForCallback(win, "OnPaint", wxEVT_PAINT)
|
||||
|
||||
def _StdFrameCallbacks(win):
|
||||
_StdWindowCallbacks(win)
|
||||
_checkForCallback(win, "OnActivate", wxEVT_ACTIVATE)
|
||||
_checkForCallback(win, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT)
|
||||
_checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW)
|
||||
|
||||
|
||||
def _StdOnScrollCallback(win):
|
||||
try: cb = getattr(win, "OnScroll")
|
||||
except: pass
|
||||
else: EVT_SCROLL(win, cb)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
# functions that look and act like the C++ Macros of the same name
|
||||
|
||||
|
||||
# Miscellaneous
|
||||
def EVT_SIZE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SIZE, func)
|
||||
|
||||
def EVT_MOVE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MOVE, func)
|
||||
|
||||
def EVT_CLOSE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_CLOSE_WINDOW, func)
|
||||
|
||||
def EVT_PAINT(win, func):
|
||||
win.Connect(-1, -1, wxEVT_PAINT, func)
|
||||
|
||||
def EVT_ERASE_BACKGROUND(win, func):
|
||||
win.Connect(-1, -1, wxEVT_ERASE_BACKGROUND, func)
|
||||
|
||||
def EVT_CHAR(win, func):
|
||||
win.Connect(-1, -1, wxEVT_CHAR, func)
|
||||
|
||||
def EVT_CHAR_HOOK(win, func):
|
||||
win.Connect(-1, -1, wxEVT_CHAR_HOOK, func)
|
||||
|
||||
def EVT_MENU_HIGHLIGHT(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, func)
|
||||
|
||||
def EVT_MENU_HIGHLIGHT_ALL(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT, func)
|
||||
|
||||
def EVT_SET_FOCUS(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SET_FOCUS, func)
|
||||
|
||||
def EVT_KILL_FOCUS(win, func):
|
||||
win.Connect(-1, -1, wxEVT_KILL_FOCUS, func)
|
||||
|
||||
def EVT_ACTIVATE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_ACTIVATE, func)
|
||||
|
||||
def EVT_ACTIVATE_APP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_ACTIVATE_APP, func)
|
||||
|
||||
def EVT_END_SESSION(win, func):
|
||||
win.Connect(-1, -1, wxEVT_END_SESSION, func)
|
||||
|
||||
def EVT_QUERY_END_SESSION(win, func):
|
||||
win.Connect(-1, -1, wxEVT_QUERY_END_SESSION, func)
|
||||
|
||||
def EVT_DROP_FILES(win, func):
|
||||
win.Connect(-1, -1, wxEVT_DROP_FILES, func)
|
||||
|
||||
def EVT_INIT_DIALOG(win, func):
|
||||
win.Connect(-1, -1, wxEVT_INIT_DIALOG, func)
|
||||
|
||||
def EVT_SYS_COLOUR_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func)
|
||||
|
||||
def EVT_SHOW(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SHOW, func)
|
||||
|
||||
def EVT_MAXIMIZE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MAXIMIZE, func)
|
||||
|
||||
def EVT_ICONIZE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_ICONIZE, func)
|
||||
|
||||
def EVT_NAVIGATION_KEY(win, func):
|
||||
win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func)
|
||||
|
||||
|
||||
# Mouse Events
|
||||
def EVT_LEFT_DOWN(win, func):
|
||||
win.Connect(-1, -1, wxEVT_LEFT_DOWN, func)
|
||||
|
||||
def EVT_LEFT_UP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_LEFT_UP, func)
|
||||
|
||||
def EVT_MIDDLE_DOWN(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func)
|
||||
|
||||
def EVT_MIDDLE_UP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_UP, func)
|
||||
|
||||
def EVT_RIGHT_DOWN(win, func):
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func)
|
||||
|
||||
def EVT_RIGHT_UP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_UP, func)
|
||||
|
||||
def EVT_MOTION(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MOTION, func)
|
||||
|
||||
def EVT_LEFT_DCLICK(win, func):
|
||||
win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func)
|
||||
|
||||
def EVT_MIDDLE_DCLICK(win, func):
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func)
|
||||
|
||||
def EVT_RIGHT_DCLICK(win, func):
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func)
|
||||
|
||||
def EVT_LEAVE_WINDOW(win, func):
|
||||
win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func)
|
||||
|
||||
def EVT_ENTER_WINDOW(win, func):
|
||||
win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func)
|
||||
|
||||
|
||||
# all mouse events
|
||||
def EVT_MOUSE_EVENTS(win, func):
|
||||
win.Connect(-1, -1, wxEVT_LEFT_DOWN, func)
|
||||
win.Connect(-1, -1, wxEVT_LEFT_UP, func)
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func)
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_UP, func)
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func)
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_UP, func)
|
||||
win.Connect(-1, -1, wxEVT_MOTION, func)
|
||||
win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func)
|
||||
win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func)
|
||||
win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func)
|
||||
win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func)
|
||||
win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func)
|
||||
|
||||
# EVT_COMMAND
|
||||
def EVT_COMMAND(win, id, cmd, func):
|
||||
win.Connect(id, -1, cmd, func)
|
||||
|
||||
def EVT_COMMAND_RANGE(win, id1, id2, cmd, func):
|
||||
win.Connect(id1, id2, cmd, func)
|
||||
|
||||
# Scrolling
|
||||
def EVT_SCROLL(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_TOP, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func)
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK,func)
|
||||
|
||||
def EVT_SCROLL_TOP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_TOP, func)
|
||||
|
||||
def EVT_SCROLL_BOTTOM(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func)
|
||||
|
||||
def EVT_SCROLL_LINEUP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func)
|
||||
|
||||
def EVT_SCROLL_LINEDOWN(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func)
|
||||
|
||||
def EVT_SCROLL_PAGEUP(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func)
|
||||
|
||||
def EVT_SCROLL_PAGEDOWN(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func)
|
||||
|
||||
def EVT_SCROLL_THUMBTRACK(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK, func)
|
||||
|
||||
|
||||
|
||||
# Scrolling, with an id
|
||||
def EVT_COMMAND_SCROLL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_TOP, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func)
|
||||
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_TOP(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_TOP, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_BOTTOM(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_LINEUP(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_LINEDOWN(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_PAGEUP(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_PAGEDOWN(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func)
|
||||
|
||||
def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK, func)
|
||||
|
||||
|
||||
# Convenience commands
|
||||
def EVT_BUTTON(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED, func)
|
||||
|
||||
def EVT_CHECKBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, func)
|
||||
|
||||
def EVT_CHOICE(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED, func)
|
||||
|
||||
def EVT_LISTBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED, func)
|
||||
|
||||
def EVT_LISTBOX_DCLICK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, func)
|
||||
|
||||
def EVT_TEXT(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED, func)
|
||||
|
||||
def EVT_TEXT_ENTER(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER, func)
|
||||
|
||||
def EVT_MENU(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func)
|
||||
|
||||
def EVT_MENU_RANGE(win, id1, id2, func):
|
||||
win.Connect(id1, id2, wxEVT_COMMAND_MENU_SELECTED, func)
|
||||
|
||||
def EVT_SLIDER(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED, func)
|
||||
|
||||
def EVT_RADIOBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED, func)
|
||||
|
||||
def EVT_RADIOBUTTON(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED, func)
|
||||
|
||||
def EVT_VLBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED, func)
|
||||
|
||||
def EVT_COMBOBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED, func)
|
||||
|
||||
def EVT_TOOL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func)
|
||||
|
||||
def EVT_TOOL_RCLICKED(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func)
|
||||
|
||||
def EVT_TOOL_ENTER(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER, func)
|
||||
|
||||
def EVT_CHECKLISTBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, func)
|
||||
|
||||
|
||||
# Generic command events
|
||||
|
||||
def EVT_COMMAND_LEFT_CLICK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK, func)
|
||||
|
||||
def EVT_COMMAND_LEFT_DCLICK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK, func)
|
||||
|
||||
def EVT_COMMAND_RIGHT_CLICK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK, func)
|
||||
|
||||
def EVT_COMMAND_RIGHT_DCLICK(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK, func)
|
||||
|
||||
def EVT_COMMAND_SET_FOCUS(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS, func)
|
||||
|
||||
def EVT_COMMAND_KILL_FOCUS(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS, func)
|
||||
|
||||
def EVT_COMMAND_ENTER(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_ENTER, func)
|
||||
|
||||
|
||||
|
||||
def EVT_NOTEBOOK_PAGE_CHANGED(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, func)
|
||||
|
||||
def EVT_NOTEBOOK_PAGE_CHANGING(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
# We need to add to the shadow classes a bit to facilitate callbacks via
|
||||
# virtual functions. These classes replace the shadows generated by SWIG.
|
||||
|
||||
class wxWindow(wxWindowPtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxWindow,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
|
||||
class wxFrame(wxFramePtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxFrame,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdFrameCallbacks(self)
|
||||
|
||||
|
||||
class wxMiniFrame(wxMiniFramePtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxMiniFrame,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdFrameCallbacks(self)
|
||||
|
||||
|
||||
class wxPanel(wxPanelPtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxPanel,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
|
||||
class wxDialog(wxDialogPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxDialog,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
_checkForCallback(self, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK)
|
||||
_checkForCallback(self, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY)
|
||||
_checkForCallback(self, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL)
|
||||
_checkForCallback(self, "OnCloseWindow", wxEVT_CLOSE_WINDOW)
|
||||
_checkForCallback(self, "OnCharHook", wxEVT_CHAR_HOOK)
|
||||
|
||||
|
||||
class wxScrolledWindow(wxScrolledWindowPtr):
|
||||
def __init__(self,arg0,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
try: argl[2] = argl[2].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(windowsc.new_wxScrolledWindow,(arg0.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
_StdOnScrollCallback(self)
|
||||
|
||||
|
||||
|
||||
class wxMDIParentFrame(wxMDIParentFramePtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(mdic.new_wxMDIParentFrame,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdFrameCallbacks(self)
|
||||
|
||||
|
||||
class wxMDIChildFrame(wxMDIChildFramePtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(mdic.new_wxMDIChildFrame,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdFrameCallbacks(self)
|
||||
|
||||
|
||||
class wxMDIClientWindow(wxMDIClientWindowPtr):
|
||||
def __init__(self,arg0,*args) :
|
||||
self.this = apply(mdic.new_wxMDIClientWindow,(arg0.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
_StdOnScrollCallback(self)
|
||||
|
||||
|
||||
|
||||
class wxControl(wxControlPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxButton(wxButtonPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxButton,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxBitmapButton(wxBitmapButtonPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxBitmapButton,(arg0.this,arg1,arg2.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxCheckBox(wxCheckBoxPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxCheckBox,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
|
||||
|
||||
class wxChoice(wxChoicePtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxChoice,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxComboBox(wxComboBoxPtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
try: argl[2] = argl[2].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxComboBox,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxGauge(wxGaugePtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxGauge,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxStaticBox(wxStaticBoxPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxStaticBox,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxStaticText(wxStaticTextPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxStaticText,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxListBox(wxListBoxPtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxListBox,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxTextCtrl(wxTextCtrlPtr):
|
||||
def __init__(self,arg0,arg1,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
try: argl[2] = argl[2].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxTextCtrl,(arg0.this,arg1,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxScrollBar(wxScrollBarPtr):
|
||||
def __init__(self,arg0,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
try: argl[2] = argl[2].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxScrollBar,(arg0.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxSpinButton(wxSpinButtonPtr):
|
||||
def __init__(self,arg0,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
try: argl[2] = argl[2].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxSpinButton,(arg0.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxStaticBitmap(wxStaticBitmapPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxStaticBitmap,(arg0.this,arg1,arg2.this,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxRadioBox(wxRadioBoxPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxRadioBox,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxRadioButton(wxRadioButtonPtr):
|
||||
def __init__(self,arg0,arg1,arg2,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxRadioButton,(arg0.this,arg1,arg2,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
class wxSlider(wxSliderPtr):
|
||||
def __init__(self,arg0,arg1,arg2,arg3,arg4,*args) :
|
||||
argl = map(None,args)
|
||||
try: argl[0] = argl[0].this
|
||||
except: pass
|
||||
try: argl[1] = argl[1].this
|
||||
except: pass
|
||||
args = tuple(argl)
|
||||
self.this = apply(controlsc.new_wxSlider,(arg0.this,arg1,arg2,arg3,arg4,)+args)
|
||||
self.thisown = 1
|
||||
_StdWindowCallbacks(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class wxTimer(wxPyTimer):
|
||||
def __init__(self):
|
||||
wxPyTimer.__init__(self, self.Notify) # derived class must provide
|
||||
# Notify(self) method.
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Some wxWin methods can take "NULL" as parameters, but the shadow classes
|
||||
# expect an object with the SWIG pointer as a 'this' member. This class
|
||||
# and instance fools the shadow into passing the NULL pointer.
|
||||
|
||||
class NullObj:
|
||||
this = 'NULL' # SWIG converts this to (void*)0
|
||||
|
||||
NULL = NullObj()
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# aliases
|
||||
|
||||
wxColor = wxColour
|
||||
wxNamedColor = wxNamedColour
|
||||
|
||||
wxPyDefaultPosition.Set(-1,-1)
|
||||
wxPyDefaultSize.Set(-1,-1)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
## class wxPyStdOutWindow(wxFrame):
|
||||
## def __init__(self, title = "wxPython: stdout/stderr"):
|
||||
## wxFrame.__init__(self, NULL, title)
|
||||
## self.title = title
|
||||
## self.text = wxTextWindow(self)
|
||||
## self.text.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxBOLD))
|
||||
## self.SetSize(-1,-1,400,200)
|
||||
## self.Show(false)
|
||||
## self.isShown = false
|
||||
|
||||
## def write(self, str): # with this method,
|
||||
## if not self.isShown:
|
||||
## self.Show(true)
|
||||
## self.isShown = true
|
||||
## self.text.WriteText(str)
|
||||
|
||||
## def OnCloseWindow(self, event): # doesn't allow the window to close, just hides it
|
||||
## self.Show(false)
|
||||
## self.isShown = false
|
||||
|
||||
|
||||
_defRedirect = (wxPlatform == '__WIN32__')
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# The main application class. Derive from this and implement an OnInit
|
||||
# method that creates a frame and then calls self.SetTopWindow(frame)
|
||||
|
||||
class wxApp(wxPyApp):
|
||||
error = 'wxApp.error'
|
||||
|
||||
def __init__(self, redirect=_defRedirect, filename=None):
|
||||
wxPyApp.__init__(self)
|
||||
self.stdioWin = None
|
||||
self.saveStdio = (sys.stdout, sys.stderr)
|
||||
if redirect:
|
||||
self.RedirectStdio(filename)
|
||||
|
||||
# this initializes wxWindows and then calls our OnInit
|
||||
_wxStart(self.OnInit)
|
||||
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.RestoreStdio()
|
||||
except:
|
||||
pass
|
||||
|
||||
def RedirectStdio(self, filename):
|
||||
if filename:
|
||||
sys.stdout = sys.stderr = open(filename, 'a')
|
||||
else:
|
||||
raise self.error, 'wxPyStdOutWindow not yet implemented.'
|
||||
#self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow()
|
||||
|
||||
def RestoreStdio(self):
|
||||
sys.stdout, sys.stderr = self.saveStdio
|
||||
if self.stdioWin != None:
|
||||
self.stdioWin.Show(false)
|
||||
self.stdioWin.Destroy()
|
||||
self.stdioWin = None
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.1 1998/08/09 08:25:49 RD
|
||||
# Initial version
|
||||
#
|
||||
#
|
||||
|
Reference in New Issue
Block a user