X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b9d6a5f3d87e0e09e4d47246c92d5f86fd6871a8..5f57b149e60ac95a47d45409ae3a9c9acaee04be:/wxPython/src/msw/_core.py diff --git a/wxPython/src/msw/_core.py b/wxPython/src/msw/_core.py index ef0a2172ad..065a985f49 100644 --- a/wxPython/src/msw/_core.py +++ b/wxPython/src/msw/_core.py @@ -85,17 +85,13 @@ SIMPLE_BORDER = _core_.SIMPLE_BORDER STATIC_BORDER = _core_.STATIC_BORDER TRANSPARENT_WINDOW = _core_.TRANSPARENT_WINDOW NO_BORDER = _core_.NO_BORDER +DEFAULT_CONTROL_BORDER = _core_.DEFAULT_CONTROL_BORDER TAB_TRAVERSAL = _core_.TAB_TRAVERSAL WANTS_CHARS = _core_.WANTS_CHARS POPUP_WINDOW = _core_.POPUP_WINDOW CENTER_FRAME = _core_.CENTER_FRAME CENTRE_ON_SCREEN = _core_.CENTRE_ON_SCREEN CENTER_ON_SCREEN = _core_.CENTER_ON_SCREEN -ED_CLIENT_MARGIN = _core_.ED_CLIENT_MARGIN -ED_BUTTONS_BOTTOM = _core_.ED_BUTTONS_BOTTOM -ED_BUTTONS_RIGHT = _core_.ED_BUTTONS_RIGHT -ED_STATIC_LINE = _core_.ED_STATIC_LINE -EXT_DIALOG_STYLE = _core_.EXT_DIALOG_STYLE CLIP_CHILDREN = _core_.CLIP_CHILDREN CLIP_SIBLINGS = _core_.CLIP_SIBLINGS ALWAYS_SHOW_SB = _core_.ALWAYS_SHOW_SB @@ -509,6 +505,27 @@ WXK_NUMPAD_DIVIDE = _core_.WXK_NUMPAD_DIVIDE WXK_WINDOWS_LEFT = _core_.WXK_WINDOWS_LEFT WXK_WINDOWS_RIGHT = _core_.WXK_WINDOWS_RIGHT WXK_WINDOWS_MENU = _core_.WXK_WINDOWS_MENU +WXK_COMMAND = _core_.WXK_COMMAND +WXK_SPECIAL1 = _core_.WXK_SPECIAL1 +WXK_SPECIAL2 = _core_.WXK_SPECIAL2 +WXK_SPECIAL3 = _core_.WXK_SPECIAL3 +WXK_SPECIAL4 = _core_.WXK_SPECIAL4 +WXK_SPECIAL5 = _core_.WXK_SPECIAL5 +WXK_SPECIAL6 = _core_.WXK_SPECIAL6 +WXK_SPECIAL7 = _core_.WXK_SPECIAL7 +WXK_SPECIAL8 = _core_.WXK_SPECIAL8 +WXK_SPECIAL9 = _core_.WXK_SPECIAL9 +WXK_SPECIAL10 = _core_.WXK_SPECIAL10 +WXK_SPECIAL11 = _core_.WXK_SPECIAL11 +WXK_SPECIAL12 = _core_.WXK_SPECIAL12 +WXK_SPECIAL13 = _core_.WXK_SPECIAL13 +WXK_SPECIAL14 = _core_.WXK_SPECIAL14 +WXK_SPECIAL15 = _core_.WXK_SPECIAL15 +WXK_SPECIAL16 = _core_.WXK_SPECIAL16 +WXK_SPECIAL17 = _core_.WXK_SPECIAL17 +WXK_SPECIAL18 = _core_.WXK_SPECIAL18 +WXK_SPECIAL19 = _core_.WXK_SPECIAL19 +WXK_SPECIAL20 = _core_.WXK_SPECIAL20 PAPER_NONE = _core_.PAPER_NONE PAPER_LETTER = _core_.PAPER_LETTER PAPER_LEGAL = _core_.PAPER_LEGAL @@ -1135,6 +1152,10 @@ class Rect(object): """SetSize(self, Size s)""" return _core_.Rect_SetSize(*args, **kwargs) + def IsEmpty(*args, **kwargs): + """IsEmpty(self) -> bool""" + return _core_.Rect_IsEmpty(*args, **kwargs) + def GetTopLeft(*args, **kwargs): """GetTopLeft(self) -> Point""" return _core_.Rect_GetTopLeft(*args, **kwargs) @@ -1691,7 +1712,7 @@ class FSFile(Object): self.this = newobj.this self.thisown = 1 del newobj.thisown - self.thisown = 0 # It will normally be deleted by the user of the wxFileSystem + self.thisown = 0 # It will normally be deleted by the user of the wx.FileSystem def __del__(self, destroy=_core_.delete_FSFile): """__del__(self)""" @@ -2013,6 +2034,9 @@ def MemoryFSHandler_RemoveFile(*args, **kwargs): """MemoryFSHandler_RemoveFile(String filename)""" return _core_.MemoryFSHandler_RemoveFile(*args, **kwargs) +IMAGE_ALPHA_TRANSPARENT = _core_.IMAGE_ALPHA_TRANSPARENT +IMAGE_ALPHA_THRESHOLD = _core_.IMAGE_ALPHA_THRESHOLD +IMAGE_ALPHA_OPAQUE = _core_.IMAGE_ALPHA_OPAQUE #--------------------------------------------------------------------------- class ImageHandler(Object): @@ -2093,6 +2117,31 @@ class ImageHistogram(object): """ return _core_.ImageHistogram_FindFirstUnusedColour(*args, **kwargs) + def GetCount(*args, **kwargs): + """ + GetCount(self, unsigned long key) -> unsigned long + + Returns the pixel count for the given key. Use `MakeKey` to create a + key value from a RGB tripple. + """ + return _core_.ImageHistogram_GetCount(*args, **kwargs) + + def GetCountRGB(*args, **kwargs): + """ + GetCountRGB(self, unsigned char r, unsigned char g, unsigned char b) -> unsigned long + + Returns the pixel count for the given RGB values. + """ + return _core_.ImageHistogram_GetCountRGB(*args, **kwargs) + + def GetCountColour(*args, **kwargs): + """ + GetCountColour(self, Colour colour) -> unsigned long + + Returns the pixel count for the given `wx.Colour` value. + """ + return _core_.ImageHistogram_GetCountColour(*args, **kwargs) + class ImageHistogramPtr(ImageHistogram): def __init__(self, this): @@ -2149,10 +2198,18 @@ class Image(Object): """Rescale(self, int width, int height) -> Image""" return _core_.Image_Rescale(*args, **kwargs) + def Resize(*args, **kwargs): + """Resize(self, Size size, Point pos, int r=-1, int g=-1, int b=-1) -> Image""" + return _core_.Image_Resize(*args, **kwargs) + def SetRGB(*args, **kwargs): """SetRGB(self, int x, int y, unsigned char r, unsigned char g, unsigned char b)""" return _core_.Image_SetRGB(*args, **kwargs) + def SetRGBRect(*args, **kwargs): + """SetRGBRect(self, Rect rect, unsigned char r, unsigned char g, unsigned char b)""" + return _core_.Image_SetRGBRect(*args, **kwargs) + def GetRed(*args, **kwargs): """GetRed(self, int x, int y) -> unsigned char""" return _core_.Image_GetRed(*args, **kwargs) @@ -2188,6 +2245,15 @@ class Image(Object): """ return _core_.Image_InitAlpha(*args, **kwargs) + def IsTransparent(*args, **kwargs): + """ + IsTransparent(self, int x, int y, unsigned char threshold=IMAGE_ALPHA_THRESHOLD) -> bool + + Returns True if this pixel is masked or has an alpha value less than + the spcified threshold. + """ + return _core_.Image_IsTransparent(*args, **kwargs) + def FindFirstUnusedColour(*args, **kwargs): """ FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b) @@ -2200,7 +2266,7 @@ class Image(Object): def ConvertAlphaToMask(*args, **kwargs): """ - ConvertAlphaToMask(self, byte threshold=128) -> bool + ConvertAlphaToMask(self, byte threshold=IMAGE_ALPHA_THRESHOLD) -> bool If the image has alpha channel, this method converts it to mask. All pixels with alpha value less than ``threshold`` are replaced with mask colour and the @@ -2289,6 +2355,10 @@ class Image(Object): """GetSubImage(self, Rect rect) -> Image""" return _core_.Image_GetSubImage(*args, **kwargs) + def Size(*args, **kwargs): + """Size(self, Size size, Point pos, int r=-1, int g=-1, int b=-1) -> Image""" + return _core_.Image_Size(*args, **kwargs) + def Copy(*args, **kwargs): """Copy(self) -> Image""" return _core_.Image_Copy(*args, **kwargs) @@ -2298,27 +2368,58 @@ class Image(Object): return _core_.Image_Paste(*args, **kwargs) def GetData(*args, **kwargs): - """GetData(self) -> PyObject""" + """ + GetData(self) -> PyObject + + Returns a string containing a copy of the RGB bytes of the image. + """ return _core_.Image_GetData(*args, **kwargs) def SetData(*args, **kwargs): - """SetData(self, PyObject data)""" + """ + SetData(self, buffer data) + + Resets the Image's RGB data from a buffer of RGB bytes. Accepts + either a string or a buffer object holding the data and the length of + the data must be width*height*3. + """ return _core_.Image_SetData(*args, **kwargs) def GetDataBuffer(*args, **kwargs): - """GetDataBuffer(self) -> PyObject""" + """ + GetDataBuffer(self) -> PyObject + + Returns a writable Python buffer object that is pointing at the RGB + image data buffer inside the wx.Image. + """ return _core_.Image_GetDataBuffer(*args, **kwargs) def SetDataBuffer(*args, **kwargs): - """SetDataBuffer(self, PyObject data)""" + """ + SetDataBuffer(self, buffer data) + + Sets the internal image data pointer to point at a Python buffer + object. This can save a copy of the data but you must ensure that the + buffer object lives longer than the wx.Image does. + """ return _core_.Image_SetDataBuffer(*args, **kwargs) def GetAlphaData(*args, **kwargs): - """GetAlphaData(self) -> PyObject""" + """ + GetAlphaData(self) -> PyObject + + Returns a string containing a copy of the alpha bytes of the image. + """ return _core_.Image_GetAlphaData(*args, **kwargs) def SetAlphaData(*args, **kwargs): - """SetAlphaData(self, PyObject data)""" + """ + SetAlphaData(self, buffer alpha) + + Resets the Image's alpha data from a buffer of bytes. Accepts either + a string or a buffer object holding the data and the length of the + data must be width*height. + """ return _core_.Image_SetAlphaData(*args, **kwargs) def GetAlphaBuffer(*args, **kwargs): @@ -2326,13 +2427,21 @@ class Image(Object): return _core_.Image_GetAlphaBuffer(*args, **kwargs) def SetAlphaBuffer(*args, **kwargs): - """SetAlphaBuffer(self, PyObject data)""" + """SetAlphaBuffer(self, buffer alpha)""" return _core_.Image_SetAlphaBuffer(*args, **kwargs) def SetMaskColour(*args, **kwargs): """SetMaskColour(self, unsigned char r, unsigned char g, unsigned char b)""" return _core_.Image_SetMaskColour(*args, **kwargs) + def GetOrFindMaskColour(*args, **kwargs): + """ + GetOrFindMaskColour() -> (r,g,b) + + Get the current mask colour or find a suitable colour. + """ + return _core_.Image_GetOrFindMaskColour(*args, **kwargs) + def GetMaskRed(*args, **kwargs): """GetMaskRed(self) -> unsigned char""" return _core_.Image_GetMaskRed(*args, **kwargs) @@ -2463,25 +2572,46 @@ def ImageFromStreamMime(*args, **kwargs): return val def EmptyImage(*args, **kwargs): - """EmptyImage(int width=0, int height=0, bool clear=True) -> Image""" + """ + EmptyImage(int width=0, int height=0, bool clear=True) -> Image + + Construct an empty image of a given size, optionally setting all + pixels to black. + """ val = _core_.new_EmptyImage(*args, **kwargs) val.thisown = 1 return val def ImageFromBitmap(*args, **kwargs): - """ImageFromBitmap(Bitmap bitmap) -> Image""" + """ + ImageFromBitmap(Bitmap bitmap) -> Image + + Construct an Image from a `wx.Bitmap`. + """ val = _core_.new_ImageFromBitmap(*args, **kwargs) val.thisown = 1 return val def ImageFromData(*args, **kwargs): - """ImageFromData(int width, int height, unsigned char data) -> Image""" + """ + ImageFromData(int width, int height, buffer data) -> Image + + Construct an Image from a buffer of RGB bytes. Accepts either a + string or a buffer object holding the data and the length of the data + must be width*height*3. + """ val = _core_.new_ImageFromData(*args, **kwargs) val.thisown = 1 return val def ImageFromDataWithAlpha(*args, **kwargs): - """ImageFromDataWithAlpha(int width, int height, unsigned char data, unsigned char alpha) -> Image""" + """ + ImageFromDataWithAlpha(int width, int height, buffer data, buffer alpha) -> Image + + Construct an Image from a buffer of RGB bytes with an Alpha channel. + Accepts either a string or a buffer object holding the data and the + length of the data must be width*height*3. + """ val = _core_.new_ImageFromDataWithAlpha(*args, **kwargs) val.thisown = 1 return val @@ -3074,6 +3204,7 @@ wxEVT_IDLE = _core_.wxEVT_IDLE wxEVT_UPDATE_UI = _core_.wxEVT_UPDATE_UI wxEVT_SIZING = _core_.wxEVT_SIZING wxEVT_MOVING = _core_.wxEVT_MOVING +wxEVT_HIBERNATE = _core_.wxEVT_HIBERNATE wxEVT_COMMAND_LEFT_CLICK = _core_.wxEVT_COMMAND_LEFT_CLICK wxEVT_COMMAND_LEFT_DCLICK = _core_.wxEVT_COMMAND_LEFT_DCLICK wxEVT_COMMAND_RIGHT_CLICK = _core_.wxEVT_COMMAND_RIGHT_CLICK @@ -3107,6 +3238,7 @@ EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS ) EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS ) EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE ) EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP ) +EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE ) EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES ) @@ -7389,6 +7521,14 @@ class Window(EvtHandler): """ return _core_.Window_GetForegroundColour(*args, **kwargs) + def InheritsBackgroundColour(*args, **kwargs): + """InheritsBackgroundColour(self) -> bool""" + return _core_.Window_InheritsBackgroundColour(*args, **kwargs) + + def UseBgCol(*args, **kwargs): + """UseBgCol(self) -> bool""" + return _core_.Window_UseBgCol(*args, **kwargs) + def SetBackgroundStyle(*args, **kwargs): """ SetBackgroundStyle(self, int style) -> bool @@ -9853,7 +9993,7 @@ class Sizer(Object): def Hide(self, item, recursive=False): """ - A convenience method for Show(item, False, recursive). + A convenience method for `Show`(item, False, recursive). """ return self.Show(item, False, recursive) @@ -11201,12 +11341,21 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION: # different on different platforms. For example, please see # http://www.alanwood.net/demos/charsetdiffs.html for differences # between the common latin/roman encodings. -import locale -default = locale.getdefaultlocale()[1] + +default = _sys.getdefaultencoding() +if default == 'ascii': + import locale + import codecs + try: + default = locale.getdefaultlocale()[1] + codecs.lookup(default) + except (ValueError, LookupError): + default = _sys.getdefaultencoding() + del locale + del codecs if default: wx.SetDefaultPyEncoding(default) del default -del locale #----------------------------------------------------------------------------