wxNAND = wxc.wxNAND
wxOR = wxc.wxOR
wxSET = wxc.wxSET
-wxSRC_OR = wxc.wxSRC_OR
-wxSRC_AND = wxc.wxSRC_AND
WXK_BACK = wxc.WXK_BACK
WXK_TAB = wxc.WXK_TAB
WXK_RETURN = wxc.WXK_RETURN
wxEVT_COMMAND_LISTBOX_SELECTED = wxc.wxEVT_COMMAND_LISTBOX_SELECTED
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED = wxc.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
wxEVT_COMMAND_CHECKLISTBOX_TOGGLED = wxc.wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
+wxEVT_COMMAND_SPINCTRL_UPDATED = wxc.wxEVT_COMMAND_SPINCTRL_UPDATED
wxEVT_COMMAND_TEXT_UPDATED = wxc.wxEVT_COMMAND_TEXT_UPDATED
wxEVT_COMMAND_TEXT_ENTER = wxc.wxEVT_COMMAND_TEXT_ENTER
wxEVT_COMMAND_MENU_SELECTED = wxc.wxEVT_COMMAND_MENU_SELECTED
wxEVT_SCROLL_PAGEUP = wxc.wxEVT_SCROLL_PAGEUP
wxEVT_SCROLL_PAGEDOWN = wxc.wxEVT_SCROLL_PAGEDOWN
wxEVT_SCROLL_THUMBTRACK = wxc.wxEVT_SCROLL_THUMBTRACK
+wxEVT_SCROLL_THUMBRELEASE = wxc.wxEVT_SCROLL_THUMBRELEASE
wxEVT_SCROLLWIN_TOP = wxc.wxEVT_SCROLLWIN_TOP
wxEVT_SCROLLWIN_BOTTOM = wxc.wxEVT_SCROLLWIN_BOTTOM
wxEVT_SCROLLWIN_LINEUP = wxc.wxEVT_SCROLLWIN_LINEUP
wxEVT_SCROLLWIN_PAGEUP = wxc.wxEVT_SCROLLWIN_PAGEUP
wxEVT_SCROLLWIN_PAGEDOWN = wxc.wxEVT_SCROLLWIN_PAGEDOWN
wxEVT_SCROLLWIN_THUMBTRACK = wxc.wxEVT_SCROLLWIN_THUMBTRACK
+wxEVT_SCROLLWIN_THUMBRELEASE = wxc.wxEVT_SCROLLWIN_THUMBRELEASE
wxEVT_SIZE = wxc.wxEVT_SIZE
wxEVT_MOVE = wxc.wxEVT_MOVE
wxEVT_CLOSE_WINDOW = wxc.wxEVT_CLOSE_WINDOW
except: pass
else: obj.Connect(theID, -1, event, cb)
-## def _checkClassCallback(obj, name):
-## try: cb = getattr(obj, name)
-## except: pass
-## else: obj._addCallback(name, cb)
-
-
def _StdWindowCallbacks(win):
_checkForCallback(win, "OnChar", wxEVT_CHAR)
_checkForCallback(win, "OnSize", wxEVT_SIZE)
def EVT_NAVIGATION_KEY(win, func):
win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func)
+def EVT_PALETTE_CHANGED(win, func):
+ win.Connect(-1, -1, wxEVT_PALETTE_CHANGED, func)
+
+def EVT_QUERY_NEW_PALETTE(win, func):
+ win.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE, func)
+
+def EVT_WINDOW_CREATE(win, func):
+ win.Connect(-1, -1, wxEVT_CREATE, func)
+
+def EVT_WINDOW_DESTROY(win, func):
+ win.Connect(-1, -1, wxEVT_DESTROY, func)
+
+
+
def EVT_IDLE(win, func):
win.Connect(-1, -1, wxEVT_IDLE, 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_PAGEUP, func)
win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func)
win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK,func)
+ win.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE,func)
def EVT_SCROLL_TOP(win, func):
win.Connect(-1, -1, wxEVT_SCROLL_TOP, func)
def EVT_SCROLL_THUMBTRACK(win, func):
win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK, func)
+def EVT_SCROLL_THUMBRELEASE(win, func):
+ win.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE, func)
+
# Scrolling, with an id
win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func)
win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func)
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func)
+ win.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE,func)
def EVT_COMMAND_SCROLL_TOP(win, id, func):
win.Connect(id, -1, wxEVT_SCROLL_TOP, func)
def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func):
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK, func)
+def EVT_COMMAND_SCROLL_THUMBRELEASE(win, id, func):
+ win.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE, func)
+
#---
def EVT_SCROLLWIN(win, func):
- win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
- win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK,func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE,func)
def EVT_SCROLLWIN_TOP(win, func):
win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP, func)
def EVT_SCROLLWIN_THUMBTRACK(win, func):
win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
+def EVT_SCROLLWIN_THUMBRELEASE(win, func):
+ win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE, func)
+
# Scrolling, with an id
def EVT_COMMAND_SCROLLWIN(win, id, func):
- win.Connect(id, -1, wxEVT_SCROLLWIN_TOP, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
- win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK,func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_TOP, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
+ win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE,func)
def EVT_COMMAND_SCROLLWIN_TOP(win, id, func):
win.Connect(id, -1, wxEVT_SCROLLWIN_TOP, func)
def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win, id, func):
win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
+def EVT_COMMAND_SCROLLWIN_THUMBRELEASE(win, id, func):
+ win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE, func)
+
+
# Convenience commands
def EVT_BUTTON(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED, func)
def EVT_TOOL(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func)
+def EVT_TOOL_RANGE(win, id, id2, func):
+ win.Connect(id, id2, wxEVT_COMMAND_TOOL_CLICKED, func)
+
def EVT_TOOL_RCLICKED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func)
+def EVT_TOOL_RCLICKED_RANGE(win, id, id2, func):
+ win.Connect(id, id2, 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)
+def EVT_SPINCTRL(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED, func)
+
+
# Generic command events
self.frame = None
self.title = title
+
def SetParent(self, parent):
self.parent = parent
+
def OnCloseWindow(self, event):
if self.frame != None:
self.frame.Destroy()
self.frame = None
self.text = None
+
# this provides the file-like behaviour
def write(self, str):
if not self.frame:
EVT_CLOSE(self.frame, self.OnCloseWindow)
self.text.AppendText(str)
+
def close(self):
+ if self.frame != None:
+ self.frame.Destroy()
self.frame = None
self.text = None
def SetTopWindow(self, frame):
if self.stdioWin:
self.stdioWin.SetParent(frame)
- sys.stdout = self.stdioWin #sys.stderr =
+ sys.stderr = sys.stdout = self.stdioWin
wxPyApp.SetTopWindow(self, frame)
+
def MainLoop(self):
wxPyApp.MainLoop(self)
self.RestoreStdio()
+
def RedirectStdio(self, filename):
if filename:
sys.stdout = sys.stderr = open(filename, 'a')
else:
self.stdioWin = self.outputWindowClass() # wxPyOnDemandOutputWindow
+
def RestoreStdio(self):
sys.stdout, sys.stderr = self.saveStdio
if self.stdioWin != None: