From 1f05e33b7dd37d68f9c3b24f8f75161e4e2fd48d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 18 Feb 2004 02:17:35 +0000 Subject: [PATCH] reSWIGged git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/mac/controls.py | 117 ++++++++++++---- wxPython/src/mac/controls_wrap.cpp | 61 +-------- wxPython/src/mac/gdi.py | 2 +- wxPython/src/mac/misc.py | 104 ++++++++++++-- wxPython/src/mac/misc_wrap.cpp | 2 +- wxPython/src/mac/windows.py | 212 +++++++++++++++++++++++------ wxPython/src/mac/windows_wrap.cpp | 52 ------- wxPython/src/msw/controls.py | 117 ++++++++++++---- wxPython/src/msw/controls_wrap.cpp | 61 +-------- wxPython/src/msw/gdi.py | 2 +- wxPython/src/msw/misc.py | 104 ++++++++++++-- wxPython/src/msw/misc_wrap.cpp | 2 +- wxPython/src/msw/windows.py | 212 +++++++++++++++++++++++------ wxPython/src/msw/windows_wrap.cpp | 52 ------- 14 files changed, 720 insertions(+), 380 deletions(-) diff --git a/wxPython/src/mac/controls.py b/wxPython/src/mac/controls.py index 06fef976a2..c8867ba346 100644 --- a/wxPython/src/mac/controls.py +++ b/wxPython/src/mac/controls.py @@ -222,6 +222,12 @@ CHK_UNCHECKED = _controls.CHK_UNCHECKED CHK_CHECKED = _controls.CHK_CHECKED CHK_UNDETERMINED = _controls.CHK_UNDETERMINED class CheckBox(core.Control): + """ + A checkbox is a labelled box which by default is either on (checkmark is + visible) or off (no checkmark). Optionally (When the wxCHK_3STATE style flag + is set) it can have a third state, called the mixed or undetermined + state. Often this is used as a "Does Not Apply" state. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxCheckBox instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -229,6 +235,8 @@ class CheckBox(core.Control): __init__(Window parent, int id, String label, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, Validator validator=DefaultValidator, String name=CheckBoxNameStr) -> CheckBox + + Creates and shows a CheckBox control """ newobj = _controls.new_CheckBox(*args, **kwargs) self.this = newobj.this @@ -241,35 +249,73 @@ class CheckBox(core.Control): Create(Window parent, int id, String label, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, Validator validator=DefaultValidator, String name=CheckBoxNameStr) -> bool + + Actually create the GUI CheckBox for 2-phase creation. """ return _controls.CheckBox_Create(*args, **kwargs) def GetValue(*args, **kwargs): - """GetValue() -> bool""" + """ + GetValue() -> bool + + Gets the state of a 2-state CheckBox. Returns True if it is checked, + False otherwise. + """ return _controls.CheckBox_GetValue(*args, **kwargs) def IsChecked(*args, **kwargs): - """IsChecked() -> bool""" + """ + IsChecked() -> bool + + Similar to GetValue, but raises an exception if it is not a 2-state CheckBox. + """ return _controls.CheckBox_IsChecked(*args, **kwargs) def SetValue(*args, **kwargs): - """SetValue(bool state)""" + """ + SetValue(bool state) + + Set the state of a 2-state CheckBox. Pass True for checked, + False for unchecked. + """ return _controls.CheckBox_SetValue(*args, **kwargs) def Get3StateValue(*args, **kwargs): - """Get3StateValue() -> int""" + """ + Get3StateValue() -> int + + Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, wx.CHK_CHECKED when + it is checked and wx.CHK_UNDETERMINED when it's in the undetermined state. + Raises an exceptiion when the function is used with a 2-state CheckBox. + """ return _controls.CheckBox_Get3StateValue(*args, **kwargs) def Set3StateValue(*args, **kwargs): - """Set3StateValue(int state)""" + """ + Set3StateValue(int state) + + Sets the CheckBox to the given state. The state parameter can be + one of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED + (Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an + exception when the CheckBox is a 2-state checkbox and setting the state + to wx.CHK_UNDETERMINED. + """ return _controls.CheckBox_Set3StateValue(*args, **kwargs) def Is3State(*args, **kwargs): - """Is3State() -> bool""" + """ + Is3State() -> bool + + Returns whether or not the CheckBox is a 3-state CheckBox. + """ return _controls.CheckBox_Is3State(*args, **kwargs) def Is3rdStateAllowedForUser(*args, **kwargs): - """Is3rdStateAllowedForUser() -> bool""" + """ + Is3rdStateAllowedForUser() -> bool + + Returns whether or not the user can set the CheckBox to the third state. + """ return _controls.CheckBox_Is3rdStateAllowedForUser(*args, **kwargs) @@ -282,7 +328,11 @@ _controls.CheckBox_swigregister(CheckBoxPtr) CheckBoxNameStr = cvar.CheckBoxNameStr def PreCheckBox(*args, **kwargs): - """PreCheckBox() -> CheckBox""" + """ + PreCheckBox() -> CheckBox + + Precreate a CheckBox for 2-phase creation. + """ val = _controls.new_PreCheckBox(*args, **kwargs) val.thisown = 1 return val @@ -290,14 +340,19 @@ def PreCheckBox(*args, **kwargs): #--------------------------------------------------------------------------- class Choice(core.ControlWithItems): + """ + A Choice control is used to select one of a list of strings. Unlike a ListBox, + only the selection is visible until the user pulls down the menu of choices. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxChoice instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ - __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, - wxArrayString choices=wxPyEmptyStringArray, - long style=0, Validator validator=DefaultValidator, + __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, + List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> Choice + + Create and show a Choice control """ newobj = _controls.new_Choice(*args, **kwargs) self.this = newobj.this @@ -307,33 +362,39 @@ class Choice(core.ControlWithItems): def Create(*args, **kwargs): """ - Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, - wxArrayString choices=wxPyEmptyStringArray, - long style=0, Validator validator=DefaultValidator, + Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, + List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> bool + + Actually create the GUI Choice control for 2-phase creation """ return _controls.Choice_Create(*args, **kwargs) - def GetColumns(*args, **kwargs): - """GetColumns() -> int""" - return _controls.Choice_GetColumns(*args, **kwargs) - - def SetColumns(*args, **kwargs): - """SetColumns(int n=1)""" - return _controls.Choice_SetColumns(*args, **kwargs) - def SetSelection(*args, **kwargs): - """SetSelection(int n)""" + """ + SetSelection(int n) + + Select the n'th item (zero based) in the list. + """ return _controls.Choice_SetSelection(*args, **kwargs) def SetStringSelection(*args, **kwargs): - """SetStringSelection(String string)""" + """ + SetStringSelection(String string) + + Select the item with the specifed string + """ return _controls.Choice_SetStringSelection(*args, **kwargs) def SetString(*args, **kwargs): - """SetString(int n, String s)""" + """ + SetString(int n, String string) + + Set the label for the n'th item (zero based) in the list. + """ return _controls.Choice_SetString(*args, **kwargs) + Select = SetSelection class ChoicePtr(Choice): def __init__(self, this): @@ -344,7 +405,11 @@ _controls.Choice_swigregister(ChoicePtr) ChoiceNameStr = cvar.ChoiceNameStr def PreChoice(*args, **kwargs): - """PreChoice() -> Choice""" + """ + PreChoice() -> Choice + + Precreate a Choice control for 2-phase creation. + """ val = _controls.new_PreChoice(*args, **kwargs) val.thisown = 1 return val diff --git a/wxPython/src/mac/controls_wrap.cpp b/wxPython/src/mac/controls_wrap.cpp index 51faaf37d4..b20276cb6b 100644 --- a/wxPython/src/mac/controls_wrap.cpp +++ b/wxPython/src/mac/controls_wrap.cpp @@ -2468,63 +2468,6 @@ static PyObject *_wrap_Choice_Create(PyObject *self, PyObject *args, PyObject *k } -static PyObject *_wrap_Choice_GetColumns(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxChoice *arg1 = (wxChoice *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Choice_GetColumns",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxChoice,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->GetColumns(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_Choice_SetColumns(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxChoice *arg1 = (wxChoice *) 0 ; - int arg2 = (int) (int)1 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char *kwnames[] = { - (char *) "self",(char *) "n", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Choice_SetColumns",kwnames,&obj0,&obj1)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxChoice,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if (obj1) { - { - arg2 = (int const) SWIG_PyObj_AsInt(obj1); - if (PyErr_Occurred()) SWIG_fail; - } - } - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - (arg1)->SetColumns(arg2); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - static PyObject *_wrap_Choice_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxChoice *arg1 = (wxChoice *) 0 ; @@ -2605,7 +2548,7 @@ static PyObject *_wrap_Choice_SetString(PyObject *self, PyObject *args, PyObject PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; char *kwnames[] = { - (char *) "self",(char *) "n",(char *) "s", NULL + (char *) "self",(char *) "n",(char *) "string", NULL }; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Choice_SetString",kwnames,&obj0,&obj1,&obj2)) goto fail; @@ -29184,8 +29127,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"new_Choice", (PyCFunction) _wrap_new_Choice, METH_VARARGS | METH_KEYWORDS }, { (char *)"new_PreChoice", (PyCFunction) _wrap_new_PreChoice, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_Create", (PyCFunction) _wrap_Choice_Create, METH_VARARGS | METH_KEYWORDS }, - { (char *)"Choice_GetColumns", (PyCFunction) _wrap_Choice_GetColumns, METH_VARARGS | METH_KEYWORDS }, - { (char *)"Choice_SetColumns", (PyCFunction) _wrap_Choice_SetColumns, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetSelection", (PyCFunction) _wrap_Choice_SetSelection, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetStringSelection", (PyCFunction) _wrap_Choice_SetStringSelection, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetString", (PyCFunction) _wrap_Choice_SetString, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/mac/gdi.py b/wxPython/src/mac/gdi.py index 16944575b5..99802424e6 100644 --- a/wxPython/src/mac/gdi.py +++ b/wxPython/src/mac/gdi.py @@ -2825,7 +2825,7 @@ class BufferedDC(MemoryDC): self.this = newobj.this self.thisown = 1 del newobj.thisown - val._dc = args[0] # save a ref so the other dc will not be deleted before self + self._dc = args[0] # save a ref so the other dc will not be deleted before self def UnMask(*args, **kwargs): """UnMask()""" diff --git a/wxPython/src/mac/misc.py b/wxPython/src/mac/misc.py index 648441cf53..c257b7c039 100644 --- a/wxPython/src/mac/misc.py +++ b/wxPython/src/mac/misc.py @@ -4586,6 +4586,18 @@ _misc.FileDropTarget_swigregister(FileDropTargetPtr) #--------------------------------------------------------------------------- class Clipboard(core.Object): + """ + wx.Clipboard represents the system clipboard and provides methods to copy data + to or paste data from it. Normally, you should only use wx.TheClipboard which + is a reference to a global wx.Clipboard instance. + + Call wx.TheClipboard.Open to get ownership of the clipboard. If this operation + returns True, you now own the clipboard. Call wx.TheClipboard.SetData to put + data on the clipboard, or wx.TheClipboard.GetData to retrieve data from the + clipboard. Call wx.TheClipboard.Close to close the clipboard and relinquish + ownership. You should keep the clipboard open only momentarily. + + """ def __repr__(self): return "<%s.%s; proxy of C++ wxClipboard instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -4601,43 +4613,97 @@ class Clipboard(core.Object): except: pass def Open(*args, **kwargs): - """Open() -> bool""" + """ + Open() -> bool + + Call this function to open the clipboard before calling SetData + and GetData. Call Close when you have finished with the clipboard. + You should keep the clipboard open for only a very short time. + Returns true on success. + """ return _misc.Clipboard_Open(*args, **kwargs) def Close(*args, **kwargs): - """Close()""" + """ + Close() + + Closes the clipboard. + """ return _misc.Clipboard_Close(*args, **kwargs) def IsOpened(*args, **kwargs): - """IsOpened() -> bool""" + """ + IsOpened() -> bool + + Query whether the clipboard is opened + """ return _misc.Clipboard_IsOpened(*args, **kwargs) def AddData(*args, **kwargs): - """AddData(DataObject data) -> bool""" + """ + AddData(DataObject data) -> bool + + Call this function to add the data object to the clipboard. You + may call this function repeatedly after having cleared the clipboard. + After this function has been called, the clipboard owns the data, so + do not delete the data explicitly. + """ return _misc.Clipboard_AddData(*args, **kwargs) def SetData(*args, **kwargs): - """SetData(DataObject data) -> bool""" + """ + SetData(DataObject data) -> bool + + Set the clipboard data, this is the same as Clear followed by AddData. + """ return _misc.Clipboard_SetData(*args, **kwargs) def IsSupported(*args, **kwargs): - """IsSupported(DataFormat format) -> bool""" + """ + IsSupported(DataFormat format) -> bool + + Returns True if the given format is available in the data object(s) on + the clipboard. + """ return _misc.Clipboard_IsSupported(*args, **kwargs) def GetData(*args, **kwargs): - """GetData(DataObject data) -> bool""" + """ + GetData(DataObject data) -> bool + + Call this function to fill data with data on the clipboard, if available + in the required format. Returns true on success. + """ return _misc.Clipboard_GetData(*args, **kwargs) def Clear(*args, **kwargs): - """Clear()""" + """ + Clear() + + Clears data from the clipboard object and also the system's clipboard + if possible. + """ return _misc.Clipboard_Clear(*args, **kwargs) def Flush(*args, **kwargs): - """Flush() -> bool""" + """ + Flush() -> bool + + Flushes the clipboard: this means that the data which is currently on + clipboard will stay available even after the application exits (possibly + eating memory), otherwise the clipboard will be emptied on exit. + Returns False if the operation is unsuccesful for any reason. + """ return _misc.Clipboard_Flush(*args, **kwargs) def UsePrimarySelection(*args, **kwargs): - """UsePrimarySelection(bool primary=False)""" + """ + UsePrimarySelection(bool primary=True) + + On platforms supporting it (the X11 based platforms), selects the so + called PRIMARY SELECTION as the clipboard as opposed to the normal + clipboard, if primary is True. + """ return _misc.Clipboard_UsePrimarySelection(*args, **kwargs) @@ -4649,10 +4715,19 @@ class ClipboardPtr(Clipboard): _misc.Clipboard_swigregister(ClipboardPtr) class ClipboardLocker(object): + """ + A helpful class for opening the clipboard and automatically closing it when + the locker is destroyed. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxClipboardLocker instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(Clipboard clipboard=None) -> ClipboardLocker""" + """ + __init__(Clipboard clipboard=None) -> ClipboardLocker + + A helpful class for opening the clipboard and automatically closing it when + the locker is destroyed. + """ newobj = _misc.new_ClipboardLocker(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -4664,7 +4739,12 @@ class ClipboardLocker(object): except: pass def __nonzero__(*args, **kwargs): - """__nonzero__() -> bool""" + """ + __nonzero__() -> bool + + A ClipboardLocker instance evaluates to True if the clipboard was + successfully opened. + """ return _misc.ClipboardLocker___nonzero__(*args, **kwargs) diff --git a/wxPython/src/mac/misc_wrap.cpp b/wxPython/src/mac/misc_wrap.cpp index 74bc443eb3..bf5a8c27be 100644 --- a/wxPython/src/mac/misc_wrap.cpp +++ b/wxPython/src/mac/misc_wrap.cpp @@ -26545,7 +26545,7 @@ static PyObject *_wrap_Clipboard_Flush(PyObject *self, PyObject *args, PyObject static PyObject *_wrap_Clipboard_UsePrimarySelection(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxClipboard *arg1 = (wxClipboard *) 0 ; - bool arg2 = (bool) False ; + bool arg2 = (bool) True ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { diff --git a/wxPython/src/mac/windows.py b/wxPython/src/mac/windows.py index 80f3eea0e7..e08e83dbb1 100644 --- a/wxPython/src/mac/windows.py +++ b/wxPython/src/mac/windows.py @@ -1600,10 +1600,15 @@ EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK ) #--------------------------------------------------------------------------- class ColourData(core.Object): + """This class holds a variety of information related to colour dialogs.""" def __repr__(self): return "<%s.%s; proxy of C++ wxColourData instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__() -> ColourData""" + """ + __init__() -> ColourData + + Constructor, sets default values. + """ newobj = _windows.new_ColourData(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -1615,27 +1620,57 @@ class ColourData(core.Object): except: pass def GetChooseFull(*args, **kwargs): - """GetChooseFull() -> bool""" + """ + GetChooseFull() -> bool + + Under Windows, determines whether the Windows colour dialog will display + the full dialog with custom colour selection controls. Has no meaning + under other platforms. The default value is true. + """ return _windows.ColourData_GetChooseFull(*args, **kwargs) def GetColour(*args, **kwargs): - """GetColour() -> Colour""" + """ + GetColour() -> Colour + + Gets the colour (pre)selected by the dialog. + """ return _windows.ColourData_GetColour(*args, **kwargs) def GetCustomColour(*args, **kwargs): - """GetCustomColour(int i) -> Colour""" + """ + GetCustomColour(int i) -> Colour + + Gets the i'th custom colour associated with the colour dialog. i should + be an integer between 0 and 15. The default custom colours are all white. + """ return _windows.ColourData_GetCustomColour(*args, **kwargs) def SetChooseFull(*args, **kwargs): - """SetChooseFull(int flag)""" + """ + SetChooseFull(int flag) + + Under Windows, tells the Windows colour dialog to display the full dialog + with custom colour selection controls. Under other platforms, has no effect. + The default value is true. + """ return _windows.ColourData_SetChooseFull(*args, **kwargs) def SetColour(*args, **kwargs): - """SetColour(Colour colour)""" + """ + SetColour(Colour colour) + + Sets the default colour for the colour dialog. The default colour is black. + """ return _windows.ColourData_SetColour(*args, **kwargs) def SetCustomColour(*args, **kwargs): - """SetCustomColour(int i, Colour colour)""" + """ + SetCustomColour(int i, Colour colour) + + Sets the i'th custom colour for the colour dialog. i should be an integer + between 0 and 15. The default custom colours are all white. + """ return _windows.ColourData_SetCustomColour(*args, **kwargs) @@ -1653,10 +1688,16 @@ GetTextFromUserPromptStr = cvar.GetTextFromUserPromptStr MessageBoxCaptionStr = cvar.MessageBoxCaptionStr class ColourDialog(Dialog): + """This class represents the colour chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxColourDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(Window parent, ColourData data=None) -> ColourDialog""" + """ + __init__(Window parent, ColourData data=None) -> ColourDialog + + Constructor. Pass a parent window, and optionally a ColourData, which + will be copied to the colour dialog's internal ColourData instance. + """ newobj = _windows.new_ColourDialog(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -1664,12 +1705,12 @@ class ColourDialog(Dialog): self._setOORInfo(self) def GetColourData(*args, **kwargs): - """GetColourData() -> ColourData""" - return _windows.ColourDialog_GetColourData(*args, **kwargs) + """ + GetColourData() -> ColourData - def ShowModal(*args, **kwargs): - """ShowModal() -> int""" - return _windows.ColourDialog_ShowModal(*args, **kwargs) + Returns a reference to the ColourData used by the dialog. + """ + return _windows.ColourDialog_GetColourData(*args, **kwargs) class ColourDialogPtr(ColourDialog): @@ -1680,6 +1721,7 @@ class ColourDialogPtr(ColourDialog): _windows.ColourDialog_swigregister(ColourDialogPtr) class DirDialog(Dialog): + """This class represents the directory chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxDirDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -1688,6 +1730,8 @@ class DirDialog(Dialog): String defaultPath=EmptyString, long style=0, Point pos=DefaultPosition, Size size=DefaultSize, String name=DirDialogNameStr) -> DirDialog + + Constructor. Use ShowModal method to show the dialog. """ newobj = _windows.new_DirDialog(*args, **kwargs) self.this = newobj.this @@ -1696,28 +1740,44 @@ class DirDialog(Dialog): self._setOORInfo(self) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Returns the default or user-selected path. + """ return _windows.DirDialog_GetPath(*args, **kwargs) def GetMessage(*args, **kwargs): - """GetMessage() -> String""" + """ + GetMessage() -> String + + Returns the message that will be displayed on the dialog. + """ return _windows.DirDialog_GetMessage(*args, **kwargs) def GetStyle(*args, **kwargs): - """GetStyle() -> long""" + """ + GetStyle() -> long + + Returns the dialog style. + """ return _windows.DirDialog_GetStyle(*args, **kwargs) def SetMessage(*args, **kwargs): - """SetMessage(String message)""" + """ + SetMessage(String message) + + Sets the message that will be displayed on the dialog. + """ return _windows.DirDialog_SetMessage(*args, **kwargs) def SetPath(*args, **kwargs): - """SetPath(String path)""" - return _windows.DirDialog_SetPath(*args, **kwargs) + """ + SetPath(String path) - def ShowModal(*args, **kwargs): - """ShowModal() -> int""" - return _windows.DirDialog_ShowModal(*args, **kwargs) + Sets the default path. + """ + return _windows.DirDialog_SetPath(*args, **kwargs) class DirDialogPtr(DirDialog): @@ -1728,6 +1788,7 @@ class DirDialogPtr(DirDialog): _windows.DirDialog_swigregister(DirDialogPtr) class FileDialog(Dialog): + """This class represents the file chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxFileDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -1736,6 +1797,8 @@ class FileDialog(Dialog): String defaultDir=EmptyString, String defaultFile=EmptyString, String wildcard=FileSelectorDefaultWildcardStr, long style=0, Point pos=DefaultPosition) -> FileDialog + + Constructor. Use ShowModal method to show the dialog. """ newobj = _windows.new_FileDialog(*args, **kwargs) self.this = newobj.this @@ -1744,67 +1807,140 @@ class FileDialog(Dialog): self._setOORInfo(self) def SetMessage(*args, **kwargs): - """SetMessage(String message)""" + """ + SetMessage(String message) + + Sets the message that will be displayed on the dialog. + """ return _windows.FileDialog_SetMessage(*args, **kwargs) def SetPath(*args, **kwargs): - """SetPath(String path)""" + """ + SetPath(String path) + + Sets the path (the combined directory and filename that will + be returned when the dialog is dismissed). + """ return _windows.FileDialog_SetPath(*args, **kwargs) def SetDirectory(*args, **kwargs): - """SetDirectory(String dir)""" + """ + SetDirectory(String dir) + + Sets the default directory. + """ return _windows.FileDialog_SetDirectory(*args, **kwargs) def SetFilename(*args, **kwargs): - """SetFilename(String name)""" + """ + SetFilename(String name) + + Sets the default filename. + """ return _windows.FileDialog_SetFilename(*args, **kwargs) def SetWildcard(*args, **kwargs): - """SetWildcard(String wildCard)""" + """ + SetWildcard(String wildCard) + + Sets the wildcard, which can contain multiple file types, for example: + "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" + """ return _windows.FileDialog_SetWildcard(*args, **kwargs) def SetStyle(*args, **kwargs): - """SetStyle(long style)""" + """ + SetStyle(long style) + + Sets the dialog style. + """ return _windows.FileDialog_SetStyle(*args, **kwargs) def SetFilterIndex(*args, **kwargs): - """SetFilterIndex(int filterIndex)""" + """ + SetFilterIndex(int filterIndex) + + Sets the default filter index, starting from zero. + """ return _windows.FileDialog_SetFilterIndex(*args, **kwargs) def GetMessage(*args, **kwargs): - """GetMessage() -> String""" + """ + GetMessage() -> String + + Returns the message that will be displayed on the dialog. + """ return _windows.FileDialog_GetMessage(*args, **kwargs) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Returns the full path (directory and filename) of the selected file. + """ return _windows.FileDialog_GetPath(*args, **kwargs) def GetDirectory(*args, **kwargs): - """GetDirectory() -> String""" + """ + GetDirectory() -> String + + Returns the default directory. + """ return _windows.FileDialog_GetDirectory(*args, **kwargs) def GetFilename(*args, **kwargs): - """GetFilename() -> String""" + """ + GetFilename() -> String + + Returns the default filename. + """ return _windows.FileDialog_GetFilename(*args, **kwargs) def GetWildcard(*args, **kwargs): - """GetWildcard() -> String""" + """ + GetWildcard() -> String + + Returns the file dialog wildcard. + """ return _windows.FileDialog_GetWildcard(*args, **kwargs) def GetStyle(*args, **kwargs): - """GetStyle() -> long""" + """ + GetStyle() -> long + + Returns the dialog style. + """ return _windows.FileDialog_GetStyle(*args, **kwargs) def GetFilterIndex(*args, **kwargs): - """GetFilterIndex() -> int""" + """ + GetFilterIndex() -> int + + Returns the index into the list of filters supplied, optionally, in + the wildcard parameter. Before the dialog is shown, this is the index + which will be used when the dialog is first displayed. After the dialog + is shown, this is the index selected by the user. + """ return _windows.FileDialog_GetFilterIndex(*args, **kwargs) def GetFilenames(*args, **kwargs): - """GetFilenames() -> PyObject""" + """ + GetFilenames() -> PyObject + + Returns a list of filenames chosen in the dialog. This function should + only be used with the dialogs which have wx.MULTIPLE style, use + GetFilename for the others. + """ return _windows.FileDialog_GetFilenames(*args, **kwargs) def GetPaths(*args, **kwargs): - """GetPaths() -> PyObject""" + """ + GetPaths() -> PyObject + + Fills the array paths with the full paths of the files chosen. This + function should only be used with the dialogs which have wx.MULTIPLE style, + use GetPath for the others. + """ return _windows.FileDialog_GetPaths(*args, **kwargs) diff --git a/wxPython/src/mac/windows_wrap.cpp b/wxPython/src/mac/windows_wrap.cpp index c6b46c9147..7dfcf84f03 100644 --- a/wxPython/src/mac/windows_wrap.cpp +++ b/wxPython/src/mac/windows_wrap.cpp @@ -10723,31 +10723,6 @@ static PyObject *_wrap_ColourDialog_GetColourData(PyObject *self, PyObject *args } -static PyObject *_wrap_ColourDialog_ShowModal(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxColourDialog *arg1 = (wxColourDialog *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:ColourDialog_ShowModal",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxColourDialog,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->ShowModal(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - static PyObject * ColourDialog_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -11032,31 +11007,6 @@ static PyObject *_wrap_DirDialog_SetPath(PyObject *self, PyObject *args, PyObjec } -static PyObject *_wrap_DirDialog_ShowModal(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxDirDialog *arg1 = (wxDirDialog *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:DirDialog_ShowModal",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxDirDialog,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->ShowModal(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - static PyObject * DirDialog_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -22680,7 +22630,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"ColourData_swigregister", ColourData_swigregister, METH_VARARGS }, { (char *)"new_ColourDialog", (PyCFunction) _wrap_new_ColourDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"ColourDialog_GetColourData", (PyCFunction) _wrap_ColourDialog_GetColourData, METH_VARARGS | METH_KEYWORDS }, - { (char *)"ColourDialog_ShowModal", (PyCFunction) _wrap_ColourDialog_ShowModal, METH_VARARGS | METH_KEYWORDS }, { (char *)"ColourDialog_swigregister", ColourDialog_swigregister, METH_VARARGS }, { (char *)"new_DirDialog", (PyCFunction) _wrap_new_DirDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_GetPath", (PyCFunction) _wrap_DirDialog_GetPath, METH_VARARGS | METH_KEYWORDS }, @@ -22688,7 +22637,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"DirDialog_GetStyle", (PyCFunction) _wrap_DirDialog_GetStyle, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_SetMessage", (PyCFunction) _wrap_DirDialog_SetMessage, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_SetPath", (PyCFunction) _wrap_DirDialog_SetPath, METH_VARARGS | METH_KEYWORDS }, - { (char *)"DirDialog_ShowModal", (PyCFunction) _wrap_DirDialog_ShowModal, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_swigregister", DirDialog_swigregister, METH_VARARGS }, { (char *)"new_FileDialog", (PyCFunction) _wrap_new_FileDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"FileDialog_SetMessage", (PyCFunction) _wrap_FileDialog_SetMessage, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/controls.py b/wxPython/src/msw/controls.py index 1ee35df066..c4f50b2308 100644 --- a/wxPython/src/msw/controls.py +++ b/wxPython/src/msw/controls.py @@ -222,6 +222,12 @@ CHK_UNCHECKED = _controls.CHK_UNCHECKED CHK_CHECKED = _controls.CHK_CHECKED CHK_UNDETERMINED = _controls.CHK_UNDETERMINED class CheckBox(core.Control): + """ + A checkbox is a labelled box which by default is either on (checkmark is + visible) or off (no checkmark). Optionally (When the wxCHK_3STATE style flag + is set) it can have a third state, called the mixed or undetermined + state. Often this is used as a "Does Not Apply" state. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxCheckBox instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -229,6 +235,8 @@ class CheckBox(core.Control): __init__(Window parent, int id, String label, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, Validator validator=DefaultValidator, String name=CheckBoxNameStr) -> CheckBox + + Creates and shows a CheckBox control """ newobj = _controls.new_CheckBox(*args, **kwargs) self.this = newobj.this @@ -241,35 +249,73 @@ class CheckBox(core.Control): Create(Window parent, int id, String label, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, Validator validator=DefaultValidator, String name=CheckBoxNameStr) -> bool + + Actually create the GUI CheckBox for 2-phase creation. """ return _controls.CheckBox_Create(*args, **kwargs) def GetValue(*args, **kwargs): - """GetValue() -> bool""" + """ + GetValue() -> bool + + Gets the state of a 2-state CheckBox. Returns True if it is checked, + False otherwise. + """ return _controls.CheckBox_GetValue(*args, **kwargs) def IsChecked(*args, **kwargs): - """IsChecked() -> bool""" + """ + IsChecked() -> bool + + Similar to GetValue, but raises an exception if it is not a 2-state CheckBox. + """ return _controls.CheckBox_IsChecked(*args, **kwargs) def SetValue(*args, **kwargs): - """SetValue(bool state)""" + """ + SetValue(bool state) + + Set the state of a 2-state CheckBox. Pass True for checked, + False for unchecked. + """ return _controls.CheckBox_SetValue(*args, **kwargs) def Get3StateValue(*args, **kwargs): - """Get3StateValue() -> int""" + """ + Get3StateValue() -> int + + Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, wx.CHK_CHECKED when + it is checked and wx.CHK_UNDETERMINED when it's in the undetermined state. + Raises an exceptiion when the function is used with a 2-state CheckBox. + """ return _controls.CheckBox_Get3StateValue(*args, **kwargs) def Set3StateValue(*args, **kwargs): - """Set3StateValue(int state)""" + """ + Set3StateValue(int state) + + Sets the CheckBox to the given state. The state parameter can be + one of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED + (Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an + exception when the CheckBox is a 2-state checkbox and setting the state + to wx.CHK_UNDETERMINED. + """ return _controls.CheckBox_Set3StateValue(*args, **kwargs) def Is3State(*args, **kwargs): - """Is3State() -> bool""" + """ + Is3State() -> bool + + Returns whether or not the CheckBox is a 3-state CheckBox. + """ return _controls.CheckBox_Is3State(*args, **kwargs) def Is3rdStateAllowedForUser(*args, **kwargs): - """Is3rdStateAllowedForUser() -> bool""" + """ + Is3rdStateAllowedForUser() -> bool + + Returns whether or not the user can set the CheckBox to the third state. + """ return _controls.CheckBox_Is3rdStateAllowedForUser(*args, **kwargs) @@ -282,7 +328,11 @@ _controls.CheckBox_swigregister(CheckBoxPtr) CheckBoxNameStr = cvar.CheckBoxNameStr def PreCheckBox(*args, **kwargs): - """PreCheckBox() -> CheckBox""" + """ + PreCheckBox() -> CheckBox + + Precreate a CheckBox for 2-phase creation. + """ val = _controls.new_PreCheckBox(*args, **kwargs) val.thisown = 1 return val @@ -290,14 +340,19 @@ def PreCheckBox(*args, **kwargs): #--------------------------------------------------------------------------- class Choice(core.ControlWithItems): + """ + A Choice control is used to select one of a list of strings. Unlike a ListBox, + only the selection is visible until the user pulls down the menu of choices. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxChoice instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ - __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, - wxArrayString choices=wxPyEmptyStringArray, - long style=0, Validator validator=DefaultValidator, + __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, + List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> Choice + + Create and show a Choice control """ newobj = _controls.new_Choice(*args, **kwargs) self.this = newobj.this @@ -307,33 +362,39 @@ class Choice(core.ControlWithItems): def Create(*args, **kwargs): """ - Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, - wxArrayString choices=wxPyEmptyStringArray, - long style=0, Validator validator=DefaultValidator, + Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, + List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> bool + + Actually create the GUI Choice control for 2-phase creation """ return _controls.Choice_Create(*args, **kwargs) - def GetColumns(*args, **kwargs): - """GetColumns() -> int""" - return _controls.Choice_GetColumns(*args, **kwargs) - - def SetColumns(*args, **kwargs): - """SetColumns(int n=1)""" - return _controls.Choice_SetColumns(*args, **kwargs) - def SetSelection(*args, **kwargs): - """SetSelection(int n)""" + """ + SetSelection(int n) + + Select the n'th item (zero based) in the list. + """ return _controls.Choice_SetSelection(*args, **kwargs) def SetStringSelection(*args, **kwargs): - """SetStringSelection(String string)""" + """ + SetStringSelection(String string) + + Select the item with the specifed string + """ return _controls.Choice_SetStringSelection(*args, **kwargs) def SetString(*args, **kwargs): - """SetString(int n, String s)""" + """ + SetString(int n, String string) + + Set the label for the n'th item (zero based) in the list. + """ return _controls.Choice_SetString(*args, **kwargs) + Select = SetSelection class ChoicePtr(Choice): def __init__(self, this): @@ -344,7 +405,11 @@ _controls.Choice_swigregister(ChoicePtr) ChoiceNameStr = cvar.ChoiceNameStr def PreChoice(*args, **kwargs): - """PreChoice() -> Choice""" + """ + PreChoice() -> Choice + + Precreate a Choice control for 2-phase creation. + """ val = _controls.new_PreChoice(*args, **kwargs) val.thisown = 1 return val diff --git a/wxPython/src/msw/controls_wrap.cpp b/wxPython/src/msw/controls_wrap.cpp index 6df340937c..09ecb3cd82 100644 --- a/wxPython/src/msw/controls_wrap.cpp +++ b/wxPython/src/msw/controls_wrap.cpp @@ -2468,63 +2468,6 @@ static PyObject *_wrap_Choice_Create(PyObject *self, PyObject *args, PyObject *k } -static PyObject *_wrap_Choice_GetColumns(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxChoice *arg1 = (wxChoice *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Choice_GetColumns",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxChoice,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->GetColumns(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_Choice_SetColumns(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxChoice *arg1 = (wxChoice *) 0 ; - int arg2 = (int) (int)1 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char *kwnames[] = { - (char *) "self",(char *) "n", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Choice_SetColumns",kwnames,&obj0,&obj1)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxChoice,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if (obj1) { - { - arg2 = (int const) SWIG_PyObj_AsInt(obj1); - if (PyErr_Occurred()) SWIG_fail; - } - } - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - (arg1)->SetColumns(arg2); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - static PyObject *_wrap_Choice_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxChoice *arg1 = (wxChoice *) 0 ; @@ -2605,7 +2548,7 @@ static PyObject *_wrap_Choice_SetString(PyObject *self, PyObject *args, PyObject PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; char *kwnames[] = { - (char *) "self",(char *) "n",(char *) "s", NULL + (char *) "self",(char *) "n",(char *) "string", NULL }; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Choice_SetString",kwnames,&obj0,&obj1,&obj2)) goto fail; @@ -29601,8 +29544,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"new_Choice", (PyCFunction) _wrap_new_Choice, METH_VARARGS | METH_KEYWORDS }, { (char *)"new_PreChoice", (PyCFunction) _wrap_new_PreChoice, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_Create", (PyCFunction) _wrap_Choice_Create, METH_VARARGS | METH_KEYWORDS }, - { (char *)"Choice_GetColumns", (PyCFunction) _wrap_Choice_GetColumns, METH_VARARGS | METH_KEYWORDS }, - { (char *)"Choice_SetColumns", (PyCFunction) _wrap_Choice_SetColumns, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetSelection", (PyCFunction) _wrap_Choice_SetSelection, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetStringSelection", (PyCFunction) _wrap_Choice_SetStringSelection, METH_VARARGS | METH_KEYWORDS }, { (char *)"Choice_SetString", (PyCFunction) _wrap_Choice_SetString, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/gdi.py b/wxPython/src/msw/gdi.py index e64a6900a9..40a48c5cb2 100644 --- a/wxPython/src/msw/gdi.py +++ b/wxPython/src/msw/gdi.py @@ -2909,7 +2909,7 @@ class BufferedDC(MemoryDC): self.this = newobj.this self.thisown = 1 del newobj.thisown - val._dc = args[0] # save a ref so the other dc will not be deleted before self + self._dc = args[0] # save a ref so the other dc will not be deleted before self def UnMask(*args, **kwargs): """UnMask()""" diff --git a/wxPython/src/msw/misc.py b/wxPython/src/msw/misc.py index 68a56218c9..6e38e457f8 100644 --- a/wxPython/src/msw/misc.py +++ b/wxPython/src/msw/misc.py @@ -4590,6 +4590,18 @@ _misc.FileDropTarget_swigregister(FileDropTargetPtr) #--------------------------------------------------------------------------- class Clipboard(core.Object): + """ + wx.Clipboard represents the system clipboard and provides methods to copy data + to or paste data from it. Normally, you should only use wx.TheClipboard which + is a reference to a global wx.Clipboard instance. + + Call wx.TheClipboard.Open to get ownership of the clipboard. If this operation + returns True, you now own the clipboard. Call wx.TheClipboard.SetData to put + data on the clipboard, or wx.TheClipboard.GetData to retrieve data from the + clipboard. Call wx.TheClipboard.Close to close the clipboard and relinquish + ownership. You should keep the clipboard open only momentarily. + + """ def __repr__(self): return "<%s.%s; proxy of C++ wxClipboard instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -4605,43 +4617,97 @@ class Clipboard(core.Object): except: pass def Open(*args, **kwargs): - """Open() -> bool""" + """ + Open() -> bool + + Call this function to open the clipboard before calling SetData + and GetData. Call Close when you have finished with the clipboard. + You should keep the clipboard open for only a very short time. + Returns true on success. + """ return _misc.Clipboard_Open(*args, **kwargs) def Close(*args, **kwargs): - """Close()""" + """ + Close() + + Closes the clipboard. + """ return _misc.Clipboard_Close(*args, **kwargs) def IsOpened(*args, **kwargs): - """IsOpened() -> bool""" + """ + IsOpened() -> bool + + Query whether the clipboard is opened + """ return _misc.Clipboard_IsOpened(*args, **kwargs) def AddData(*args, **kwargs): - """AddData(DataObject data) -> bool""" + """ + AddData(DataObject data) -> bool + + Call this function to add the data object to the clipboard. You + may call this function repeatedly after having cleared the clipboard. + After this function has been called, the clipboard owns the data, so + do not delete the data explicitly. + """ return _misc.Clipboard_AddData(*args, **kwargs) def SetData(*args, **kwargs): - """SetData(DataObject data) -> bool""" + """ + SetData(DataObject data) -> bool + + Set the clipboard data, this is the same as Clear followed by AddData. + """ return _misc.Clipboard_SetData(*args, **kwargs) def IsSupported(*args, **kwargs): - """IsSupported(DataFormat format) -> bool""" + """ + IsSupported(DataFormat format) -> bool + + Returns True if the given format is available in the data object(s) on + the clipboard. + """ return _misc.Clipboard_IsSupported(*args, **kwargs) def GetData(*args, **kwargs): - """GetData(DataObject data) -> bool""" + """ + GetData(DataObject data) -> bool + + Call this function to fill data with data on the clipboard, if available + in the required format. Returns true on success. + """ return _misc.Clipboard_GetData(*args, **kwargs) def Clear(*args, **kwargs): - """Clear()""" + """ + Clear() + + Clears data from the clipboard object and also the system's clipboard + if possible. + """ return _misc.Clipboard_Clear(*args, **kwargs) def Flush(*args, **kwargs): - """Flush() -> bool""" + """ + Flush() -> bool + + Flushes the clipboard: this means that the data which is currently on + clipboard will stay available even after the application exits (possibly + eating memory), otherwise the clipboard will be emptied on exit. + Returns False if the operation is unsuccesful for any reason. + """ return _misc.Clipboard_Flush(*args, **kwargs) def UsePrimarySelection(*args, **kwargs): - """UsePrimarySelection(bool primary=False)""" + """ + UsePrimarySelection(bool primary=True) + + On platforms supporting it (the X11 based platforms), selects the so + called PRIMARY SELECTION as the clipboard as opposed to the normal + clipboard, if primary is True. + """ return _misc.Clipboard_UsePrimarySelection(*args, **kwargs) @@ -4653,10 +4719,19 @@ class ClipboardPtr(Clipboard): _misc.Clipboard_swigregister(ClipboardPtr) class ClipboardLocker(object): + """ + A helpful class for opening the clipboard and automatically closing it when + the locker is destroyed. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxClipboardLocker instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(Clipboard clipboard=None) -> ClipboardLocker""" + """ + __init__(Clipboard clipboard=None) -> ClipboardLocker + + A helpful class for opening the clipboard and automatically closing it when + the locker is destroyed. + """ newobj = _misc.new_ClipboardLocker(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -4668,7 +4743,12 @@ class ClipboardLocker(object): except: pass def __nonzero__(*args, **kwargs): - """__nonzero__() -> bool""" + """ + __nonzero__() -> bool + + A ClipboardLocker instance evaluates to True if the clipboard was + successfully opened. + """ return _misc.ClipboardLocker___nonzero__(*args, **kwargs) diff --git a/wxPython/src/msw/misc_wrap.cpp b/wxPython/src/msw/misc_wrap.cpp index 9b88fec904..dc2efa5b0d 100644 --- a/wxPython/src/msw/misc_wrap.cpp +++ b/wxPython/src/msw/misc_wrap.cpp @@ -26578,7 +26578,7 @@ static PyObject *_wrap_Clipboard_Flush(PyObject *self, PyObject *args, PyObject static PyObject *_wrap_Clipboard_UsePrimarySelection(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxClipboard *arg1 = (wxClipboard *) 0 ; - bool arg2 = (bool) False ; + bool arg2 = (bool) True ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index 0f00827fe1..03f585570f 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -1648,10 +1648,15 @@ EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK ) #--------------------------------------------------------------------------- class ColourData(core.Object): + """This class holds a variety of information related to colour dialogs.""" def __repr__(self): return "<%s.%s; proxy of C++ wxColourData instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__() -> ColourData""" + """ + __init__() -> ColourData + + Constructor, sets default values. + """ newobj = _windows.new_ColourData(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -1663,27 +1668,57 @@ class ColourData(core.Object): except: pass def GetChooseFull(*args, **kwargs): - """GetChooseFull() -> bool""" + """ + GetChooseFull() -> bool + + Under Windows, determines whether the Windows colour dialog will display + the full dialog with custom colour selection controls. Has no meaning + under other platforms. The default value is true. + """ return _windows.ColourData_GetChooseFull(*args, **kwargs) def GetColour(*args, **kwargs): - """GetColour() -> Colour""" + """ + GetColour() -> Colour + + Gets the colour (pre)selected by the dialog. + """ return _windows.ColourData_GetColour(*args, **kwargs) def GetCustomColour(*args, **kwargs): - """GetCustomColour(int i) -> Colour""" + """ + GetCustomColour(int i) -> Colour + + Gets the i'th custom colour associated with the colour dialog. i should + be an integer between 0 and 15. The default custom colours are all white. + """ return _windows.ColourData_GetCustomColour(*args, **kwargs) def SetChooseFull(*args, **kwargs): - """SetChooseFull(int flag)""" + """ + SetChooseFull(int flag) + + Under Windows, tells the Windows colour dialog to display the full dialog + with custom colour selection controls. Under other platforms, has no effect. + The default value is true. + """ return _windows.ColourData_SetChooseFull(*args, **kwargs) def SetColour(*args, **kwargs): - """SetColour(Colour colour)""" + """ + SetColour(Colour colour) + + Sets the default colour for the colour dialog. The default colour is black. + """ return _windows.ColourData_SetColour(*args, **kwargs) def SetCustomColour(*args, **kwargs): - """SetCustomColour(int i, Colour colour)""" + """ + SetCustomColour(int i, Colour colour) + + Sets the i'th custom colour for the colour dialog. i should be an integer + between 0 and 15. The default custom colours are all white. + """ return _windows.ColourData_SetCustomColour(*args, **kwargs) @@ -1701,10 +1736,16 @@ GetTextFromUserPromptStr = cvar.GetTextFromUserPromptStr MessageBoxCaptionStr = cvar.MessageBoxCaptionStr class ColourDialog(Dialog): + """This class represents the colour chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxColourDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(Window parent, ColourData data=None) -> ColourDialog""" + """ + __init__(Window parent, ColourData data=None) -> ColourDialog + + Constructor. Pass a parent window, and optionally a ColourData, which + will be copied to the colour dialog's internal ColourData instance. + """ newobj = _windows.new_ColourDialog(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -1712,12 +1753,12 @@ class ColourDialog(Dialog): self._setOORInfo(self) def GetColourData(*args, **kwargs): - """GetColourData() -> ColourData""" - return _windows.ColourDialog_GetColourData(*args, **kwargs) + """ + GetColourData() -> ColourData - def ShowModal(*args, **kwargs): - """ShowModal() -> int""" - return _windows.ColourDialog_ShowModal(*args, **kwargs) + Returns a reference to the ColourData used by the dialog. + """ + return _windows.ColourDialog_GetColourData(*args, **kwargs) class ColourDialogPtr(ColourDialog): @@ -1728,6 +1769,7 @@ class ColourDialogPtr(ColourDialog): _windows.ColourDialog_swigregister(ColourDialogPtr) class DirDialog(Dialog): + """This class represents the directory chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxDirDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -1736,6 +1778,8 @@ class DirDialog(Dialog): String defaultPath=EmptyString, long style=0, Point pos=DefaultPosition, Size size=DefaultSize, String name=DirDialogNameStr) -> DirDialog + + Constructor. Use ShowModal method to show the dialog. """ newobj = _windows.new_DirDialog(*args, **kwargs) self.this = newobj.this @@ -1744,28 +1788,44 @@ class DirDialog(Dialog): self._setOORInfo(self) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Returns the default or user-selected path. + """ return _windows.DirDialog_GetPath(*args, **kwargs) def GetMessage(*args, **kwargs): - """GetMessage() -> String""" + """ + GetMessage() -> String + + Returns the message that will be displayed on the dialog. + """ return _windows.DirDialog_GetMessage(*args, **kwargs) def GetStyle(*args, **kwargs): - """GetStyle() -> long""" + """ + GetStyle() -> long + + Returns the dialog style. + """ return _windows.DirDialog_GetStyle(*args, **kwargs) def SetMessage(*args, **kwargs): - """SetMessage(String message)""" + """ + SetMessage(String message) + + Sets the message that will be displayed on the dialog. + """ return _windows.DirDialog_SetMessage(*args, **kwargs) def SetPath(*args, **kwargs): - """SetPath(String path)""" - return _windows.DirDialog_SetPath(*args, **kwargs) + """ + SetPath(String path) - def ShowModal(*args, **kwargs): - """ShowModal() -> int""" - return _windows.DirDialog_ShowModal(*args, **kwargs) + Sets the default path. + """ + return _windows.DirDialog_SetPath(*args, **kwargs) class DirDialogPtr(DirDialog): @@ -1776,6 +1836,7 @@ class DirDialogPtr(DirDialog): _windows.DirDialog_swigregister(DirDialogPtr) class FileDialog(Dialog): + """This class represents the file chooser dialog.""" def __repr__(self): return "<%s.%s; proxy of C++ wxFileDialog instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): @@ -1784,6 +1845,8 @@ class FileDialog(Dialog): String defaultDir=EmptyString, String defaultFile=EmptyString, String wildcard=FileSelectorDefaultWildcardStr, long style=0, Point pos=DefaultPosition) -> FileDialog + + Constructor. Use ShowModal method to show the dialog. """ newobj = _windows.new_FileDialog(*args, **kwargs) self.this = newobj.this @@ -1792,67 +1855,140 @@ class FileDialog(Dialog): self._setOORInfo(self) def SetMessage(*args, **kwargs): - """SetMessage(String message)""" + """ + SetMessage(String message) + + Sets the message that will be displayed on the dialog. + """ return _windows.FileDialog_SetMessage(*args, **kwargs) def SetPath(*args, **kwargs): - """SetPath(String path)""" + """ + SetPath(String path) + + Sets the path (the combined directory and filename that will + be returned when the dialog is dismissed). + """ return _windows.FileDialog_SetPath(*args, **kwargs) def SetDirectory(*args, **kwargs): - """SetDirectory(String dir)""" + """ + SetDirectory(String dir) + + Sets the default directory. + """ return _windows.FileDialog_SetDirectory(*args, **kwargs) def SetFilename(*args, **kwargs): - """SetFilename(String name)""" + """ + SetFilename(String name) + + Sets the default filename. + """ return _windows.FileDialog_SetFilename(*args, **kwargs) def SetWildcard(*args, **kwargs): - """SetWildcard(String wildCard)""" + """ + SetWildcard(String wildCard) + + Sets the wildcard, which can contain multiple file types, for example: + "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" + """ return _windows.FileDialog_SetWildcard(*args, **kwargs) def SetStyle(*args, **kwargs): - """SetStyle(long style)""" + """ + SetStyle(long style) + + Sets the dialog style. + """ return _windows.FileDialog_SetStyle(*args, **kwargs) def SetFilterIndex(*args, **kwargs): - """SetFilterIndex(int filterIndex)""" + """ + SetFilterIndex(int filterIndex) + + Sets the default filter index, starting from zero. + """ return _windows.FileDialog_SetFilterIndex(*args, **kwargs) def GetMessage(*args, **kwargs): - """GetMessage() -> String""" + """ + GetMessage() -> String + + Returns the message that will be displayed on the dialog. + """ return _windows.FileDialog_GetMessage(*args, **kwargs) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Returns the full path (directory and filename) of the selected file. + """ return _windows.FileDialog_GetPath(*args, **kwargs) def GetDirectory(*args, **kwargs): - """GetDirectory() -> String""" + """ + GetDirectory() -> String + + Returns the default directory. + """ return _windows.FileDialog_GetDirectory(*args, **kwargs) def GetFilename(*args, **kwargs): - """GetFilename() -> String""" + """ + GetFilename() -> String + + Returns the default filename. + """ return _windows.FileDialog_GetFilename(*args, **kwargs) def GetWildcard(*args, **kwargs): - """GetWildcard() -> String""" + """ + GetWildcard() -> String + + Returns the file dialog wildcard. + """ return _windows.FileDialog_GetWildcard(*args, **kwargs) def GetStyle(*args, **kwargs): - """GetStyle() -> long""" + """ + GetStyle() -> long + + Returns the dialog style. + """ return _windows.FileDialog_GetStyle(*args, **kwargs) def GetFilterIndex(*args, **kwargs): - """GetFilterIndex() -> int""" + """ + GetFilterIndex() -> int + + Returns the index into the list of filters supplied, optionally, in + the wildcard parameter. Before the dialog is shown, this is the index + which will be used when the dialog is first displayed. After the dialog + is shown, this is the index selected by the user. + """ return _windows.FileDialog_GetFilterIndex(*args, **kwargs) def GetFilenames(*args, **kwargs): - """GetFilenames() -> PyObject""" + """ + GetFilenames() -> PyObject + + Returns a list of filenames chosen in the dialog. This function should + only be used with the dialogs which have wx.MULTIPLE style, use + GetFilename for the others. + """ return _windows.FileDialog_GetFilenames(*args, **kwargs) def GetPaths(*args, **kwargs): - """GetPaths() -> PyObject""" + """ + GetPaths() -> PyObject + + Fills the array paths with the full paths of the files chosen. This + function should only be used with the dialogs which have wx.MULTIPLE style, + use GetPath for the others. + """ return _windows.FileDialog_GetPaths(*args, **kwargs) diff --git a/wxPython/src/msw/windows_wrap.cpp b/wxPython/src/msw/windows_wrap.cpp index af8b713ff8..0346ae018b 100644 --- a/wxPython/src/msw/windows_wrap.cpp +++ b/wxPython/src/msw/windows_wrap.cpp @@ -11038,31 +11038,6 @@ static PyObject *_wrap_ColourDialog_GetColourData(PyObject *self, PyObject *args } -static PyObject *_wrap_ColourDialog_ShowModal(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxColourDialog *arg1 = (wxColourDialog *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:ColourDialog_ShowModal",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxColourDialog,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->ShowModal(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - static PyObject * ColourDialog_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -11347,31 +11322,6 @@ static PyObject *_wrap_DirDialog_SetPath(PyObject *self, PyObject *args, PyObjec } -static PyObject *_wrap_DirDialog_ShowModal(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxDirDialog *arg1 = (wxDirDialog *) 0 ; - int result; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:DirDialog_ShowModal",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxDirDialog,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (int)(arg1)->ShowModal(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_PyObj_FromInt((int)result); - return resultobj; - fail: - return NULL; -} - - static PyObject * DirDialog_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -23086,7 +23036,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"ColourData_swigregister", ColourData_swigregister, METH_VARARGS }, { (char *)"new_ColourDialog", (PyCFunction) _wrap_new_ColourDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"ColourDialog_GetColourData", (PyCFunction) _wrap_ColourDialog_GetColourData, METH_VARARGS | METH_KEYWORDS }, - { (char *)"ColourDialog_ShowModal", (PyCFunction) _wrap_ColourDialog_ShowModal, METH_VARARGS | METH_KEYWORDS }, { (char *)"ColourDialog_swigregister", ColourDialog_swigregister, METH_VARARGS }, { (char *)"new_DirDialog", (PyCFunction) _wrap_new_DirDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_GetPath", (PyCFunction) _wrap_DirDialog_GetPath, METH_VARARGS | METH_KEYWORDS }, @@ -23094,7 +23043,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"DirDialog_GetStyle", (PyCFunction) _wrap_DirDialog_GetStyle, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_SetMessage", (PyCFunction) _wrap_DirDialog_SetMessage, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_SetPath", (PyCFunction) _wrap_DirDialog_SetPath, METH_VARARGS | METH_KEYWORDS }, - { (char *)"DirDialog_ShowModal", (PyCFunction) _wrap_DirDialog_ShowModal, METH_VARARGS | METH_KEYWORDS }, { (char *)"DirDialog_swigregister", DirDialog_swigregister, METH_VARARGS }, { (char *)"new_FileDialog", (PyCFunction) _wrap_new_FileDialog, METH_VARARGS | METH_KEYWORDS }, { (char *)"FileDialog_SetMessage", (PyCFunction) _wrap_FileDialog_SetMessage, METH_VARARGS | METH_KEYWORDS }, -- 2.45.2