X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70d7cb34a692697c3c7290c02c876f5bb91c1424..8fb6915941f155741ab282eb8fcffb480407a982:/wxPython/src/gtk/_core.py diff --git a/wxPython/src/gtk/_core.py b/wxPython/src/gtk/_core.py index b4a2481d23..8cd90f30c7 100644 --- a/wxPython/src/gtk/_core.py +++ b/wxPython/src/gtk/_core.py @@ -708,6 +708,16 @@ class Object(object): args[0].this.own(False) return _core_.Object_Destroy(*args, **kwargs) + def IsSameAs(*args, **kwargs): + """ + IsSameAs(self, Object p) -> bool + + For wx.Objects that use C++ reference counting internally, this method + can be used to determine if two objects are referencing the same data + object. + """ + return _core_.Object_IsSameAs(*args, **kwargs) + ClassName = property(GetClassName,doc="See `GetClassName`") _core_.Object_swigregister(Object) _wxPySetDictionary = _core_._wxPySetDictionary @@ -734,6 +744,7 @@ BITMAP_TYPE_PICT = _core_.BITMAP_TYPE_PICT BITMAP_TYPE_ICON = _core_.BITMAP_TYPE_ICON BITMAP_TYPE_ANI = _core_.BITMAP_TYPE_ANI BITMAP_TYPE_IFF = _core_.BITMAP_TYPE_IFF +BITMAP_TYPE_TGA = _core_.BITMAP_TYPE_TGA BITMAP_TYPE_MACCURSOR = _core_.BITMAP_TYPE_MACCURSOR BITMAP_TYPE_ANY = _core_.BITMAP_TYPE_ANY CURSOR_NONE = _core_.CURSOR_NONE @@ -2059,7 +2070,7 @@ class FileSystemHandler(CPPFileSystemHandler): def __init__(self, *args, **kwargs): """__init__(self) -> FileSystemHandler""" _core_.FileSystemHandler_swiginit(self,_core_.new_FileSystemHandler(*args, **kwargs)) - self._setCallbackInfo(self, FileSystemHandler) + FileSystemHandler._setCallbackInfo(self, self, FileSystemHandler) def _setCallbackInfo(*args, **kwargs): """_setCallbackInfo(self, PyObject self, PyObject _class)""" @@ -3657,6 +3668,19 @@ class TIFFHandler(ImageHandler): _core_.TIFFHandler_swiginit(self,_core_.new_TIFFHandler(*args, **kwargs)) _core_.TIFFHandler_swigregister(TIFFHandler) +class TGAHandler(ImageHandler): + """A `wx.ImageHandler` for TGA image files.""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + """ + __init__(self) -> TGAHandler + + A `wx.ImageHandler` for TGA image files. + """ + _core_.TGAHandler_swiginit(self,_core_.new_TGAHandler(*args, **kwargs)) +_core_.TGAHandler_swigregister(TGAHandler) + QUANTIZE_INCLUDE_WINDOWS_COLOURS = _core_.QUANTIZE_INCLUDE_WINDOWS_COLOURS QUANTIZE_FILL_DESTINATION_IMAGE = _core_.QUANTIZE_FILL_DESTINATION_IMAGE class Quantize(object): @@ -3734,18 +3758,6 @@ class EvtHandler(Object): """ProcessPendingEvents(self)""" return _core_.EvtHandler_ProcessPendingEvents(*args, **kwargs) - def AllowReentrance(*args, **kwargs): - """AllowReentrance(self, bool allow=True)""" - return _core_.EvtHandler_AllowReentrance(*args, **kwargs) - - def IsReentranceAllowed(*args, **kwargs): - """IsReentranceAllowed(self) -> bool""" - return _core_.EvtHandler_IsReentranceAllowed(*args, **kwargs) - - def IsEventHandlingInProgress(*args, **kwargs): - """IsEventHandlingInProgress(self) -> bool""" - return _core_.EvtHandler_IsEventHandlingInProgress(*args, **kwargs) - def Connect(*args, **kwargs): """Connect(self, int id, int lastId, int eventType, PyObject func)""" return _core_.EvtHandler_Connect(*args, **kwargs) @@ -3757,7 +3769,7 @@ class EvtHandler(Object): def _setOORInfo(*args, **kwargs): """_setOORInfo(self, PyObject _self, bool incref=True)""" val = _core_.EvtHandler__setOORInfo(*args, **kwargs) - args[0].thisown = 0 + args[0].this.own(False) return val def Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY): @@ -6995,13 +7007,12 @@ class PyApp(EvtHandler): Create a new application object, starting the bootstrap process. """ _core_.PyApp_swiginit(self,_core_.new_PyApp(*args, **kwargs)) - self._setCallbackInfo(self, PyApp, False) - self._setOORInfo(self, False) + self._setOORInfo(self, False);PyApp._setCallbackInfo(self, self, PyApp) __swig_destroy__ = _core_.delete_PyApp __del__ = lambda self : None; def _setCallbackInfo(*args, **kwargs): - """_setCallbackInfo(self, PyObject self, PyObject _class, bool incref)""" + """_setCallbackInfo(self, PyObject self, PyObject _class, bool incref=False)""" return _core_.PyApp__setCallbackInfo(*args, **kwargs) def GetAppName(*args, **kwargs): @@ -7236,7 +7247,7 @@ class PyApp(EvtHandler): def SetUseBestVisual(*args, **kwargs): """ - SetUseBestVisual(self, bool flag) + SetUseBestVisual(self, bool flag, bool forceTrueColour=False) Set whether the app should try to use the best available visual on systems where more than one is available, (Sun, SGI, XFree86 4, etc.) @@ -7729,6 +7740,9 @@ in on the main display of your Mac.""" # Use Python's install prefix as the default wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix) + # Until the new native control for wxMac is up to par, still use the generic one. + wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 1) + # This finishes the initialization of wxWindows and then calls # the OnInit that should be present in the derived class self._BootstrapApp() @@ -8367,21 +8381,22 @@ class Window(EvtHandler): """ return _core_.Window_MoveXY(*args, **kwargs) - def SetBestFittingSize(*args, **kwargs): + def SetInitialSize(*args, **kwargs): """ - SetBestFittingSize(self, Size size=DefaultSize) + SetInitialSize(self, Size size=DefaultSize) A 'Smart' SetSize that will fill in default size components with the window's *best size* values. Also set's the minsize for use with sizers. """ - return _core_.Window_SetBestFittingSize(*args, **kwargs) + return _core_.Window_SetInitialSize(*args, **kwargs) + SetBestFittingSize = wx._deprecated(SetInitialSize, 'Use `SetInitialSize`') def Raise(*args, **kwargs): """ Raise(self) Raises the window to the top of the window hierarchy. In current - version of wxWidgets this works both for manage and child windows. + version of wxWidgets this works both for managed and child windows. """ return _core_.Window_Raise(*args, **kwargs) @@ -8390,7 +8405,7 @@ class Window(EvtHandler): Lower(self) Lowers the window to the bottom of the window hierarchy. In current - version of wxWidgets this works both for manage and child windows. + version of wxWidgets this works both for managed and child windows. """ return _core_.Window_Lower(*args, **kwargs) @@ -8583,29 +8598,23 @@ class Window(EvtHandler): """ return _core_.Window_CacheBestSize(*args, **kwargs) - def GetBestFittingSize(*args, **kwargs): + def GetEffectiveMinSize(*args, **kwargs): """ - GetBestFittingSize(self) -> Size + GetEffectiveMinSize(self) -> Size This function will merge the window's best size into the window's minimum size, giving priority to the min size components, and returns the results. """ - return _core_.Window_GetBestFittingSize(*args, **kwargs) + return _core_.Window_GetEffectiveMinSize(*args, **kwargs) - def GetAdjustedBestSize(*args, **kwargs): - """ - GetAdjustedBestSize(self) -> Size - - This method is similar to GetBestSize, except in one - thing. GetBestSize should return the minimum untruncated size of the - window, while this method will return the largest of BestSize and any - user specified minimum size. ie. it is the minimum size the window - should currently be drawn at, not the minimal size it can possibly - tolerate. - """ - return _core_.Window_GetAdjustedBestSize(*args, **kwargs) + GetBestFittingSize = wx._deprecated(GetEffectiveMinSize, 'Use `GetEffectiveMinSize` instead.') + def GetAdjustedBestSize(self): + s = self.GetBestSize() + return wx.Size(max(s.width, self.GetMinWidth()), + max(s.height, self.GetMinHeight())) + GetAdjustedBestSize = wx._deprecated(GetAdjustedBestSize, 'Use `GetEffectiveMinSize` instead.') def Center(*args, **kwargs): """ @@ -8791,6 +8800,14 @@ class Window(EvtHandler): """ return _core_.Window_GetVirtualSizeTuple(*args, **kwargs) + def GetWindowBorderSize(*args, **kwargs): + """ + GetWindowBorderSize(self) -> Size + + Return the size of the left/right and top/bottom borders. + """ + return _core_.Window_GetWindowBorderSize(*args, **kwargs) + def GetBestVirtualSize(*args, **kwargs): """ GetBestVirtualSize(self) -> Size @@ -8904,6 +8921,15 @@ class Window(EvtHandler): """ return _core_.Window_IsRetained(*args, **kwargs) + def ToggleWindowStyle(*args, **kwargs): + """ + ToggleWindowStyle(self, int flag) -> bool + + Turn the flag on if it had been turned off before and vice versa, + returns True if the flag is turned on by this function call. + """ + return _core_.Window_ToggleWindowStyle(*args, **kwargs) + def SetExtraStyle(*args, **kwargs): """ SetExtraStyle(self, long exStyle) @@ -10322,7 +10348,7 @@ class Window(EvtHandler): if hasattr(self, '_setOORInfo'): self._setOORInfo(self) if hasattr(self, '_setCallbackInfo'): - self._setCallbackInfo(self, self.__class__) + self._setCallbackInfo(self, pre.__class__) def SendSizeEvent(self): self.GetEventHandler().ProcessEvent(wx.SizeEvent((-1,-1))) @@ -10332,7 +10358,7 @@ class Window(EvtHandler): AutoLayout = property(GetAutoLayout,SetAutoLayout,doc="See `GetAutoLayout` and `SetAutoLayout`") BackgroundColour = property(GetBackgroundColour,SetBackgroundColour,doc="See `GetBackgroundColour` and `SetBackgroundColour`") BackgroundStyle = property(GetBackgroundStyle,SetBackgroundStyle,doc="See `GetBackgroundStyle` and `SetBackgroundStyle`") - BestFittingSize = property(GetBestFittingSize,SetBestFittingSize,doc="See `GetBestFittingSize` and `SetBestFittingSize`") + EffectiveMinSize = property(GetEffectiveMinSize,doc="See `GetEffectiveMinSize`") BestSize = property(GetBestSize,doc="See `GetBestSize`") BestVirtualSize = property(GetBestVirtualSize,doc="See `GetBestVirtualSize`") Border = property(GetBorder,doc="See `GetBorder`") @@ -10591,12 +10617,10 @@ class PyValidator(Validator): def __init__(self, *args, **kwargs): """__init__(self) -> PyValidator""" _core_.PyValidator_swiginit(self,_core_.new_PyValidator(*args, **kwargs)) - - self._setCallbackInfo(self, PyValidator, 1) - self._setOORInfo(self) + self._setOORInfo(self);PyValidator._setCallbackInfo(self, self, PyValidator) def _setCallbackInfo(*args, **kwargs): - """_setCallbackInfo(self, PyObject self, PyObject _class, int incref=True)""" + """_setCallbackInfo(self, PyObject self, PyObject _class, int incref=1)""" return _core_.PyValidator__setCallbackInfo(*args, **kwargs) _core_.PyValidator_swigregister(PyValidator) @@ -11367,7 +11391,7 @@ class ItemContainer(object): def Insert(*args, **kwargs): """ - Insert(self, String item, unsigned int pos, PyObject clientData=None) -> int + Insert(self, String item, int pos, PyObject clientData=None) -> int Insert an item into the control before the item at the ``pos`` index, optionally associating some data object with the item. @@ -11384,7 +11408,7 @@ class ItemContainer(object): def Delete(*args, **kwargs): """ - Delete(self, unsigned int n) + Delete(self, int n) Deletes the item at the zero-based index 'n' from the control. Note that it is an error (signalled by a `wx.PyAssertionError` exception if @@ -11395,7 +11419,7 @@ class ItemContainer(object): def GetClientData(*args, **kwargs): """ - GetClientData(self, unsigned int n) -> PyObject + GetClientData(self, int n) -> PyObject Returns the client data associated with the given item, (if any.) """ @@ -11403,7 +11427,7 @@ class ItemContainer(object): def SetClientData(*args, **kwargs): """ - SetClientData(self, unsigned int n, PyObject clientData) + SetClientData(self, int n, PyObject clientData) Associate the given client data with the item at position n. """ @@ -11411,7 +11435,7 @@ class ItemContainer(object): def GetCount(*args, **kwargs): """ - GetCount(self) -> unsigned int + GetCount(self) -> int Returns the number of items in the control. """ @@ -11427,7 +11451,7 @@ class ItemContainer(object): def GetString(*args, **kwargs): """ - GetString(self, unsigned int n) -> String + GetString(self, int n) -> String Returns the label of the item with the given index. """ @@ -11439,7 +11463,7 @@ class ItemContainer(object): def SetString(*args, **kwargs): """ - SetString(self, unsigned int n, String s) + SetString(self, int n, String s) Sets the label for the given item. """ @@ -12422,7 +12446,7 @@ class PySizer(Sizer): class. """ _core_.PySizer_swiginit(self,_core_.new_PySizer(*args, **kwargs)) - self._setCallbackInfo(self, PySizer);self._setOORInfo(self) + self._setOORInfo(self);PySizer._setCallbackInfo(self, self, PySizer) def _setCallbackInfo(*args, **kwargs): """_setCallbackInfo(self, PyObject self, PyObject _class)""" @@ -13648,6 +13672,24 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION: import warnings warnings.warn("wxPython/wxWidgets release number mismatch") + +def version(): + """Returns a string containing version and port info""" + ctype = wx.USE_UNICODE and 'unicode' or 'ansi' + if wx.Platform == '__WXMSW__': + port = 'msw' + elif wx.Platform == '__WXMAC__': + port = 'mac' + elif wx.Platform == '__WXGTK__': + port = 'gtk' + if 'gtk2' in wx.PlatformInfo: + port = 'gtk2' + else: + port = '?' + + return "%s (%s-%s)" % (wx.VERSION_STRING, port, ctype) + + #---------------------------------------------------------------------------- # Set wxPython's default string<-->unicode conversion encoding from @@ -13667,7 +13709,10 @@ if default == 'ascii': import locale import codecs try: - default = locale.getdefaultlocale()[1] + if hasattr(locale, 'getpreferredencoding'): + default = locale.getpreferredencoding() + else: + default = locale.getdefaultlocale()[1] codecs.lookup(default) except (ValueError, LookupError, TypeError): default = _sys.getdefaultencoding()