WxGladeCustomControls: wxGlade_custom_widget_manual.html

File wxGlade_custom_widget_manual.html, 143.9 KB (added by flip, 9 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Nouveau</title>
3
4
5
6
7
8
9 
10
11 
12 
13  <meta content="Evrsoft First Page" name="GENERATOR" />
14
15 
16  <meta http-equiv="content-type" content="text/html; charset=us-ascii" />
17
18 
19  <style type="text/css">
20
21.python {
22    BORDER-RIGHT: #a0a0a0 1px dotted; PADDING-RIGHT: 0px; BORDER-TOP: #a0a0a0 1px dotted; PADDING-LEFT: 0px; FONT-SIZE: 110%; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: #a0a0a0 1px dotted; COLOR: #0000bb; LINE-HEIGHT: 110%; PADDING-TOP: 0px; BORDER-BOTTOM: #a0a0a0 1px dotted; FONT-FAMILY: 'Courier New', Courier, monospace; WHITE-SPACE: nowrap; BACKGROUND-COLOR: #f0f0f0
23}
24.python A:link {
25    COLOR: #006
26}
27.python A:hover {
28    BACKGROUND-COLOR: #d6d6e6
29}
30.python .head {
31    PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 70%; PADDING-BOTTOM: 2px; COLOR: #808080; PADDING-TOP: 2px; BORDER-BOTTOM: #d0d0d0 1px solid; FONT-FAMILY: Verdana, Arial, sans-serif; BACKGROUND-COLOR: #f0f0ff
32}
33.python .foot {
34    PADDING-RIGHT: 2px; BORDER-TOP: #d0d0d0 1px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 70%; PADDING-BOTTOM: 2px; COLOR: #808080; PADDING-TOP: 2px; FONT-FAMILY: Verdana, Arial, sans-serif; BACKGROUND-COLOR: #f0f0ff
35}
36.python .imp {
37    FONT-WEIGHT: bold; COLOR: red
38}
39.python .kw1 {
40    FONT-WEIGHT: bold; COLOR: #ff7700
41}
42.python .kw2 {
43    COLOR: #008000
44}
45.python .kw3 {
46    COLOR: #dc143c
47}
48.python .kw4 {
49    COLOR: #0000cd
50}
51.python .co1 {
52    COLOR: #808080; FONT-STYLE: normal
53}
54.python .coMULTI {
55    COLOR: #808080; FONT-STYLE: normal
56}
57.python .es0 {
58    FONT-WEIGHT: normal; COLOR: #000099
59}
60.python .br0 {
61    COLOR: black
62}
63.python .sy0 {
64    COLOR: #66cc66
65}
66.python .st0 {
67    COLOR: #483d8b
68}
69.python .nu0 {
70    COLOR: #ff4500
71}
72.python .me1 {
73    COLOR: black
74}
75.python .me {
76   
77}
78.python SPAN.xtra {
79    DISPLAY: block
80}
81
82  </style></head><body style="color: rgb(0, 0, 0);" alink="#ee0000" link="#0000ee" vlink="#551a8b">
83<h1><a class="mozTocH1" name="mozTocId138871">The wxGlade local Widgets book</a></h1><a class="mozTocH1" name="mozTocId138871"> V 0.1b 2009-11-04 Correct filename, add more properties description<br />
84V 0.2b 2009-11-21 Added commented code for TextProperty<br />
85</a><ul id="mozToc"><!--mozToc h2 1 h3 2--><li><a href="#mozTocId967307">Introduction</a></li><li><a href="#mozTocId361763">Local widgets installation</a><ul><li><a href="#mozTocId318620">Setup the local widgets root directory</a></li><li><a href="#mozTocId648003">Move the local widget to the root diretory</a></li><li><a href="#mozTocId492578">Enter the widget in the widgets.txt file</a></li><li><a href="#mozTocId697384">More information - local widget directory, files and formats</a></li></ul></li><li><a href="#mozTocId823707">A simple local widget</a><ul><li><a href="#mozTocId357897">Create the first local widget</a></li></ul></li><li><a href="#mozTocId243097">Adding a new widget</a><ul><li><a href="#mozTocId370065">Declaration</a></li><li><a href="#mozTocId380523">Base classes
86</a></li><li><a href="#mozTocId711328">Builders and code generators
87</a></li><li><a href="#mozTocId654016">Icons</a></li><li><a href="#mozTocId89429">Widget GUI instanciating</a></li><li><a href="#mozTocId794705">Events</a></li></ul></li><li><a href="#mozTocId532593">Adding properties</a><ul><li><a href="#mozTocId158145">Declare properties</a></li><li><a href="#mozTocId545737"></a></li><li><a href="#mozTocId545737"></a></li><li><a href="#mozTocId545737">HiddenProperty</a></li><li><a href="#mozTocId858025">TextBoxProperty</a></li><li><a href="#mozTocId17321">CheckBoxProperty</a></li><li><a href="#mozTocId209529">SpinProperty</a></li><li><a href="#mozTocId932650">ComboBoxProperty</a></li><li><a href="#mozTocId688601">RadioProperty</a></li><li><a href="#mozTocId78959">CheckListProperty</a></li><li><a href="#mozTocId866626">DialogProperty</a></li><li><a href="#mozTocId808736">FileDialogProperty</a></li><li><a href="#mozTocId849718">FontDialogProperty</a></li><li><a href="#mozTocId694066">ColorDialogProperty</a></li><li><a href="#mozTocId185857">GridProperty</a></li><li><a href="#mozTocId185857"></a></li><li><a href="#mozTocId185857"></a></li><li><a href="#mozTocId185857"></a></li><li><a href="#mozTocId580976"></a></li><li><a href="#mozTocId580976">ChoicesProperty</a></li><li><a href="#mozTocId580976"></a></li><li><a href="#mozTocId580976">
88</a></li></ul></li><li><a href="#mozTocId64918">Technical reference</a><ul><li><a href="#mozTocId303571">Widget classes using properties</a></li><li><a href="#mozTocId755371">widget_properties.py reference</a></li></ul></li><li><a href="#mozTocId699146">Licence</a></li></ul>
89
90
91<h2><a class="mozTocH2" name="mozTocId967307">Introduction</a></h2>
92
93<p><a class="mozTocH2" name="mozTocId967307">wxGlade
94is a GUI designer that is used to design and generate code for
95the wxWidget toolkit. wxGlade has a limited widget choice but have
96extensions possibilities. First, there is a custom widget button so
97that you can insert about any wxWidget on your form, there are also
98templates that you can manage and use as needed and finally, there is
99support for local 'plug-in' widget.</a></p>
100
101<p><a class="mozTocH2" name="mozTocId967307">This document describe howto design and install
102local plugin widgets. They are well integrated to wxGlade, using the
103widgets parameters, properties and events interfaces panels. They
104provide the correct look in the visual design window. In all ways, they
105have the same 'look and feel' as built-in widgets.</a></p>
106
107<h2><a class="mozTocH2" name="mozTocId361763">Local widgets installation</a></h2>
108
109<a class="mozTocH2" name="mozTocId361763">This
110section show you how to install the local widgets. If you have already
111a local widget, you have just a few steps to install.<br />
112
113</a><h3><a class="mozTocH3" name="mozTocId318620">Setup the local widgets root directory</a></h3>
114
115<p><a class="mozTocH3" name="mozTocId318620">Start wxGlade, select <span style="font-weight: bold;">View-&gt;Preferences...</span>
116In the preferences window, select the <span style="font-weight: bold;">'Other'</span>
117tab.menu. The local widget root is in the <span style="font-weight: bold;">'Local widget path'</span> field. Create
118the directory and enter the path as needed. You should have a
119widgets.txt file in the directory, create an empty text file if needed.</a></p>
120
121<h3><a class="mozTocH3" name="mozTocId648003">Move the local widget to the root diretory</a></h3>
122
123<a class="mozTocH3" name="mozTocId648003">Move or copy the new widget directory and his files in the local widget
124root directory.<br />
125
126</a><h3><a class="mozTocH3" name="mozTocId492578">Enter the widget in the widgets.txt file</a></h3>
127
128<a class="mozTocH3" name="mozTocId492578">Open the text file with any plain text editor and add a line with the
129name of the widget directory<br />
130
131<br />
132
133</a><h3><a class="mozTocH3" name="mozTocId697384">More information - local widget directory, files and formats</a></h3>
134
135<a class="mozTocH3" name="mozTocId697384"><br />
136
137</a><div class="python">
138<div class="head"><a class="mozTocH3" name="mozTocId697384"> Directory example: knob Control </a></div>
139<span class="st0"><a class="mozTocH3" name="mozTocId697384">"""<br />
140<br />
141Local widget root directory<br />
142&nbsp; |<br />
143&nbsp; |-- widgets.txt<br />
144&nbsp; |<br />
145&nbsp; |-- knob_ctrl<br />
146&nbsp; &nbsp; &nbsp; |<br />
147&nbsp; &nbsp; &nbsp; |-- __.ini__.py<br />
148&nbsp; &nbsp; &nbsp; |-- knob_ctrl.py<br />
149&nbsp; &nbsp; &nbsp; |-- codegen.py<br />
150&nbsp; &nbsp; &nbsp; |-- knob_ctrl.xpm<br />
151&nbsp; &nbsp; &nbsp; |-- perl_codegen.py (optional)<br />
152&nbsp; &nbsp; &nbsp; |-- lisp_codegen.py (optional)<br />
153&nbsp; &nbsp; &nbsp; |-- more worker directories, class and/or modules<br />
154"""</a></span><a class="mozTocH3" name="mozTocId697384"> </a></div>
155
156<a class="mozTocH3" name="mozTocId697384"><br />
157
158</a><h4><a class="mozTocH3" name="mozTocId697384">Files description</a></h4>
159
160<table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2">
161
162  <tbody>
163    <tr>
164      <td style="vertical-align: top;">__ini__.py<br />
165      </td>
166      <td style="vertical-align: top;">Load and initialize the local
167widget<br />
168      </td>
169    </tr>
170    <tr>
171      <td style="vertical-align: top;">&lt;widget&gt;.py<br />
172      </td>
173      <td style="vertical-align: top;">Widget GUI code. Standard
174properties and method to connect to wxGlade.<br />
175      </td>
176    </tr>
177    <tr>
178      <td style="vertical-align: top;">codegen.py<br />
179      </td>
180      <td style="vertical-align: top;">Code generation to write Python,
181xml file and C++ files<br />
182      </td>
183    </tr>
184    <tr>
185      <td style="vertical-align: top;">&lt;widget&gt;.xpm<br />
186      </td>
187      <td style="vertical-align: top;">Icon file in XWindows picture
188map format.<br />
189      </td>
190    </tr>
191    <tr>
192      <td style="vertical-align: top;">perl_codegen.py<br />
193      </td>
194      <td style="vertical-align: top;">Generate perl code.<br />
195      </td>
196    </tr>
197    <tr>
198      <td style="vertical-align: top;">lisp_codegen.py<br />
199      </td>
200      <td style="vertical-align: top;">Generate lisp code<br />
201      </td>
202    </tr>
203    <tr>
204      <td style="vertical-align: top;">class/helper modules<br />
205      </td>
206      <td style="vertical-align: top;">Any
207module to add functions or class to help streamline the code. Only
208required for very complex widgets (multi-panels, tool strips, ...)<br />
209      </td>
210    </tr>
211  </tbody>
212</table>
213
214<a class="mozTocH3" name="mozTocId697384"><br />
215
216</a><h4><a class="mozTocH3" name="mozTocId697384">widgets.txt file</a></h4>
217
218<p><a class="mozTocH3" name="mozTocId697384">The
219file is scanned at wxGlade startup. Il you have may local widgets, you
220can comment the ones you don't need to reduce clutter.
221</a></p>
222
223<div class="python">
224<div class="head"><a class="mozTocH3" name="mozTocId697384"> widgets.txt example </a></div>
225<span class="co1"><a class="mozTocH3" name="mozTocId697384"># list of widget modules available (one per line,
226without extension)</a></span><a class="mozTocH3" name="mozTocId697384"><br />
227<span class="co1"># lines starting with a '#' are comments</span><br />
228<span class="co1">knob_ctrl</span> &nbsp; </a></div>
229
230<a class="mozTocH3" name="mozTocId697384"><br />
231
232</a><h4><a class="mozTocH3" name="mozTocId697384">Icon file</a></h4>
233
234<p><a class="mozTocH3" name="mozTocId697384">Icons
235for wxGlade tool panel buttons. Icons for builtin widget are found in
236the wxGlade/icon directory. We will place the new ones in the local
237widget subdirectory to help portability.</a></p>
238
239<hr style="width: 100%; height: 2px;" />
240
241
242<h2><a class="mozTocH2" name="mozTocId823707">A simple local widget</a></h2>
243
244<h3><a class="mozTocH3" name="mozTocId357897">Create the first local widget</a></h3>
245
246<p><a class="mozTocH3" name="mozTocId357897">This
247will show how easy it can be to create a new widget. For our first
248local widget we will code the checkListBox. To make things easier, we
249select the listBox as a starting point as it is very close to the
250checkListBox. Just a few easy steps:</a></p>
251
252<ol>
253
254<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Copy the list_box directory with all the files from the
255wxGlade/widget directory to the local widget directory.</a></li>
256<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Change the local widget directory name from <span style="font-weight: bold;">list_box</span> to <span style="font-weight: bold;">check_list_box</span></a></li>
257<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Change the file name from <span style="font-weight: bold;">list_box.py</span>
258to <span style="font-weight: bold;">check_list_box.py</span></a></li>
259<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Scan all the source files, find and replace <span style="font-weight: bold;">list_box</span> by <span style="font-weight: bold;">check_list_box</span>; find and replace
260also <span style="font-weight: bold;">wxListBox</span> by <span style="font-weight: bold;">wxCheckListBox</span></a></li>
261<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Replace the events by <span style="font-weight: bold;">EVT_CHECKED</span></a></li>
262<a class="mozTocH3" name="mozTocId357897">  </a><li><a class="mozTocH3" name="mozTocId357897">Add a line in the local widgets.txt file with only <span style="font-weight: bold;">check_list_box</span> on the line.</a></li>
263</ol>
264
265<p><a class="mozTocH3" name="mozTocId357897">Done! Start wxGlade: you will see the button: 'Custom components'.
266Create a frame, add a checkListBox, and preview.</a></p>
267
268<a class="mozTocH3" name="mozTocId357897"><br />
269
270</a><hr style="width: 100%; height: 2px;" />
271<h2><a class="mozTocH2" name="mozTocId243097">Adding a new widget</a></h2>
272
273<a class="mozTocH2" name="mozTocId243097">Select
274the widget, try to find a similar widget that you can use as a starting
275point. Enumerate parameters, properties and events. Create the new
276local widget directory and modules.<br />
277
278<br />
279
280The code must:<br />
281
282</a><ul>
283
284<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Declare the widget and his icon to the wxGlade tool panel;</a></li>
285<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Create a widget instance for the GUI builder;</a></li>
286<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Declare widget events for the events interface panel;</a></li><li><a class="mozTocH2" name="mozTocId243097">Provide properties declarations and processing;</a></li>
287<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Read and write the project file using the standard XRC format;</a></li>
288<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Create Python and C++ code for the widget and configuration
289selected;</a></li>
290<a class="mozTocH2" name="mozTocId243097">  </a><li><a class="mozTocH2" name="mozTocId243097">Optionnally, create perl and lisp code for the same.</a></li>
291</ul>
292
293<a class="mozTocH2" name="mozTocId243097">From now on, the following conventions will apply:<br />
294
295<br />
296
297</a><table style="width: 100%; text-align: left;" border="0" cellpadding="2" cellspacing="2">
298
299  <tbody>
300    <tr>
301      <td style="vertical-align: top;">&lt;localDir&gt;<br />
302      </td>
303      <td style="vertical-align: top;">The name of the root directory
304for the local widget.<br />
305      </td>
306    </tr>
307    <tr>
308      <td style="vertical-align: top;">&lt;widgetDir&gt;<br />
309      </td>
310      <td style="vertical-align: top;">The directory that contains the
311local widget modules.<br />
312      </td>
313    </tr>
314    <tr>
315      <td style="vertical-align: top;">&lt;widget&gt;<br />
316      </td>
317      <td style="vertical-align: top;">Then name of the widget 'python
318style' ie lower case with underscores<br />
319      </td>
320    </tr>
321    <tr>
322      <td style="vertical-align: top;">&lt;wxWidget&gt;<br />
323      </td>
324      <td style="vertical-align: top;">The name of the widget as used
325in wxPython<br />
326      </td>
327    </tr>
328  </tbody>
329</table>
330
331<a class="mozTocH2" name="mozTocId243097"><br />
332
333</a><h3><a class="mozTocH3" name="mozTocId370065">Declaration</a></h3>
334
335<a class="mozTocH3" name="mozTocId370065">In the &lt;localDir&gt;\widgets.txt file: add a line for &lt;widget&gt;.<br />
336
337<br />
338
339The __ini__.py will import the widget modules and icon. The standard is
340OK for most purposes, importing and initializing modules:<br />
341
342<br />
343
344</a><div class="python">
345<div class="head"><a class="mozTocH3" name="mozTocId370065"> __ini__.py example
346</a></div>
347<a class="mozTocH3" name="mozTocId370065"><br />
348<span class="kw1">def</span> initialize<span class="br0">(</span><span class="br0">)</span>:<br />
349&nbsp; &nbsp; <span class="kw1">import</span> common<br />
350&nbsp; &nbsp; <span class="kw1">import</span> codegen<br />
351&nbsp; &nbsp; codegen.<span class="me1">initialize</span><span class="br0">(</span><span class="br0">)</span><br />
352&nbsp; &nbsp; <span class="kw1">if</span> common.<span class="me1">use_gui</span>:<br />
353&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> knob_ctrl<br />
354&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> knob_ctrl.<span class="me1">initialize</span><span class="br0">(</span><span class="br0">)</span><br />
355&nbsp;
356</a></div>
357
358<a class="mozTocH3" name="mozTocId370065"><br />
359
360Declare the new widget class in the &lt;widget&gt;.py file.<br />
361
362<br />
363
364</a><div class="python">
365<div class="head"><a class="mozTocH3" name="mozTocId370065"> Class declaration </a></div>
366<a class="mozTocH3" name="mozTocId370065">&nbsp; &nbsp;<br />
367<span class="kw1">class</span> EditKnobCtrl<span class="br0">(</span>ManagedBase<span class="br0">)</span>:<br />
368&nbsp; &nbsp; <span class="st0">"""<span class="es0">\</span><br />
369&nbsp; &nbsp; Class to handle wxKnobCtrl objects<br />
370&nbsp; &nbsp; """</span>
371</a></div>
372
373<a class="mozTocH3" name="mozTocId370065"><br />
374</a><h3><a class="mozTocH3" name="mozTocId380523">Base classes
375</a></h3>
376<a class="mozTocH3" name="mozTocId380523">Different base classes are available, depending on the class parameters. You will find them in edit_window.py<br />
377
378<br />
379
380</a><table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2">
381
382  <tbody>
383    <tr>
384      <td style="vertical-align: top;">EditBase<br />
385      </td>
386      <td style="vertical-align: top;">Base class of every window
387available in the builder.<br />
388      </td>
389    </tr>
390    <tr>
391      <td style="vertical-align: top;">WindowBase<br />
392      </td>
393      <td style="vertical-align: top;">Extends
394EditBase with the addition of the common properties available to almost
395every window: size, background and foreground colors, and font<br />
396      </td>
397    </tr>
398    <tr>
399      <td style="vertical-align: top;">ManagedBase<br />
400      </td>
401      <td style="vertical-align: top;">Base
402class for every managed window used by the builder: extends WindowBase
403with the addition of properties relative to the layout of the window:
404option, flag, and border<br />
405      </td>
406    </tr>
407    <tr>
408      <td style="vertical-align: top;">TopLevelBase<br />
409      </td>
410      <td style="vertical-align: top;">Base class for every non-managed
411window (i.e. Frames and Dialogs).<br />
412      </td>
413    </tr>
414  </tbody>
415</table>
416
417<a class="mozTocH3" name="mozTocId380523"><br />
418</a><h3><a class="mozTocH3" name="mozTocId711328">Builders and code generators
419</a></h3>
420<a class="mozTocH3" name="mozTocId711328">Builders and codes generators are declared in the
421initialize function of &lt;widget&gt;.py and codegen.py. The standard
422one will work just fine. Just change the widget names unless
423you have custom properties handlers.<br />
424
425<br />Again keep the same code in the builder and xml_builder functions in
426&lt;widget&gt;.py; only change the widget edit class.<br />
427
428<br />
429
430<br />
431
432</a><hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId711328"> <br />
433
434</a><h3><a class="mozTocH3" name="mozTocId654016">Icons</a></h3>
435
436<p><a class="mozTocH3" name="mozTocId654016">wxGlade icons are used on the toolbox array buttons. They are 21x21
437pixels, 256 colors xpm format files; you can use Gimp to format them.
438</a></p>
439
440<p><a class="mozTocH3" name="mozTocId654016">Modify
441an existing icon or create your own from scratch, then save it as
442&lt;localDir&gt;/&lt;widget&gt;/&lt;widget&gt;.xpm. Our example would
443use localWidgets/check_list_box/check_list_box.xpm.</a></p>
444
445<p><a class="mozTocH3" name="mozTocId654016">Change the (normally last) line of &lt;widiget&gt;.py to use the
446current module directory:</a></p>
447
448<a class="mozTocH3" name="mozTocId654016"><br />
449
450</a><div class="python">
451<div class="head"><a class="mozTocH3" name="mozTocId654016"> Local widget icon - find and load </a></div>
452<a class="mozTocH3" name="mozTocId654016"><br />
453&nbsp; &nbsp; <span class="kw1">import</span> <span class="kw3">os</span><br />
454&nbsp; &nbsp; <span class="co1"># ... module code</span><br />
455<br />
456&nbsp; &nbsp; <span class="co1"># Change the last line to find module
457directory</span><br />
458&nbsp; &nbsp; <span class="co1"># return
459common.make_object_button('EditCheckListBox', 'icons/list_box.xpm')
460&nbsp; &nbsp; &nbsp;&nbsp;</span><br />
461&nbsp; &nbsp; <span class="kw1">return</span> common.<span class="me1">make_object_button</span><span class="br0">(</span><span class="st0">'EditCheckListBox'</span>,<br />
462&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">os</span>.<span class="me1">path</span>.<span class="me1">join</span><span class="br0">(</span><span class="kw3">os</span>.<span class="me1">path</span>.<span class="me1">dirname</span><span class="br0">(</span>__file__<span class="br0">)</span> ,<span class="st0">'check_list_box.xpm'</span><span class="br0">)</span><span class="br0">)</span><br />
463
464&nbsp; </a></div>
465
466<hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId654016"> <br />
467
468</a><h3><a class="mozTocH3" name="mozTocId89429">Widget GUI instanciating</a></h3><a class="mozTocH3" name="mozTocId89429">The &lt;widget&gt;.create_widget method will create an instance of the widget to use on the designer GUI. Use
469'self.widget' for the object name, 'self.parent.widget' as parent and
470'self.id' as id. After instanciation, you can add whatever code you
471need to process properties values. Parameters are handled automatically depending of the base class used in the edit control.<br />
472
473<br />
474
475</a><div class="python">
476<div class="head"><a class="mozTocH3" name="mozTocId89429"> Create widget </a></div>
477<a class="mozTocH3" name="mozTocId89429"><br />
478&nbsp; &nbsp; <span class="kw1">def</span> create_widget<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
479&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span> = wx.<span class="me1">lib</span>.<span class="me1">agw</span>.<span class="me1">knobctrl</span>.<span class="me1">KnobCtrl</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>, <span class="kw2">self</span>.<span class="kw2">id</span><span class="br0">)</span><br />
480&nbsp;
481</a></div>
482
483<a class="mozTocH3" name="mozTocId89429"><br />
484
485</a><hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId89429"> <br />
486
487</a><h3><a class="mozTocH3" name="mozTocId794705">Events</a></h3>
488
489<a class="mozTocH3" name="mozTocId794705">All
490processing is done by wxGlade. Events are defined in the
491&lt;widget&gt;.py module, 'Edit&lt;widget&gt;' class.&nbsp; 'events' is
492a class variable that holds the list of events we want to show in
493wxGlade:<br />
494
495<br />
496
497</a><div class="python">
498<div class="head"><a class="mozTocH3" name="mozTocId794705"> Events declaration </a></div>
499<a class="mozTocH3" name="mozTocId794705">&nbsp; &nbsp;<br />
500<span class="kw1"><br />
501&nbsp; &nbsp; events = <span class="br0">[</span><span class="st0">'KC_EVENT_ANGLE_CHANGING'</span>,<span class="st0">'KC_EVENT_ANGLE_CHANGED'</span><span class="br0">]</span><br />
502&nbsp; &nbsp;
503&nbsp;</span> </a></div>
504
505
506
507<hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId794705"><br />
508</a><h2><a class="mozTocH2" name="mozTocId532593">Adding properties</a></h2>
509
510<p><a class="mozTocH2" name="mozTocId532593">wxGlade provides useful tools to manage properties:
511</a></p>
512
513<ul>
514
515<a class="mozTocH2" name="mozTocId532593">  </a><li><a class="mozTocH2" name="mozTocId532593">The widget property dictionnary
516</a></li>
517<a class="mozTocH2" name="mozTocId532593">  </a><li><a class="mozTocH2" name="mozTocId532593">Loading and saving of standard types properties</a></li>
518<a class="mozTocH2" name="mozTocId532593">  </a><li><a class="mozTocH2" name="mozTocId532593">Predefined types with properties window handler</a></li>
519<a class="mozTocH2" name="mozTocId532593">  </a><li><a class="mozTocH2" name="mozTocId532593">Standard properties handling</a></li>
520<a class="mozTocH2" name="mozTocId532593">  </a><li><a class="mozTocH2" name="mozTocId532593">Properties grid management</a></li>
521</ul>
522
523<h3><a class="mozTocH3" name="mozTocId158145">Declare properties</a></h3><p><a class="mozTocH3" name="mozTocId158145">The properties declaration will be added in the &lt;widget&gt;.Edit&lt;widget&gt;.__init__</a></p>
524
525<p><a class="mozTocH3" name="mozTocId158145">Add the object instance variables to hold the property value.</a></p>
526
527<p><a class="mozTocH3" name="mozTocId158145">Add a self.access_function declaration for the property</a></p>
528
529<p><a class="mozTocH3" name="mozTocId158145">Add the property to the dictionnary as a property type object.</a></p>
530
531<p><a class="mozTocH3" name="mozTocId158145">You can use one of the following standard properties objects; you
532can find them in the widget_properties.py module:</a></p>
533
534<ul>
535
536<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">HiddenProperty</a></li>
537<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">TextProperty</a></li>
538<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">CheckBox</a></li>
539<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">SpinProperty</a></li>
540<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">ComboBoxProperty</a></li>
541<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">RadioProperty</a></li>
542<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">CheckListProperty</a></li>
543<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">DialogProperty</a></li>
544<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">FileDialogProperty</a></li>
545<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">FontDialogProperty</a></li>
546<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">ColorDialogProperty
547  </a></li>
548<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">GridProperty</a></li>
549<a class="mozTocH3" name="mozTocId158145">  </a><li><a class="mozTocH3" name="mozTocId158145">ChoicesProperty (import and special handler)
550  </a></li>
551</ul>
552
553<hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId158145"><br />
554</a><h4><a class="mozTocH3" name="mozTocId158145">Common ObjectProperty parameters</a></h4>
555<h5><a class="mozTocH3" name="mozTocId158145">Parent</a></h5>
556
557<h5><a class="mozTocH3" name="mozTocId158145">Label</a></h5>
558
559<a class="mozTocH3" name="mozTocId158145">Will be shown on the property panel.<br />
560
561</a><h5><a class="mozTocH3" name="mozTocId158145">can_disable</a></h5>
562
563
564<p><a class="mozTocH3" name="mozTocId158145">Every type handler has a boolean
565'can_disable' property'. If True a checkbox will be displayed at the
566left of the parameter field. If<br />
567this checkbox is empty, the input
568field will be disabled and the property will be deleted from the
569property dictionnary. Thus we can control code generation in codegen
570modules. The program can change the status using the toggle_active()
571method and test it with is_active property.
572</a></p>
573<h5><a class="mozTocH3" name="mozTocId158145">write_always</a></h5>
574<a class="mozTocH3" name="mozTocId158145">If True, the property will be written to the xrc file, even if the can_disable box is unchecked. Default: False<br />
575</a><h5><a class="mozTocH3" name="mozTocId158145">omitter</a></h5>
576<a class="mozTocH3" name="mozTocId158145">Blocking key used by activator enabled object, default None.<br />
577</a><p><a class="mozTocH3" name="mozTocId158145">Working with editors, you can access widgets underlyiing the
578input fields. For example, to change minimun and maximum value of a
579SpinProperty, add a line to the display method after the widget
580property entry is created:<br />
581self.property['maxValue'].spin.SetRange(100, 1000)<br />
582Be warned that the names can change in a later version so your code
583won't work anymore.
584</a></p>
585<h4><a class="mozTocH3" name="mozTocId158145" /></h4>
586<h4><a class="mozTocH3" name="mozTocId158145">Common ObjectProperty properties</a></h4>
587<h4><a class="mozTocH3" name="mozTocId158145" /></h4>
588<h4><a class="mozTocH3" name="mozTocId158145" /></h4>
589<h4><a class="mozTocH3" name="mozTocId158145" /></h4>
590<h4><a class="mozTocH3" name="mozTocId158145">
591</a></h4>
592<h3><a class="mozTocH3" name="mozTocId545737" /></h3>
593<h3><a class="mozTocH3" name="mozTocId545737" /></h3>
594<h5><a class="mozTocH3" name="mozTocId545737">access_functions[] </a></h5>
595<a class="mozTocH3" name="mozTocId545737">This dictionnary will contain for each property name a tuple of the get/set functions.<br />
596</a><h5><a class="mozTocH3" name="mozTocId545737">_original[]</a></h5>
597<a class="mozTocH3" name="mozTocId545737">Dictionnary of original property value for each property name.<br />
598</a><h5><a class="mozTocH3" name="mozTocId545737">properties[]</a></h5>
599<a class="mozTocH3" name="mozTocId545737">Dictionnary of specific PropertyType for each property name<br />
600</a><h3><a class="mozTocH3" name="mozTocId545737">HiddenProperty</a></h3>
601
602
603<p><a class="mozTocH3" name="mozTocId545737">This is a place holder for a property without user interface,
604ie computed from other values. 'label' is set to None by the property code. The
605'HiddenProperty' will provide dummy access functions so you don't have to declare get_value and set_value
606method in the property dictionnary. Naturally, you can also provide your own get_value and/or
607set_value methods.<br />
608This property type is useful as it is built around the same structures
609and processing frames as the other properties type. The standard
610properties services will provide file read/write. And it is easy to
611switch property type if you ever have to.<br />
612</a></p>
613<h3><a class="mozTocH3" name="mozTocId858025">TextBoxProperty</a></h3>
614
615<a class="mozTocH3" name="mozTocId858025">This property will let the
616user input a text. You have the option to allow multi-lines entries. We
617will use extracts from static_text and shows how to use it, first in
618the widget module, then in the codegen.py<br />
619<br />
620 </a>
621<div class="python"><div class="head">TextBoxProperty - commented code<br />
622</div>&nbsp; &nbsp; <span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, name, parent, <span class="kw2">id</span>, label, sizer, pos, property_window,<br />
623&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;show=<span class="kw2">True</span><span class="br0">)</span>:<br />
624&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">"""<span class="es0">\</span><br />
625&nbsp; &nbsp; &nbsp; &nbsp; Class to handle ... objects<br />
626&nbsp; &nbsp; &nbsp; &nbsp; """</span><br />
627&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> config<br />
628&nbsp; &nbsp; &nbsp; &nbsp; ManagedBase.<span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, name, <span class="st0">'wxStaticText'</span>, parent, <span class="kw2">id</span>, sizer,<br />&nbsp;
629&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
630&nbsp; &nbsp; &nbsp; &nbsp;pos, property_window, show=show<span class="br0">)</span><br />
631&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># &nbsp;Declare the local value holder for the parameter</span><br />
632&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># we initialise the value to the __init__ parameter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><br />
633&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">label</span> = label<br />
634&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code...</span><br />
635&nbsp; &nbsp; &nbsp; &nbsp; <br />
636&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Declare the get and set function </span><br />
637&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">access_functions</span><span class="br0">[</span><span class="st0">'label'</span><span class="br0">]</span> = <span class="br0">(</span><span class="kw2">self</span>.<span class="me1">get_label</span>, <span class="kw2">self</span>.<span class="me1">set_label</span><span class="br0">)</span><br />
638&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code...</span><br />
639&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code...</span><br />
640&nbsp; &nbsp; &nbsp; &nbsp; <br />
641&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Create the user interface object: notice the 'multiline' option!</span><br />
642&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'label'</span><span class="br0">]</span> = TextProperty<span class="br0">(</span><span class="kw2">self</span>, <span class="st0">'label'</span>, <span class="kw2">None</span>,<br />
643&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
644&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
645&nbsp; &nbsp; &nbsp; &nbsp; multiline=<span class="kw2">True</span>, label=_<span class="br0">(</span><span class="st0">'label'</span><span class="br0">)</span><span class="br0">)</span><br />
646&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># more code...</span><br />
647&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
648&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
649&nbsp; &nbsp; <span class="kw1">def</span> create_widget<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
650&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span> = StaticText<span class="br0">(</span><span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>, <span class="kw2">self</span>.<span class="kw2">id</span>,<br />
651&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw2">self</span>.<span class="me1">label</span>.<span class="me1">replace</span><span class="br0">(</span><span class="st0">'<span class="es0">\\</span>n'</span>, <span class="st0">'<span class="es0">\n</span>'</span><span class="br0">)</span><span class="br0">)</span><br />
652&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># we don't have to provide an creation time value as it</span><br />
653&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <span class="co1"># is specified in the __init__ parameter.</span><br />
654&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
655&nbsp; &nbsp; <span class="kw1">def</span> create_properties<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
656&nbsp; &nbsp; &nbsp; &nbsp; ManagedBase.<span class="me1">create_properties</span><span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span><br />
657&nbsp; &nbsp; &nbsp; &nbsp; panel = wx.<span class="me1">Panel</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">notebook</span>, -<span class="nu0">1</span><span class="br0">)</span><br />
658&nbsp; &nbsp; &nbsp; &nbsp; szr = wx.<span class="me1">BoxSizer</span><span class="br0">(</span>wx.<span class="me1">VERTICAL</span><span class="br0">)</span><br />
659&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Add the property to the property panel</span><br />
660&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'label'</span><span class="br0">]</span>.<span class="me1">display</span><span class="br0">(</span>panel<span class="br0">)</span><br />
661&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code...</span><br />
662&nbsp; &nbsp; &nbsp; &nbsp; szr.<span class="me1">Add</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'label'</span><span class="br0">]</span>.<span class="me1">panel</span>, <span class="nu0">0</span>, wx.<span class="me1">EXPAND</span><span class="br0">)</span><br />
663&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code...</span><br />
664&nbsp; &nbsp; &nbsp; &nbsp; <br />
665&nbsp; &nbsp; <br />
666&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># The 'get' method&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><br />
667&nbsp; &nbsp; <span class="kw1">def</span> get_label<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>: <span class="kw1">return</span> <span class="kw2">self</span>.<span class="me1">label</span><br />
668<br />
669&nbsp; &nbsp; <span class="co1"># The 'set' method</span><br />
670&nbsp; &nbsp; <span class="kw1">def</span> set_label<span class="br0">(</span><span class="kw2">self</span>, value<span class="br0">)</span>:<br />
671&nbsp; &nbsp; &nbsp; &nbsp; value = misc.<span class="me1">wxstr</span><span class="br0">(</span>value<span class="br0">)</span><br />
672&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw1">not</span> misc.<span class="me1">streq</span><span class="br0">(</span>value, <span class="kw2">self</span>.<span class="me1">label</span><span class="br0">)</span>:<br />
673&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">label</span> = value<br />
674&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>:<br />
675&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetLabel</span><span class="br0">(</span>value.<span class="me1">replace</span><span class="br0">(</span><span class="st0">'<span class="es0">\\</span>n'</span>, <span class="st0">'<span class="es0">\n</span>'</span><span class="br0">)</span><span class="br0">)</span><br />
676&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw1">not</span> <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'size'</span><span class="br0">]</span>.<span class="me1">is_active</span><span class="br0">(</span><span class="br0">)</span>:<br />
677&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">sizer</span>.<span class="me1">set_item</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">pos</span>,<br />
678&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
679&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
680size=<span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">GetBestSize</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><br />&nbsp;
681<br />
682</div>
683<a class="mozTocH3" name="mozTocId858025">
684
685</a><br />
686<br />
687<br />
688
689<div class="python"><div class="head">codegen.py - with comments<br />
690</div><span class="kw1">class</span> PythonCodeGenerator:<br />
691&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br />
692&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Code, code, code...</span><br />
693&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Get property value, add proper quotes</span><br />
694&nbsp; &nbsp; &nbsp; &nbsp; label = pygen.<span class="me1">quote_str</span><span class="br0">(</span>prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'label'</span>, <span class="st0">''</span><span class="br0">)</span><span class="br0">)</span><br />
695&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Code...</span><br />
696&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
697&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Use the value in the code generator:</span><br />
698&nbsp; &nbsp; &nbsp; &nbsp; init.<span class="me1">append</span><span class="br0">(</span><span class="st0">'%s%s = %s(%s, %s, %s%s)<span class="es0">\n</span>'</span> <span class="sy0">%</span><br />
699&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">(</span>prefix, obj.<span class="me1">name</span>, klass, parent, <span class="kw2">id</span>, label, style<span class="br0">)</span><span class="br0">)</span><br />
700&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
701<br />
702<span class="kw1">class</span> CppCodeGenerator:<br />
703&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br />
704&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...</span><br />
705&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Get property value, add proper quotes</span><br />
706&nbsp; &nbsp; &nbsp; &nbsp; label = cppgen.<span class="me1">quote_str</span><span class="br0">(</span>prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'label'</span>, <span class="st0">''</span><span class="br0">)</span><span class="br0">)</span><br />
707&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Code....</span><br />
708&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Write the value to the c text</span><br />
709&nbsp; &nbsp; &nbsp; &nbsp; init = <span class="br0">[</span><span class="st0">'%s%s = new %s(%s, %s, %s%s);<span class="es0">\n</span>'</span> <span class="sy0">%</span><br />
710&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">(</span>prefix, obj.<span class="me1">name</span>, obj.<span class="me1">klass</span>, parent, <span class="kw2">id</span>, label, extra<span class="br0">)</span> <span class="br0">]<br />
711&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <br />
712</span>
713&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># More code....</span><br />
714&nbsp;
715</div>
716<h3><a class="mozTocH3" name="mozTocId17321">CheckBoxProperty</a></h3>
717
718<a class="mozTocH3" name="mozTocId17321">Use a check box to set the property value.
719</a><h3><a class="mozTocH3" name="mozTocId209529">SpinProperty</a></h3>
720
721<h3><a class="mozTocH3" name="mozTocId932650">ComboBoxProperty</a></h3>
722
723<h3><a class="mozTocH3" name="mozTocId688601">RadioProperty</a></h3>
724
725<h3><a class="mozTocH3" name="mozTocId78959">CheckListProperty</a></h3>
726
727<h3><a class="mozTocH3" name="mozTocId866626">DialogProperty</a></h3>
728
729<h3><a class="mozTocH3" name="mozTocId808736">FileDialogProperty</a></h3>
730
731<h3><a class="mozTocH3" name="mozTocId849718">FontDialogProperty</a></h3>
732<a class="mozTocH3" name="mozTocId849718" />This property allows you to manage fonts selection. <br />
733Invoke the property creation&nbsp; prop['font']<br />
734
735
736<h3><a class="mozTocH3" name="mozTocId694066">ColorDialogProperty</a></h3>
737
738<a class="mozTocH3" name="mozTocId694066">Returns either the name of a system context color
739or the name of a color. You must transform it to an actual color to
740display the widget in wxGlade but keep in&nbsp; the code generators.<br />
741<span style="font-family: 'Courier New',Courier,monospace;">If you use a ColorDialog with the parameter
742can_disable=True, the class will reset the property
743to the default value when the property is disabled, i.e. check box
744unchecked. To use it:<br />
745</span></a><ul>
746<a class="mozTocH3" name="mozTocId694066">  </a><li><a class="mozTocH3" name="mozTocId694066">&nbsp;your property name must match the property in the
747widget.SetColour method. If you name the property 'Background', wxGlade
748will try to execute 'SetBackgroundColour' to set the default value;</a></li>
749<a class="mozTocH3" name="mozTocId694066">  </a><li><a class="mozTocH3" name="mozTocId694066">&nbsp;you must supply the default value in a
750dictionnary named _original using the property name as the key value.</a></li>
751</ul>
752
753
754<a class="mozTocH3" name="mozTocId694066">The user selected value is a string that can represent a system
755color (wx.SYS_COLOUR_BTNFACE) or a string representation of a hex value
756of the RGB channel (#000000 = black). (As of this writing wxGlade does
757not support Alpha channel). This is the value written to file and used
758to generate the code.<br />
759
760<br />To display this color, we convert it to a wx.colour object that we can use in SetObjectColour
761methods. wxGlade provide the misc.string_to_color functon that returns a wx.object. We must use this
762format for the self._original value as it is used in the wxGlade
763functions.<br />
764
765<br />The ColorDialogProperty
766will capitalize the property name and add 'Set' before and 'Colour' after the
767name so 'tags' will become SetTagsColour method. If the
768method use two capital letters (SetFirstGradientColour), just assign
769the proper name to the ColorDialogProperty name in create_widget:<br />
770
771<br />
772&nbsp;
773
774
775</a><div class="python"><div class="head"><a class="mozTocH3" name="mozTocId694066">Adding a color property - widget commented code</a></div><a class="mozTocH3" name="mozTocId694066">&nbsp; &nbsp;<br />
776&nbsp; &nbsp; <br />
777&nbsp; &nbsp; <span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, name, parent, <span class="kw2">id</span>, sizer, pos, property_window,<br />
778&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;show=<span class="kw2">True</span><span class="br0">)</span>:<br />
779&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> config<br />
780&nbsp; &nbsp; &nbsp; &nbsp; ManagedBase.<span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, name, <span class="st0">'wxKnobCtrl'</span>, parent, <span class="kw2">id</span>,<br />&nbsp;
781&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
782&nbsp; &nbsp; &nbsp; &nbsp;sizer, pos, property_window, show=show<span class="br0">)</span><br />
783&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code.......</span><br />
784&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
785&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Declare the local value holder for the parameter</span><br />
786&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">color1</span>=<span class="st0">'wxSYS_COLOUR_BTNFACE'</span> <br />
787&nbsp; &nbsp; &nbsp; &nbsp; <br />
788&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
789&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Declare the get and set function and create a user interface object</span><br />
790&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">access_functions</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>=<span class="br0">(</span><span class="kw2">self</span>.<span class="me1">get_color1</span>, <span class="kw2">self</span>.<span class="me1">set_color1</span><span class="br0">)</span><br />
791&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>=ColorDialogProperty<span class="br0">(</span><span class="kw2">self</span>, <span class="st0">'FirstGradient'</span>, can_disable=<span class="kw2">True</span>, label=_<span class="br0">(</span><span class="st0">'Color 1'</span><span class="br0">)</span><span class="br0">)</span><br />
792&nbsp; &nbsp; &nbsp; &nbsp; <br />
793&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
794&nbsp; &nbsp; <span class="co1"># Helper function for color management&nbsp; &nbsp; &nbsp; </span><br />
795&nbsp; &nbsp; <span class="kw1">def</span> to_color<span class="br0">(</span><span class="kw2">self</span>, colorName<span class="br0">)</span>:<br />
796&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">"""From system color name or hex color string<br />
797&nbsp; &nbsp; &nbsp; &nbsp; returns wxColor object """</span><br />
798&nbsp; &nbsp; &nbsp; &nbsp; wColorName=colorName.<span class="me1">strip</span><span class="br0">(</span><span class="br0">)</span><br />
799&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> wColorName <span class="kw1">in</span> ColorDialogProperty.<span class="me1">str_to_colors</span>:<br />
800&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> wx.<span class="me1">SystemSettings_GetColour</span><span class="br0">(</span>ColorDialogProperty.<span class="me1">str_to_colors</span><span class="br0">[</span>wColorName<span class="br0">]</span><span class="br0">)</span><br />
801&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
802&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">try</span>:<br />
803&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> misc.<span class="me1">string_to_color</span><span class="br0">(</span>wColorName<span class="br0">)</span><br />
804&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">except</span>:<br />
805&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">None</span><br />
806&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
807&nbsp; &nbsp; <span class="kw1">def</span> create_widget<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
808&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span> = wx.<span class="me1">lib</span>.<span class="me1">agw</span>.<span class="me1">knobctrl</span>.<span class="me1">KnobCtrl</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>, <br />
809&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
810&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
811&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
812&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
813&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="kw2">id</span><span class="br0">)</span><br />
814&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
815&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># We must create synonyms for methods with multiple Capital letters</span><br />
816&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># as ColorProperty will capitallze some names</span><br />
817&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetFirstgradientColour</span>=<span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetFirstGradientColour</span><br />
818&nbsp; &nbsp; &nbsp; &nbsp; <br />
819&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># As we want the original value we memorize it right after widget creation</span><br />
820&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># This will provide automatic value rollback when the checkbox is unchecked</span><br />
821&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>._original<span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>=<span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">GetFirstGradientColour</span><span class="br0">(</span><span class="br0">)</span><br />
822<br />
823&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
824&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Apply any value read from a xrc file</span><br />
825&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>.<span class="me1">is_active</span><span class="br0">(</span><span class="br0">)</span>:<br />
826&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetFirstGradientColour</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">to_color</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">color1</span><span class="br0">)</span><span class="br0">)</span><br />
827&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
828&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
829&nbsp; &nbsp; <span class="kw1">def</span> create_properties<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
830&nbsp; &nbsp; &nbsp; &nbsp; ManagedBase.<span class="me1">create_properties</span><span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span><br />
831&nbsp; &nbsp; &nbsp; &nbsp; panel = wx.<span class="me1">ScrolledWindow</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">notebook</span>, -<span class="nu0">1</span>, style=wx.<span class="me1">TAB_TRAVERSAL</span><span class="br0">)</span><br />
832&nbsp; &nbsp; &nbsp; &nbsp; szr = wx.<span class="me1">BoxSizer</span><span class="br0">(</span>wx.<span class="me1">VERTICAL</span><span class="br0">)</span><br />
833<br />
834&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
835&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Add the property to the property grid panel</span><br />
836&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>.<span class="me1">display</span><span class="br0">(</span>panel<span class="br0">)</span><br />
837<br />
838&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
839&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># add the property field to the sizer</span><br />
840&nbsp; &nbsp; &nbsp; &nbsp; szr.<span class="me1">Add</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>.<span class="me1">panel</span>, <span class="nu0">0</span>, wx.<span class="me1">EXPAND</span><span class="br0">)</span><br />
841<br />
842&nbsp; &nbsp; <span class="co1"># ...</span><br />
843&nbsp; &nbsp; <span class="co1"># add the get property and set property method &nbsp; &nbsp;</span><br />
844&nbsp; &nbsp; <span class="kw1">def</span> get_color1<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
845&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">self</span>.<span class="me1">color1</span><br />
846&nbsp; &nbsp; <br />
847&nbsp; &nbsp; <span class="kw1">def</span> set_color1<span class="br0">(</span><span class="kw2">self</span>, value<span class="br0">)</span>:<br />
848&nbsp; &nbsp; &nbsp; &nbsp; new_color=<span class="kw2">self</span>.<span class="me1">to_color</span><span class="br0">(</span>value<span class="br0">)</span><br />
849&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> new_color:<br />
850&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">color1</span>=value<br />
851&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>:<br />
852&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetFirstGradientColour</span><span class="br0">(</span>new_color<span class="br0">)</span><br />
853&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
854&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'FirstGradient'</span><span class="br0">]</span>.<span class="me1">set_value</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">color1</span><span class="br0">)</span>
855&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </a></div>
856<a class="mozTocH3" name="mozTocId694066"><br />
857<br />
858</a><div class="python"><div class="head"><a class="mozTocH3" name="mozTocId694066">Color property generate python and c++ - codegen.py</a></div><a class="mozTocH3" name="mozTocId694066"><br />
859<span class="kw1">class</span> PythonCodeGenerator<span class="br0">(</span><span class="br0">)</span>:<br />
860&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code.....</span><br />
861&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br />
862&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># code....</span><br />
863&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># &nbsp;Read the selected value and output a color code or a system color name</span><br />
864&nbsp; &nbsp; &nbsp; &nbsp; color1=prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'FirstGradient'</span><span class="br0">)</span><br />
865&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> color1 <span class="kw1">is</span> <span class="kw1">not</span> <span class="kw2">None</span>:<br />
866&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sysColIdx=<span class="kw2">getattr</span><span class="br0">(</span>wx, color1<span class="br0">[</span><span class="nu0">2</span>:<span class="br0">]</span>, <span class="kw2">None</span><span class="br0">)</span><br />
867&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> color1<span class="br0">[</span><span class="nu0">0</span>:<span class="nu0">12</span><span class="br0">]</span>==<span class="st0">'wxSYS_COLOUR'</span> <span class="kw1">and</span> sysColIdx <span class="kw1">is</span> <span class="kw1">not</span> <span class="kw2">None</span>:<br />
868&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colorCode=<span class="br0">(</span><span class="st0">'wx.SystemSettings_GetColour(wx.%s)'</span> <span class="sy0">%</span><br />
869&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color1<span class="br0">[</span><span class="nu0">2</span>:<span class="br0">]</span><span class="br0">)</span><br />
870&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
871&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colorCode=<span class="br0">(</span><span class="st0">'wx.Colour(%s, %s, %s)'</span> <span class="sy0">%</span> <br />
872&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw2">tuple</span><span class="br0">(</span><span class="br0">[</span><span class="kw2">int</span><span class="br0">(</span>color1<span class="br0">[</span>i:i+<span class="nu0">2</span><span class="br0">]</span>, <span class="nu0">16</span><span class="br0">)</span> <span class="kw1">for</span> i <span class="kw1">in</span> <span class="kw2">range</span><span class="br0">(</span><span class="nu0">1</span>, <span class="nu0">7</span>, <span class="nu0">2</span><span class="br0">)</span><span class="br0">]</span><span class="br0">)</span><span class="br0">)</span><br />
873&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; props_buf.<span class="me1">append</span><span class="br0">(</span><span class="st0">'self.%s.SetFirstGradientColour(%s)<span class="es0">\n</span>'</span> <span class="sy0">%</span><br />
874&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">(</span>obj.<span class="me1">name</span>, colorCode<span class="br0">)</span><span class="br0">)</span><br />
875<br />
876&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
877<br />
878<span class="kw1">class</span> CppCodeGenerator:<br />
879&nbsp; &nbsp; <span class="co1"># ,,,</span><br />
880&nbsp; &nbsp; &nbsp; &nbsp; <br />
881&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br />
882&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">"""<span class="es0">\</span><br />
883&nbsp; &nbsp; &nbsp; &nbsp; generates C++ code for wxKnobCtrl objects.<br />
884&nbsp; &nbsp; &nbsp; &nbsp; """</span><br />
885&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
886&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Read the selected value and output a color code or a system color name</span><br />
887&nbsp; &nbsp; &nbsp; &nbsp; color1=prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'FirstGradient'</span><span class="br0">)</span><br />
888&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> color1 <span class="kw1">is</span> <span class="kw1">not</span> <span class="kw2">None</span>:<br />
889&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sysColIdx=<span class="kw2">getattr</span><span class="br0">(</span>wx, color1<span class="br0">[</span><span class="nu0">2</span>:<span class="br0">]</span>, <span class="kw2">None</span><span class="br0">)</span><br />
890&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> color1<span class="br0">[</span><span class="nu0">0</span>:<span class="nu0">12</span><span class="br0">]</span>==<span class="st0">'wxSYS_COLOUR'</span> <span class="kw1">and</span> sysColIdx <span class="kw1">is</span> <span class="kw1">not</span> <span class="kw2">None</span>:<br />
891&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colorCode=<span class="br0">(</span><span class="st0">'wxSystemSettings_GetColour(wx%s)'</span> <span class="sy0">%</span><br />
892&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color1<span class="br0">[</span><span class="nu0">2</span>:<span class="br0">]</span><span class="br0">)</span><br />
893&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
894&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colorCode=<span class="br0">(</span><span class="st0">'wxColour(%s, %s, %s)'</span> <span class="sy0">%</span> <br />
895&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw2">tuple</span><span class="br0">(</span><span class="br0">[</span><span class="kw2">int</span><span class="br0">(</span>color1<span class="br0">[</span>i:i+<span class="nu0">2</span><span class="br0">]</span>, <span class="nu0">16</span><span class="br0">)</span> <span class="kw1">for</span> i <span class="kw1">in</span> <span class="kw2">range</span><span class="br0">(</span><span class="nu0">1</span>, <span class="nu0">7</span>, <span class="nu0">2</span><span class="br0">)</span><span class="br0">]</span><span class="br0">)</span><span class="br0">)</span><br />
896&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; props_buf.<span class="me1">append</span><span class="br0">(</span><span class="st0">'%s-&gt;SetFirstGradientColour(%s)<span class="es0">\n</span>'</span> <span class="sy0">%</span><br />
897&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">(</span>obj.<span class="me1">name</span>, colorCode<span class="br0">)</span><span class="br0">)</span><br />
898&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;
899</a></div>
900<h3><a class="mozTocH3" name="mozTocId185857">GridProperty</a></h3>
901<h3><a class="mozTocH3" name="mozTocId185857" /></h3>
902<h3><a class="mozTocH3" name="mozTocId185857" /></h3>
903<h3><a class="mozTocH3" name="mozTocId185857" /></h3>
904
905
906
907<h3><a class="mozTocH3" name="mozTocId580976" /></h3><a class="mozTocH3" name="mozTocId580976">Grid Property
908is&nbsp; used when you need to input tabular values like the&nbsp;
909arguments table for the custom widget, fields in the status bar, grid
910columns list, etc... It provides 'Apply', 'Add', 'Insert' and 'Remove'
911buttons, columns headers and multiple selection.<br />
912
913The grid property supports four columns input type: string, int, float
914and bool with defined constants. It exposes 'can_add', 'can_remove' and
915'can_insert' properties to enable/disable those buttons.<br />
916
917<br />
918We can have an example in the frame.py module, class EditStatusBar:<br />
919<br />
920
921</a><div class="python"><div class="head"><a class="mozTocH3" name="mozTocId580976">Commented code from EditStatusBar<br />
922</a></div><a class="mozTocH3" name="mozTocId580976"><br />
923<span class="co1"><span class="co1"># code ...</span><br />
924
925<br /><br />
926<span class="kw1">class</span> EditStatusBar<span class="br0">(</span>EditBase<span class="br0">)</span>:<br />
927<br /><span class="co1">&nbsp;&nbsp;&nbsp; # code...</span><br />
928&nbsp;&nbsp;  <br />
929&nbsp; &nbsp; <span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, parent, property_window<span class="br0">)</span>:<br />
930&nbsp; &nbsp; &nbsp; &nbsp; EditBase.<span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self</span>, parent.<span class="me1">name</span> + <span class="st0">'_statusbar'</span>,<br />
931&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'wxStatusBar'</span>, parent, <span class="kw2">id</span>, property_window,<br />
932&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; custom_class=<span class="kw2">False</span>, show=<span class="kw2">False</span><span class="br0">)</span><br /><br />
933<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # code...</span><br />
934
935<span class="co1">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; # create value holder</span><br />
936&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">fields</span> = <span class="br0">[</span> <span class="br0">[</span><span class="kw2">self</span>.<span class="me1">name</span>, <span class="st0">"-1"</span><span class="br0">]</span> <span class="br0">]</span> <span class="co1"># list of 2-lists label, size</span><br />&nbsp;
937&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
938&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
939&nbsp; <span class="co1"># for the statusbar fields</span><br />
940&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">access_functions</span><span class="br0">[</span><span class="st0">'fields'</span><span class="br0">]</span> = <span class="br0">(</span><span class="kw2">self</span>.<span class="me1">get_fields</span>, <span class="kw2">self</span>.<span class="me1">set_fields</span><span class="br0">)</span> <br />
941&nbsp; &nbsp; &nbsp; &nbsp; prop = <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'fields'</span><span class="br0">]</span> = GridProperty<span class="br0">(</span><br />
942&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>, <span class="st0">'fields'</span>, <span class="kw2">None</span>,<br />
943&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">[</span><span class="br0">(</span><span class="st0">"Text"</span>, GridProperty.<span class="me1">STRING</span><span class="br0">)</span>, <span class="br0">(</span><span class="st0">"Size"</span>, GridProperty.<span class="me1">INT</span><span class="br0">)</span><span class="br0">]</span><span class="br0">)</span><br /><span class="co1">&nbsp;&nbsp;&nbsp; <br />
944&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # code...</span><br />
945
946<span class="co1">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; # fields custom writer...</span><br />
947
948<br />
949&nbsp; &nbsp; <span class="kw1">def</span> create_widget<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
950&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span> = wx.<span class="me1">StatusBar</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>, wx.<span class="me1">NewId</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><br />
951&nbsp; &nbsp; &nbsp; &nbsp; wx.<span class="me1">EVT_LEFT_DOWN</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">widget</span>, <span class="kw2">self</span>.<span class="me1">on_set_focus</span><span class="br0">)</span><br /><span class="co1">&nbsp;&nbsp;&nbsp; <br />
952&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # we use the local value when we create the wxGlade widget</span><br />
953
954
955&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">set_fields</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">fields</span><span class="br0">)</span><br />
956&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>: <span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>.<span class="me1">SetStatusBar</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">widget</span><span class="br0">)</span><br />
957<br />
958&nbsp; &nbsp; <span class="kw1">def</span> create_properties<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br /><span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # code...</span><br />
959
960<span class="co1">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; # link property to properties panel</span><br />
961&nbsp; &nbsp; &nbsp; &nbsp; prop = <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'fields'</span><span class="br0">]</span><br />
962&nbsp; &nbsp; &nbsp; &nbsp; prop.<span class="me1">display</span><span class="br0">(</span>page<span class="br0">)</span><br />
963&nbsp; &nbsp; &nbsp; &nbsp; sizer = page.<span class="me1">GetSizer</span><span class="br0">(</span><span class="br0">)</span><br /><br />
964<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # code...</span><br />
965
966<span class="co1">&nbsp;&nbsp;&nbsp; <br />
967&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # Add to the sizer</span><br />
968
969&nbsp; &nbsp; &nbsp; &nbsp; sizer.<span class="me1">Add</span><span class="br0">(</span>prop.<span class="me1">panel</span>, <span class="nu0">1</span>, wx.<span class="me1">ALL</span>|wx.<span class="me1">EXPAND</span>, <span class="nu0">3</span><span class="br0">)</span><br /><span class="co1">&nbsp;&nbsp;&nbsp; <br />
970&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # code...</span><br />
971
972<br />
973<span class="co1"><br />
974&nbsp;&nbsp;&nbsp; # set/get property</span><br />
975&nbsp; &nbsp; <span class="kw1">def</span> set_fields<span class="br0">(</span><span class="kw2">self</span>, values<span class="br0">)</span>:<br />
976&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># values is a list of lists</span><br />
977&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">fields</span> = <span class="br0">[</span><span class="br0">]</span><br />
978&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>: <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetFieldsCount</span><span class="br0">(</span><span class="kw2">len</span><span class="br0">(</span>values<span class="br0">)</span><span class="br0">)</span><br />
979&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> i <span class="kw1">in</span> <span class="kw2">range</span><span class="br0">(</span><span class="kw2">len</span><span class="br0">(</span>values<span class="br0">)</span><span class="br0">)</span>:<br />
980&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">try</span>: v = <span class="kw2">int</span><span class="br0">(</span>values<span class="br0">[</span>i<span class="br0">]</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">)</span><br />
981&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">except</span>: v = <span class="nu0">0</span><br />
982&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = misc.<span class="me1">wxstr</span><span class="br0">(</span>values<span class="br0">[</span>i<span class="br0">]</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">)</span><br />
983&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">fields</span>.<span class="me1">append</span><span class="br0">(</span><span class="br0">[</span>s, <span class="kw2">str</span><span class="br0">(</span>v<span class="br0">)</span><span class="br0">]</span><span class="br0">)</span><br />
984&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>: <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetStatusText</span><span class="br0">(</span>s, i<span class="br0">)</span><br />
985&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>:<br />
986&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetStatusWidths</span><span class="br0">(</span><span class="br0">[</span><span class="kw2">int</span><span class="br0">(</span>i<span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">)</span> <span class="kw1">for</span> i <span class="kw1">in</span> <span class="kw2">self</span>.<span class="me1">fields</span><span class="br0">]</span><span class="br0">)</span><br />
987<br />
988&nbsp; &nbsp; <span class="kw1">def</span> get_fields<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
989&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">self</span>.<span class="me1">fields</span><br /><span class="co1"><br />
990&nbsp;&nbsp;&nbsp; # code...</span><br />
991
992<span class="co1">&nbsp;&nbsp;&nbsp; # code...</span><br />
993
994<span class="co1">&nbsp;&nbsp;&nbsp; # code...</span><br />
995
996<br />
997&nbsp;&nbsp;  <br /><span class="co1"># end of class EditStatusBar</span><br />
998&nbsp; &nbsp; &nbsp;&nbsp;  <br />
999<br />
1000</span></a></div>
1001<h4><a class="mozTocH3" name="mozTocId580976" /></h4>
1002<h3><a class="mozTocH3" name="mozTocId580976">ChoicesProperty</a></h3>
1003<span>This property type will allow the
1004user to load a list of selectable value. It is used in comboBox,
1005listBox, radioBox. It is a GridProperty subclassed to handle choices.<br />
1006<br />
1007Most of the time, there is also a selection value field to preset to
1008the selection value. Choices and selection are different properties but
1009work together.<br />
1010<br />
1011&nbsp;The following is taken from the list_box widget:<br />
1012<br />
1013 <br />
1014
1015<div class="python"><div class="head">Choices property - commented code from list_box widget<br />
1016</div><span class="co1"><br />
1017# import the propertyType </span><br />
1018
1019<span class="kw1">from</span> ChoicesProperty <span class="kw1">import</span> <span class="sy0">*</span><br />
1020<br />
1021<span class="kw1">class</span> EditListBox<span class="br0">(</span>ManagedBase<span class="br0">)</span>:<br />
1022&nbsp;&nbsp;&nbsp; ...<br />&nbsp;&nbsp;  <br />
1023
1024&nbsp; &nbsp; <span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">(</span><span class="kw2">self....</span><span class="kw2"><span class="br0">)</span>:<br /><br />
1025
1026&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...</span><br />
1027
1028
1029
1030&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Create a value holder</span><br />
1031&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">choices</span> = choices<br />
1032
1033&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># properties</span><br />
1034&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ChoicesProperty subclasses GridProperty: see widget_properties.py</span><br />
1035
1036&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">access_functions</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span> = <span class="br0">(</span><span class="kw2">self</span>.<span class="me1">get_choices</span>, <span class="kw2">self</span>.<span class="me1">set_choices</span><span class="br0">)</span><br />
1037
1038&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span> = ChoicesProperty<span class="br0">(</span><span class="kw2">self</span>, <span class="st0">'choices'</span>, <span class="kw2">None</span>,<br />&nbsp;
1039
1040&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1041&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1042
1043&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">[</span><span class="br0">(</span>_<span class="br0">(</span><span class="st0">'Label'</span><span class="br0">)</span>,<br />
1044&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1045
1046&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1047&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GridProperty.<span class="me1">STRING</span><span class="br0">)</span><span class="br0">]</span>,<br />
1048
1049&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1050&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1051
1052&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw2">len</span><span class="br0">(</span>choices<span class="br0">)</span>, label=_<span class="br0">(</span><span class="st0">'choices'</span><span class="br0">)</span><span class="br0">)</span><br /><br />
1053
1054&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br />
1055<br />
1056</span>
1057&nbsp; &nbsp; <span class="kw1">def</span> create_widget<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
1058
1059&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Actually use the value when we create the GUI widget:<br />
1060</span>
1061&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span> = wx.<span class="me1">ListBox</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">parent</span>.<span class="me1">widget</span>, <span class="kw2">self</span>.<span class="kw2">id</span>,<br />
1062
1063&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choices=<span class="kw2">self</span>.<span class="me1">choices</span><span class="br0">)</span><br /><br />
1064
1065&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br />
1066<br />
1067</span>
1068&nbsp; &nbsp; <span class="kw1">def</span> create_properties<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
1069
1070&nbsp; &nbsp; &nbsp; &nbsp; ManagedBase.<span class="me1">create_properties</span><span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span><br />
1071&nbsp; &nbsp; &nbsp; &nbsp; panel = wx.<span class="me1">ScrolledWindow</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">notebook</span>, -<span class="nu0">1</span>, style=wx.<span class="me1">TAB_TRAVERSAL</span><span class="br0">)</span><br />
1072
1073&nbsp; &nbsp; &nbsp; &nbsp; szr = wx.<span class="me1">BoxSizer</span><span class="br0">(</span>wx.<span class="me1">VERTICAL</span><span class="br0">)</span><br />
1074&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Link the property type to the wxGlade properties panel<br />
1075
1076</span>
1077&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span>.<span class="me1">display</span><span class="br0">(</span>panel<span class="br0">)</span><br /><br />
1078
1079
1080&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br /></span>
1081&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Add the Choice selector to the wxGlade properties panel</span><br />
1082&nbsp; &nbsp; &nbsp; &nbsp; ch = <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span>.<span class="me1">panel</span><br />
1083
1084&nbsp; &nbsp; &nbsp; &nbsp; ch.<span class="me1">SetSize</span><span class="br0">(</span><span class="br0">(</span>ch.<span class="me1">GetSize</span><span class="br0">(</span><span class="br0">)</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span>-<span class="nu0">20</span>, <span class="nu0">200</span><span class="br0">)</span><span class="br0">)</span><br />
1085
1086&nbsp; &nbsp; &nbsp; &nbsp; szr.<span class="me1">Add</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span>.<span class="me1">panel</span>, <span class="nu0">1</span>, wx.<span class="me1">ALL</span>|wx.<span class="me1">EXPAND</span>, <span class="nu0">5</span><span class="br0">)</span><br />
1087
1088&nbsp; &nbsp; &nbsp; &nbsp; panel.<span class="me1">SetAutoLayout</span><span class="br0">(</span><span class="kw2">True</span><span class="br0">)</span><br />
1089&nbsp; &nbsp; &nbsp; &nbsp; panel.<span class="me1">SetSizer</span><span class="br0">(</span>szr<span class="br0">)</span><br />
1090
1091&nbsp; &nbsp; &nbsp; &nbsp; szr.<span class="me1">Fit</span><span class="br0">(</span>panel<span class="br0">)<br />
1092<br />
1093</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Add scroll bar and adjust sizes</span><br />
1094
1095
1096
1097&nbsp; &nbsp; &nbsp; &nbsp; w, h = panel.<span class="me1">GetSize</span><span class="br0">(</span><span class="br0">)</span><br />
1098&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">from</span> <span class="kw3">math</span> <span class="kw1">import</span> ceil<br />
1099
1100&nbsp; &nbsp; &nbsp; &nbsp; panel.<span class="me1">SetScrollbars</span><span class="br0">(</span><span class="nu0">5</span>, <span class="nu0">5</span>, <span class="kw2">int</span><span class="br0">(</span>ceil<span class="br0">(</span>w/<span class="nu0">5.0</span><span class="br0">)</span><span class="br0">)</span>, <span class="kw2">int</span><span class="br0">(</span>ceil<span class="br0">(</span>h/<span class="nu0">5.0</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span><br />
1101
1102&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">notebook</span>.<span class="me1">AddPage</span><span class="br0">(</span>panel, <span class="st0">'Widget'</span><span class="br0">)</span><br />
1103&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span>.<span class="me1">set_col_sizes</span><span class="br0">(</span><span class="br0">[</span>-<span class="nu0">1</span><span class="br0">]</span><span class="br0">)</span><br />
1104
1105&nbsp; &nbsp; &nbsp; &nbsp; <br />
1106&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br />
1107<br />
1108<br />
1109</span>
1110&nbsp; &nbsp; <span class="kw1">def</span> get_property_handler<span class="br0">(</span><span class="kw2">self</span>, prop_name<span class="br0">)</span>:<br />
1111
1112
1113&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ChoicesProperty uses a custom property handler</span> &nbsp;&nbsp; &nbsp;&nbsp;  <br />
1114&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># found in ChoicesProperty.py</span><br />
1115
1116&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> prop_name == <span class="st0">'choices'</span>:<br />
1117&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> ChoicesHandler<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span><br />
1118
1119&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> ManagedBase.<span class="me1">get_property_handler</span><span class="br0">(</span><span class="kw2">self</span>, prop_name<span class="br0">)</span><br />
1120<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="co1"># ...code...<br />
1121
1122<br />
1123<br />
1124</span>
1125&nbsp; &nbsp; <span class="co1"># get/set methods <br />
1126</span>
1127&nbsp; &nbsp; <span class="kw1">def</span> get_choices<span class="br0">(</span><span class="kw2">self</span><span class="br0">)</span>:<br />
1128
1129&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">zip</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">choices</span><span class="br0">)</span><br />
1130<br />&nbsp; &nbsp; <span class="kw1">def</span> set_choices<span class="br0">(</span><span class="kw2">self</span>, values<span class="br0">)</span>:<br />
1131
1132&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">choices</span> = <span class="br0">[</span> misc.<span class="me1">wxstr</span><span class="br0">(</span>v<span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">)</span> <span class="kw1">for</span> v <span class="kw1">in</span> values <span class="br0">]</span><br />
1133
1134&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'selection'</span><span class="br0">]</span>.<span class="me1">set_range</span><span class="br0">(</span><span class="nu0">0</span>, <span class="kw2">len</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">choices</span><span class="br0">)</span>-<span class="nu0">1</span><span class="br0">)</span><br />
1135
1136&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">self</span>.<span class="me1">widget</span>:<br />
1137&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">Clear</span><span class="br0">(</span><span class="br0">)</span><br />
1138
1139&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> c <span class="kw1">in</span> <span class="kw2">self</span>.<span class="me1">choices</span>: <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">Append</span><span class="br0">(</span>c<span class="br0">)</span><br />
1140
1141&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw1">not</span> <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'size'</span><span class="br0">]</span>.<span class="me1">is_active</span><span class="br0">(</span><span class="br0">)</span>:<br />
1142
1143&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">sizer</span>.<span class="me1">set_item</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">pos</span>, size=<span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">GetBestSize</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><br />
1144
1145&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">widget</span>.<span class="me1">SetSelection</span><span class="br0">(</span><br />
1146&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">int</span><span class="br0">(</span><span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'selection'</span><span class="br0">]</span>.<span class="me1">get_value</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span><br />
1147
1148<br />
1149&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br />
1150</span><br />
1151<span class="co1"># end of class EditListBox</span><br />
1152<br />
1153
1154&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># ...code...<br />
1155
1156</span><br /><br />
1157</span></div>
1158<br />
1159<br />
1160
1161<div class="python"><div class="head">commented code for choice - codegen.py<br />
1162</div><span class="co1"><span class="co1"># THIS PROGRAM COMES WITH NO WARRANTY</span><br />
1163<br />
1164<span class="co1"><span class="co1"># We will need the special choice handler: import it</span><br />
1165</span><span class="kw1">from</span> ChoicesCodeHandler <span class="kw1">import</span> <span class="sy0">*</span><br />
1166
1167<br />
1168<br />
1169<span class="kw1">class</span> PythonCodeGenerator:<br />
1170&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br /><br />
1171
1172<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # ...</span><br />
1173<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # Find user selected choices</span><br />
1174
1175
1176&nbsp; &nbsp; &nbsp; &nbsp; choices = prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'choices'</span>, <span class="br0">[</span><span class="br0">]</span><span class="br0">)</span><br /><br />
1177
1178<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # ...</span><br />
1179
1180<span class="co1">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # Format string and output code</span><br />
1181
1182&nbsp; &nbsp; &nbsp; &nbsp; choices = <span class="st0">', '</span>.<span class="me1">join</span><span class="br0">(</span><span class="br0">[</span>pygen.<span class="me1">quote_str</span><span class="br0">(</span>c<span class="br0">)</span> <span class="kw1">for</span> c <span class="kw1">in</span> choices<span class="br0">]</span><span class="br0">)</span><br /><br />
1183
1184&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="co1"># ...</span><br />
1185
1186
1187&nbsp; &nbsp; &nbsp; &nbsp; init.<span class="me1">append</span><span class="br0">(</span><span class="st0">'self.%s = %s(%s, %s, choices=[%s]%s)<span class="es0">\n</span>'</span> <span class="sy0">%</span><br />
1188
1189&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">(</span>obj.<span class="me1">name</span>, klass, parent, <span class="kw2">id</span>, choices, style<span class="br0">)</span><span class="br0">)</span><br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="co1"># ...</span><br />
1190
1191
1192&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="co1"># ...</span><br />
1193
1194<br />
1195<span class="co1"># end of class PythonCodeGenerator</span><br />
1196<br />
1197<span class="co1"># We must create a custom xrc generator to process the interaction<br />
1198</span>
1199<span class="co1"># of 'choices' and 'selection'</span><br />
1200<span class="kw1">def</span> xrc_code_generator<span class="br0">(</span>obj<span class="br0">)</span>:<br />
1201
1202&nbsp; &nbsp; xrcgen = common.<span class="me1">code_writers</span><span class="br0">[</span><span class="st0">'XRC'</span><span class="br0">]</span><br />
1203&nbsp; &nbsp; <span class="kw1">class</span> ListBoxXrcObject<span class="br0">(</span>xrcgen.<span class="me1">DefaultXrcObject</span><span class="br0">)</span>:<br />
1204
1205&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">def</span> write_property<span class="br0">(</span><span class="kw2">self</span>, name, val, outfile, tabs<span class="br0">)</span>:<br />
1206&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> name == <span class="st0">'choices'</span>:<br />
1207
1208&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xrc_write_choices_property<span class="br0">(</span><span class="kw2">self</span>, outfile, tabs<span class="br0">)</span><br />
1209&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">elif</span> name == <span class="st0">'selection'</span>:<br />
1210
1211&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choices = <span class="kw2">self</span>.<span class="me1">properties</span><span class="br0">[</span><span class="st0">'choices'</span><span class="br0">]</span><br />
1212&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> choices:<br />
1213
1214&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xrcgen.<span class="me1">DefaultXrcObject</span>.<span class="me1">write_property</span><span class="br0">(</span><span class="kw2">self</span>, name, val,<br />&nbsp;
1215
1216&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1217&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1218
1219&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;outfile,
1220tabs<span class="br0">)</span><br />
1221&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
1222
1223&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xrcgen.<span class="me1">DefaultXrcObject</span>.<span class="me1">write_property</span><span class="br0">(</span><span class="kw2">self</span>, name, val,<br />
1224&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1225
1226&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
1227&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;outfile, tabs<span class="br0">)</span><br />
1228
1229<br />
1230&nbsp; &nbsp; <span class="co1"># end of class ListBoxXrcObject</span><br />
1231<br />
1232&nbsp; &nbsp; <span class="kw1">return</span> ListBoxXrcObject<span class="br0">(</span>obj<span class="br0">)</span><br />
1233<br />
1234<br />
1235
1236<span class="kw1">class</span> CppCodeGenerator:<br />
1237&nbsp; &nbsp; <span class="kw1">def</span> get_code<span class="br0">(</span><span class="kw2">self</span>, obj<span class="br0">)</span>:<br />
1238&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">"""<span class="es0">\</span><br />
1239
1240&nbsp; &nbsp; &nbsp; &nbsp; generates the C++ code for wxListBox objects<br />
1241&nbsp; &nbsp; &nbsp; &nbsp; """</span><br />&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
1242
1243&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># Get the values</span><br />
1244
1245&nbsp; &nbsp; &nbsp; &nbsp; choices = prop.<span class="me1">get</span><span class="br0">(</span><span class="st0">'choices'</span>, <span class="br0">[</span><span class="br0">]</span><span class="br0">)</span><br /><br />
1246
1247&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
1248
1249
1250&nbsp; &nbsp; <span class="co1">&nbsp;&nbsp;&nbsp; # build the choice array</span><br />
1251
1252&nbsp; &nbsp; &nbsp; &nbsp; ch_arr = <span class="st0">'{<span class="es0">\n</span> &nbsp; &nbsp; &nbsp; &nbsp;%s<span class="es0">\n</span> &nbsp; &nbsp;};<span class="es0">\n</span>'</span> <span class="sy0">%</span> \<br />
1253
1254&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">',<span class="es0">\n</span> &nbsp; &nbsp; &nbsp; &nbsp;'</span>.<span class="me1">join</span><span class="br0">(</span><span class="br0">[</span>cppgen.<span class="me1">quote_str</span><span class="br0">(</span>c<span class="br0">)</span> <span class="kw1">for</span> c <span class="kw1">in</span> choices<span class="br0">]</span><span class="br0">)</span><br /><br />
1255
1256&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
1257
1258&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># Generate c++ code</span><br />
1259
1260&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> number:<br />
1261
1262&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; init.<span class="me1">append</span><span class="br0">(</span><span class="st0">'const wxString %s_choices[] = %s'</span> <span class="sy0">%</span> <span class="br0">(</span>obj.<span class="me1">name</span>, ch_arr<span class="br0">)</span><span class="br0">)</span><br />
1263
1264&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span>:<br />
1265&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; init.<span class="me1">append</span><span class="br0">(</span><span class="st0">'const wxString *%s_choices = NULL;<span class="es0">\n</span>'</span> <span class="sy0">%</span> obj.<span class="me1">name</span><span class="br0">)</span><br />
1266
1267&nbsp; &nbsp; &nbsp; &nbsp; init.<span class="me1">append</span><span class="br0">(</span><span class="st0">'%s = new %s(%s, %s, wxDefaultPosition, wxDefaultSize, '</span><br />
1268&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'%s, %s_choices, %s);<span class="es0">\n</span>'</span> <span class="sy0">%</span> \<br />
1269
1270&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">(</span>obj.<span class="me1">name</span>, obj.<span class="me1">klass</span>, parent, <span class="kw2">id</span>, number, obj.<span class="me1">name</span>, style<span class="br0">)</span><span class="br0">)</span><br />&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <span class="co1"># ...</span><br />
1271
1272
1273<br />
1274<span class="co1"># end of class CppCodeGenerator</span><br />
1275<br />
1276<br /><span class="co1"># We must declare the custom property handler for each generator:</span><br />
1277<span class="kw1">def</span> initialize<span class="br0">(</span><span class="br0">)</span>:<br />
1278&nbsp; &nbsp; common.<span class="me1">class_names</span><span class="br0">[</span><span class="st0">'EditListBox'</span><span class="br0">]</span> = <span class="st0">'wxListBox'</span><br />
1279
1280<br />
1281&nbsp; &nbsp; pygen = common.<span class="me1">code_writers</span>.<span class="me1">get</span><span class="br0">(</span><span class="st0">"python"</span><span class="br0">)</span><br />
1282&nbsp; &nbsp; <span class="kw1">if</span> pygen:<br />
1283
1284&nbsp; &nbsp; &nbsp; &nbsp; pygen.<span class="me1">add_widget_handler</span><span class="br0">(</span><span class="st0">'wxListBox'</span>, PythonCodeGenerator<span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><br />
1285&nbsp; &nbsp; &nbsp; &nbsp; pygen.<span class="me1">add_property_handler</span><span class="br0">(</span><span class="st0">'choices'</span>, ChoicesCodeHandler<span class="br0">)</span><br />
1286
1287&nbsp; &nbsp; xrcgen = common.<span class="me1">code_writers</span>.<span class="me1">get</span><span class="br0">(</span><span class="st0">"XRC"</span><span class="br0">)</span><br />
1288&nbsp; &nbsp; <span class="kw1">if</span> xrcgen:<br />
1289&nbsp; &nbsp; &nbsp; &nbsp; xrcgen.<span class="me1">add_widget_handler</span><span class="br0">(</span><span class="st0">'wxListBox'</span>, xrc_code_generator<span class="br0">)</span><br />
1290
1291&nbsp; &nbsp; &nbsp; &nbsp; xrcgen.<span class="me1">add_property_handler</span><span class="br0">(</span><span class="st0">'choices'</span>, ChoicesCodeHandler<span class="br0">)</span><br />
1292&nbsp; &nbsp; cppgen = common.<span class="me1">code_writers</span>.<span class="me1">get</span><span class="br0">(</span><span class="st0">'C++'</span><span class="br0">)</span><br />
1293
1294&nbsp; &nbsp; <span class="kw1">if</span> cppgen:<br />
1295&nbsp; &nbsp; &nbsp; &nbsp; cppgen.<span class="me1">add_widget_handler</span><span class="br0">(</span><span class="st0">'wxListBox'</span>, CppCodeGenerator<span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><br />
1296
1297&nbsp; &nbsp; &nbsp; &nbsp; cppgen.<span class="me1">add_property_handler</span><span class="br0">(</span><span class="st0">'choices'</span>, ChoicesCodeHandler<span class="br0">)</span><br />&nbsp;
1298<br />
1299</span></div>
1300<h3><a class="mozTocH3" name="mozTocId580976" /></h3>
1301<h3><a class="mozTocH3" name="mozTocId580976">
1302</a></h3>
1303
1304
1305<hr style="width: 100%; height: 2px;" /><a class="mozTocH3" name="mozTocId580976"><br />
1306</a><h2><a class="mozTocH2" name="mozTocId64918">Technical reference</a></h2>
1307
1308
1309
1310<h3><a class="mozTocH3" name="mozTocId303571">Widget classes using properties</a></h3>
1311<a class="mozTocH3" name="mozTocId303571">The following widgets use properties. Read the code to get a better understanding of how to do it.<br />
1312
1313</a><ul><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">notebook</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">choice</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">comboBox</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">customWidget</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">frame</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">grid</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">listbox</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">menubar</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">radiobox</a></li><a class="mozTocH3" name="mozTocId303571">  </a><li><a class="mozTocH3" name="mozTocId303571">toolBar</a></li></ul>
1314<a class="mozTocH3" name="mozTocId303571"><br />
1315
1316</a><h3><a class="mozTocH3" name="mozTocId755371">widget_properties.py reference</a></h3>
1317
1318
1319<table summary="heading" border="0" cellpadding="2" cellspacing="0" width="100%">
1320
1321<tbody><tr bgcolor="#7799ee">
1322<td valign="bottom">&nbsp;<br />
1323
1324<font color="#ffffff" face="helvetica, arial">&nbsp;<br /><big><big><strong>widget_properties</strong></big></big></font></td><td align="right" valign="bottom"><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br /><a href="file:///C%7C/program%20files/wxglade/source/wxglade-0.6.3/widget_properties.py">c:\program files\wxglade\source\wxglade-0.6.3\widget_properties.py</a></font></td></tr></tbody>
1325</table>
1326
1327<a class="mozTocH3" name="mozTocId755371">   
1328</a><p><a class="mozTocH3" name="mozTocId755371"><tt>#&nbsp;widget_properties.py:&nbsp;classes&nbsp;to&nbsp;handle&nbsp;the&nbsp;various&nbsp;properties&nbsp;of&nbsp;the&nbsp;widgets<br />
1329
1330
1331#&nbsp;(name,&nbsp;size,&nbsp;color,&nbsp;etc.)<br />
1332#&nbsp;$Id:&nbsp;widget_properties.py,v&nbsp;1.65&nbsp;2007/08/07&nbsp;12:21:56&nbsp;agriggio&nbsp;Exp&nbsp;$<br />
1333
1334#&nbsp;<br />
1335
1336#&nbsp;Copyright&nbsp;(c)&nbsp;2002-2007&nbsp;Alberto&nbsp;Griggio&nbsp;&lt;agriggio@users.sourceforge.net&gt;<br />
1337#&nbsp;License:&nbsp;MIT&nbsp;(see&nbsp;license.txt)<br />
1338
1339#&nbsp;THIS&nbsp;PROGRAM&nbsp;COMES&nbsp;WITH&nbsp;NO&nbsp;WARRANTY</tt></a></p>
1340
1341
1342
1343<table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1344
1345<tbody><tr bgcolor="#aa55cc">
1346<td colspan="3" valign="bottom">&nbsp;<br />
1347<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
1348
1349   
1350<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
1351<td width="100%"><table summary="list" width="100%"><tbody><tr><td valign="top" width="25%"><a href="common.html">common</a><br />
1352</td><td valign="top" width="25%"><a href="misc.html">misc</a><br />
1353</td><td valign="top" width="25%"><a href="wx.html">wx</a><br />
1354</td><td width="25%"><br />
1355</td></tr></tbody></table></td></tr></tbody>
1356</table>
1357
1358<table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1359
1360<tbody><tr bgcolor="#ee77aa">
1361
1362<td colspan="3" valign="bottom">&nbsp;<br />
1363
1364<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
1365   
1366<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
1367<td width="100%"><dl><dt><font face="helvetica, arial"><a href="widget_properties.html#Property">Property</a>
1368</font></dt><dd>
1369<dl><dt><font face="helvetica, arial"><a href="widget_properties.html#CheckBoxProperty">CheckBoxProperty</a>
1370</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#CheckListProperty">CheckListProperty</a>
1371</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#ComboBoxProperty">ComboBoxProperty</a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)
1372
1373</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#DialogProperty">DialogProperty</a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)
1374</font></dt><dd>
1375<dl><dt><font face="helvetica, arial"><a href="widget_properties.html#ColorDialogProperty">ColorDialogProperty</a>
1376</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#FileDialogProperty">FileDialogProperty</a>
1377</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#FontDialogProperty">FontDialogProperty</a>
1378</font></dt></dl>
1379</dd><dt><font face="helvetica, arial"><a href="widget_properties.html#GridProperty">GridProperty</a>
1380
1381
1382</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#HiddenProperty">HiddenProperty</a>
1383</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#RadioProperty">RadioProperty</a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)
1384</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#SpinProperty">SpinProperty</a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)
1385</font></dt><dt><font face="helvetica, arial"><a href="widget_properties.html#TextProperty">TextProperty</a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)
1386
1387</font></dt></dl>
1388</dd></dl>
1389 <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1390<tbody><tr bgcolor="#ffc8d8">
1391<td colspan="3" valign="bottom">&nbsp;<br />
1392<font color="#000000" face="helvetica, arial"><a name="CheckBoxProperty">class <strong>CheckBoxProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>)</font></td></tr>
1393   
1394<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1395<td colspan="2"><tt>Properties&nbsp;whose&nbsp;values&nbsp;can&nbsp;be&nbsp;changed&nbsp;by&nbsp;one&nbsp;checkbox.&nbsp;</tt></td></tr>
1396
1397
1398<tr><td>&nbsp;</td>
1399<td width="100%">Methods defined here:<br />
1400<dl><dt><a name="CheckBoxProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, label<font color="#909090">=None</font>, write_always<font color="#909090">=False</font>)</dt></dl>
1401
1402<dl><dt><a name="CheckBoxProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1403
1404
1405<dl><dt><a name="CheckBoxProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;check&nbsp;box&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1406interactively</tt></dd></dl>
1407
1408
1409<dl><dt><a name="CheckBoxProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1410
1411<dl><dt><a name="CheckBoxProperty-set_value"><strong>set_value</strong></a>(self, val)</dt></dl>
1412
1413<dl><dt><a name="CheckBoxProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
1414
1415<hr />
1416Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1417
1418
1419<dl><dt><a name="CheckBoxProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1420
1421
1422has&nbsp;changed</tt></dd></dl>
1423
1424</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1425<tbody><tr bgcolor="#ffc8d8">
1426<td colspan="3" valign="bottom">&nbsp;<br />
1427<font color="#000000" face="helvetica, arial"><a name="CheckListProperty">class <strong>CheckListProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>)</font></td></tr>
1428   
1429<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1430
1431
1432<td colspan="2"><tt>Properties&nbsp;whose&nbsp;values&nbsp;can&nbsp;be&nbsp;changed&nbsp;by&nbsp;a&nbsp;list&nbsp;of&nbsp;checkboxes.&nbsp;</tt></td></tr>
1433<tr><td>&nbsp;</td>
1434<td width="100%">Methods defined here:<br />
1435<dl><dt><a name="CheckListProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, labels<font color="#909090">=None</font>, writer<font color="#909090">=None</font>, tooltips<font color="#909090">=None</font>)</dt><dd><tt>@type&nbsp;labels:&nbsp;list&nbsp;of&nbsp;strings<br />
1436
1437
1438@param&nbsp;labels:&nbsp;list&nbsp;of&nbsp;names&nbsp;of&nbsp;the&nbsp;labels&nbsp;of&nbsp;the&nbsp;checkboxes;&nbsp;a<br />
1439label&nbsp;that&nbsp;begins&nbsp;with&nbsp;the&nbsp;string&nbsp;"#section#"&nbsp;is&nbsp;used&nbsp;as&nbsp;the<br />
1440
1441
1442title&nbsp;of&nbsp;a&nbsp;static&nbsp;box&nbsp;that&nbsp;encloses&nbsp;the&nbsp;checkboxes&nbsp;that<br />
1443follow<br />
1444@type&nbsp;tooltips:&nbsp;tuple&nbsp;of&nbsp;strings<br />@param&nbsp;tooltips:&nbsp;a&nbsp;list&nbsp;of&nbsp;strings&nbsp;to&nbsp;be&nbsp;displayed&nbsp;as&nbsp;the&nbsp;tool-tips&nbsp;for<br />
1445
1446the&nbsp;properties</tt></dd></dl>
1447
1448<dl><dt><a name="CheckListProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1449
1450<dl><dt><a name="CheckListProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;list&nbsp;of&nbsp;checkboxes&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1451
1452
1453interactively</tt></dd></dl>
1454
1455<dl><dt><a name="CheckListProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1456
1457<dl><dt><a name="CheckListProperty-prepare_value"><strong>prepare_value</strong></a>(self, old_val)</dt><dd><tt>turns&nbsp;a&nbsp;string&nbsp;of&nbsp;tokens&nbsp;separated&nbsp;by&nbsp;'|'&nbsp;into&nbsp;a&nbsp;list&nbsp;of<br />
1458
1459
1460boolean&nbsp;values</tt></dd></dl>
1461
1462<dl><dt><a name="CheckListProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1463
1464<dl><dt><a name="CheckListProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
1465
1466<hr />
1467Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1468
1469
1470<dl><dt><a name="CheckListProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1471
1472
1473has&nbsp;changed</tt></dd></dl>
1474
1475</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1476<tbody><tr bgcolor="#ffc8d8">
1477<td colspan="3" valign="bottom">&nbsp;<br />
1478<font color="#000000" face="helvetica, arial"><a name="ColorDialogProperty">class <strong>ColorDialogProperty</strong></a>(<a href="widget_properties.html#DialogProperty">DialogProperty</a>)</font></td></tr>
1479   
1480<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
1481
1482
1483<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#ColorDialogProperty">ColorDialogProperty</a></dd><dd><a href="widget_properties.html#DialogProperty">DialogProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1484<hr />
1485Methods defined here:<br />
1486<dl><dt><a name="ColorDialogProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, can_disable<font color="#909090">=True</font>, label<font color="#909090">=None</font>)</dt></dl>
1487
1488
1489<dl><dt><a name="ColorDialogProperty-display_dialog"><strong>display_dialog</strong></a>(self, event)</dt></dl>
1490
1491<dl><dt><a name="ColorDialogProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1492
1493<hr />
1494Data and other attributes defined here:<br />
1495<dl><dt><strong>colors_to_str</strong> = {0: 'wxSYS_COLOUR_SCROLLBAR',
14961: 'wxSYS_COLOUR_DESKTOP', 2: 'wxSYS_COLOUR_ACTIVECAPTION', 3:
1497'wxSYS_COLOUR_INACTIVECAPTION', 4: 'wxSYS_COLOUR_MENU', 5:
1498'wxSYS_COLOUR_WINDOW', 6: 'wxSYS_COLOUR_WINDOWFRAME', 7:
1499'wxSYS_COLOUR_MENUTEXT', 8: 'wxSYS_COLOUR_WINDOWTEXT', 9:
1500'wxSYS_COLOUR_CAPTIONTEXT', ...}</dt></dl>
1501
1502<dl><dt><strong>dialog</strong> = [None]</dt></dl>
1503
1504<dl><dt><strong>str_to_colors</strong> = {'wxSYS_COLOUR_3DDKSHADOW':
150521, 'wxSYS_COLOUR_3DFACE': 15, 'wxSYS_COLOUR_3DHIGHLIGHT': 20,
1506'wxSYS_COLOUR_3DHILIGHT': 20, 'wxSYS_COLOUR_3DLIGHT': 22,
1507'wxSYS_COLOUR_3DSHADOW': 16, 'wxSYS_COLOUR_ACTIVEBORDER': 10,
1508'wxSYS_COLOUR_ACTIVECAPTION': 2, 'wxSYS_COLOUR_APPWORKSPACE': 12,
1509'wxSYS_COLOUR_BACKGROUND': 1, ...}</dt></dl>
1510
1511<hr />
1512Methods inherited from <a href="widget_properties.html#DialogProperty">DialogProperty</a>:<br />
1513<dl><dt><a name="ColorDialogProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1514
1515
1516<dl><dt><a name="ColorDialogProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;panel&nbsp;(with&nbsp;the&nbsp;text&nbsp;ctrl&nbsp;and&nbsp;the&nbsp;button&nbsp;to&nbsp;display<br />
1517
1518
1519the&nbsp;dialog)&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property&nbsp;interactively</tt></dd></dl>
1520
1521<dl><dt><a name="ColorDialogProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1522
1523<dl><dt><a name="ColorDialogProperty-on_char"><strong>on_char</strong></a>(self, event)</dt></dl>
1524
1525<dl><dt><a name="ColorDialogProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1526
1527<dl><dt><a name="ColorDialogProperty-write"><strong>write</strong></a>(self, dest_file<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt></dl>
1528
1529<hr />
1530
1531Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1532
1533<dl><dt><a name="ColorDialogProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1534
1535
1536has&nbsp;changed</tt></dd></dl>
1537
1538<hr />
1539Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1540<dl><dt><a name="ColorDialogProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1541
1542</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1543<tbody><tr bgcolor="#ffc8d8">
1544
1545
1546<td colspan="3" valign="bottom">&nbsp;<br />
1547<font color="#000000" face="helvetica, arial"><a name="ComboBoxProperty">class <strong>ComboBoxProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)</font></td></tr>
1548   
1549<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1550<td colspan="2"><tt>Properties&nbsp;whose&nbsp;values&nbsp;can&nbsp;be&nbsp;changed&nbsp;with&nbsp;a&nbsp;combobox.&nbsp;</tt></td></tr>
1551
1552
1553<tr><td>&nbsp;</td>
1554<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#ComboBoxProperty">ComboBoxProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1555<hr />
1556Methods defined here:<br />
1557<dl><dt><a name="ComboBoxProperty-__init__"><strong>__init__</strong></a>(self, owner, name, choices, parent<font color="#909090">=None</font>, label<font color="#909090">=None</font>, can_disable<font color="#909090">=False</font>, enabled<font color="#909090">=False</font>, write_always<font color="#909090">=False</font>)</dt></dl>
1558
1559
1560<dl><dt><a name="ComboBoxProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1561
1562<dl><dt><a name="ComboBoxProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;check&nbsp;box&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1563
1564
1565interactively</tt></dd></dl>
1566
1567<dl><dt><a name="ComboBoxProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1568
1569<dl><dt><a name="ComboBoxProperty-set_value"><strong>set_value</strong></a>(self, val)</dt></dl>
1570
1571<dl><dt><a name="ComboBoxProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
1572
1573<hr />
1574
1575Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1576
1577<dl><dt><a name="ComboBoxProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1578
1579
1580has&nbsp;changed</tt></dd></dl>
1581
1582<hr />
1583Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1584<dl><dt><a name="ComboBoxProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1585
1586<dl><dt><a name="ComboBoxProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1587
1588
1589</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1590<tbody><tr bgcolor="#ffc8d8">
1591<td colspan="3" valign="bottom">&nbsp;<br />
1592<font color="#000000" face="helvetica, arial"><a name="DialogProperty">class <strong>DialogProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)</font></td></tr>
1593   
1594<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1595<td colspan="2"><tt><a href="#Property">Property</a>&nbsp;which&nbsp;selection&nbsp;is&nbsp;made&nbsp;through&nbsp;a&nbsp;dialog,&nbsp;which&nbsp;must&nbsp;provide&nbsp;a<br />
1596
1597
1598get_value&nbsp;method.&nbsp;</tt></td></tr>
1599<tr><td>&nbsp;</td>
1600<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#DialogProperty">DialogProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1601<hr />
1602Methods defined here:<br />
1603
1604<dl><dt><a name="DialogProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent, dialog, can_disable<font color="#909090">=False</font>, enabled<font color="#909090">=False</font>, label<font color="#909090">=None</font>)</dt></dl>
1605
1606<dl><dt><a name="DialogProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1607
1608<dl><dt><a name="DialogProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;panel&nbsp;(with&nbsp;the&nbsp;text&nbsp;ctrl&nbsp;and&nbsp;the&nbsp;button&nbsp;to&nbsp;display<br />
1609
1610
1611the&nbsp;dialog)&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property&nbsp;interactively</tt></dd></dl>
1612
1613<dl><dt><a name="DialogProperty-display_dialog"><strong>display_dialog</strong></a>(self, event)</dt></dl>
1614
1615<dl><dt><a name="DialogProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1616
1617<dl><dt><a name="DialogProperty-on_char"><strong>on_char</strong></a>(self, event)</dt></dl>
1618
1619<dl><dt><a name="DialogProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1620
1621<dl><dt><a name="DialogProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1622
1623<dl><dt><a name="DialogProperty-write"><strong>write</strong></a>(self, dest_file<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt></dl>
1624
1625
1626<hr />
1627Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1628<dl><dt><a name="DialogProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1629
1630
1631has&nbsp;changed</tt></dd></dl>
1632
1633<hr />
1634Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1635<dl><dt><a name="DialogProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1636
1637</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1638<tbody><tr bgcolor="#ffc8d8">
1639
1640
1641<td colspan="3" valign="bottom">&nbsp;<br />
1642<font color="#000000" face="helvetica, arial"><a name="FileDialogProperty">class <strong>FileDialogProperty</strong></a>(<a href="widget_properties.html#DialogProperty">DialogProperty</a>)</font></td></tr>
1643   
1644<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
1645<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#FileDialogProperty">FileDialogProperty</a></dd><dd><a href="widget_properties.html#DialogProperty">DialogProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1646<hr />
1647Methods defined here:<br />
1648<dl><dt><a name="FileDialogProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, wildcard<font color="#909090">=u'All Files|*'</font>, message<font color="#909090">=u'Choose a file'</font>, can_disable<font color="#909090">=True</font>, style<font color="#909090">=0</font>, label<font color="#909090">=None</font>)</dt></dl>
1649
1650
1651<hr />
1652Data and other attributes defined here:<br />
1653<dl><dt><strong>FileDialog</strong> = &lt;class widget_properties.FileDialog at 0x03AC1D80&gt;</dt></dl>
1654
1655<dl><dt><strong>dialog</strong> = [None]</dt></dl>
1656
1657<hr />
1658Methods inherited from <a href="widget_properties.html#DialogProperty">DialogProperty</a>:<br />
1659
1660
1661<dl><dt><a name="FileDialogProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1662
1663<dl><dt><a name="FileDialogProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;panel&nbsp;(with&nbsp;the&nbsp;text&nbsp;ctrl&nbsp;and&nbsp;the&nbsp;button&nbsp;to&nbsp;display<br />
1664
1665
1666the&nbsp;dialog)&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property&nbsp;interactively</tt></dd></dl>
1667
1668<dl><dt><a name="FileDialogProperty-display_dialog"><strong>display_dialog</strong></a>(self, event)</dt></dl>
1669
1670<dl><dt><a name="FileDialogProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1671
1672<dl><dt><a name="FileDialogProperty-on_char"><strong>on_char</strong></a>(self, event)</dt></dl>
1673
1674<dl><dt><a name="FileDialogProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1675
1676<dl><dt><a name="FileDialogProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1677
1678<dl><dt><a name="FileDialogProperty-write"><strong>write</strong></a>(self, dest_file<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt></dl>
1679
1680
1681<hr />
1682Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1683<dl><dt><a name="FileDialogProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1684
1685
1686has&nbsp;changed</tt></dd></dl>
1687
1688<hr />
1689Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1690<dl><dt><a name="FileDialogProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1691
1692</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1693<tbody><tr bgcolor="#ffc8d8">
1694
1695
1696<td colspan="3" valign="bottom">&nbsp;<br />
1697<font color="#000000" face="helvetica, arial"><a name="FontDialogProperty">class <strong>FontDialogProperty</strong></a>(<a href="widget_properties.html#DialogProperty">DialogProperty</a>)</font></td></tr>
1698   
1699<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
1700<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#FontDialogProperty">FontDialogProperty</a></dd><dd><a href="widget_properties.html#DialogProperty">DialogProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1701<hr />
1702Methods defined here:<br />
1703<dl><dt><a name="FontDialogProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, can_disable<font color="#909090">=True</font>, label<font color="#909090">=None</font>)</dt></dl>
1704
1705<dl><dt><a name="FontDialogProperty-display_dialog"><strong>display_dialog</strong></a>(self, event)</dt></dl>
1706
1707<dl><dt><a name="FontDialogProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1708
1709<dl><dt><a name="FontDialogProperty-write"><strong>write</strong></a>(self, outfile<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt></dl>
1710
1711<hr />
1712
1713Data and other attributes defined here:<br />
1714<dl><dt><strong>dialog</strong> = [None]</dt></dl>
1715
1716<dl><dt><strong>font_families_from</strong> = {70: 'default', 71: 'decorative', 72: 'roman', 73: 'script', 74: 'swiss', 75: 'modern', 76: 'teletype'}</dt></dl>
1717
1718<dl><dt><strong>font_families_to</strong> = {'decorative': 71, 'default': 70, 'modern': 75, 'roman': 72, 'script': 73, 'swiss': 74, 'teletype': 76}</dt></dl>
1719
1720<dl><dt><strong>font_styles_from</strong> = {90: 'normal', 93: 'italic', 94: 'slant'}</dt></dl>
1721
1722<dl><dt><strong>font_styles_to</strong> = {'italic': 93, 'normal': 90, 'slant': 94}</dt></dl>
1723
1724<dl><dt><strong>font_weights_from</strong> = {90: 'normal', 91: 'light', 92: 'bold'}</dt></dl>
1725
1726<dl><dt><strong>font_weights_to</strong> = {'bold': 92, 'light': 91, 'normal': 90}</dt></dl>
1727
1728
1729<hr />
1730Methods inherited from <a href="widget_properties.html#DialogProperty">DialogProperty</a>:<br />
1731<dl><dt><a name="FontDialogProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1732
1733<dl><dt><a name="FontDialogProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;panel&nbsp;(with&nbsp;the&nbsp;text&nbsp;ctrl&nbsp;and&nbsp;the&nbsp;button&nbsp;to&nbsp;display<br />
1734
1735
1736the&nbsp;dialog)&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property&nbsp;interactively</tt></dd></dl>
1737
1738<dl><dt><a name="FontDialogProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1739
1740<dl><dt><a name="FontDialogProperty-on_char"><strong>on_char</strong></a>(self, event)</dt></dl>
1741
1742<dl><dt><a name="FontDialogProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1743
1744<hr />
1745Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1746<dl><dt><a name="FontDialogProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1747
1748
1749has&nbsp;changed</tt></dd></dl>
1750
1751<hr />
1752Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1753<dl><dt><a name="FontDialogProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1754
1755</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1756<tbody><tr bgcolor="#ffc8d8">
1757
1758
1759<td colspan="3" valign="bottom">&nbsp;<br />
1760<font color="#000000" face="helvetica, arial"><a name="GridProperty">class <strong>GridProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>)</font></td></tr>
1761   
1762<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1763<td colspan="2"><tt><a href="#Property">Property</a>&nbsp;whose&nbsp;values&nbsp;are&nbsp;modified&nbsp;through&nbsp;a&nbsp;wxGrid&nbsp;table.&nbsp;</tt></td></tr>
1764
1765
1766<tr><td>&nbsp;</td>
1767<td width="100%">Methods defined here:<br />
1768<dl><dt><a name="GridProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent, cols, rows<font color="#909090">=1</font>, can_add<font color="#909090">=True</font>, can_remove<font color="#909090">=True</font>, can_insert<font color="#909090">=True</font>, label<font color="#909090">=None</font>)</dt></dl>
1769
1770
1771<dl><dt><a name="GridProperty-add_row"><strong>add_row</strong></a>(self, event)</dt></dl>
1772
1773<dl><dt><a name="GridProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1774
1775<dl><dt><a name="GridProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;grid&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1776
1777
1778interactively</tt></dd></dl>
1779
1780<dl><dt><a name="GridProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1781
1782<dl><dt><a name="GridProperty-insert_row"><strong>insert_row</strong></a>(self, event)</dt></dl>
1783
1784<dl><dt><a name="GridProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1785
1786
1787has&nbsp;changed</tt></dd></dl>
1788
1789<dl><dt><a name="GridProperty-on_select_cell"><strong>on_select_cell</strong></a>(self, event)</dt></dl>
1790
1791<dl><dt><a name="GridProperty-remove_row"><strong>remove_row</strong></a>(self, event)</dt></dl>
1792
1793<dl><dt><a name="GridProperty-set_col_sizes"><strong>set_col_sizes</strong></a>(self, sizes)</dt><dd><tt>sets&nbsp;the&nbsp;width&nbsp;of&nbsp;the&nbsp;columns.<br />
1794sizes&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;integers&nbsp;with&nbsp;the&nbsp;size&nbsp;of&nbsp;each&nbsp;column:&nbsp;a&nbsp;value&nbsp;of&nbsp;0<br />
1795stands&nbsp;for&nbsp;a&nbsp;default&nbsp;size,&nbsp;while&nbsp;-1&nbsp;means&nbsp;to&nbsp;expand&nbsp;the&nbsp;column&nbsp;to&nbsp;fit<br />
1796the&nbsp;available&nbsp;space&nbsp;(at&nbsp;most&nbsp;one&nbsp;column&nbsp;can&nbsp;have&nbsp;size&nbsp;-1)</tt></dd></dl>
1797
1798
1799<dl><dt><a name="GridProperty-set_value"><strong>set_value</strong></a>(self, values)</dt></dl>
1800
1801<hr />
1802Data and other attributes defined here:<br />
1803<dl><dt><strong>BOOL</strong> = 3</dt></dl>
1804
1805<dl><dt><strong>FLOAT</strong> = 2</dt></dl>
1806
1807
1808<dl><dt><strong>INT</strong> = 1</dt></dl>
1809
1810<dl><dt><strong>STRING</strong> = 0</dt></dl>
1811
1812<dl><dt><strong>col_format</strong> = [&lt;function &lt;lambda&gt; at
18130x03ADA970&gt;, &lt;function &lt;lambda&gt; at 0x03ADA9B0&gt;,
1814
1815&lt;function &lt;lambda&gt; at 0x03ADA9F0&gt;, &lt;function
1816&lt;lambda&gt; at 0x03ADAA30&gt;]</dt></dl>
1817
1818<hr />
1819Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1820
1821<dl><dt><a name="GridProperty-write"><strong>write</strong></a>(self, outfile<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt><dd><tt>Writes&nbsp;the&nbsp;xml&nbsp;code&nbsp;for&nbsp;this&nbsp;property&nbsp;onto&nbsp;the&nbsp;given&nbsp;file.</tt></dd></dl>
1822
1823
1824</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1825<tbody><tr bgcolor="#ffc8d8">
1826<td colspan="3" valign="bottom">&nbsp;<br />
1827<font color="#000000" face="helvetica, arial"><a name="HiddenProperty">class <strong>HiddenProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>)</font></td></tr>
1828   
1829<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1830<td colspan="2"><tt>Properties&nbsp;not&nbsp;associated&nbsp;to&nbsp;any&nbsp;control,&nbsp;i.e.&nbsp;not&nbsp;editable&nbsp;by&nbsp;the&nbsp;user.&nbsp;</tt></td></tr>
1831
1832
1833<tr><td>&nbsp;</td>
1834<td width="100%">Methods defined here:<br />
1835<dl><dt><a name="HiddenProperty-__init__"><strong>__init__</strong></a>(self, owner, name, value<font color="#909090">=None</font>, label<font color="#909090">=None</font>)</dt></dl>
1836
1837<dl><dt><a name="HiddenProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1838
1839<dl><dt><a name="HiddenProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1840
1841
1842<dl><dt><a name="HiddenProperty-set_value"><strong>set_value</strong></a>(self, val)</dt></dl>
1843
1844<hr />
1845Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1846<dl><dt><a name="HiddenProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1847
1848
1849has&nbsp;changed</tt></dd></dl>
1850
1851<dl><dt><a name="HiddenProperty-write"><strong>write</strong></a>(self, outfile<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt><dd><tt>Writes&nbsp;the&nbsp;xml&nbsp;code&nbsp;for&nbsp;this&nbsp;property&nbsp;onto&nbsp;the&nbsp;given&nbsp;file.</tt></dd></dl>
1852
1853
1854</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1855<tbody><tr bgcolor="#ffc8d8">
1856<td colspan="3" valign="bottom">&nbsp;<br />
1857<font color="#000000" face="helvetica, arial"><a name="Property">class <strong>Property</strong></a></font></td></tr>
1858   
1859<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1860<td colspan="2"><tt>A&nbsp;class&nbsp;to&nbsp;handle&nbsp;a&nbsp;single&nbsp;property&nbsp;of&nbsp;a&nbsp;widget.&nbsp;</tt></td></tr>
1861
1862
1863<tr><td>&nbsp;</td>
1864<td width="100%">Methods defined here:<br />
1865<dl><dt><a name="Property-__init__"><strong>__init__</strong></a>(self, owner, name, parent, getter<font color="#909090">=None</font>, setter<font color="#909090">=None</font>, label<font color="#909090">=None</font>)</dt><dd><tt>Access&nbsp;to&nbsp;the&nbsp;property&nbsp;is&nbsp;made&nbsp;through&nbsp;the&nbsp;getter&nbsp;and&nbsp;setter&nbsp;functions,<br />
1866which&nbsp;are&nbsp;invoked&nbsp;also&nbsp;in&nbsp;the&nbsp;default&nbsp;event&nbsp;handler.&nbsp;If&nbsp;they&nbsp;are&nbsp;None,<br />
1867they&nbsp;default&nbsp;to&nbsp;owner[name][0]&nbsp;and&nbsp;owner[name][1]</tt></dd></dl>
1868
1869
1870<dl><dt><a name="Property-bind_event"><strong>bind_event</strong></a>(self, function)</dt><dd><tt>sets&nbsp;the&nbsp;default&nbsp;event&nbsp;handler&nbsp;for&nbsp;this&nbsp;property.</tt></dd></dl>
1871
1872<dl><dt><a name="Property-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1873
1874<dl><dt><a name="Property-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1875
1876
1877has&nbsp;changed</tt></dd></dl>
1878
1879<dl><dt><a name="Property-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1880
1881<dl><dt><a name="Property-write"><strong>write</strong></a>(self, outfile<font color="#909090">=None</font>, tabs<font color="#909090">=0</font>)</dt><dd><tt>Writes&nbsp;the&nbsp;xml&nbsp;code&nbsp;for&nbsp;this&nbsp;property&nbsp;onto&nbsp;the&nbsp;given&nbsp;file.</tt></dd></dl>
1882
1883
1884</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1885<tbody><tr bgcolor="#ffc8d8">
1886<td colspan="3" valign="bottom">&nbsp;<br />
1887<font color="#000000" face="helvetica, arial"><a name="RadioProperty">class <strong>RadioProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)</font></td></tr>
1888   
1889<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1890<td colspan="2"><tt>properties&nbsp;controlled&nbsp;by&nbsp;a&nbsp;series&nbsp;of&nbsp;radio&nbsp;buttons.&nbsp;</tt></td></tr>
1891
1892
1893<tr><td>&nbsp;</td>
1894<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#RadioProperty">RadioProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1895<hr />
1896Methods defined here:<br />
1897<dl><dt><a name="RadioProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent, choices, can_disable<font color="#909090">=False</font>, enabled<font color="#909090">=False</font>, columns<font color="#909090">=1</font>, label<font color="#909090">=None</font>)</dt></dl>
1898
1899
1900<dl><dt><a name="RadioProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1901
1902<dl><dt><a name="RadioProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;radio&nbsp;box&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1903
1904
1905interactively</tt></dd></dl>
1906
1907<dl><dt><a name="RadioProperty-get_str_value"><strong>get_str_value</strong></a>(self)</dt></dl>
1908
1909<dl><dt><a name="RadioProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1910
1911<dl><dt><a name="RadioProperty-set_str_value"><strong>set_str_value</strong></a>(self, value)</dt></dl>
1912
1913<dl><dt><a name="RadioProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1914
1915
1916<dl><dt><a name="RadioProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
1917
1918<hr />
1919Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1920<dl><dt><a name="RadioProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1921
1922
1923has&nbsp;changed</tt></dd></dl>
1924
1925<hr />
1926Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1927<dl><dt><a name="RadioProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1928
1929<dl><dt><a name="RadioProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1930
1931
1932</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1933<tbody><tr bgcolor="#ffc8d8">
1934<td colspan="3" valign="bottom">&nbsp;<br />
1935<font color="#000000" face="helvetica, arial"><a name="SpinProperty">class <strong>SpinProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)</font></td></tr>
1936   
1937<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1938<td colspan="2"><tt>Properties&nbsp;associated&nbsp;to&nbsp;a&nbsp;spin&nbsp;control.&nbsp;</tt></td></tr>
1939
1940
1941<tr><td>&nbsp;</td>
1942<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#SpinProperty">SpinProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1943<hr />
1944Methods defined here:<br />
1945<dl><dt><a name="SpinProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, can_disable<font color="#909090">=False</font>, r<font color="#909090">=None</font>, enabled<font color="#909090">=False</font>, immediate<font color="#909090">=False</font>, label<font color="#909090">=None</font>)</dt></dl>
1946
1947
1948<dl><dt><a name="SpinProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1949
1950<dl><dt><a name="SpinProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;spin&nbsp;control&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1951
1952
1953interactively</tt></dd></dl>
1954
1955<dl><dt><a name="SpinProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
1956
1957<dl><dt><a name="SpinProperty-set_range"><strong>set_range</strong></a>(self, min_v, max_v)</dt></dl>
1958
1959<dl><dt><a name="SpinProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
1960
1961<dl><dt><a name="SpinProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
1962
1963
1964<hr />
1965Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
1966<dl><dt><a name="SpinProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
1967
1968
1969has&nbsp;changed</tt></dd></dl>
1970
1971<hr />
1972Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
1973<dl><dt><a name="SpinProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
1974
1975<dl><dt><a name="SpinProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
1976
1977
1978</td></tr></tbody></table> <table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">
1979<tbody><tr bgcolor="#ffc8d8">
1980<td colspan="3" valign="bottom">&nbsp;<br />
1981<font color="#000000" face="helvetica, arial"><a name="TextProperty">class <strong>TextProperty</strong></a>(<a href="widget_properties.html#Property">Property</a>, <a href="widget_properties.html#_activator">_activator</a>)</font></td></tr>
1982   
1983<tr bgcolor="#ffc8d8"><td rowspan="2"><tt>&nbsp;&nbsp;&nbsp;</tt></td>
1984<td colspan="2"><tt>Properties&nbsp;associated&nbsp;to&nbsp;a&nbsp;text&nbsp;control.&nbsp;</tt></td></tr>
1985
1986
1987<tr><td>&nbsp;</td>
1988<td width="100%"><dl><dt>Method resolution order:</dt><dd><a href="widget_properties.html#TextProperty">TextProperty</a></dd><dd><a href="widget_properties.html#Property">Property</a></dd><dd><a href="widget_properties.html#_activator">_activator</a></dd></dl>
1989<hr />
1990Methods defined here:<br />
1991<dl><dt><a name="TextProperty-__init__"><strong>__init__</strong></a>(self, owner, name, parent<font color="#909090">=None</font>, can_disable<font color="#909090">=False</font>, enabled<font color="#909090">=False</font>, readonly<font color="#909090">=False</font>, multiline<font color="#909090">=False</font>, label<font color="#909090">=None</font>)</dt></dl>
1992
1993
1994<dl><dt><a name="TextProperty-bind_event"><strong>bind_event</strong></a>(self, function)</dt></dl>
1995
1996<dl><dt><a name="TextProperty-display"><strong>display</strong></a>(self, parent)</dt><dd><tt>Actually&nbsp;builds&nbsp;the&nbsp;text&nbsp;control&nbsp;to&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;property<br />
1997
1998
1999interactively</tt></dd></dl>
2000
2001<dl><dt><a name="TextProperty-get_value"><strong>get_value</strong></a>(self)</dt></dl>
2002
2003<dl><dt><a name="TextProperty-on_char"><strong>on_char</strong></a>(self, event)</dt></dl>
2004
2005<dl><dt><a name="TextProperty-set_value"><strong>set_value</strong></a>(self, value)</dt></dl>
2006
2007<dl><dt><a name="TextProperty-write"><strong>write</strong></a>(self, outfile, tabs)</dt></dl>
2008
2009
2010<hr />
2011Methods inherited from <a href="widget_properties.html#Property">Property</a>:<br />
2012<dl><dt><a name="TextProperty-on_change_val"><strong>on_change_val</strong></a>(self, event, first<font color="#909090">=[True]</font>)</dt><dd><tt>Event&nbsp;handler&nbsp;called&nbsp;to&nbsp;notify&nbsp;owner&nbsp;that&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;<a href="#Property">Property</a><br />
2013
2014
2015has&nbsp;changed</tt></dd></dl>
2016
2017<hr />
2018Methods inherited from <a href="widget_properties.html#_activator">_activator</a>:<br />
2019<dl><dt><a name="TextProperty-is_active"><strong>is_active</strong></a>(self)</dt></dl>
2020
2021<dl><dt><a name="TextProperty-toggle_active"><strong>toggle_active</strong></a>(self, active)</dt></dl>
2022
2023
2024</td></tr></tbody></table></td></tr></tbody>
2025</table>
2026
2027
2028<a class="mozTocH3" name="mozTocId755371"><br />
2029
2030<br />
2031</a><h2><a class="mozTocH2" name="mozTocId699146">Licence</a></h2>
2032<a class="mozTocH2" name="mozTocId699146">This document is provided by Laurent Marcoux under the Creative Commons 3.0 Attribution/Share Alike Licence<br /><br />
2033Code highlight by GeSHi Generic Syntax Highlighter<br />
2034<br />
2035Most code examples are from wxGlade, under MIT licence: <br />
2036</a></span>
2037<div style="margin-left: 40px; background-color: rgb(204, 204, 204);"><span><a class="mozTocH2" name="mozTocId699146">Copyright (c) 2002-2007 Alberto Griggio&nbsp; &lt;agriggio@users.sourceforge.net&gt;</a></span><br />
2038<span><a class="mozTocH2" name="mozTocId699146" /></span><br />
2039<span><a class="mozTocH2" name="mozTocId699146">Permission is hereby granted, free of charge, to any person obtaining a copy of</a></span><br />
2040<span><a class="mozTocH2" name="mozTocId699146">this software and associated documentation files (the "Software"), to deal in</a></span><br />
2041<span><a class="mozTocH2" name="mozTocId699146">the Software without restriction, including without limitation the rights to</a></span><br />
2042<span><a class="mozTocH2" name="mozTocId699146">use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies</a></span><br />
2043<span><a class="mozTocH2" name="mozTocId699146">of the Software, and to permit persons to whom the Software is furnished to do</a></span><br />
2044<span><a class="mozTocH2" name="mozTocId699146">so, subject to the following conditions:</a></span><br />
2045<span><a class="mozTocH2" name="mozTocId699146" /></span><br />
2046<span><a class="mozTocH2" name="mozTocId699146">The above copyright notice and this permission notice shall be included in all</a></span><br />
2047<span><a class="mozTocH2" name="mozTocId699146">copies or substantial portions of the Software.</a></span><br />
2048<span><a class="mozTocH2" name="mozTocId699146" /></span><br />
2049<span><a class="mozTocH2" name="mozTocId699146">THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</a></span><br />
2050<span><a class="mozTocH2" name="mozTocId699146">IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</a></span><br />
2051<span><a class="mozTocH2" name="mozTocId699146">FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</a></span><br />
2052<span><a class="mozTocH2" name="mozTocId699146">AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</a></span><br />
2053<span><a class="mozTocH2" name="mozTocId699146">LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</a></span><br />
2054<span><a class="mozTocH2" name="mozTocId699146">OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</a></span><br />
2055<span><a class="mozTocH2" name="mozTocId699146">SOFTWARE.</a></span><br />
2056<span><a class="mozTocH2" name="mozTocId699146" /></span></div>
2057<span><a class="mozTocH2" name="mozTocId699146"><br />
2058
2059<br />
2060
2061
2062
2063</a></span></body></html>