X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b05032577a28bf58f50da320414aa4b94351100c..03837c5c878d3e612e9c80dc46f37def0a0835d9:/wxPython/src/mac/_core.py?ds=inline diff --git a/wxPython/src/mac/_core.py b/wxPython/src/mac/_core.py index d0a18ae629..6001f1ab0c 100644 --- a/wxPython/src/mac/_core.py +++ b/wxPython/src/mac/_core.py @@ -1322,11 +1322,19 @@ class Point2D(object): self.thisown = 1 del newobj.thisown def GetFloor(*args, **kwargs): - """GetFloor() -> (x,y)""" + """ + GetFloor() -> (x,y) + + Convert to integer + """ return _core_.Point2D_GetFloor(*args, **kwargs) def GetRounded(*args, **kwargs): - """GetRounded() -> (x,y)""" + """ + GetRounded() -> (x,y) + + Convert to integer + """ return _core_.Point2D_GetRounded(*args, **kwargs) def GetVectorLength(*args, **kwargs): @@ -1950,7 +1958,13 @@ class ImageHistogram(object): MakeKey = staticmethod(MakeKey) def FindFirstUnusedColour(*args, **kwargs): - """FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b)""" + """ + FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b) + + Find first colour that is not used in the image and has higher RGB + values than startR, startG, startB. Returns a tuple consisting of a + success flag and rgb values. + """ return _core_.ImageHistogram_FindFirstUnusedColour(*args, **kwargs) @@ -2037,7 +2051,13 @@ class Image(Object): return _core_.Image_HasAlpha(*args, **kwargs) def FindFirstUnusedColour(*args, **kwargs): - """FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b)""" + """ + FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b) + + Find first colour that is not used in the image and has higher RGB + values than startR, startG, startB. Returns a tuple consisting of a + success flag and rgb values. + """ return _core_.Image_FindFirstUnusedColour(*args, **kwargs) def SetMaskFromImage(*args, **kwargs): @@ -3356,6 +3376,20 @@ class MouseEvent(Event): """ShiftDown(self) -> bool""" return _core_.MouseEvent_ShiftDown(*args, **kwargs) + def CmdDown(*args, **kwargs): + """ + CmdDown(self) -> bool + + "Cmd" is a pseudo key which is the same as Control for PC and Unix + platforms but the special "Apple" (a.k.a as "Command") key on + Macs: it makes often sense to use it instead of, say, `ControlDown` + because Cmd key is used for the same thing under Mac as Ctrl + elsewhere. The Ctrl still exists, it's just not used for this + purpose. So for non-Mac platforms this is the same as `ControlDown` + and Macs this is the same as `MetaDown`. + """ + return _core_.MouseEvent_CmdDown(*args, **kwargs) + def LeftDown(*args, **kwargs): """LeftDown(self) -> bool""" return _core_.MouseEvent_LeftDown(*args, **kwargs) @@ -3552,6 +3586,20 @@ class KeyEvent(Event): """ShiftDown(self) -> bool""" return _core_.KeyEvent_ShiftDown(*args, **kwargs) + def CmdDown(*args, **kwargs): + """ + CmdDown(self) -> bool + + "Cmd" is a pseudo key which is the same as Control for PC and Unix + platforms but the special "Apple" (a.k.a as "Command") key on + Macs: it makes often sense to use it instead of, say, `ControlDown` + because Cmd key is used for the same thing under Mac as Ctrl + elsewhere. The Ctrl still exists, it's just not used for this + purpose. So for non-Mac platforms this is the same as `ControlDown` + and Macs this is the same as `MetaDown`. + """ + return _core_.KeyEvent_CmdDown(*args, **kwargs) + def HasModifiers(*args, **kwargs): """HasModifiers(self) -> bool""" return _core_.KeyEvent_HasModifiers(*args, **kwargs) @@ -3561,10 +3609,11 @@ class KeyEvent(Event): return _core_.KeyEvent_GetKeyCode(*args, **kwargs) KeyCode = GetKeyCode - def GetUniChar(*args, **kwargs): - """GetUniChar(self) -> int""" - return _core_.KeyEvent_GetUniChar(*args, **kwargs) + def GetUnicodeKey(*args, **kwargs): + """GetUnicodeKey(self) -> int""" + return _core_.KeyEvent_GetUnicodeKey(*args, **kwargs) + GetUniChar = GetUnicodeKey def GetRawKeyCode(*args, **kwargs): """GetRawKeyCode(self) -> unsigned int""" return _core_.KeyEvent_GetRawKeyCode(*args, **kwargs) @@ -4251,7 +4300,7 @@ class NavigationKeyEvent(Event): return _core_.NavigationKeyEvent_GetDirection(*args, **kwargs) def SetDirection(*args, **kwargs): - """SetDirection(self, bool bForward)""" + """SetDirection(self, bool forward)""" return _core_.NavigationKeyEvent_SetDirection(*args, **kwargs) def IsWindowChange(*args, **kwargs): @@ -4259,9 +4308,13 @@ class NavigationKeyEvent(Event): return _core_.NavigationKeyEvent_IsWindowChange(*args, **kwargs) def SetWindowChange(*args, **kwargs): - """SetWindowChange(self, bool bIs)""" + """SetWindowChange(self, bool ischange)""" return _core_.NavigationKeyEvent_SetWindowChange(*args, **kwargs) + def SetFlags(*args, **kwargs): + """SetFlags(self, long flags)""" + return _core_.NavigationKeyEvent_SetFlags(*args, **kwargs) + def GetCurrentFocus(*args, **kwargs): """GetCurrentFocus(self) -> Window""" return _core_.NavigationKeyEvent_GetCurrentFocus(*args, **kwargs) @@ -4270,6 +4323,9 @@ class NavigationKeyEvent(Event): """SetCurrentFocus(self, Window win)""" return _core_.NavigationKeyEvent_SetCurrentFocus(*args, **kwargs) + IsBackward = _core_.NavigationKeyEvent_IsBackward + IsForward = _core_.NavigationKeyEvent_IsForward + WinChange = _core_.NavigationKeyEvent_WinChange class NavigationKeyEventPtr(NavigationKeyEvent): def __init__(self, this): @@ -4976,6 +5032,8 @@ class PyOnDemandOutputWindow: def __init__(self, title = "wxPython: stdout/stderr"): self.frame = None self.title = title + self.pos = wx.DefaultPosition + self.size = (450, 300) self.parent = None def SetParent(self, parent): @@ -4984,12 +5042,11 @@ class PyOnDemandOutputWindow: def CreateOutputWindow(self, st): - self.frame = wx.Frame(self.parent, -1, self.title, - style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) + self.frame = wx.Frame(self.parent, -1, self.title, self.pos, self.size, + style=wx.DEFAULT_FRAME_STYLE) self.text = wx.TextCtrl(self.frame, -1, "", - style = wx.TE_MULTILINE | wx.TE_READONLY) + style=wx.TE_MULTILINE|wx.TE_READONLY) self.text.AppendText(st) - self.frame.SetSize((450, 300)) self.frame.Show(True) EVT_CLOSE(self.frame, self.OnCloseWindow) @@ -5025,6 +5082,10 @@ class PyOnDemandOutputWindow: wx.CallAfter(self.frame.Close) + def flush(self): + pass + + #---------------------------------------------------------------------- @@ -5163,6 +5224,22 @@ your Mac.""" _sys.stdout, _sys.stderr = self.saveStdio + def SetOutputWindowAttributes(self, title=None, pos=None, size=None): + """ + Set the title, position and/or size of the output window if + the stdio has been redirected. This should be called before + any output would cause the output window to be created. + """ + if self.stdioWin: + if title is not None: + self.stdioWin.title = title + if pos is not None: + self.stdioWin.pos = pos + if size is not None: + self.stdioWin.size = size + + + # change from wx.PyApp_XX to wx.App_XX App_GetMacSupportPCMenuShortcuts = _core_.PyApp_GetMacSupportPCMenuShortcuts @@ -5645,6 +5722,15 @@ class Window(EvtHandler): """ return _core_.Window_MoveXY(*args, **kwargs) + def SetBestFittingSize(*args, **kwargs): + """ + SetBestFittingSize(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) + def Raise(*args, **kwargs): """ Raise(self) @@ -5803,6 +5889,26 @@ class Window(EvtHandler): """ return _core_.Window_GetBestSizeTuple(*args, **kwargs) + def InvalidateBestSize(*args, **kwargs): + """ + InvalidateBestSize(self) + + Reset the cached best size value so it will be recalculated the next + time it is needed. + """ + return _core_.Window_InvalidateBestSize(*args, **kwargs) + + def GetBestFittingSize(*args, **kwargs): + """ + GetBestFittingSize(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) + def GetAdjustedBestSize(*args, **kwargs): """ GetAdjustedBestSize(self) -> Size @@ -5874,31 +5980,84 @@ class Window(EvtHandler): """ return _core_.Window_FitInside(*args, **kwargs) - def SetSizeHints(*args): + def SetSizeHints(*args, **kwargs): """ SetSizeHints(self, int minW, int minH, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1) - SetSizeHints(self, Size minSize, Size maxSize=DefaultSize, Size incSize=DefaultSize) Allows specification of minimum and maximum window sizes, and window size increments. If a pair of values is not set (or set to -1), the default values will be used. If this function is called, the user - will not be able to size the window outside the given bounds. The - resizing increments are only significant under Motif or Xt. + will not be able to size the window outside the given bounds (if it is + a top-level window.) Sizers will also inspect the minimum window size + and will use that value if set when calculating layout. + + The resizing increments are only significant under Motif or Xt. + """ + return _core_.Window_SetSizeHints(*args, **kwargs) + + def SetSizeHintsSz(*args, **kwargs): + """ + SetSizeHintsSz(self, Size minSize, Size maxSize=DefaultSize, Size incSize=DefaultSize) + + Allows specification of minimum and maximum window sizes, and window + size increments. If a pair of values is not set (or set to -1), the + default values will be used. If this function is called, the user + will not be able to size the window outside the given bounds (if it is + a top-level window.) Sizers will also inspect the minimum window size + and will use that value if set when calculating layout. + + The resizing increments are only significant under Motif or Xt. """ - return _core_.Window_SetSizeHints(*args) + return _core_.Window_SetSizeHintsSz(*args, **kwargs) - def SetVirtualSizeHints(*args): + def SetVirtualSizeHints(*args, **kwargs): """ SetVirtualSizeHints(self, int minW, int minH, int maxW=-1, int maxH=-1) - SetVirtualSizeHints(self, Size minSize, Size maxSize=DefaultSize) Allows specification of minimum and maximum virtual window sizes. If a pair of values is not set (or set to -1), the default values will be used. If this function is called, the user will not be able to size the virtual area of the window outside the given bounds. """ - return _core_.Window_SetVirtualSizeHints(*args) + return _core_.Window_SetVirtualSizeHints(*args, **kwargs) + + def SetVirtualSizeHintsSz(*args, **kwargs): + """ + SetVirtualSizeHintsSz(self, Size minSize, Size maxSize=DefaultSize) + + Allows specification of minimum and maximum virtual window sizes. If a + pair of values is not set (or set to -1), the default values will be + used. If this function is called, the user will not be able to size + the virtual area of the window outside the given bounds. + """ + return _core_.Window_SetVirtualSizeHintsSz(*args, **kwargs) + + def GetMaxSize(*args, **kwargs): + """GetMaxSize(self) -> Size""" + return _core_.Window_GetMaxSize(*args, **kwargs) + + def GetMinSize(*args, **kwargs): + """GetMinSize(self) -> Size""" + return _core_.Window_GetMinSize(*args, **kwargs) + + def SetMinSize(*args, **kwargs): + """ + SetMinSize(self, Size minSize) + + A more convenient method than `SetSizeHints` for setting just the + min size. + """ + return _core_.Window_SetMinSize(*args, **kwargs) + + def SetMaxSize(*args, **kwargs): + """ + SetMaxSize(self, Size maxSize) + + A more convenient method than `SetSizeHints` for setting just the + max size. + """ + return _core_.Window_SetMaxSize(*args, **kwargs) def GetMinWidth(*args, **kwargs): """GetMinWidth(self) -> int""" @@ -5916,14 +6075,6 @@ class Window(EvtHandler): """GetMaxHeight(self) -> int""" return _core_.Window_GetMaxHeight(*args, **kwargs) - def GetMaxSize(*args, **kwargs): - """GetMaxSize(self) -> Size""" - return _core_.Window_GetMaxSize(*args, **kwargs) - - def GetMinSize(*args, **kwargs): - """GetMinSize(self) -> Size""" - return _core_.Window_GetMinSize(*args, **kwargs) - def SetVirtualSize(*args, **kwargs): """ SetVirtualSize(self, Size size) @@ -6189,6 +6340,39 @@ class Window(EvtHandler): """ return _core_.Window_SetTmpDefaultItem(*args, **kwargs) + def Navigate(*args, **kwargs): + """ + Navigate(self, int flags=NavigationKeyEvent.IsForward) -> bool + + Does keyboard navigation from this window to another, by sending a + `wx.NavigationKeyEvent`. + """ + return _core_.Window_Navigate(*args, **kwargs) + + def MoveAfterInTabOrder(*args, **kwargs): + """ + MoveAfterInTabOrder(self, Window win) + + Moves this window in the tab navigation order after the specified + sibling window. This means that when the user presses the TAB key on + that other window, the focus switches to this window. + + The default tab order is the same as creation order. This function + and `MoveBeforeInTabOrder` allow to change it after creating all the + windows. + + """ + return _core_.Window_MoveAfterInTabOrder(*args, **kwargs) + + def MoveBeforeInTabOrder(*args, **kwargs): + """ + MoveBeforeInTabOrder(self, Window win) + + Same as `MoveAfterInTabOrder` except that it inserts this window just + before win instead of putting it right after it. + """ + return _core_.Window_MoveBeforeInTabOrder(*args, **kwargs) + def GetChildren(*args, **kwargs): """ GetChildren(self) -> PyObject @@ -6716,22 +6900,23 @@ class Window(EvtHandler): Sets the background colour of the window. Returns True if the colour was changed. The background colour is usually painted by the default EVT_ERASE_BACKGROUND event handler function under Windows and - automatically under GTK. + automatically under GTK. Using `wx.NullColour` will reset the window + to the default background colour. Note that setting the background colour may not cause an immediate - refresh, so you may wish to call ClearBackground or Refresh after + refresh, so you may wish to call `ClearBackground` or `Refresh` after calling this function. - Use this function with care under GTK+ as the new appearance of the - window might not look equally well when used with themes, i.e GTK+'s - ability to change its look as the user wishes with run-time loadable - modules. + Using this function will disable attempts to use themes for this + window, if the system supports them. Use with care since usually the + themes represent the appearance chosen by the user to be used for all + applications on the system. """ return _core_.Window_SetBackgroundColour(*args, **kwargs) - def SetDefaultBackgroundColour(*args, **kwargs): - """SetDefaultBackgroundColour(self, Colour colour)""" - return _core_.Window_SetDefaultBackgroundColour(*args, **kwargs) + def SetOwnBackgroundColour(*args, **kwargs): + """SetOwnBackgroundColour(self, Colour colour)""" + return _core_.Window_SetOwnBackgroundColour(*args, **kwargs) def SetForegroundColour(*args, **kwargs): """ @@ -6744,9 +6929,9 @@ class Window(EvtHandler): """ return _core_.Window_SetForegroundColour(*args, **kwargs) - def SetDefaultForegroundColour(*args, **kwargs): - """SetDefaultForegroundColour(self, Colour colour)""" - return _core_.Window_SetDefaultForegroundColour(*args, **kwargs) + def SetOwnForegroundColour(*args, **kwargs): + """SetOwnForegroundColour(self, Colour colour)""" + return _core_.Window_SetOwnForegroundColour(*args, **kwargs) def GetBackgroundColour(*args, **kwargs): """ @@ -6794,9 +6979,9 @@ class Window(EvtHandler): """ return _core_.Window_SetFont(*args, **kwargs) - def SetDefaultFont(*args, **kwargs): - """SetDefaultFont(self, Font font)""" - return _core_.Window_SetDefaultFont(*args, **kwargs) + def SetOwnFont(*args, **kwargs): + """SetOwnFont(self, Font font)""" + return _core_.Window_SetOwnFont(*args, **kwargs) def GetFont(*args, **kwargs): """ @@ -6839,7 +7024,11 @@ class Window(EvtHandler): return _core_.Window_GetCharWidth(*args, **kwargs) def GetTextExtent(*args, **kwargs): - """GetTextExtent(String string) -> (width, height)""" + """ + GetTextExtent(String string) -> (width, height) + + Get the width and height of the text using the current font. + """ return _core_.Window_GetTextExtent(*args, **kwargs) def GetFullTextExtent(*args, **kwargs): @@ -7261,7 +7450,7 @@ class Window(EvtHandler): By 'intelligently' the following is meant: by default, all windows use their own default attributes. However if some of the parent's attributes are explicitly changed (that is, using SetFont and not - SetDefaultFont) and if the corresponding attribute hadn't been + SetOwnFont) and if the corresponding attribute hadn't been explicitly set for this window itself, then this window takes the same value as used by the parent. In addition, if the window overrides ShouldInheritColours to return false, the colours will not be changed @@ -8199,7 +8388,7 @@ class ItemContainer(object): def AppendItems(*args, **kwargs): """ - AppendItems(self, wxArrayString strings) + AppendItems(self, List strings) Apend several items at once to the control. Notice that calling this method may be much faster than appending the items one by one if you @@ -8435,6 +8624,15 @@ class SizerItem(Object): """ return _core_.SizerItem_GetMinSize(*args, **kwargs) + def GetMinSizeWithBorder(*args, **kwargs): + """ + GetMinSizeWithBorder(self) -> Size + + Get the minimum size needed for the item with space for the borders + added, if needed. + """ + return _core_.SizerItem_GetMinSizeWithBorder(*args, **kwargs) + def SetInitSize(*args, **kwargs): """SetInitSize(self, int x, int y)""" return _core_.SizerItem_SetInitSize(*args, **kwargs) @@ -9460,11 +9658,21 @@ class FlexGridSizer(GridSizer): return _core_.FlexGridSizer_GetNonFlexibleGrowMode(*args, **kwargs) def GetRowHeights(*args, **kwargs): - """GetRowHeights(self) -> list""" + """ + GetRowHeights(self) -> list + + Returns a list of integers representing the heights of each of the + rows in the sizer. + """ return _core_.FlexGridSizer_GetRowHeights(*args, **kwargs) def GetColWidths(*args, **kwargs): - """GetColWidths(self) -> list""" + """ + GetColWidths(self) -> list + + Returns a list of integers representing the widths of each of the + columns in the sizer. + """ return _core_.FlexGridSizer_GetColWidths(*args, **kwargs) @@ -10335,7 +10543,7 @@ def CallAfter(callable, *args, **kw): :see: `wx.FutureCall` """ app = wx.GetApp() - assert app, 'No wxApp created yet' + assert app is not None, 'No wx.App created yet' global _wxPyCallAfterId if _wxPyCallAfterId is None: