X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8edf1c75f0667d3568e224910fa858cf05234942..b88bce5f07e0359732245ea77d1e59a8794f9bef:/wxPython/src/msw/misc.py?ds=sidebyside diff --git a/wxPython/src/msw/misc.py b/wxPython/src/msw/misc.py index 98ef175946..6e38e457f8 100644 --- a/wxPython/src/msw/misc.py +++ b/wxPython/src/msw/misc.py @@ -2012,43 +2012,69 @@ EVT_JOYSTICK_EVENTS = wx.PyEventBinder([ wxEVT_JOY_BUTTON_DOWN, #--------------------------------------------------------------------------- -class Wave(object): +SOUND_SYNC = _misc.SOUND_SYNC +SOUND_ASYNC = _misc.SOUND_ASYNC +SOUND_LOOP = _misc.SOUND_LOOP +class Sound(object): def __repr__(self): - return "<%s.%s; proxy of C++ wxWave instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): - """__init__(String fileName, bool isResource=False) -> Wave""" - newobj = _misc.new_Wave(*args, **kwargs) + return "<%s.%s; proxy of C++ wxSound instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args): + """ + __init__() -> Sound + __init__(String fileName, bool isResource=false) -> Sound + __init__(int size, wxByte data) -> Sound + """ + newobj = _misc.new_Sound(*args) self.this = newobj.this self.thisown = 1 del newobj.thisown - def __del__(self, destroy=_misc.delete_Wave): + def __del__(self, destroy=_misc.delete_Sound): """__del__()""" try: if self.thisown: destroy(self) except: pass + def Create(*args): + """ + Create(String fileName, bool isResource=false) -> bool + Create(int size, wxByte data) -> bool + """ + return _misc.Sound_Create(*args) + def IsOk(*args, **kwargs): """IsOk() -> bool""" - return _misc.Wave_IsOk(*args, **kwargs) + return _misc.Sound_IsOk(*args, **kwargs) - def Play(*args, **kwargs): - """Play(bool async=True, bool looped=False) -> bool""" - return _misc.Wave_Play(*args, **kwargs) + def Play(*args): + """Play(unsigned int flags=SOUND_ASYNC) -> bool""" + return _misc.Sound_Play(*args) + def PlaySound(*args): + """PlaySound(String filename, unsigned int flags=SOUND_ASYNC) -> bool""" + return _misc.Sound_PlaySound(*args) + + PlaySound = staticmethod(PlaySound) + def Stop(*args, **kwargs): + """Stop()""" + return _misc.Sound_Stop(*args, **kwargs) + + Stop = staticmethod(Stop) def __nonzero__(self): return self.IsOk() -class WavePtr(Wave): +class SoundPtr(Sound): def __init__(self, this): self.this = this if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = Wave -_misc.Wave_swigregister(WavePtr) + self.__class__ = Sound +_misc.Sound_swigregister(SoundPtr) -def WaveData(*args, **kwargs): - """WaveData(String data) -> Wave""" - val = _misc.new_WaveData(*args, **kwargs) - val.thisown = 1 - return val +def Sound_PlaySound(*args): + """Sound_PlaySound(String filename, unsigned int flags=SOUND_ASYNC) -> bool""" + return _misc.Sound_PlaySound(*args) + +def Sound_Stop(*args, **kwargs): + """Sound_Stop()""" + return _misc.Sound_Stop(*args, **kwargs) #--------------------------------------------------------------------------- @@ -3173,6 +3199,8 @@ class DateTime(object): """IsValid() -> bool""" return _misc.DateTime_IsValid(*args, **kwargs) + Ok = IsValid + def __nonzero__(self): return self.Ok() def GetTicks(*args, **kwargs): """GetTicks() -> time_t""" return _misc.DateTime_GetTicks(*args, **kwargs) @@ -3335,7 +3363,7 @@ class DateTime(object): return _misc.DateTime_ParseRfc822Date(*args, **kwargs) def ParseFormat(*args, **kwargs): - """ParseFormat(String date, String format=DateFormatStr, DateTime dateDef=wxDefaultDateTime) -> int""" + """ParseFormat(String date, String format=DateFormatStr, DateTime dateDef=DefaultDateTime) -> int""" return _misc.DateTime_ParseFormat(*args, **kwargs) def ParseDateTime(*args, **kwargs): @@ -4015,6 +4043,7 @@ class DataFormatPtr(DataFormat): if not hasattr(self,"thisown"): self.thisown = 0 self.__class__ = DataFormat _misc.DataFormat_swigregister(DataFormatPtr) +DefaultDateTime = cvar.DefaultDateTime def CustomDataFormat(*args, **kwargs): """CustomDataFormat(String format) -> DataFormat""" @@ -4561,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): @@ -4576,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) @@ -4624,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 @@ -4639,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)