from gdi import *
+from fonts import *
+
from clip_dnd import *
from events import *
from streams import *
+from utils import *
+
from mdi import *
from frames import *
from sizers import *
from filesys import *
-
-from utils import *
class wxPyAppPtr(wxEvtHandlerPtr):
def __init__(self,this):
self.this = this
def SetUseBestVisual(self, *_args, **_kwargs):
val = apply(wxc.wxPyApp_SetUseBestVisual,(self,) + _args, _kwargs)
return val
- def GetStdIcon(self, *_args, **_kwargs):
- val = apply(wxc.wxPyApp_GetStdIcon,(self,) + _args, _kwargs)
- if val: val = wxIconPtr(val) ; val.thisown = 1
- return val
def __repr__(self):
return "<C wxPyApp instance at %s>" % (self.this,)
class wxPyApp(wxPyAppPtr):
wxBORDER = wxc.wxBORDER
wxSIMPLE_BORDER = wxc.wxSIMPLE_BORDER
wxSTATIC_BORDER = wxc.wxSTATIC_BORDER
-wxBORDER_MASK = wxc.wxBORDER_MASK
wxTRANSPARENT_WINDOW = wxc.wxTRANSPARENT_WINDOW
wxNO_BORDER = wxc.wxNO_BORDER
wxUSER_COLOURS = wxc.wxUSER_COLOURS
wxCLIP_SIBLINGS = wxc.wxCLIP_SIBLINGS
wxRETAINED = wxc.wxRETAINED
wxBACKINGSTORE = wxc.wxBACKINGSTORE
-wxTB_3DBUTTONS = wxc.wxTB_3DBUTTONS
wxTB_HORIZONTAL = wxc.wxTB_HORIZONTAL
wxTB_VERTICAL = wxc.wxTB_VERTICAL
+wxTB_3DBUTTONS = wxc.wxTB_3DBUTTONS
wxTB_FLAT = wxc.wxTB_FLAT
wxTB_DOCKABLE = wxc.wxTB_DOCKABLE
+wxTB_NOICONS = wxc.wxTB_NOICONS
+wxTB_TEXT = wxc.wxTB_TEXT
+wxTB_NODIVIDER = wxc.wxTB_NODIVIDER
+wxTB_NOALIGN = wxc.wxTB_NOALIGN
wxCOLOURED = wxc.wxCOLOURED
wxFIXED_LENGTH = wxc.wxFIXED_LENGTH
wxALIGN_LEFT = wxc.wxALIGN_LEFT
wxLB_HSCROLL = wxc.wxLB_HSCROLL
wxPROCESS_ENTER = wxc.wxPROCESS_ENTER
wxPASSWORD = wxc.wxPASSWORD
-wxTE_PROCESS_ENTER = wxc.wxTE_PROCESS_ENTER
-wxTE_PROCESS_TAB = wxc.wxTE_PROCESS_TAB
-wxTE_PASSWORD = wxc.wxTE_PASSWORD
wxTE_READONLY = wxc.wxTE_READONLY
-wxTE_RICH = wxc.wxTE_RICH
wxTE_MULTILINE = wxc.wxTE_MULTILINE
-wxTE_AUTO_SCROLL = wxc.wxTE_AUTO_SCROLL
+wxTE_PROCESS_TAB = wxc.wxTE_PROCESS_TAB
+wxTE_RICH = wxc.wxTE_RICH
+wxTE_RICH2 = wxc.wxTE_RICH2
wxTE_NO_VSCROLL = wxc.wxTE_NO_VSCROLL
+wxTE_AUTO_SCROLL = wxc.wxTE_AUTO_SCROLL
+wxTE_PROCESS_ENTER = wxc.wxTE_PROCESS_ENTER
+wxTE_PASSWORD = wxc.wxTE_PASSWORD
wxTE_AUTO_URL = wxc.wxTE_AUTO_URL
+wxTE_NOHIDESEL = wxc.wxTE_NOHIDESEL
+wxTE_DONTWRAP = wxc.wxTE_DONTWRAP
+wxTE_LINEWRAP = wxc.wxTE_LINEWRAP
+wxTE_WORDWRAP = wxc.wxTE_WORDWRAP
wxCB_SIMPLE = wxc.wxCB_SIMPLE
wxCB_DROPDOWN = wxc.wxCB_DROPDOWN
wxCB_SORT = wxc.wxCB_SORT
wxSB_VERTICAL = wxc.wxSB_VERTICAL
wxST_SIZEGRIP = wxc.wxST_SIZEGRIP
wxST_NO_AUTORESIZE = wxc.wxST_NO_AUTORESIZE
-wxBU_AUTODRAW = wxc.wxBU_AUTODRAW
wxBU_NOAUTODRAW = wxc.wxBU_NOAUTODRAW
+wxBU_AUTODRAW = wxc.wxBU_AUTODRAW
+wxBU_LEFT = wxc.wxBU_LEFT
+wxBU_TOP = wxc.wxBU_TOP
+wxBU_RIGHT = wxc.wxBU_RIGHT
+wxBU_BOTTOM = wxc.wxBU_BOTTOM
+wxBU_EXACTFIT = wxc.wxBU_EXACTFIT
wxSP_VERTICAL = wxc.wxSP_VERTICAL
wxSP_HORIZONTAL = wxc.wxSP_HORIZONTAL
wxSP_ARROW_KEYS = wxc.wxSP_ARROW_KEYS
wxID_HELP_COMMANDS = wxc.wxID_HELP_COMMANDS
wxID_HELP_PROCEDURES = wxc.wxID_HELP_PROCEDURES
wxID_HELP_CONTEXT = wxc.wxID_HELP_CONTEXT
+wxID_CLOSE_ALL = wxc.wxID_CLOSE_ALL
wxID_CUT = wxc.wxID_CUT
wxID_COPY = wxc.wxID_COPY
wxID_PASTE = wxc.wxID_PASTE
wxID_YES = wxc.wxID_YES
wxID_NO = wxc.wxID_NO
wxID_STATIC = wxc.wxID_STATIC
-wxID_SEPARATOR = wxc.wxID_SEPARATOR
wxID_FORWARD = wxc.wxID_FORWARD
wxID_BACKWARD = wxc.wxID_BACKWARD
-wxID_SETUP = wxc.wxID_SETUP
+wxID_DEFAULT = wxc.wxID_DEFAULT
wxID_MORE = wxc.wxID_MORE
+wxID_SETUP = wxc.wxID_SETUP
+wxID_RESET = wxc.wxID_RESET
+wxID_CONTEXT_HELP = wxc.wxID_CONTEXT_HELP
+wxID_YESTOALL = wxc.wxID_YESTOALL
+wxID_NOTOALL = wxc.wxID_NOTOALL
+wxID_ABORT = wxc.wxID_ABORT
+wxID_RETRY = wxc.wxID_RETRY
+wxID_IGNORE = wxc.wxID_IGNORE
wxOPEN = wxc.wxOPEN
wxSAVE = wxc.wxSAVE
wxHIDE_READONLY = wxc.wxHIDE_READONLY
wxPD_ELAPSED_TIME = wxc.wxPD_ELAPSED_TIME
wxPD_ESTIMATED_TIME = wxc.wxPD_ESTIMATED_TIME
wxPD_REMAINING_TIME = wxc.wxPD_REMAINING_TIME
+wxDD_NEW_DIR_BUTTON = wxc.wxDD_NEW_DIR_BUTTON
+wxDD_DEFAULT_STYLE = wxc.wxDD_DEFAULT_STYLE
wxMENU_TEAROFF = wxc.wxMENU_TEAROFF
wxMB_DOCKABLE = wxc.wxMB_DOCKABLE
wxNO_FULL_REPAINT_ON_RESIZE = wxc.wxNO_FULL_REPAINT_ON_RESIZE
wxNB_MULTILINE = wxc.wxNB_MULTILINE
wxLI_HORIZONTAL = wxc.wxLI_HORIZONTAL
wxLI_VERTICAL = wxc.wxLI_VERTICAL
-wxHW_SCROLLBAR_NEVER = wxc.wxHW_SCROLLBAR_NEVER
-wxHW_SCROLLBAR_AUTO = wxc.wxHW_SCROLLBAR_AUTO
wxJOYSTICK1 = wxc.wxJOYSTICK1
wxJOYSTICK2 = wxc.wxJOYSTICK2
wxJOY_BUTTON1 = wxc.wxJOY_BUTTON1
wxJOY_BUTTON_ANY = wxc.wxJOY_BUTTON_ANY
wxWS_EX_VALIDATE_RECURSIVELY = wxc.wxWS_EX_VALIDATE_RECURSIVELY
wxWS_EX_BLOCK_EVENTS = wxc.wxWS_EX_BLOCK_EVENTS
+wxWS_EX_TRANSIENT = wxc.wxWS_EX_TRANSIENT
wxMM_TEXT = wxc.wxMM_TEXT
wxMM_LOMETRIC = wxc.wxMM_LOMETRIC
wxMM_HIMETRIC = wxc.wxMM_HIMETRIC
wxMM_ANISOTROPIC = wxc.wxMM_ANISOTROPIC
wxMM_POINTS = wxc.wxMM_POINTS
wxMM_METRIC = wxc.wxMM_METRIC
+wxTIMER_CONTINUOUS = wxc.wxTIMER_CONTINUOUS
+wxTIMER_ONE_SHOT = wxc.wxTIMER_ONE_SHOT
+wxBORDER_DEFAULT = wxc.wxBORDER_DEFAULT
+wxBORDER_NONE = wxc.wxBORDER_NONE
+wxBORDER_STATIC = wxc.wxBORDER_STATIC
+wxBORDER_SIMPLE = wxc.wxBORDER_SIMPLE
+wxBORDER_RAISED = wxc.wxBORDER_RAISED
+wxBORDER_SUNKEN = wxc.wxBORDER_SUNKEN
+wxBORDER_DOUBLE = wxc.wxBORDER_DOUBLE
+wxBORDER_MASK = wxc.wxBORDER_MASK
wxDEFAULT = wxc.wxDEFAULT
wxDECORATIVE = wxc.wxDECORATIVE
wxROMAN = wxc.wxROMAN
wxBITMAP_TYPE_PICT_RESOURCE = wxc.wxBITMAP_TYPE_PICT_RESOURCE
wxBITMAP_TYPE_ICON = wxc.wxBITMAP_TYPE_ICON
wxBITMAP_TYPE_ICON_RESOURCE = wxc.wxBITMAP_TYPE_ICON_RESOURCE
+wxBITMAP_TYPE_ANI = wxc.wxBITMAP_TYPE_ANI
+wxBITMAP_TYPE_IFF = wxc.wxBITMAP_TYPE_IFF
wxBITMAP_TYPE_MACCURSOR = wxc.wxBITMAP_TYPE_MACCURSOR
wxBITMAP_TYPE_MACCURSOR_RESOURCE = wxc.wxBITMAP_TYPE_MACCURSOR_RESOURCE
wxBITMAP_TYPE_ANY = wxc.wxBITMAP_TYPE_ANY
wxCURSOR_NONE = wxc.wxCURSOR_NONE
wxCURSOR_ARROW = wxc.wxCURSOR_ARROW
+wxCURSOR_RIGHT_ARROW = wxc.wxCURSOR_RIGHT_ARROW
wxCURSOR_BULLSEYE = wxc.wxCURSOR_BULLSEYE
wxCURSOR_CHAR = wxc.wxCURSOR_CHAR
wxCURSOR_CROSS = wxc.wxCURSOR_CROSS
wxDUPLEX_SIMPLEX = wxc.wxDUPLEX_SIMPLEX
wxDUPLEX_HORIZONTAL = wxc.wxDUPLEX_HORIZONTAL
wxDUPLEX_VERTICAL = wxc.wxDUPLEX_VERTICAL
+wxITEM_SEPARATOR = wxc.wxITEM_SEPARATOR
+wxITEM_NORMAL = wxc.wxITEM_NORMAL
+wxITEM_CHECK = wxc.wxITEM_CHECK
+wxITEM_RADIO = wxc.wxITEM_RADIO
+wxITEM_MAX = wxc.wxITEM_MAX
+wxHT_NOWHERE = wxc.wxHT_NOWHERE
+wxHT_SCROLLBAR_FIRST = wxc.wxHT_SCROLLBAR_FIRST
+wxHT_SCROLLBAR_ARROW_LINE_1 = wxc.wxHT_SCROLLBAR_ARROW_LINE_1
+wxHT_SCROLLBAR_ARROW_LINE_2 = wxc.wxHT_SCROLLBAR_ARROW_LINE_2
+wxHT_SCROLLBAR_ARROW_PAGE_1 = wxc.wxHT_SCROLLBAR_ARROW_PAGE_1
+wxHT_SCROLLBAR_ARROW_PAGE_2 = wxc.wxHT_SCROLLBAR_ARROW_PAGE_2
+wxHT_SCROLLBAR_THUMB = wxc.wxHT_SCROLLBAR_THUMB
+wxHT_SCROLLBAR_BAR_1 = wxc.wxHT_SCROLLBAR_BAR_1
+wxHT_SCROLLBAR_BAR_2 = wxc.wxHT_SCROLLBAR_BAR_2
+wxHT_SCROLLBAR_LAST = wxc.wxHT_SCROLLBAR_LAST
+wxHT_WINDOW_OUTSIDE = wxc.wxHT_WINDOW_OUTSIDE
+wxHT_WINDOW_INSIDE = wxc.wxHT_WINDOW_INSIDE
+wxHT_WINDOW_VERT_SCROLLBAR = wxc.wxHT_WINDOW_VERT_SCROLLBAR
+wxHT_WINDOW_HORZ_SCROLLBAR = wxc.wxHT_WINDOW_HORZ_SCROLLBAR
+wxHT_WINDOW_CORNER = wxc.wxHT_WINDOW_CORNER
+wxHT_MAX = wxc.wxHT_MAX
FALSE = wxc.FALSE
false = wxc.false
TRUE = wxc.TRUE
true = wxc.true
-wxVERSION_STRING = wxc.wxVERSION_STRING
wxEVT_NULL = wxc.wxEVT_NULL
wxEVT_FIRST = wxc.wxEVT_FIRST
wxEVT_COMMAND_BUTTON_CLICKED = wxc.wxEVT_COMMAND_BUTTON_CLICKED
wxEVT_COMMAND_TOOL_ENTER = wxc.wxEVT_COMMAND_TOOL_ENTER
wxEVT_SET_FOCUS = wxc.wxEVT_SET_FOCUS
wxEVT_KILL_FOCUS = wxc.wxEVT_KILL_FOCUS
+wxEVT_CHILD_FOCUS = wxc.wxEVT_CHILD_FOCUS
wxEVT_MOUSEWHEEL = wxc.wxEVT_MOUSEWHEEL
wxEVT_LEFT_DOWN = wxc.wxEVT_LEFT_DOWN
wxEVT_LEFT_UP = wxc.wxEVT_LEFT_UP
wxEVT_LEFT_DCLICK = wxc.wxEVT_LEFT_DCLICK
wxEVT_MIDDLE_DCLICK = wxc.wxEVT_MIDDLE_DCLICK
wxEVT_RIGHT_DCLICK = wxc.wxEVT_RIGHT_DCLICK
+wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED
wxEVT_NC_LEFT_DOWN = wxc.wxEVT_NC_LEFT_DOWN
wxEVT_NC_LEFT_UP = wxc.wxEVT_NC_LEFT_UP
wxEVT_NC_MIDDLE_DOWN = wxc.wxEVT_NC_MIDDLE_DOWN
wxEVT_NC_LEFT_DCLICK = wxc.wxEVT_NC_LEFT_DCLICK
wxEVT_NC_MIDDLE_DCLICK = wxc.wxEVT_NC_MIDDLE_DCLICK
wxEVT_NC_RIGHT_DCLICK = wxc.wxEVT_NC_RIGHT_DCLICK
+wxEVT_SET_CURSOR = wxc.wxEVT_SET_CURSOR
wxEVT_CHAR = wxc.wxEVT_CHAR
wxEVT_KEY_DOWN = wxc.wxEVT_KEY_DOWN
wxEVT_KEY_UP = wxc.wxEVT_KEY_UP
wxEVT_SHOW = wxc.wxEVT_SHOW
wxEVT_ICONIZE = wxc.wxEVT_ICONIZE
wxEVT_MAXIMIZE = wxc.wxEVT_MAXIMIZE
-wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED
wxEVT_PAINT = wxc.wxEVT_PAINT
wxEVT_ERASE_BACKGROUND = wxc.wxEVT_ERASE_BACKGROUND
wxEVT_NC_PAINT = wxc.wxEVT_NC_PAINT
wxEVT_PAINT_ICON = wxc.wxEVT_PAINT_ICON
-wxEVT_MENU_CHAR = wxc.wxEVT_MENU_CHAR
-wxEVT_MENU_INIT = wxc.wxEVT_MENU_INIT
+wxEVT_MENU_OPEN = wxc.wxEVT_MENU_OPEN
+wxEVT_MENU_CLOSE = wxc.wxEVT_MENU_CLOSE
wxEVT_MENU_HIGHLIGHT = wxc.wxEVT_MENU_HIGHLIGHT
-wxEVT_POPUP_MENU_INIT = wxc.wxEVT_POPUP_MENU_INIT
+wxEVT_CONTEXT_MENU = wxc.wxEVT_CONTEXT_MENU
wxEVT_SYS_COLOUR_CHANGED = wxc.wxEVT_SYS_COLOUR_CHANGED
+wxEVT_DISPLAY_CHANGED = wxc.wxEVT_DISPLAY_CHANGED
wxEVT_SETTING_CHANGED = wxc.wxEVT_SETTING_CHANGED
wxEVT_QUERY_NEW_PALETTE = wxc.wxEVT_QUERY_NEW_PALETTE
wxEVT_PALETTE_CHANGED = wxc.wxEVT_PALETTE_CHANGED
# Author: Robin Dunn
#
# Created: 6/30/97
-# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
def EVT_KEY_UP(win, func):
win.Connect(-1, -1, wxEVT_KEY_UP, func)
+def EVT_MENU_OPEN(win, func):
+ win.Connect(-1, -1, wxEVT_MENU_OPEN, func)
+
+def EVT_MENU_CLOSE(win, func):
+ win.Connect(-1, -1, wxEVT_MENU_CLOSE, func)
+
def EVT_MENU_HIGHLIGHT(win, id, func):
win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, func)
def EVT_KILL_FOCUS(win, func):
win.Connect(-1, -1, wxEVT_KILL_FOCUS, func)
+def EVT_CHILD_FOCUS(win, func):
+ win.Connect(-1, -1, wxEVT_CHILD_FOCUS, func)
+
def EVT_ACTIVATE(win, func):
win.Connect(-1, -1, wxEVT_ACTIVATE, func)
def EVT_SYS_COLOUR_CHANGED(win, func):
win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func)
+def EVT_DISPLAY_CHANGED(win, func):
+ win.Connect(-1, -1, wxEVT_DISPLAY_CHANGED, func)
+
def EVT_SHOW(win, func):
win.Connect(-1, -1, wxEVT_SHOW, func)
def EVT_WINDOW_DESTROY(win, func):
win.Connect(-1, -1, wxEVT_DESTROY, func)
+def EVT_SET_CURSOR(win, func):
+ win.Connect(-1, -1, wxEVT_SET_CURSOR, func)
+
def EVT_IDLE(win, func):
win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func)
win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func)
+def EVT_MOUSE_CAPTURE_CHANGED(win, func):
+ win.Connect(-1, -1, wxEVT_MOUSE_CAPTURE_CHANGED, func)
+
# EVT_COMMAND
def EVT_COMMAND(win, id, cmd, func):
win.Connect(id, -1, cmd, func)
-# Help events
-def EVT_HELP(win, id, func):
- win.Connect(id, -1, wxEVT_HELP, func)
-
-def EVT_HELP_RANGE(win, id, id2, func):
- win.Connect(id, id2, wxEVT_HELP, func)
-
-def EVT_DETAILED_HELP(win, id, func):
- win.Connect(id, -1, wxEVT_DETAILED_HELP, func)
-
-def EVT_DETAILED_HELP_RANGE(win, id, id2, func):
- win.Connect(id, id2, wxEVT_DETAILED_HELP, func)
-
def EVT_CONTEXT_MENU(win, func):
win.Connect(-1, -1, wxEVT_CONTEXT_MENU, func)
wxPyTimer.__init__(self, None)
self.SetOwner(evtHandler, id)
-#----------------------------------------------------------------------
-
-NULL = None # For backwards compatibility only. You should really be
- # using None now.
-
-
#----------------------------------------------------------------------
# aliases
wxColor = wxColour
wxNamedColor = wxNamedColour
wxPen = wxPyPen
+wxScrollbar = wxScrollBar
+
# backwards compatibility
wxNoRefBitmap = wxBitmap
wxPyDefaultPosition = wxDefaultPosition
wxPyDefaultSize = wxDefaultSize
-
+NULL = None
+wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour
+wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont
+wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric
#----------------------------------------------------------------------
# wxGTK sets the locale when initialized. Doing this at the Python
# level should set it up to match what GTK is doing at the C level.
-try:
- import locale
- locale.setlocale(locale.LC_ALL, "")
-except:
- pass
+if wxPlatform == "__WXGTK__":
+ try:
+ import locale
+ locale.setlocale(locale.LC_ALL, "")
+ except:
+ pass
theClass = globals()[typeStr+"Ptr"]
typeStr = __wxPyPtrTypeMap.get(typeStr, typeStr)
if hasattr(obj, "this"):
- if obj.__class__ is theClass: # if already the right type then just return it
+ # if already the right type then just return it
+ if isinstance(obj, theClass) or obj.__class__ is theClass:
return obj
newPtr = ptrcast(obj.this, typeStr+"_p")
else:
return theObj
+#----------------------------------------------------------------------------
+
+class wxPyDeadObjectError(AttributeError):
+ pass
+
+class _wxPyDeadObject:
+ """
+ Instances of wx objects that are OOR capable will have their __class__
+ changed to this class when the C++ object is deleted. This should help
+ prevent crashes due to referencing a bogus C++ pointer.
+ """
+ reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)"
+ attrStr = "The C++ part of the %s object has been deleted, attribute access no longer allowed."
+
+ def __repr__( self ):
+ if not hasattr(self, "_name"):
+ self._name = "[unknown]"
+ return self.reprStr % self._name
+
+ def __getattr__( self, *args ):
+ if not hasattr(self, "_name"):
+ self._name = "[unknown]"
+ raise wxPyDeadObjectError( self.attrStr % self._name )
+
+ def __nonzero__(self):
+ return 0
+
+
#----------------------------------------------------------------------
#----------------------------------------------------------------------
self.frame.Close()
-_defRedirect = (wxPlatform == '__WXMSW__')
+_defRedirect = (wxPlatform == '__WXMSW__' or wxPlatform == '__WXMAC__')
#----------------------------------------------------------------------
# The main application class. Derive from this and implement an OnInit
self.frame.Show(true)
#----------------------------------------------------------------------------
-# DO NOT hold any other references to this object. This is how we know when
-# to cleanup system resources that wxWin is holding. When this module is
-# unloaded, the refcount on __cleanMeUp goes to zero and it calls the
-# wxApp_CleanUp function.
+# DO NOT hold any other references to this object. This is how we
+# know when to cleanup system resources that wxWin is holding. When
+# the sys module is unloaded, the refcount on sys.__wxPythonCleanup
+# goes to zero and it calls the wxApp_CleanUp function.
class __wxPyCleanup:
def __init__(self):
def __del__(self):
self.cleanup()
-__cleanMeUp = __wxPyCleanup()
+sys.__wxPythonCleanup = __wxPyCleanup()
+
+## # another possible solution, but it gets called too early...
+## if sys.version[0] == '2':
+## import atexit
+## atexit.register(wxc.wxApp_CleanUp)
+## else:
+## sys.exitfunc = wxc.wxApp_CleanUp
+
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------