@@ -9,194 +9,6 @@ FloatingWindow
9
9
:inherited-members:
10
10
:members:
11
11
12
- .. method :: FloatingWindow.assignToDocument(document)
13
-
14
- Add this window to the list of windows associated with a document.
15
-
16
- **document ** should be a *NSDocument * instance.
17
-
18
-
19
- .. method :: FloatingWindow.setTitle(title)
20
-
21
- Set the title in the window's title bar.
22
-
23
- **title ** should be a string.
24
-
25
-
26
- .. method :: FloatingWindow.setPosSize(posSize, animate=True)
27
-
28
- Set the position and size of the FloatingWindow.
29
-
30
- **posSize ** A tuple of form *(left, top, width, height) *.
31
-
32
-
33
- .. method :: FloatingWindow.move(x, y, animate=True)
34
-
35
- Move the window by *x * units and *y * units.
36
-
37
-
38
- .. method :: FloatingWindow.resize(width, height, animate=True)
39
-
40
- Change the size of the window to *width * and *height *.
41
-
42
-
43
- .. method :: FloatingWindow.setDefaultButton(button)
44
-
45
- Set the default button in the FloatingWindow.
46
-
47
- **button ** will be bound to the Return and Enter keys.
48
-
49
-
50
- .. method :: FloatingWindow.bind(event, callback)
51
-
52
- Bind a callback to an event.
53
-
54
- **event ** A string representing the desired event. The options are:
55
-
56
- +-------------------+----------------------------------------------------------------------+
57
- | *"should close" * | Called when the user attempts to close the window. This must return |
58
- | | a bool indicating if the window should be closed or not. |
59
- +-------------------+----------------------------------------------------------------------+
60
- | *"close" * | Called immediately before the window closes. |
61
- +-------------------+----------------------------------------------------------------------+
62
- | *"move" * | Called immediately after the window is moved. |
63
- +-------------------+----------------------------------------------------------------------+
64
- | *"resize" * | Called immediately after the window is resized. |
65
- +-------------------+----------------------------------------------------------------------+
66
- | *"became main" * | Called immediately after the window has become the main window. |
67
- +-------------------+----------------------------------------------------------------------+
68
- | *"resigned main" * | Called immediately after the window has lost its main window status. |
69
- +-------------------+----------------------------------------------------------------------+
70
- | *"became key" * | Called immediately after the window has become the key window. |
71
- +-------------------+----------------------------------------------------------------------+
72
- | *"resigned key" * | Called immediately after the window has lost its key window status. |
73
- +-------------------+----------------------------------------------------------------------+
74
-
75
- For more information about main and key windows, refer to the Cocoa `documentation `_ on the subject.
76
-
77
- .. _documentation : http://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyFloatingWindow.html
78
-
79
- **callback ** The callback that will be called when the event occurs. It should accept a *sender * argument which will
80
- be the Window that called the callback.::
81
-
82
- from vanilla import Window
83
-
84
- class WindowBindDemo(object):
85
-
86
- def __init__(self):
87
- self.w = Window((200, 200))
88
- self.w.bind("move", self.windowMoved)
89
- self.w.open()
90
-
91
- def windowMoved(self, sender):
92
- print("window moved!", sender)
93
-
94
- WindowBindDemo()
95
-
96
-
97
- .. method :: FloatingWindow.unbind(event, callback)
98
-
99
- Unbind a callback from an event.
100
-
101
- **event ** A string representing the desired event.
102
- Refer to *bind * for the options.
103
-
104
- **callback ** The callback that has been bound to the event.
105
-
106
-
107
- .. method :: FloatingWindow.addToolbar(toolbarIdentifier, toolbarItems, addStandardItems=True)
108
-
109
- Add a toolbar to the FloatingWindow.
110
-
111
- **toolbarIdentifier ** A string representing a unique name for the toolbar.
112
-
113
- **toolbarItems ** An ordered list of dictionaries containing the following items:
114
-
115
- +-------------------------------+---------------------------------------------------------------------------+
116
- | *itemIdentifier * | A unique string identifier for the item. This is only used internally. |
117
- +-------------------------------+---------------------------------------------------------------------------+
118
- | *label * (optional) | The text label for the item. Defaults to *None *. |
119
- +-------------------------------+---------------------------------------------------------------------------+
120
- | *paletteLabel * (optional) | The text label shown in the customization palette. Defaults to *label *. |
121
- +-------------------------------+---------------------------------------------------------------------------+
122
- | *toolTip * (optional) | The tool tip for the item. Defaults to *label *. |
123
- +-------------------------------+---------------------------------------------------------------------------+
124
- | *imagePath * (optional) | A file path to an image. Defaults to *None *. |
125
- +-------------------------------+---------------------------------------------------------------------------+
126
- | *imageNamed * (optional) | The name of an image already loaded as a `NSImage `_ by the application. |
127
- | | Defaults to *None *. |
128
- +-------------------------------+---------------------------------------------------------------------------+
129
- | *imageObject * (optional) | A `NSImage `_ object. Defaults to *None *. |
130
- +-------------------------------+---------------------------------------------------------------------------+
131
- | *imageTemplate * (optional) | A boolean representing if the image should converted to a template image. |
132
- +-------------------------------+---------------------------------------------------------------------------+
133
- | *selectable * (optional) | A boolean representing if the item is selectable or not. The default |
134
- | | value is *False *. For more information on selectable toolbar items, refer |
135
- | | to Apple's documentation. |
136
- +-------------------------------+---------------------------------------------------------------------------+
137
- | *view * (optional) | A *NSView * object to be used instead of an image. Defaults to *None *. |
138
- +-------------------------------+---------------------------------------------------------------------------+
139
- | *visibleByDefault * (optional) | If the item should be visible by default pass *True * to this argument. |
140
- | | If the item should be added to the toolbar only through the customization |
141
- | | palette, use a value of *False *. Defaults to *True *. |
142
- +-------------------------------+---------------------------------------------------------------------------+
143
-
144
- .. _NSImage : http://developer.apple.com/documentation/appkit/nsimage?language=objc
145
-
146
- **addStandardItems ** A boolean, specifying whether the standard Cocoa toolbar items
147
- should be added. Defaults to *True *. If you set it to *False *, you must specify any
148
- standard items manually in *toolbarItems *, by using the constants from the AppKit module:
149
-
150
- +-------------------------------------------+------------------------------------------------------+
151
- | *NSToolbarSeparatorItemIdentifier * | The Separator item. |
152
- +-------------------------------------------+------------------------------------------------------+
153
- | *NSToolbarSpaceItemIdentifier * | The Space item. |
154
- +-------------------------------------------+------------------------------------------------------+
155
- | *NSToolbarFlexibleSpaceItemIdentifier * | The Flexible Space item. |
156
- +-------------------------------------------+------------------------------------------------------+
157
- | *NSToolbarShowColorsItemIdentifier * | The Colors item. Shows the color panel. |
158
- +-------------------------------------------+------------------------------------------------------+
159
- | *NSToolbarShowFontsItemIdentifier * | The Fonts item. Shows the font panel. |
160
- +-------------------------------------------+------------------------------------------------------+
161
- | *NSToolbarCustomizeToolbarItemIdentifier * | The Customize item. Shows the customization palette. |
162
- +-------------------------------------------+------------------------------------------------------+
163
- | *NSToolbarPrintItemIdentifier * | The Print item. Refer to Apple's `NSToolbarItem `_ |
164
- | | documentation for more information. |
165
- +-------------------------------------------+------------------------------------------------------+
166
-
167
- .. _NSToolbarItem : https://developer.apple.com/documentation/appkit/nstoolbaritem?language=objc
168
-
169
- **displayMode ** A string representing the desired display mode for the toolbar.
170
-
171
- +-------------+
172
- | "default" |
173
- +-------------+
174
- | "iconLabel" |
175
- +-------------+
176
- | "icon" |
177
- +-------------+
178
- | "label" |
179
- +-------------+
180
-
181
- **sizeStyle ** A string representing the desired size for the toolbar
182
-
183
- +-----------+
184
- | "default" |
185
- +-----------+
186
- | "regular" |
187
- +-----------+
188
- | "small" |
189
- +-----------+
190
-
191
- Returns a dictionary containing the created toolbar items, mapped by itemIdentifier.
192
-
193
-
194
- .. method :: FloatingWindow.removeToolbarItem(itemIdentifier)
195
-
196
- Remove a toolbar item by his identifier.
197
-
198
- **itemIdentifier ** A unique string identifier for the removed item.
199
-
200
12
201
13
.. autoclass :: HUDFloatingWindow
202
14
:members:
0 commit comments