Merge lp:~gdesklets-desklet-team/gdesklets/develbook-control-array into lp:~gdesklets-desklet-team/gdesklets/develbook

Proposed by Joe Sapp on 2010-04-24
Status: Merged
Approved by: Joe Sapp on 2010-06-21
Approved revision: 10
Merged at revision: 11
Proposed branch: lp:~gdesklets-desklet-team/gdesklets/develbook-control-array
Merge into: lp:~gdesklets-desklet-team/gdesklets/develbook
Diff against target: 206 lines (+72/-12) 5 files modified
To merge this branch: bzr merge lp:~gdesklets-desklet-team/gdesklets/develbook-control-array
Reviewer Review Type Date Requested Status
Bjoern Koch 2010-06-18 Approve on 2010-06-20
gDesklets Core Team 2010-04-24 Pending
Review via email: mp+24055@code.launchpad.net

Description of the Change

Added information on using Control arrays

To post a comment you must log in.
10. By Joe Sapp on 2010-06-18

Merged main branch

Bjoern Koch (h.humpel) wrote :

Looks good.

But I am just wondering if we should skip the Control IDs as we don't need them anymore:

<programlisting><![CDATA[
...
<control id="myctrl" interface="ITime" length="1"/>

<script>
 Dsp.lbl1.value = str(myctrl[0].time)
</script>
...
 ]]></programlisting>

review: Approve

Preview Diff

1=== modified file 'ChangeLog'
2--- ChangeLog 2010-05-24 11:36:24 +0000
3+++ ChangeLog 2010-06-18 01:30:41 +0000
4@@ -14,6 +14,12 @@
5 * info.xml: updated copyright information (added missing 2009)
6 * dsp-tag-image.xml: added "saturation" attribute
7
8+2010-04-23 Joe Sapp <nixphoeni@gmail.com>
9+
10+ * info.xml
11+ * tmp.xml
12+ * xibook.xml
13+ * ctrl-use.xml: Added Control array information
14
15 === 0.36.2 Released ===
16
17
18=== modified file 'ctrl-use.xml'
19--- ctrl-use.xml 2008-03-17 09:59:43 +0000
20+++ ctrl-use.xml 2010-06-18 01:30:41 +0000
21@@ -18,7 +18,7 @@
22 ]]></programlisting>
23
24 <para>The <property>id</property> attribute specifies the ID under which you
25- later want to access the control in your applet. Controls are no display
26+ later want to access the control in your applet. Controls are not display
27 elements, thus this ID will not be put into the
28 <link linkend="script-using-dsp"><literal>Dsp</literal> namespace</link>,
29 but is directly accessible.</para>
30@@ -30,7 +30,7 @@
31
32 <para>Controls are property-based. There are properties where you can read
33 from, and properties where you can write to. You can use the
34- <application>gdesklets-shell</application> to look up the available
35+ <application>gdesklets shell</application> command to look up the available
36 properties of a control and their descriptions.</para>
37
38 <para>By setting properties, you can e.g. change the state of a control.
39@@ -64,7 +64,6 @@
40 </section>
41
42
43-
44 <section id="ctrl-use-watch"><title>Watching Properties</title>
45
46 <para>The values of properties can change from time to time. For instance,
47@@ -102,4 +101,32 @@
48 </section>
49
50
51+<section id="ctrl-use-multiple"><title>Using Multiple Controls</title>
52+
53+ <para>Since controls can be considered state machines, sometimes it's useful
54+ to support multiple instances of a control in a desklet. This can be done
55+ by instantiating the control with the <property>length</property> property
56+ explicitly set. With this set at load-time, the control will only be
57+ accessible like a list and will be expandable with the
58+ <property>length</property> property. If you do not, the control may not
59+ necessarily provide the <property>length</property> property, will be
60+ accessible as shown above, and will not be expandable. In other words,
61+ existing desklets will continue to work as they are.</para>
62+
63+ <programlisting><![CDATA[
64+...
65+<control id="myctrl" interface="ITime:9y703dqtfnv4w373caserz68r" length="1"/>
66+
67+<script>
68+ Dsp.lbl1.value = str(myctrl[0].time)
69+</script>
70+...
71+ ]]></programlisting>
72+
73+ <para>For compatibility with this feature, you should not implement a
74+ <property>length</property> property in your control.</para>
75+
76+</section>
77+
78+
79 </section>
80
81=== modified file 'info.xml'
82--- info.xml 2010-05-23 23:23:27 +0000
83+++ info.xml 2010-06-18 01:30:41 +0000
84@@ -24,7 +24,7 @@
85 </author>
86 </authorgroup>
87
88- <edition>Developer's Book for gDesklets v0.36.2</edition>
89+ <edition>Developer's Book for gDesklets v0.36.3(beta)</edition>
90 <pubdate>2010</pubdate>
91
92 <copyright>
93@@ -39,7 +39,7 @@
94 </copyright>
95
96 <releaseinfo>
97- This book describes version 0.36.2 of the gDesklets platform.
98+ This book describes version 0.36.3(beta) of the gDesklets platform.
99 </releaseinfo>
100
101 <legalnotice>
102
103=== modified file 'tmp.xml'
104--- tmp.xml 2010-05-24 11:36:24 +0000
105+++ tmp.xml 2010-06-18 01:30:41 +0000
106@@ -29,7 +29,7 @@
107 </author>
108 </authorgroup>
109
110- <edition>Developer's Book for gDesklets v0.36.2</edition>
111+ <edition>Developer's Book for gDesklets v0.36.3(beta)</edition>
112 <pubdate>2010</pubdate>
113
114 <copyright>
115@@ -44,7 +44,7 @@
116 </copyright>
117
118 <releaseinfo>
119- This book describes version 0.36.2 of the gDesklets platform.
120+ This book describes version 0.36.3(beta) of the gDesklets platform.
121 </releaseinfo>
122
123 <legalnotice>
124@@ -2867,7 +2867,7 @@
125 ]]></programlisting>
126
127 <para>The <property>id</property> attribute specifies the ID under which you
128- later want to access the control in your applet. Controls are no display
129+ later want to access the control in your applet. Controls are not display
130 elements, thus this ID will not be put into the
131 <link linkend="script-using-dsp"><literal>Dsp</literal> namespace</link>,
132 but is directly accessible.</para>
133@@ -2879,7 +2879,7 @@
134
135 <para>Controls are property-based. There are properties where you can read
136 from, and properties where you can write to. You can use the
137- <application>gdesklets-shell</application> to look up the available
138+ <application>gdesklets shell</application> command to look up the available
139 properties of a control and their descriptions.</para>
140
141 <para>By setting properties, you can e.g. change the state of a control.
142@@ -2913,7 +2913,6 @@
143 </section>
144
145
146-
147 <section id="ctrl-use-watch"><title>Watching Properties</title>
148
149 <para>The values of properties can change from time to time. For instance,
150@@ -2951,6 +2950,34 @@
151 </section>
152
153
154+<section id="ctrl-use-multiple"><title>Using Multiple Controls</title>
155+
156+ <para>Since controls can be considered state machines, sometimes it's useful
157+ to support multiple instances of a control in a desklet. This can be done
158+ by instantiating the control with the <property>length</property> property
159+ explicitly set. With this set at load-time, the control will only be
160+ accessible like a list and will be expandable with the
161+ <property>length</property> property. If you do not, the control may not
162+ necessarily provide the <property>length</property> property, will be
163+ accessible as shown above, and will not be expandable. In other words,
164+ existing desklets will continue to work as they are.</para>
165+
166+ <programlisting><![CDATA[
167+...
168+<control id="myctrl" interface="ITime:9y703dqtfnv4w373caserz68r" length="1"/>
169+
170+<script>
171+ Dsp.lbl1.value = str(myctrl[0].time)
172+</script>
173+...
174+ ]]></programlisting>
175+
176+ <para>For compatibility with this feature, you should not implement a
177+ <property>length</property> property in your control.</para>
178+
179+</section>
180+
181+
182 </section>
183 <section xmlns:xi="http://www.w3.org/2001/XInclude" id="ctrl-write">
184 <title>Writing Controls</title>
185
186=== modified file 'xibook.xml'
187--- xibook.xml 2010-05-23 23:23:27 +0000
188+++ xibook.xml 2010-06-18 01:30:41 +0000
189@@ -29,7 +29,7 @@
190 </author>
191 </authorgroup>
192
193- <edition>Developer's Book for gDesklets v0.36.2</edition>
194+ <edition>Developer's Book for gDesklets v0.36.3(beta)</edition>
195 <pubdate>2010</pubdate>
196
197 <copyright>
198@@ -43,7 +43,7 @@
199 </copyright>
200
201 <releaseinfo>
202- This book describes version 0.36.2 of the gDesklets platform.
203+ This book describes version 0.36.3(beta) of the gDesklets platform.
204 </releaseinfo>
205
206 <legalnotice>

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: