A bunch of little tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-09-19 00:21:48 +00:00
parent 2bd6903d18
commit a927ed1665
12 changed files with 1340 additions and 48 deletions

View File

@@ -9,16 +9,15 @@ class TestPanel(wxPanel):
self.log = log self.log = log
self.count = 0 self.count = 0
wxStaticText(self, -1, "This example uses the wxGauge control.", wxStaticText(self, -1, "This example shows the wxGauge control.",
wxPoint(45, 15)) wxPoint(45, 15))
#self.g1 = wxGauge(self, -1, 50, wxPoint(40, 50), wxSize(40, 160), self.g1 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25))
# wxGA_VERTICAL) self.g1.SetBezelFace(3)
#self.g1.SetBezelFace(3) self.g1.SetShadowWidth(3)
#self.g1.SetShadowWidth(3)
self.g2 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25), self.g2 = wxGauge(self, -1, 50, wxPoint(110, 95), wxSize(250, 25),
wxGA_HORIZONTAL) wxGA_HORIZONTAL|wxGA_SMOOTH)
self.g2.SetBezelFace(5) self.g2.SetBezelFace(5)
self.g2.SetShadowWidth(5) self.g2.SetShadowWidth(5)
@@ -29,7 +28,7 @@ class TestPanel(wxPanel):
self.count = self.count + 1 self.count = self.count + 1
if self.count >= 50: if self.count >= 50:
self.count = 0 self.count = 0
#self.g1.SetValue(self.count) self.g1.SetValue(self.count)
self.g2.SetValue(self.count) self.g2.SetValue(self.count)

View File

@@ -60,7 +60,7 @@ musicdata = {
class TestListCtrlPanel(wxPanel): class TestListCtrlPanel(wxPanel):
def __init__(self, parent, log): def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1) wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS)
self.log = log self.log = log
tID = wxNewId() tID = wxNewId()
@@ -68,8 +68,8 @@ class TestListCtrlPanel(wxPanel):
self.il = wxImageList(16, 16) self.il = wxImageList(16, 16)
idx1 = self.il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)) idx1 = self.il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize, self.list = wxListCtrl(self, tID,
wxLC_REPORT|wxSUNKEN_BORDER) style=wxLC_REPORT|wxSUNKEN_BORDER)
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL) self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
self.list.SetToolTip(wxToolTip("This is a ToolTip!")) self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
@@ -100,6 +100,7 @@ class TestListCtrlPanel(wxPanel):
self.currentItem = 0 self.currentItem = 0
EVT_SIZE(self, self.OnSize) EVT_SIZE(self, self.OnSize)
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected) EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
EVT_LIST_ITEM_ACTIVATED(self, tID, self.OnItemActivated)
EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete) EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
EVT_LIST_COL_CLICK(self, tID, self.OnColClick) EVT_LIST_COL_CLICK(self, tID, self.OnColClick)
EVT_LEFT_DCLICK(self.list, self.OnDoubleClick) EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
@@ -122,6 +123,10 @@ class TestListCtrlPanel(wxPanel):
self.currentItem = event.m_itemIndex self.currentItem = event.m_itemIndex
self.log.WriteText("OnItemSelected: %s\n" % self.list.GetItemText(self.currentItem)) self.log.WriteText("OnItemSelected: %s\n" % self.list.GetItemText(self.currentItem))
def OnItemActivated(self, event):
self.currentItem = event.m_itemIndex
self.log.WriteText("OnItemActivated: %s\n" % self.list.GetItemText(self.currentItem))
def OnItemDelete(self, event): def OnItemDelete(self, event):
self.log.WriteText("OnItemDelete\n") self.log.WriteText("OnItemDelete\n")

View File

@@ -12,6 +12,8 @@ class TestPanel(wxPanel):
t = wxTextCtrl(self, 10, "Test it out and see", wxPoint(80, 25), wxSize(150, 20)) t = wxTextCtrl(self, 10, "Test it out and see", wxPoint(80, 25), wxSize(150, 20))
t.SetInsertionPoint(0) t.SetInsertionPoint(0)
EVT_TEXT(self, 10, self.EvtText) EVT_TEXT(self, 10, self.EvtText)
EVT_CHAR(t, self.EvtChar)
wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20)) wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20))
wxTextCtrl(self, 20, "", wxPoint(80, 50), wxSize(150, 20), wxTE_PASSWORD) wxTextCtrl(self, 20, "", wxPoint(80, 50), wxSize(150, 20), wxTE_PASSWORD)
@@ -26,6 +28,10 @@ class TestPanel(wxPanel):
self.log.WriteText('EvtText: %s\n' % event.GetString()) self.log.WriteText('EvtText: %s\n' % event.GetString())
def EvtChar(self, event):
self.log.WriteText('EvtChar: %d\n' % event.GetKeyCode())
event.Skip()
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@@ -380,7 +380,7 @@ public:
%addmethods { %addmethods {
int __cmp__(wxTreeItemId* other) { int __cmp__(wxTreeItemId* other) {
if (! other) return 0; if (! other) return -1;
return *self != *other; return *self != *other;
} }
} }
@@ -392,15 +392,15 @@ public:
class wxPyTreeItemData : public wxTreeItemData { class wxPyTreeItemData : public wxTreeItemData {
public: public:
wxPyTreeItemData(PyObject* obj = NULL) { wxPyTreeItemData(PyObject* obj = NULL) {
if (obj == NULL) if (obj == NULL)
obj = Py_None; obj = Py_None;
Py_INCREF(obj); Py_INCREF(obj);
m_obj = obj; m_obj = obj;
} }
~wxPyTreeItemData() { ~wxPyTreeItemData() {
bool doSave = wxPyRestoreThread(); bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj); Py_DECREF(m_obj);
wxPySaveThread(doSave); wxPySaveThread(doSave);
} }
@@ -517,8 +517,8 @@ public:
void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE);
%addmethods { %addmethods {
// [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
// if needed. // if needed.
wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { wxPyTreeItemData* GetItemData(const wxTreeItemId& item) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
if (data == NULL) { if (data == NULL) {
@@ -532,11 +532,11 @@ public:
void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
data->SetId(item); // set the id data->SetId(item); // set the id
self->SetItemData(item, data); self->SetItemData(item, data);
} }
// [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
// automatically creating data classes. // automatically creating data classes.
PyObject* GetPyData(const wxTreeItemId& item) { PyObject* GetPyData(const wxTreeItemId& item) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
if (data == NULL) { if (data == NULL) {
data = new wxPyTreeItemData(); data = new wxPyTreeItemData();
@@ -544,7 +544,7 @@ public:
self->SetItemData(item, data); self->SetItemData(item, data);
} }
return data->GetData(); return data->GetData();
} }
void SetPyData(const wxTreeItemId& item, PyObject* obj) { void SetPyData(const wxTreeItemId& item, PyObject* obj) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
@@ -554,7 +554,7 @@ public:
self->SetItemData(item, data); self->SetItemData(item, data);
} else } else
data->SetData(obj); data->SetData(obj);
} }
} }

View File

@@ -156,6 +156,15 @@ public:
wxPoint GetLogicalPosition(const wxDC& dc); wxPoint GetLogicalPosition(const wxDC& dc);
long GetX(); long GetX();
long GetY(); long GetY();
long m_x, m_y;
bool m_leftDown;
bool m_middleDown;
bool m_rightDown;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -177,6 +186,15 @@ public:
long GetY(); long GetY();
wxPoint GetPosition(); wxPoint GetPosition();
%name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT); %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
long m_x, m_y;
long m_keyCode;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
bool m_scanCode;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -462,7 +462,7 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// These classes can be derived from in Python and passed through the event // These classes can be derived from in Python and passed through the event
// system without loosing anything. They do this by keeping a reference to // system without losing anything. They do this by keeping a reference to
// themselves and some special case handling in wxPyCallback::EventThunker. // themselves and some special case handling in wxPyCallback::EventThunker.

View File

@@ -7327,7 +7327,150 @@ static PyObject *_wrap_new_wxSpinCtrl(PyObject *self, PyObject *args, PyObject *
return _resultobj; return _resultobj;
} }
#define wxSpinCtrl_GetMax(_swigobj) (_swigobj->GetMax())
static PyObject *_wrap_wxSpinCtrl_GetMax(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMax",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMax. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMax(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetMin(_swigobj) (_swigobj->GetMin())
static PyObject *_wrap_wxSpinCtrl_GetMin(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMin",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMin. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMin(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetValue(_swigobj) (_swigobj->GetValue())
static PyObject *_wrap_wxSpinCtrl_GetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetValue",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetValue(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_SetRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetRange(_swigarg0,_swigarg1))
static PyObject *_wrap_wxSpinCtrl_SetRange(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
int _arg2;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","min","max", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxSpinCtrl_SetRange",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetRange. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetRange(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxSpinCtrl_SetValue(_swigobj,_swigarg0) (_swigobj->SetValue(_swigarg0))
static PyObject *_wrap_wxSpinCtrl_SetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","value", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSpinCtrl_SetValue",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetValue(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyMethodDef controlscMethods[] = { static PyMethodDef controlscMethods[] = {
{ "wxSpinCtrl_SetValue", (PyCFunction) _wrap_wxSpinCtrl_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_SetRange", (PyCFunction) _wrap_wxSpinCtrl_SetRange, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetValue", (PyCFunction) _wrap_wxSpinCtrl_GetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMin", (PyCFunction) _wrap_wxSpinCtrl_GetMin, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMax", (PyCFunction) _wrap_wxSpinCtrl_GetMax, METH_VARARGS | METH_KEYWORDS },
{ "new_wxSpinCtrl", (PyCFunction) _wrap_new_wxSpinCtrl, METH_VARARGS | METH_KEYWORDS }, { "new_wxSpinCtrl", (PyCFunction) _wrap_new_wxSpinCtrl, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetValue", (PyCFunction) _wrap_wxSlider_SetValue, METH_VARARGS | METH_KEYWORDS }, { "wxSlider_SetValue", (PyCFunction) _wrap_wxSlider_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetTick", (PyCFunction) _wrap_wxSlider_SetTick, METH_VARARGS | METH_KEYWORDS }, { "wxSlider_SetTick", (PyCFunction) _wrap_wxSlider_SetTick, METH_VARARGS | METH_KEYWORDS },

View File

@@ -806,6 +806,21 @@ class wxSpinCtrlPtr(wxSpinButtonPtr):
def __init__(self,this): def __init__(self,this):
self.this = this self.this = this
self.thisown = 0 self.thisown = 0
def GetMax(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMax,(self,) + _args, _kwargs)
return val
def GetMin(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMin,(self,) + _args, _kwargs)
return val
def GetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetValue,(self,) + _args, _kwargs)
return val
def SetRange(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetRange,(self,) + _args, _kwargs)
return val
def SetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetValue,(self,) + _args, _kwargs)
return val
def __repr__(self): def __repr__(self):
return "<C wxSpinCtrl instance at %s>" % (self.this,) return "<C wxSpinCtrl instance at %s>" % (self.this,)
class wxSpinCtrl(wxSpinCtrlPtr): class wxSpinCtrl(wxSpinCtrlPtr):

View File

@@ -132,15 +132,15 @@ extern wxValidator wxPyDefaultValidator;
class wxPyTreeItemData : public wxTreeItemData { class wxPyTreeItemData : public wxTreeItemData {
public: public:
wxPyTreeItemData(PyObject* obj = NULL) { wxPyTreeItemData(PyObject* obj = NULL) {
if (obj == NULL) if (obj == NULL)
obj = Py_None; obj = Py_None;
Py_INCREF(obj); Py_INCREF(obj);
m_obj = obj; m_obj = obj;
} }
~wxPyTreeItemData() { ~wxPyTreeItemData() {
bool doSave = wxPyRestoreThread(); bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj); Py_DECREF(m_obj);
wxPySaveThread(doSave); wxPySaveThread(doSave);
} }
@@ -4678,7 +4678,7 @@ static PyObject *_wrap_wxTreeItemId_IsOk(PyObject *self, PyObject *args, PyObjec
} }
static int wxTreeItemId___cmp__(wxTreeItemId *self,wxTreeItemId * other) { static int wxTreeItemId___cmp__(wxTreeItemId *self,wxTreeItemId * other) {
if (! other) return 0; if (! other) return -1;
return *self != *other; return *self != *other;
} }
static PyObject *_wrap_wxTreeItemId___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxTreeItemId___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -5780,7 +5780,7 @@ static PyObject *_wrap_wxTreeCtrl_GetItemData(PyObject *self, PyObject *args, Py
static void wxPyTreeCtrl_SetItemData(wxPyTreeCtrl *self,const wxTreeItemId & item,wxPyTreeItemData * data) { static void wxPyTreeCtrl_SetItemData(wxPyTreeCtrl *self,const wxTreeItemId & item,wxPyTreeItemData * data) {
data->SetId(item); // set the id data->SetId(item); // set the id
self->SetItemData(item, data); self->SetItemData(item, data);
} }
static PyObject *_wrap_wxTreeCtrl_SetItemData(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxTreeCtrl_SetItemData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxPyTreeCtrl * _arg0; wxPyTreeCtrl * _arg0;
@@ -5833,7 +5833,7 @@ static PyObject * wxPyTreeCtrl_GetPyData(wxPyTreeCtrl *self,const wxTreeItemId &
self->SetItemData(item, data); self->SetItemData(item, data);
} }
return data->GetData(); return data->GetData();
} }
static PyObject *_wrap_wxTreeCtrl_GetPyData(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxTreeCtrl_GetPyData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
PyObject * _result; PyObject * _result;
@@ -5879,7 +5879,7 @@ static void wxPyTreeCtrl_SetPyData(wxPyTreeCtrl *self,const wxTreeItemId & item
self->SetItemData(item, data); self->SetItemData(item, data);
} else } else
data->SetData(obj); data->SetData(obj);
} }
static PyObject *_wrap_wxTreeCtrl_SetPyData(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxTreeCtrl_SetPyData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxPyTreeCtrl * _arg0; wxPyTreeCtrl * _arg0;

File diff suppressed because it is too large Load Diff

View File

@@ -298,6 +298,55 @@ class wxMouseEventPtr(wxEventPtr):
def GetY(self, *_args, **_kwargs): def GetY(self, *_args, **_kwargs):
val = apply(eventsc.wxMouseEvent_GetY,(self,) + _args, _kwargs) val = apply(eventsc.wxMouseEvent_GetY,(self,) + _args, _kwargs)
return val return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxMouseEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxMouseEvent_m_y_set(self,value)
return
if name == "m_leftDown" :
eventsc.wxMouseEvent_m_leftDown_set(self,value)
return
if name == "m_middleDown" :
eventsc.wxMouseEvent_m_middleDown_set(self,value)
return
if name == "m_rightDown" :
eventsc.wxMouseEvent_m_rightDown_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxMouseEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxMouseEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxMouseEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxMouseEvent_m_metaDown_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxMouseEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxMouseEvent_m_y_get(self)
if name == "m_leftDown" :
return eventsc.wxMouseEvent_m_leftDown_get(self)
if name == "m_middleDown" :
return eventsc.wxMouseEvent_m_middleDown_get(self)
if name == "m_rightDown" :
return eventsc.wxMouseEvent_m_rightDown_get(self)
if name == "m_controlDown" :
return eventsc.wxMouseEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxMouseEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxMouseEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxMouseEvent_m_metaDown_get(self)
raise AttributeError,name
def __repr__(self): def __repr__(self):
return "<C wxMouseEvent instance at %s>" % (self.this,) return "<C wxMouseEvent instance at %s>" % (self.this,)
class wxMouseEvent(wxMouseEventPtr): class wxMouseEvent(wxMouseEventPtr):
@@ -346,6 +395,50 @@ class wxKeyEventPtr(wxEventPtr):
def GetPositionTuple(self, *_args, **_kwargs): def GetPositionTuple(self, *_args, **_kwargs):
val = apply(eventsc.wxKeyEvent_GetPositionTuple,(self,) + _args, _kwargs) val = apply(eventsc.wxKeyEvent_GetPositionTuple,(self,) + _args, _kwargs)
return val return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxKeyEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxKeyEvent_m_y_set(self,value)
return
if name == "m_keyCode" :
eventsc.wxKeyEvent_m_keyCode_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxKeyEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxKeyEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxKeyEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxKeyEvent_m_metaDown_set(self,value)
return
if name == "m_scanCode" :
eventsc.wxKeyEvent_m_scanCode_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxKeyEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxKeyEvent_m_y_get(self)
if name == "m_keyCode" :
return eventsc.wxKeyEvent_m_keyCode_get(self)
if name == "m_controlDown" :
return eventsc.wxKeyEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxKeyEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxKeyEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxKeyEvent_m_metaDown_get(self)
if name == "m_scanCode" :
return eventsc.wxKeyEvent_m_scanCode_get(self)
raise AttributeError,name
def __repr__(self): def __repr__(self):
return "<C wxKeyEvent instance at %s>" % (self.this,) return "<C wxKeyEvent instance at %s>" % (self.this,)
class wxKeyEvent(wxKeyEventPtr): class wxKeyEvent(wxKeyEventPtr):

View File

@@ -65,6 +65,12 @@ class FileBrowseButton(wxPanel):
self.fileMode = fileMode self.fileMode = fileMode
self.changeCallback = changeCallback self.changeCallback = changeCallback
# get background to match it
try:
self._bc = parent.GetBackgroundColour()
except:
pass
# create the dialog # create the dialog
self.createDialog(parent, id, pos, size, style ) self.createDialog(parent, id, pos, size, style )
# Setting a value causes the changeCallback to be called. # Setting a value causes the changeCallback to be called.
@@ -76,7 +82,11 @@ class FileBrowseButton(wxPanel):
def createDialog( self, parent, id, pos, size, style ): def createDialog( self, parent, id, pos, size, style ):
"""Setup the graphic representation of the dialog""" """Setup the graphic representation of the dialog"""
wxPanel.__init__ (self, parent, id, pos, size, style) wxPanel.__init__ (self, parent, id, pos, size, style)
# try to set the background colour
try:
self.SetBackgroundColour(self._bc)
except:
pass
box = wxBoxSizer(wxHORIZONTAL) box = wxBoxSizer(wxHORIZONTAL)
self.label = self.createLabel( ) self.label = self.createLabel( )
@@ -99,6 +109,10 @@ class FileBrowseButton(wxPanel):
if size.width != -1 or size.height != -1: if size.width != -1 or size.height != -1:
self.SetSize(size) self.SetSize(size)
def SetBackgroundColour(self,color):
wxPanel.SetBackgroundColour(self,color)
self.label.SetBackgroundColour(color)
def createLabel( self ): def createLabel( self ):
"""Create the label/caption""" """Create the label/caption"""
label = wxStaticText(self, -1, self.labelText, style =wxALIGN_RIGHT ) label = wxStaticText(self, -1, self.labelText, style =wxALIGN_RIGHT )
@@ -125,20 +139,26 @@ class FileBrowseButton(wxPanel):
EVT_BUTTON(button, ID, self.OnBrowse) EVT_BUTTON(button, ID, self.OnBrowse)
return button return button
def OnBrowse (self, event = None):
""" Going to browse for file... """ def OnBrowse (self, event = None):
current = self.GetValue () """ Going to browse for file... """
directory = os.path.split(current) current = self.GetValue()
if os.path.isdir( current): directory = os.path.split(current)
directory = current if os.path.isdir( current):
elif directory and os.path.isdir( directory[0] ): directory = current
directory = directory [0] current = ''
else: elif directory and os.path.isdir( directory[0] ):
directory = self.startDirectory current = directory[1]
dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode) directory = directory [0]
if dlg.ShowModal() == wxID_OK: else:
self.SetValue (dlg.GetPath()) directory = self.startDirectory
dlg.Destroy() dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode)
if dlg.ShowModal() == wxID_OK:
self.SetValue (dlg.GetPath())
dlg.Destroy()
def GetValue (self): def GetValue (self):
""" Convenient access to text control value """ """ Convenient access to text control value """