X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d03fd34d3cca63ba73cee48271eda244ceb98337..4f89f6a36b34749fd9bcad72cb99668bf26ac611:/wxPython/src/msw/misc.py diff --git a/wxPython/src/msw/misc.py b/wxPython/src/msw/misc.py index 562fb93f7d..65fb21a8a1 100644 --- a/wxPython/src/msw/misc.py +++ b/wxPython/src/msw/misc.py @@ -103,32 +103,32 @@ class SystemSettings(object): def __repr__(self): return "<%s.%s; proxy of C++ wxSystemSettings instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def GetColour(*args, **kwargs): - """SystemSettings.GetColour(int index) -> Colour""" + """GetColour(int index) -> Colour""" return _misc.SystemSettings_GetColour(*args, **kwargs) GetColour = staticmethod(GetColour) def GetFont(*args, **kwargs): - """SystemSettings.GetFont(int index) -> Font""" + """GetFont(int index) -> Font""" return _misc.SystemSettings_GetFont(*args, **kwargs) GetFont = staticmethod(GetFont) def GetMetric(*args, **kwargs): - """SystemSettings.GetMetric(int index) -> int""" + """GetMetric(int index) -> int""" return _misc.SystemSettings_GetMetric(*args, **kwargs) GetMetric = staticmethod(GetMetric) def HasFeature(*args, **kwargs): - """SystemSettings.HasFeature(int index) -> bool""" + """HasFeature(int index) -> bool""" return _misc.SystemSettings_HasFeature(*args, **kwargs) HasFeature = staticmethod(HasFeature) def GetScreenType(*args, **kwargs): - """SystemSettings.GetScreenType() -> int""" + """GetScreenType() -> int""" return _misc.SystemSettings_GetScreenType(*args, **kwargs) GetScreenType = staticmethod(GetScreenType) def SetScreenType(*args, **kwargs): - """SystemSettings.SetScreenType(int screen)""" + """SetScreenType(int screen)""" return _misc.SystemSettings_SetScreenType(*args, **kwargs) SetScreenType = staticmethod(SetScreenType) @@ -164,11 +164,6 @@ def SystemSettings_SetScreenType(*args, **kwargs): """SystemSettings_SetScreenType(int screen)""" return _misc.SystemSettings_SetScreenType(*args, **kwargs) -# backwards compatibility aliasses -SystemSettings_GetSystemColour = SystemSettings_GetColour -SystemSettings_GetSystemFont = SystemSettings_GetFont -SystemSettings_GetSystemMetric = SystemSettings_GetMetric - class SystemOptions(core.Object): def __repr__(self): return "<%s.%s; proxy of C++ wxSystemOptions instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) @@ -179,27 +174,27 @@ class SystemOptions(core.Object): self.thisown = 1 del newobj.thisown def SetOption(*args, **kwargs): - """SystemOptions.SetOption(String name, String value)""" + """SetOption(String name, String value)""" return _misc.SystemOptions_SetOption(*args, **kwargs) SetOption = staticmethod(SetOption) def SetOptionInt(*args, **kwargs): - """SystemOptions.SetOptionInt(String name, int value)""" + """SetOptionInt(String name, int value)""" return _misc.SystemOptions_SetOptionInt(*args, **kwargs) SetOptionInt = staticmethod(SetOptionInt) def GetOption(*args, **kwargs): - """SystemOptions.GetOption(String name) -> String""" + """GetOption(String name) -> String""" return _misc.SystemOptions_GetOption(*args, **kwargs) GetOption = staticmethod(GetOption) def GetOptionInt(*args, **kwargs): - """SystemOptions.GetOptionInt(String name) -> int""" + """GetOptionInt(String name) -> int""" return _misc.SystemOptions_GetOptionInt(*args, **kwargs) GetOptionInt = staticmethod(GetOptionInt) def HasOption(*args, **kwargs): - """SystemOptions.HasOption(String name) -> bool""" + """HasOption(String name) -> bool""" return _misc.SystemOptions_HasOption(*args, **kwargs) HasOption = staticmethod(HasOption) @@ -558,12 +553,12 @@ class ToolTip(core.Object): return _misc.ToolTip_GetWindow(*args, **kwargs) def Enable(*args, **kwargs): - """ToolTip.Enable(bool flag)""" + """Enable(bool flag)""" return _misc.ToolTip_Enable(*args, **kwargs) Enable = staticmethod(Enable) def SetDelay(*args, **kwargs): - """ToolTip.SetDelay(long milliseconds)""" + """SetDelay(long milliseconds)""" return _misc.ToolTip_SetDelay(*args, **kwargs) SetDelay = staticmethod(SetDelay) @@ -828,6 +823,7 @@ class FileHistory(core.Object): """GetCount() -> int""" return _misc.FileHistory_GetCount(*args, **kwargs) + GetNoHistoryFiles = GetCount class FileHistoryPtr(FileHistory): def __init__(self, this): @@ -952,7 +948,7 @@ class Timer(core.EvtHandler): self.this = newobj.this self.thisown = 1 del newobj.thisown - self._setCallbackInfo(self, Timer) + self._setCallbackInfo(self, Timer, 0) def __del__(self, destroy=_misc.delete_Timer): """__del__()""" @@ -961,7 +957,7 @@ class Timer(core.EvtHandler): except: pass def _setCallbackInfo(*args, **kwargs): - """_setCallbackInfo(PyObject self, PyObject _class)""" + """_setCallbackInfo(PyObject self, PyObject _class, int incref=1)""" return _misc.Timer__setCallbackInfo(*args, **kwargs) def SetOwner(*args, **kwargs): @@ -1012,7 +1008,7 @@ class PyTimer(Timer): EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER, 1 ) - + class TimerEvent(core.Event): def __repr__(self): @@ -1098,17 +1094,17 @@ class Log(object): self.thisown = 1 del newobj.thisown def IsEnabled(*args, **kwargs): - """Log.IsEnabled() -> bool""" + """IsEnabled() -> bool""" return _misc.Log_IsEnabled(*args, **kwargs) IsEnabled = staticmethod(IsEnabled) def EnableLogging(*args, **kwargs): - """Log.EnableLogging(bool doIt=True) -> bool""" + """EnableLogging(bool doIt=True) -> bool""" return _misc.Log_EnableLogging(*args, **kwargs) EnableLogging = staticmethod(EnableLogging) def OnLog(*args, **kwargs): - """Log.OnLog(wxLogLevel level, wxChar szString, time_t t)""" + """OnLog(wxLogLevel level, wxChar szString, time_t t)""" return _misc.Log_OnLog(*args, **kwargs) OnLog = staticmethod(OnLog) @@ -1117,102 +1113,102 @@ class Log(object): return _misc.Log_Flush(*args, **kwargs) def FlushActive(*args, **kwargs): - """Log.FlushActive()""" + """FlushActive()""" return _misc.Log_FlushActive(*args, **kwargs) FlushActive = staticmethod(FlushActive) def GetActiveTarget(*args, **kwargs): - """Log.GetActiveTarget() -> Log""" + """GetActiveTarget() -> Log""" return _misc.Log_GetActiveTarget(*args, **kwargs) GetActiveTarget = staticmethod(GetActiveTarget) def SetActiveTarget(*args, **kwargs): - """Log.SetActiveTarget(Log pLogger) -> Log""" + """SetActiveTarget(Log pLogger) -> Log""" return _misc.Log_SetActiveTarget(*args, **kwargs) SetActiveTarget = staticmethod(SetActiveTarget) def Suspend(*args, **kwargs): - """Log.Suspend()""" + """Suspend()""" return _misc.Log_Suspend(*args, **kwargs) Suspend = staticmethod(Suspend) def Resume(*args, **kwargs): - """Log.Resume()""" + """Resume()""" return _misc.Log_Resume(*args, **kwargs) Resume = staticmethod(Resume) def SetVerbose(*args, **kwargs): - """Log.SetVerbose(bool bVerbose=True)""" + """SetVerbose(bool bVerbose=True)""" return _misc.Log_SetVerbose(*args, **kwargs) SetVerbose = staticmethod(SetVerbose) def SetLogLevel(*args, **kwargs): - """Log.SetLogLevel(wxLogLevel logLevel)""" + """SetLogLevel(wxLogLevel logLevel)""" return _misc.Log_SetLogLevel(*args, **kwargs) SetLogLevel = staticmethod(SetLogLevel) def DontCreateOnDemand(*args, **kwargs): - """Log.DontCreateOnDemand()""" + """DontCreateOnDemand()""" return _misc.Log_DontCreateOnDemand(*args, **kwargs) DontCreateOnDemand = staticmethod(DontCreateOnDemand) def SetTraceMask(*args, **kwargs): - """Log.SetTraceMask(wxTraceMask ulMask)""" + """SetTraceMask(wxTraceMask ulMask)""" return _misc.Log_SetTraceMask(*args, **kwargs) SetTraceMask = staticmethod(SetTraceMask) def AddTraceMask(*args, **kwargs): - """Log.AddTraceMask(String str)""" + """AddTraceMask(String str)""" return _misc.Log_AddTraceMask(*args, **kwargs) AddTraceMask = staticmethod(AddTraceMask) def RemoveTraceMask(*args, **kwargs): - """Log.RemoveTraceMask(String str)""" + """RemoveTraceMask(String str)""" return _misc.Log_RemoveTraceMask(*args, **kwargs) RemoveTraceMask = staticmethod(RemoveTraceMask) def ClearTraceMasks(*args, **kwargs): - """Log.ClearTraceMasks()""" + """ClearTraceMasks()""" return _misc.Log_ClearTraceMasks(*args, **kwargs) ClearTraceMasks = staticmethod(ClearTraceMasks) def GetTraceMasks(*args, **kwargs): - """Log.GetTraceMasks() -> wxArrayString""" + """GetTraceMasks() -> wxArrayString""" return _misc.Log_GetTraceMasks(*args, **kwargs) GetTraceMasks = staticmethod(GetTraceMasks) def SetTimestamp(*args, **kwargs): - """Log.SetTimestamp(wxChar ts)""" + """SetTimestamp(wxChar ts)""" return _misc.Log_SetTimestamp(*args, **kwargs) SetTimestamp = staticmethod(SetTimestamp) def GetVerbose(*args, **kwargs): - """Log.GetVerbose() -> bool""" + """GetVerbose() -> bool""" return _misc.Log_GetVerbose(*args, **kwargs) GetVerbose = staticmethod(GetVerbose) def GetTraceMask(*args, **kwargs): - """Log.GetTraceMask() -> wxTraceMask""" + """GetTraceMask() -> wxTraceMask""" return _misc.Log_GetTraceMask(*args, **kwargs) GetTraceMask = staticmethod(GetTraceMask) def IsAllowedTraceMask(*args, **kwargs): - """Log.IsAllowedTraceMask(wxChar mask) -> bool""" + """IsAllowedTraceMask(wxChar mask) -> bool""" return _misc.Log_IsAllowedTraceMask(*args, **kwargs) IsAllowedTraceMask = staticmethod(IsAllowedTraceMask) def GetLogLevel(*args, **kwargs): - """Log.GetLogLevel() -> wxLogLevel""" + """GetLogLevel() -> wxLogLevel""" return _misc.Log_GetLogLevel(*args, **kwargs) GetLogLevel = staticmethod(GetLogLevel) def GetTimestamp(*args, **kwargs): - """Log.GetTimestamp() -> wxChar""" + """GetTimestamp() -> wxChar""" return _misc.Log_GetTimestamp(*args, **kwargs) GetTimestamp = staticmethod(GetTimestamp) def TimeStamp(*args, **kwargs): - """Log.TimeStamp() -> String""" + """TimeStamp() -> String""" return _misc.Log_TimeStamp(*args, **kwargs) TimeStamp = staticmethod(TimeStamp) @@ -1580,17 +1576,17 @@ class Process(core.EvtHandler): def __repr__(self): return "<%s.%s; proxy of C++ wxPyProcess instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def Kill(*args, **kwargs): - """Process.Kill(int pid, int sig=SIGTERM) -> int""" + """Kill(int pid, int sig=SIGTERM) -> int""" return _misc.Process_Kill(*args, **kwargs) Kill = staticmethod(Kill) def Exists(*args, **kwargs): - """Process.Exists(int pid) -> bool""" + """Exists(int pid) -> bool""" return _misc.Process_Exists(*args, **kwargs) Exists = staticmethod(Exists) def Open(*args, **kwargs): - """Process.Open(String cmd, int flags=EXEC_ASYNC) -> Process""" + """Open(String cmd, int flags=EXEC_ASYNC) -> Process""" return _misc.Process_Open(*args, **kwargs) Open = staticmethod(Open) @@ -1773,7 +1769,7 @@ class Joystick(object): return _misc.Joystick_SetMovementThreshold(*args, **kwargs) def IsOk(*args, **kwargs): - """IsOk(void ??) -> bool""" + """IsOk() -> bool""" return _misc.Joystick_IsOk(*args, **kwargs) def GetNumberJoysticks(*args, **kwargs): @@ -2016,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): + """Play(unsigned int flags=SOUND_ASYNC) -> bool""" + return _misc.Sound_Play(*args) - def Play(*args, **kwargs): - """Play(bool async=True, bool looped=False) -> bool""" - return _misc.Wave_Play(*args, **kwargs) + 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) #--------------------------------------------------------------------------- @@ -2202,7 +2224,7 @@ class FileType(object): return _misc.FileType_Unassociate(*args, **kwargs) def ExpandCommand(*args, **kwargs): - """FileType.ExpandCommand(String command, String filename, String mimetype=EmptyString) -> String""" + """ExpandCommand(String command, String filename, String mimetype=EmptyString) -> String""" return _misc.FileType_ExpandCommand(*args, **kwargs) ExpandCommand = staticmethod(ExpandCommand) @@ -2222,7 +2244,7 @@ class MimeTypesManager(object): def __repr__(self): return "<%s.%s; proxy of C++ wxMimeTypesManager instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def IsOfType(*args, **kwargs): - """MimeTypesManager.IsOfType(String mimeType, String wildcard) -> bool""" + """IsOfType(String mimeType, String wildcard) -> bool""" return _misc.MimeTypesManager_IsOfType(*args, **kwargs) IsOfType = staticmethod(IsOfType) @@ -2310,7 +2332,7 @@ class ArtProvider(object): def PushProvider(*args, **kwargs): """ - ArtProvider.PushProvider(ArtProvider provider) + PushProvider(ArtProvider provider) Add new provider to the top of providers stack. """ @@ -2319,7 +2341,7 @@ class ArtProvider(object): PushProvider = staticmethod(PushProvider) def PopProvider(*args, **kwargs): """ - ArtProvider.PopProvider() -> bool + PopProvider() -> bool Remove latest added provider and delete it. """ @@ -2328,7 +2350,7 @@ class ArtProvider(object): PopProvider = staticmethod(PopProvider) def RemoveProvider(*args, **kwargs): """ - ArtProvider.RemoveProvider(ArtProvider provider) -> bool + RemoveProvider(ArtProvider provider) -> bool Remove provider. The provider must have been added previously! The provider is _not_ deleted. @@ -2338,7 +2360,7 @@ class ArtProvider(object): RemoveProvider = staticmethod(RemoveProvider) def GetBitmap(*args, **kwargs): """ - ArtProvider.GetBitmap(String id, String client=ART_OTHER, Size size=DefaultSize) -> Bitmap + GetBitmap(String id, String client=ART_OTHER, Size size=DefaultSize) -> Bitmap Query the providers for bitmap with given ID and return it. Return wx.NullBitmap if no provider provides it. @@ -2348,7 +2370,7 @@ class ArtProvider(object): GetBitmap = staticmethod(GetBitmap) def GetIcon(*args, **kwargs): """ - ArtProvider.GetIcon(String id, String client=ART_OTHER, Size size=DefaultSize) -> Icon + GetIcon(String id, String client=ART_OTHER, Size size=DefaultSize) -> Icon Query the providers for icon with given ID and return it. Return wx.NullIcon if no provider provides it. @@ -2456,6 +2478,27 @@ CONFIG_USE_GLOBAL_FILE = _misc.CONFIG_USE_GLOBAL_FILE CONFIG_USE_RELATIVE_PATH = _misc.CONFIG_USE_RELATIVE_PATH CONFIG_USE_NO_ESCAPE_CHARACTERS = _misc.CONFIG_USE_NO_ESCAPE_CHARACTERS class ConfigBase(object): + """ + wx.ConfigBase class defines the basic interface of all config + classes. It can not be used by itself (it is an abstract base + class) and you will always use one of its derivations: wx.Config + or wx.FileConfig. + + wx.ConfigBase organizes the items in a tree-like structure, + modeled after the Unix/Dos filesystem. There are groups that act + like directories and entries, key/value pairs that act like + files. There is always one current group given by the current + path. As in the file system case, to specify a key in the config + class you must use a path to it. Config classes also support the + notion of the current group, which makes it possible to use + relative paths. + + Keys are pairs "key_name = value" where value may be of string, + integer floating point or boolean, you can not store binary data + without first encoding it as a string. For performance reasons + items should be kept small, no more than a couple kilobytes. + + """ def __init__(self): raise RuntimeError, "No constructor defined" def __repr__(self): return "<%s.%s; proxy of C++ wxConfigBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) @@ -2471,147 +2514,311 @@ class ConfigBase(object): Type_Integer = _misc.ConfigBase_Type_Integer Type_Float = _misc.ConfigBase_Type_Float def Set(*args, **kwargs): - """ConfigBase.Set(ConfigBase pConfig) -> ConfigBase""" + """ + Set(ConfigBase config) -> ConfigBase + + Sets the global config object (the one returned by Get) and + returns a reference to the previous global config object. + """ return _misc.ConfigBase_Set(*args, **kwargs) Set = staticmethod(Set) def Get(*args, **kwargs): - """ConfigBase.Get(bool createOnDemand=True) -> ConfigBase""" + """ + Get(bool createOnDemand=True) -> ConfigBase + + Returns the current global config object, creating one if neccessary. + """ return _misc.ConfigBase_Get(*args, **kwargs) Get = staticmethod(Get) def Create(*args, **kwargs): - """ConfigBase.Create() -> ConfigBase""" + """ + Create() -> ConfigBase + + Create and return a new global config object. This function will + create the "best" implementation of wx.Config available for the + current platform. + """ return _misc.ConfigBase_Create(*args, **kwargs) Create = staticmethod(Create) def DontCreateOnDemand(*args, **kwargs): - """ConfigBase.DontCreateOnDemand()""" + """ + DontCreateOnDemand() + + Should Get() try to create a new log object if there isn't a current one? + """ return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) DontCreateOnDemand = staticmethod(DontCreateOnDemand) def SetPath(*args, **kwargs): - """SetPath(String strPath)""" + """ + SetPath(String path) + + Set current path: if the first character is '/', it's the absolute path, + otherwise it's a relative path. '..' is supported. If the strPath + doesn't exist it is created. + """ return _misc.ConfigBase_SetPath(*args, **kwargs) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Retrieve the current path (always as absolute path) + """ return _misc.ConfigBase_GetPath(*args, **kwargs) def GetFirstGroup(*args, **kwargs): - """GetFirstGroup() -> PyObject""" + """ + GetFirstGroup() -> (more, value, index) + + Allows enumerating the subgroups in a config object. Returns + a tuple containing a flag indicating there are more items, the + name of the current item, and an index to pass to GetNextGroup to + fetch the next item. + """ return _misc.ConfigBase_GetFirstGroup(*args, **kwargs) def GetNextGroup(*args, **kwargs): - """GetNextGroup(long index) -> PyObject""" + """ + GetNextGroup(long index) -> (more, value, index) + + Allows enumerating the subgroups in a config object. Returns + a tuple containing a flag indicating there are more items, the + name of the current item, and an index to pass to GetNextGroup to + fetch the next item. + """ return _misc.ConfigBase_GetNextGroup(*args, **kwargs) def GetFirstEntry(*args, **kwargs): - """GetFirstEntry() -> PyObject""" + """ + GetFirstEntry() -> (more, value, index) + + Allows enumerating the entries in the current group in a config + object. Returns a tuple containing a flag indicating there are + more items, the name of the current item, and an index to pass to + GetNextGroup to fetch the next item. + """ return _misc.ConfigBase_GetFirstEntry(*args, **kwargs) def GetNextEntry(*args, **kwargs): - """GetNextEntry(long index) -> PyObject""" + """ + GetNextEntry(long index) -> (more, value, index) + + Allows enumerating the entries in the current group in a config + object. Returns a tuple containing a flag indicating there are + more items, the name of the current item, and an index to pass to + GetNextGroup to fetch the next item. + """ return _misc.ConfigBase_GetNextEntry(*args, **kwargs) def GetNumberOfEntries(*args, **kwargs): - """GetNumberOfEntries(bool bRecursive=False) -> size_t""" + """ + GetNumberOfEntries(bool recursive=False) -> size_t + + Get the number of entries in the current group, with or + without its subgroups. + """ return _misc.ConfigBase_GetNumberOfEntries(*args, **kwargs) def GetNumberOfGroups(*args, **kwargs): - """GetNumberOfGroups(bool bRecursive=False) -> size_t""" + """ + GetNumberOfGroups(bool recursive=False) -> size_t + + Get the number of subgroups in the current group, with or + without its subgroups. + """ return _misc.ConfigBase_GetNumberOfGroups(*args, **kwargs) def HasGroup(*args, **kwargs): - """HasGroup(String strName) -> bool""" + """ + HasGroup(String name) -> bool + + Returns True if the group by this name exists + """ return _misc.ConfigBase_HasGroup(*args, **kwargs) def HasEntry(*args, **kwargs): - """HasEntry(String strName) -> bool""" + """ + HasEntry(String name) -> bool + + Returns True if the entry by this name exists + """ return _misc.ConfigBase_HasEntry(*args, **kwargs) def Exists(*args, **kwargs): - """Exists(String strName) -> bool""" + """ + Exists(String name) -> bool + + Returns True if either a group or an entry with a given name exists + """ return _misc.ConfigBase_Exists(*args, **kwargs) def GetEntryType(*args, **kwargs): - """GetEntryType(String name) -> int""" + """ + GetEntryType(String name) -> int + + Get the type of the entry. Returns one of the wx.Config.Type_XXX values. + """ return _misc.ConfigBase_GetEntryType(*args, **kwargs) def Read(*args, **kwargs): - """Read(String key, String defaultVal=EmptyString) -> String""" + """ + Read(String key, String defaultVal=EmptyString) -> String + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_Read(*args, **kwargs) def ReadInt(*args, **kwargs): - """ReadInt(String key, long defaultVal=0) -> long""" + """ + ReadInt(String key, long defaultVal=0) -> long + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadInt(*args, **kwargs) def ReadFloat(*args, **kwargs): - """ReadFloat(String key, double defaultVal=0.0) -> double""" + """ + ReadFloat(String key, double defaultVal=0.0) -> double + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadFloat(*args, **kwargs) def ReadBool(*args, **kwargs): - """ReadBool(String key, bool defaultVal=False) -> bool""" + """ + ReadBool(String key, bool defaultVal=False) -> bool + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadBool(*args, **kwargs) def Write(*args, **kwargs): - """Write(String key, String value) -> bool""" + """ + Write(String key, String value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_Write(*args, **kwargs) def WriteInt(*args, **kwargs): - """WriteInt(String key, long value) -> bool""" + """ + WriteInt(String key, long value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteInt(*args, **kwargs) def WriteFloat(*args, **kwargs): - """WriteFloat(String key, double value) -> bool""" + """ + WriteFloat(String key, double value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteFloat(*args, **kwargs) def WriteBool(*args, **kwargs): - """WriteBool(String key, bool value) -> bool""" + """ + WriteBool(String key, bool value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteBool(*args, **kwargs) def Flush(*args, **kwargs): - """Flush(bool bCurrentOnly=False) -> bool""" + """ + Flush(bool currentOnly=False) -> bool + + permanently writes all changes + """ return _misc.ConfigBase_Flush(*args, **kwargs) def RenameEntry(*args, **kwargs): - """RenameEntry(String oldName, String newName) -> bool""" + """ + RenameEntry(String oldName, String newName) -> bool + + Rename an entry. Returns False on failure (probably because the new + name is already taken by an existing entry) + """ return _misc.ConfigBase_RenameEntry(*args, **kwargs) def RenameGroup(*args, **kwargs): - """RenameGroup(String oldName, String newName) -> bool""" + """ + RenameGroup(String oldName, String newName) -> bool + + Rename aa group. Returns False on failure (probably because the new + name is already taken by an existing entry) + """ return _misc.ConfigBase_RenameGroup(*args, **kwargs) def DeleteEntry(*args, **kwargs): - """DeleteEntry(String key, bool bDeleteGroupIfEmpty=True) -> bool""" + """ + DeleteEntry(String key, bool deleteGroupIfEmpty=True) -> bool + + Deletes the specified entry and the group it belongs to if + it was the last key in it and the second parameter is True + """ return _misc.ConfigBase_DeleteEntry(*args, **kwargs) def DeleteGroup(*args, **kwargs): - """DeleteGroup(String key) -> bool""" + """ + DeleteGroup(String key) -> bool + + Delete the group (with all subgroups) + """ return _misc.ConfigBase_DeleteGroup(*args, **kwargs) def DeleteAll(*args, **kwargs): - """DeleteAll() -> bool""" - return _misc.ConfigBase_DeleteAll(*args, **kwargs) + """ + DeleteAll() -> bool - def IsExpandingEnvVars(*args, **kwargs): - """IsExpandingEnvVars() -> bool""" - return _misc.ConfigBase_IsExpandingEnvVars(*args, **kwargs) + Delete the whole underlying object (disk file, registry key, ...) + primarly intended for use by desinstallation routine. + """ + return _misc.ConfigBase_DeleteAll(*args, **kwargs) def SetExpandEnvVars(*args, **kwargs): - """SetExpandEnvVars(bool bDoIt=True)""" + """ + SetExpandEnvVars(bool doIt=True) + + We can automatically expand environment variables in the config entries + (this option is on by default, you can turn it on/off at any time) + """ return _misc.ConfigBase_SetExpandEnvVars(*args, **kwargs) + def IsExpandingEnvVars(*args, **kwargs): + """ + IsExpandingEnvVars() -> bool + + Are we currently expanding environment variables? + """ + return _misc.ConfigBase_IsExpandingEnvVars(*args, **kwargs) + def SetRecordDefaults(*args, **kwargs): - """SetRecordDefaults(bool bDoIt=True)""" + """ + SetRecordDefaults(bool doIt=True) + + Set whether the config objec should record default values. + """ return _misc.ConfigBase_SetRecordDefaults(*args, **kwargs) def IsRecordingDefaults(*args, **kwargs): - """IsRecordingDefaults() -> bool""" + """ + IsRecordingDefaults() -> bool + + Are we currently recording default values? + """ return _misc.ConfigBase_IsRecordingDefaults(*args, **kwargs) def ExpandEnvVars(*args, **kwargs): - """ExpandEnvVars(String str) -> String""" + """ + ExpandEnvVars(String str) -> String + + Expand any environment variables in str and return the result + """ return _misc.ConfigBase_ExpandEnvVars(*args, **kwargs) def GetAppName(*args, **kwargs): @@ -2647,56 +2854,52 @@ class ConfigBasePtr(ConfigBase): _misc.ConfigBase_swigregister(ConfigBasePtr) def ConfigBase_Set(*args, **kwargs): - """ConfigBase_Set(ConfigBase pConfig) -> ConfigBase""" + """ + ConfigBase_Set(ConfigBase config) -> ConfigBase + + Sets the global config object (the one returned by Get) and + returns a reference to the previous global config object. + """ return _misc.ConfigBase_Set(*args, **kwargs) def ConfigBase_Get(*args, **kwargs): - """ConfigBase_Get(bool createOnDemand=True) -> ConfigBase""" + """ + ConfigBase_Get(bool createOnDemand=True) -> ConfigBase + + Returns the current global config object, creating one if neccessary. + """ return _misc.ConfigBase_Get(*args, **kwargs) def ConfigBase_Create(*args, **kwargs): - """ConfigBase_Create() -> ConfigBase""" + """ + ConfigBase_Create() -> ConfigBase + + Create and return a new global config object. This function will + create the "best" implementation of wx.Config available for the + current platform. + """ return _misc.ConfigBase_Create(*args, **kwargs) def ConfigBase_DontCreateOnDemand(*args, **kwargs): - """ConfigBase_DontCreateOnDemand()""" - return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) - -class ConfigPathChanger(object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxConfigPathChanger instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): - """__init__(ConfigBase pContainer, String strEntry) -> ConfigPathChanger""" - newobj = _misc.new_ConfigPathChanger(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown - def __del__(self, destroy=_misc.delete_ConfigPathChanger): - """__del__()""" - try: - if self.thisown: destroy(self) - except: pass - - def Name(*args, **kwargs): - """Name() -> String""" - return _misc.ConfigPathChanger_Name(*args, **kwargs) - + """ + ConfigBase_DontCreateOnDemand() -class ConfigPathChangerPtr(ConfigPathChanger): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = ConfigPathChanger -_misc.ConfigPathChanger_swigregister(ConfigPathChangerPtr) + Should Get() try to create a new log object if there isn't a current one? + """ + return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) class Config(ConfigBase): + """ + This ConfigBase-derived class will use the registry on Windows, + and will be a wx.FileConfig on other platforms. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxConfig instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ __init__(String appName=EmptyString, String vendorName=EmptyString, String localFilename=EmptyString, String globalFilename=EmptyString, - long style=0) -> Config + long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE) -> Config """ newobj = _misc.new_Config(*args, **kwargs) self.this = newobj.this @@ -2717,13 +2920,14 @@ class ConfigPtr(Config): _misc.Config_swigregister(ConfigPtr) class FileConfig(ConfigBase): + """This config class will use a file for storage on all platforms.""" def __repr__(self): return "<%s.%s; proxy of C++ wxFileConfig instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ __init__(String appName=EmptyString, String vendorName=EmptyString, String localFilename=EmptyString, String globalFilename=EmptyString, - long style=0) -> FileConfig + long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE) -> FileConfig """ newobj = _misc.new_FileConfig(*args, **kwargs) self.this = newobj.this @@ -2743,9 +2947,53 @@ class FileConfigPtr(FileConfig): self.__class__ = FileConfig _misc.FileConfig_swigregister(FileConfigPtr) +class ConfigPathChanger(object): + """ + A handy little class which changes current path to the path of + given entry and restores it in the destructoir: so if you declare + a local variable of this type, you work in the entry directory + and the path is automatically restored when the function returns. + """ + def __repr__(self): + return "<%s.%s; proxy of C++ wxConfigPathChanger instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """__init__(ConfigBase config, String entry) -> ConfigPathChanger""" + newobj = _misc.new_ConfigPathChanger(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_ConfigPathChanger): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def Name(*args, **kwargs): + """ + Name() -> String + + Get the key name + """ + return _misc.ConfigPathChanger_Name(*args, **kwargs) + + +class ConfigPathChangerPtr(ConfigPathChanger): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = ConfigPathChanger +_misc.ConfigPathChanger_swigregister(ConfigPathChangerPtr) + def ExpandEnvVars(*args, **kwargs): - """ExpandEnvVars(String sz) -> String""" + """ + ExpandEnvVars(String sz) -> String + + Replace environment variables ($SOMETHING) with their values. The + format is $VARNAME or ${VARNAME} where VARNAME contains + alphanumeric characters and '_' only. '$' must be escaped ('\$') + in order to be taken literally. + """ return _misc.ExpandEnvVars(*args, **kwargs) #--------------------------------------------------------------------------- @@ -2908,62 +3156,62 @@ class DateTime(object): Monday_First = _misc.DateTime_Monday_First Sunday_First = _misc.DateTime_Sunday_First def SetCountry(*args, **kwargs): - """DateTime.SetCountry(int country)""" + """SetCountry(int country)""" return _misc.DateTime_SetCountry(*args, **kwargs) SetCountry = staticmethod(SetCountry) def GetCountry(*args, **kwargs): - """DateTime.GetCountry() -> int""" + """GetCountry() -> int""" return _misc.DateTime_GetCountry(*args, **kwargs) GetCountry = staticmethod(GetCountry) def IsWestEuropeanCountry(*args, **kwargs): - """DateTime.IsWestEuropeanCountry(int country=Country_Default) -> bool""" + """IsWestEuropeanCountry(int country=Country_Default) -> bool""" return _misc.DateTime_IsWestEuropeanCountry(*args, **kwargs) IsWestEuropeanCountry = staticmethod(IsWestEuropeanCountry) def GetCurrentYear(*args, **kwargs): - """DateTime.GetCurrentYear(int cal=Gregorian) -> int""" + """GetCurrentYear(int cal=Gregorian) -> int""" return _misc.DateTime_GetCurrentYear(*args, **kwargs) GetCurrentYear = staticmethod(GetCurrentYear) def ConvertYearToBC(*args, **kwargs): - """DateTime.ConvertYearToBC(int year) -> int""" + """ConvertYearToBC(int year) -> int""" return _misc.DateTime_ConvertYearToBC(*args, **kwargs) ConvertYearToBC = staticmethod(ConvertYearToBC) def GetCurrentMonth(*args, **kwargs): - """DateTime.GetCurrentMonth(int cal=Gregorian) -> int""" + """GetCurrentMonth(int cal=Gregorian) -> int""" return _misc.DateTime_GetCurrentMonth(*args, **kwargs) GetCurrentMonth = staticmethod(GetCurrentMonth) def IsLeapYear(*args, **kwargs): - """DateTime.IsLeapYear(int year=Inv_Year, int cal=Gregorian) -> bool""" + """IsLeapYear(int year=Inv_Year, int cal=Gregorian) -> bool""" return _misc.DateTime_IsLeapYear(*args, **kwargs) IsLeapYear = staticmethod(IsLeapYear) def GetCentury(*args, **kwargs): - """DateTime.GetCentury(int year=Inv_Year) -> int""" + """GetCentury(int year=Inv_Year) -> int""" return _misc.DateTime_GetCentury(*args, **kwargs) GetCentury = staticmethod(GetCentury) def GetNumberOfDaysinYear(*args, **kwargs): - """DateTime.GetNumberOfDaysinYear(int year, int cal=Gregorian) -> int""" + """GetNumberOfDaysinYear(int year, int cal=Gregorian) -> int""" return _misc.DateTime_GetNumberOfDaysinYear(*args, **kwargs) GetNumberOfDaysinYear = staticmethod(GetNumberOfDaysinYear) def GetNumberOfDaysInMonth(*args, **kwargs): - """DateTime.GetNumberOfDaysInMonth(int month, int year=Inv_Year, int cal=Gregorian) -> int""" + """GetNumberOfDaysInMonth(int month, int year=Inv_Year, int cal=Gregorian) -> int""" return _misc.DateTime_GetNumberOfDaysInMonth(*args, **kwargs) GetNumberOfDaysInMonth = staticmethod(GetNumberOfDaysInMonth) def GetMonthName(*args, **kwargs): - """DateTime.GetMonthName(int month, int flags=Name_Full) -> String""" + """GetMonthName(int month, int flags=Name_Full) -> String""" return _misc.DateTime_GetMonthName(*args, **kwargs) GetMonthName = staticmethod(GetMonthName) def GetWeekDayName(*args, **kwargs): - """DateTime.GetWeekDayName(int weekday, int flags=Name_Full) -> String""" + """GetWeekDayName(int weekday, int flags=Name_Full) -> String""" return _misc.DateTime_GetWeekDayName(*args, **kwargs) GetWeekDayName = staticmethod(GetWeekDayName) @@ -2977,32 +3225,32 @@ class DateTime(object): GetAmPmStrings = staticmethod(GetAmPmStrings) def IsDSTApplicable(*args, **kwargs): - """DateTime.IsDSTApplicable(int year=Inv_Year, int country=Country_Default) -> bool""" + """IsDSTApplicable(int year=Inv_Year, int country=Country_Default) -> bool""" return _misc.DateTime_IsDSTApplicable(*args, **kwargs) IsDSTApplicable = staticmethod(IsDSTApplicable) def GetBeginDST(*args, **kwargs): - """DateTime.GetBeginDST(int year=Inv_Year, int country=Country_Default) -> DateTime""" + """GetBeginDST(int year=Inv_Year, int country=Country_Default) -> DateTime""" return _misc.DateTime_GetBeginDST(*args, **kwargs) GetBeginDST = staticmethod(GetBeginDST) def GetEndDST(*args, **kwargs): - """DateTime.GetEndDST(int year=Inv_Year, int country=Country_Default) -> DateTime""" + """GetEndDST(int year=Inv_Year, int country=Country_Default) -> DateTime""" return _misc.DateTime_GetEndDST(*args, **kwargs) GetEndDST = staticmethod(GetEndDST) def Now(*args, **kwargs): - """DateTime.Now() -> DateTime""" + """Now() -> DateTime""" return _misc.DateTime_Now(*args, **kwargs) Now = staticmethod(Now) def UNow(*args, **kwargs): - """DateTime.UNow() -> DateTime""" + """UNow() -> DateTime""" return _misc.DateTime_UNow(*args, **kwargs) UNow = staticmethod(UNow) def Today(*args, **kwargs): - """DateTime.Today() -> DateTime""" + """Today() -> DateTime""" return _misc.DateTime_Today(*args, **kwargs) Today = staticmethod(Today) @@ -3177,6 +3425,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) @@ -3339,7 +3589,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): @@ -3500,52 +3750,52 @@ class TimeSpan(object): def __repr__(self): return "<%s.%s; proxy of C++ wxTimeSpan instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def Seconds(*args, **kwargs): - """TimeSpan.Seconds(long sec) -> TimeSpan""" + """Seconds(long sec) -> TimeSpan""" return _misc.TimeSpan_Seconds(*args, **kwargs) Seconds = staticmethod(Seconds) def Second(*args, **kwargs): - """TimeSpan.Second() -> TimeSpan""" + """Second() -> TimeSpan""" return _misc.TimeSpan_Second(*args, **kwargs) Second = staticmethod(Second) def Minutes(*args, **kwargs): - """TimeSpan.Minutes(long min) -> TimeSpan""" + """Minutes(long min) -> TimeSpan""" return _misc.TimeSpan_Minutes(*args, **kwargs) Minutes = staticmethod(Minutes) def Minute(*args, **kwargs): - """TimeSpan.Minute() -> TimeSpan""" + """Minute() -> TimeSpan""" return _misc.TimeSpan_Minute(*args, **kwargs) Minute = staticmethod(Minute) def Hours(*args, **kwargs): - """TimeSpan.Hours(long hours) -> TimeSpan""" + """Hours(long hours) -> TimeSpan""" return _misc.TimeSpan_Hours(*args, **kwargs) Hours = staticmethod(Hours) def Hour(*args, **kwargs): - """TimeSpan.Hour() -> TimeSpan""" + """Hour() -> TimeSpan""" return _misc.TimeSpan_Hour(*args, **kwargs) Hour = staticmethod(Hour) def Days(*args, **kwargs): - """TimeSpan.Days(long days) -> TimeSpan""" + """Days(long days) -> TimeSpan""" return _misc.TimeSpan_Days(*args, **kwargs) Days = staticmethod(Days) def Day(*args, **kwargs): - """TimeSpan.Day() -> TimeSpan""" + """Day() -> TimeSpan""" return _misc.TimeSpan_Day(*args, **kwargs) Day = staticmethod(Day) def Weeks(*args, **kwargs): - """TimeSpan.Weeks(long days) -> TimeSpan""" + """Weeks(long days) -> TimeSpan""" return _misc.TimeSpan_Weeks(*args, **kwargs) Weeks = staticmethod(Weeks) def Week(*args, **kwargs): - """TimeSpan.Week() -> TimeSpan""" + """Week() -> TimeSpan""" return _misc.TimeSpan_Week(*args, **kwargs) Week = staticmethod(Week) @@ -3758,42 +4008,42 @@ class DateSpan(object): except: pass def Days(*args, **kwargs): - """DateSpan.Days(int days) -> DateSpan""" + """Days(int days) -> DateSpan""" return _misc.DateSpan_Days(*args, **kwargs) Days = staticmethod(Days) def Day(*args, **kwargs): - """DateSpan.Day() -> DateSpan""" + """Day() -> DateSpan""" return _misc.DateSpan_Day(*args, **kwargs) Day = staticmethod(Day) def Weeks(*args, **kwargs): - """DateSpan.Weeks(int weeks) -> DateSpan""" + """Weeks(int weeks) -> DateSpan""" return _misc.DateSpan_Weeks(*args, **kwargs) Weeks = staticmethod(Weeks) def Week(*args, **kwargs): - """DateSpan.Week() -> DateSpan""" + """Week() -> DateSpan""" return _misc.DateSpan_Week(*args, **kwargs) Week = staticmethod(Week) def Months(*args, **kwargs): - """DateSpan.Months(int mon) -> DateSpan""" + """Months(int mon) -> DateSpan""" return _misc.DateSpan_Months(*args, **kwargs) Months = staticmethod(Months) def Month(*args, **kwargs): - """DateSpan.Month() -> DateSpan""" + """Month() -> DateSpan""" return _misc.DateSpan_Month(*args, **kwargs) Month = staticmethod(Month) def Years(*args, **kwargs): - """DateSpan.Years(int years) -> DateSpan""" + """Years(int years) -> DateSpan""" return _misc.DateSpan_Years(*args, **kwargs) Years = staticmethod(Years) def Year(*args, **kwargs): - """DateSpan.Year() -> DateSpan""" + """Year() -> DateSpan""" return _misc.DateSpan_Year(*args, **kwargs) Year = staticmethod(Year) @@ -3968,10 +4218,27 @@ DF_PRIVATE = _misc.DF_PRIVATE DF_HTML = _misc.DF_HTML DF_MAX = _misc.DF_MAX class DataFormat(object): + """ + A wx.DataFormat is an encapsulation of a platform-specific format + handle which is used by the system for the clipboard and drag and + drop operations. The applications are usually only interested in, + for example, pasting data from the clipboard only if the data is + in a format the program understands. A data format is is used to + uniquely identify this format. + + On the system level, a data format is usually just a number + (CLIPFORMAT under Windows or Atom under X11, for example). + """ def __repr__(self): return "<%s.%s; proxy of C++ wxDataFormat instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(int type) -> DataFormat""" + """ + __init__(int type) -> DataFormat + + Constructs a data format object for one of the standard data + formats or an empty data object (use SetType or SetId later in + this case) + """ newobj = _misc.new_DataFormat(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -3997,19 +4264,35 @@ class DataFormat(object): return _misc.DataFormat___ne__(*args) def SetType(*args, **kwargs): - """SetType(int format)""" + """ + SetType(int format) + + Sets the format to the given value, which should be one of wx.DF_XXX constants. + """ return _misc.DataFormat_SetType(*args, **kwargs) def GetType(*args, **kwargs): - """GetType() -> int""" + """ + GetType() -> int + + Returns the platform-specific number identifying the format. + """ return _misc.DataFormat_GetType(*args, **kwargs) def GetId(*args, **kwargs): - """GetId() -> String""" + """ + GetId() -> String + + Returns the name of a custom format (this function will fail for a standard format). + """ return _misc.DataFormat_GetId(*args, **kwargs) def SetId(*args, **kwargs): - """SetId(String format)""" + """ + SetId(String format) + + Sets the format to be the custom format identified by the given name. + """ return _misc.DataFormat_SetId(*args, **kwargs) @@ -4019,9 +4302,14 @@ 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""" + """ + CustomDataFormat(String format) -> DataFormat + + Constructs a data format object for a custom format identified by its name. + """ val = _misc.new_CustomDataFormat(*args, **kwargs) val.thisown = 1 return val @@ -4135,9 +4423,7 @@ class DataObjectComposite(DataObject): del newobj.thisown def Add(*args, **kwargs): """Add(DataObjectSimple dataObject, int preferred=False)""" - val = _misc.DataObjectComposite_Add(*args, **kwargs) - args[1].thisown = 0 - return val + return _misc.DataObjectComposite_Add(*args, **kwargs) class DataObjectCompositePtr(DataObjectComposite): @@ -4375,7 +4661,7 @@ class DropSource(object): return "<%s.%s; proxy of C++ wxPyDropSource instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ - __init__(Window win=None, Cursor copy=wxNullCursor, Cursor move=wxNullCursor, + __init__(Window win, Cursor copy=wxNullCursor, Cursor move=wxNullCursor, Cursor none=wxNullCursor) -> DropSource """ newobj = _misc.new_DropSource(*args, **kwargs) @@ -4424,12 +4710,11 @@ class DropTarget(object): def __repr__(self): return "<%s.%s; proxy of C++ wxPyDropTarget instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """PyDropTarget(DataObject dataObject=None) -> DropTarget""" - newobj = _misc.new_PyDropTarget(*args, **kwargs) + """__init__(DataObject dataObject=None) -> DropTarget""" + newobj = _misc.new_DropTarget(*args, **kwargs) self.this = newobj.this self.thisown = 1 del newobj.thisown - if args: args[0].thisown = 0; self._setCallbackInfo(self, DropTarget) def _setCallbackInfo(*args, **kwargs): @@ -4448,9 +4733,7 @@ class DropTarget(object): def SetDataObject(*args, **kwargs): """SetDataObject(DataObject dataObject)""" - val = _misc.DropTarget_SetDataObject(*args, **kwargs) - args[1].thisown = 0 - return val + return _misc.DropTarget_SetDataObject(*args, **kwargs) def base_OnEnter(*args, **kwargs): """base_OnEnter(int x, int y, int def) -> int""" @@ -4570,6 +4853,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): @@ -4585,43 +4880,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) @@ -4633,10 +4982,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 @@ -4648,7 +5006,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) @@ -4660,4 +5023,252 @@ class ClipboardLockerPtr(ClipboardLocker): _misc.ClipboardLocker_swigregister(ClipboardLockerPtr) TheClipboard = cvar.TheClipboard +#--------------------------------------------------------------------------- + +class VideoMode(object): + """A simple struct containing video mode parameters for a display""" + def __repr__(self): + return "<%s.%s; proxy of C++ wxVideoMode instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """ + __init__(int width=0, int height=0, int depth=0, int freq=0) -> VideoMode + + A simple struct containing video mode parameters for a display + """ + newobj = _misc.new_VideoMode(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_VideoMode): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def Matches(*args, **kwargs): + """ + Matches(VideoMode other) -> bool + + Returns true if this mode matches the other one in the sense that + all non zero fields of the other mode have the same value in this + one (except for refresh which is allowed to have a greater value) + """ + return _misc.VideoMode_Matches(*args, **kwargs) + + def GetWidth(*args, **kwargs): + """ + GetWidth() -> int + + Returns the screen width in pixels (e.g. 640*480), 0 means + unspecified + """ + return _misc.VideoMode_GetWidth(*args, **kwargs) + + def GetHeight(*args, **kwargs): + """ + GetHeight() -> int + + Returns the screen width in pixels (e.g. 640*480), 0 means + unspecified + """ + return _misc.VideoMode_GetHeight(*args, **kwargs) + + def GetDepth(*args, **kwargs): + """ + GetDepth() -> int + + Returns the screen's bits per pixel (e.g. 32), 1 is monochrome + and 0 means unspecified/known + """ + return _misc.VideoMode_GetDepth(*args, **kwargs) + + def IsOk(*args, **kwargs): + """ + IsOk() -> bool + + returns true if the object has been initialized + """ + return _misc.VideoMode_IsOk(*args, **kwargs) + + def __nonzero__(self): return self.IsOk() + def __eq__(*args, **kwargs): + """__eq__(VideoMode other) -> bool""" + return _misc.VideoMode___eq__(*args, **kwargs) + + def __ne__(*args, **kwargs): + """__ne__(VideoMode other) -> bool""" + return _misc.VideoMode___ne__(*args, **kwargs) + + w = property(_misc.VideoMode_w_get, _misc.VideoMode_w_set) + h = property(_misc.VideoMode_h_get, _misc.VideoMode_h_set) + bpp = property(_misc.VideoMode_bpp_get, _misc.VideoMode_bpp_set) + refresh = property(_misc.VideoMode_refresh_get, _misc.VideoMode_refresh_set) + +class VideoModePtr(VideoMode): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = VideoMode +_misc.VideoMode_swigregister(VideoModePtr) + +class Display(object): + """Represents a display/monitor attached to the system""" + def __repr__(self): + return "<%s.%s; proxy of C++ wxDisplay instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """ + __init__(size_t index=0) -> Display + + Set up a Display instance with the specified display. The + displays are numbered from 0 to GetCount() - 1, 0 is always the + primary display and the only one which is always supported + """ + newobj = _misc.new_Display(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_Display): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def GetCount(*args, **kwargs): + """ + GetCount() -> size_t + + Return the number of available displays. + """ + return _misc.Display_GetCount(*args, **kwargs) + + GetCount = staticmethod(GetCount) + def GetFromPoint(*args, **kwargs): + """ + GetFromPoint(Point pt) -> int + + Find the display where the given point lies, return wx.NOT_FOUND + if it doesn't belong to any display + """ + return _misc.Display_GetFromPoint(*args, **kwargs) + + GetFromPoint = staticmethod(GetFromPoint) + def GetFromWindow(*args, **kwargs): + """ + GetFromWindow(Window window) -> int + + Find the display where the given window lies, return wx.NOT_FOUND + if it is not shown at all. + """ + return _misc.Display_GetFromWindow(*args, **kwargs) + + GetFromWindow = staticmethod(GetFromWindow) + def IsOk(*args, **kwargs): + """ + IsOk() -> bool + + Return true if the object was initialized successfully + """ + return _misc.Display_IsOk(*args, **kwargs) + + def __nonzero__(self): return self.IsOk() + def GetGeometry(*args, **kwargs): + """ + GetGeometry() -> Rect + + Returns the bounding rectangle of the display whose index was + passed to the constructor. + """ + return _misc.Display_GetGeometry(*args, **kwargs) + + def GetName(*args, **kwargs): + """ + GetName() -> String + + Returns the display's name. A name is not available on all platforms. + """ + return _misc.Display_GetName(*args, **kwargs) + + def IsPrimary(*args, **kwargs): + """ + IsPrimary() -> bool + + Returns true if the display is the primary display. The primary + display is the one whose index is 0. + """ + return _misc.Display_IsPrimary(*args, **kwargs) + + def GetModes(*args, **kwargs): + """ + GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...] + + Enumerate all video modes supported by this display matching the + given one (in the sense of VideoMode.Match()). + + As any mode matches the default value of the argument and there + is always at least one video mode supported by display, the + returned array is only empty for the default value of the + argument if this function is not supported at all on this + platform. + """ + return _misc.Display_GetModes(*args, **kwargs) + + def GetCurrentMode(*args, **kwargs): + """ + GetCurrentMode() -> VideoMode + + Get the current video mode. + """ + return _misc.Display_GetCurrentMode(*args, **kwargs) + + def ChangeMode(*args, **kwargs): + """ + ChangeMode(VideoMode mode=DefaultVideoMode) -> bool + + Change current mode, return true if succeeded, false otherwise + """ + return _misc.Display_ChangeMode(*args, **kwargs) + + def ResetMode(*args, **kwargs): + """ + ResetMode() + + Restore the default video mode (just a more readable synonym) + """ + return _misc.Display_ResetMode(*args, **kwargs) + + +class DisplayPtr(Display): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = Display +_misc.Display_swigregister(DisplayPtr) +DefaultVideoMode = cvar.DefaultVideoMode + +def Display_GetCount(*args, **kwargs): + """ + Display_GetCount() -> size_t + + Return the number of available displays. + """ + return _misc.Display_GetCount(*args, **kwargs) + +def Display_GetFromPoint(*args, **kwargs): + """ + Display_GetFromPoint(Point pt) -> int + + Find the display where the given point lies, return wx.NOT_FOUND + if it doesn't belong to any display + """ + return _misc.Display_GetFromPoint(*args, **kwargs) + +def Display_GetFromWindow(*args, **kwargs): + """ + Display_GetFromWindow(Window window) -> int + + Find the display where the given window lies, return wx.NOT_FOUND + if it is not shown at all. + """ + return _misc.Display_GetFromWindow(*args, **kwargs) +