<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;feed=atom&amp;action=history</id>
		<title>Development/Tutorials/Plasma/Python/Using DataEngines - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;action=history"/>
		<updated>2013-05-23T18:39:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=60647&amp;oldid=prev</id>
		<title>Neverendingo: Text replace - &quot;&lt;/code&gt;&quot; to &quot;&lt;/syntaxhighlight&gt;&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=60647&amp;oldid=prev"/>
				<updated>2011-06-29T20:54:09Z</updated>
		
		<summary type="html">&lt;p&gt;Text replace - &amp;quot;&amp;lt;/code&amp;gt;&amp;quot; to &amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:54, 29 June 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Select the &amp;quot;time&amp;quot; in the pulldown list and then click on &amp;quot;Request&amp;quot;. This will fetch the list of data sources which the &amp;quot;time&amp;quot; DataEngine makes available.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Select the &amp;quot;time&amp;quot; in the pulldown list and then click on &amp;quot;Request&amp;quot;. This will fetch the list of data sources which the &amp;quot;time&amp;quot; DataEngine makes available.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; self.timeEngine.connectSource(self.currentTimezone,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; self.timeEngine.connectSource(self.currentTimezone,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; self, 6000, Plasma.AlignToMinute)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; self, 6000, Plasma.AlignToMinute)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This method is called from the clock's &amp;lt;tt&amp;gt;init()&amp;lt;/tt&amp;gt; method. It first calls the &amp;lt;tt&amp;gt;dateEngine()&amp;lt;/tt&amp;gt; method on the &amp;lt;tt&amp;gt;plasmascript.Applet&amp;lt;/tt&amp;gt; class to get a reference to the &amp;quot;time&amp;quot; DataEngine.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This method is called from the clock's &amp;lt;tt&amp;gt;init()&amp;lt;/tt&amp;gt; method. It first calls the &amp;lt;tt&amp;gt;dateEngine()&amp;lt;/tt&amp;gt; method on the &amp;lt;tt&amp;gt;plasmascript.Applet&amp;lt;/tt&amp;gt; class to get a reference to the &amp;quot;time&amp;quot; DataEngine.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 56:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 56:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.lastTimeSeen = self.time&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.lastTimeSeen = self.time&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt;, and then the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt can find the correct method on our applet when data is sent.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt;, and then the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt can find the correct method on our applet when data is sent.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:60004:newid:60647 --&gt;
&lt;/table&gt;</summary>
		<author><name>Neverendingo</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=60004&amp;oldid=prev</id>
		<title>Neverendingo: Text replace - &quot;&lt;code bash&gt;&quot; to &quot;&lt;syntaxhighlight lang=&quot;bash&quot;&gt;&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=60004&amp;oldid=prev"/>
				<updated>2011-06-29T20:39:37Z</updated>
		
		<summary type="html">&lt;p&gt;Text replace - &amp;quot;&amp;lt;code bash&amp;gt;&amp;quot; to &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:39, 29 June 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Plasma comes with a handy tool called &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; which lists all of the available DataEngines and can be used to examine them to see what kind of data and fields they send. &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; can be started directly from the shell.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Plasma comes with a handy tool called &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; which lists all of the available DataEngines and can be used to examine them to see what kind of data and fields they send. &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; can be started directly from the shell.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code &lt;/del&gt;bash&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight lang=&amp;quot;&lt;/ins&gt;bash&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Neverendingo</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=59677&amp;oldid=prev</id>
		<title>Neverendingo: Text replace - &quot;&lt;code python&gt;&quot; to &quot;&lt;syntaxhighlight lang=&quot;python&quot;&gt;&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=59677&amp;oldid=prev"/>
				<updated>2011-06-29T20:29:54Z</updated>
		
		<summary type="html">&lt;p&gt;Text replace - &amp;quot;&amp;lt;code python&amp;gt;&amp;quot; to &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:29, 29 June 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code to connect to the &amp;quot;time&amp;quot; DataEngine is in the clock's &amp;lt;tt&amp;gt;connectToEngine()&amp;lt;/tt&amp;gt; method, shown below.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code to connect to the &amp;quot;time&amp;quot; DataEngine is in the clock's &amp;lt;tt&amp;gt;connectToEngine()&amp;lt;/tt&amp;gt; method, shown below.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code &lt;/del&gt;python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight lang=&amp;quot;&lt;/ins&gt;python&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def connectToEngine(self):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def connectToEngine(self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.timeEngine = self.dataEngine(&amp;quot;time&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.timeEngine = self.dataEngine(&amp;quot;time&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 44:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 44:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Data is injected into the applet via the &amp;lt;tt&amp;gt;dataUpdate()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Data is injected into the applet via the &amp;lt;tt&amp;gt;dataUpdate()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code &lt;/del&gt;python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight lang=&amp;quot;&lt;/ins&gt;python&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;@pyqtSignature(&amp;quot;dataUpdated(const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;)&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;@pyqtSignature(&amp;quot;dataUpdated(const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;)&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def dataUpdated(self, sourceName, data):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def dataUpdated(self, sourceName, data):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Neverendingo</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37567&amp;oldid=prev</id>
		<title>Tmske: fixed typo</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37567&amp;oldid=prev"/>
				<updated>2009-01-18T16:21:47Z</updated>
		
		<summary type="html">&lt;p&gt;fixed typo&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 16:21, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt;, and then the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/del&gt;find the correct method on our applet when data is sent.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt;, and then the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can &lt;/ins&gt;find the correct method on our applet when data is sent.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code just ignores the &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter because it knows that the data must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrates on the data. The &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter becomes important when you have multiple DataEngines attached to the same applet. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code just ignores the &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter because it knows that the data must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrates on the data. The &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter becomes important when you have multiple DataEngines attached to the same applet. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tmske</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37565&amp;oldid=prev</id>
		<title>Sedwards: corrections</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37565&amp;oldid=prev"/>
				<updated>2009-01-18T15:16:10Z</updated>
		
		<summary type="html">&lt;p&gt;corrections&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:16, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Abstract ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Abstract ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most important concepts in Plasma is that of the &amp;quot;DataEngine&amp;quot;. DataEngines are used to deliver data from somewhere, often from an internet service for example, to your applet. In this tutorial we&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'ll &lt;/del&gt;discuss DataEngines, what they are, and how to use them from your Plasma applet.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most important concepts in Plasma is that of the &amp;quot;DataEngine&amp;quot;. DataEngines are used to deliver data from somewhere, often from an internet service for example, to your applet. In this tutorial we &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/ins&gt;discuss DataEngines, what they are, and how to use them from your Plasma applet.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== What are DataEngines? ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== What are DataEngines? ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As already mentioned, DataEngines are objects which serve to deliver some kind of data to Plasma applets. Plasma supports many different DataEngines out of the box which deliver all &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;sorts &lt;/del&gt;of varied information about the state of the machine, e.g. CPU usage, memory usage, position of the mouse pointer; to things such as the current weather report, current time or the latest comic from the internet. DataEngines are used to supply the raw data which an applet &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;can display&lt;/del&gt;. Separating the part of the code &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/del&gt;fetches data from the part which displays the data means that one DataEngine can be reused by many applets, regardless of which language the DataEngine is written in. It also makes it easy for people to display the same data using different applets which may tuned &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/del&gt;different &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tasks of &lt;/del&gt;screen form factors.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As already mentioned, DataEngines are objects which serve to deliver some kind of data to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;one or more &lt;/ins&gt;Plasma applets. Plasma supports many different DataEngines out of the box which deliver all &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;kinds &lt;/ins&gt;of varied information about &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;things like &lt;/ins&gt;the state of the machine, e.g. CPU usage, memory usage, position of the mouse pointer; to things such as the current weather report, current time or the latest comic from the internet. DataEngines are used to supply the raw data which an applet &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;displays&lt;/ins&gt;. Separating the part of the code &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that &lt;/ins&gt;fetches data from the part which displays the data&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/ins&gt;means that one DataEngine can be reused by many applets, regardless of which language the DataEngine &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;or applet &lt;/ins&gt;is written in. It also makes it easy for people to display the same data using different applets which may tuned &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;towards &lt;/ins&gt;different &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;uses or &lt;/ins&gt;screen form factors.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Exploring DataEngines ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Exploring DataEngines ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Plasma comes with a handy tool called &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to list &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;running &lt;/del&gt;DataEngines and examine them to see what kind of data and fields &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;them &lt;/del&gt;send. &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; can be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;simply &lt;/del&gt;started from the shell &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;as so&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Plasma comes with a handy tool called &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which lists all of &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;available &lt;/ins&gt;DataEngines and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can be used to &lt;/ins&gt;examine them to see what kind of data and fields &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;they &lt;/ins&gt;send. &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; can be started &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;directly &lt;/ins&gt;from the shell.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code bash&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code bash&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;plasmaengineexplorer&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Dataengine_snapshot.png|center]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Dataengine_snapshot.png|center]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;quot;time&amp;quot; DataEngine periodically publishes the current time for many different timezones. The first timezone in the list (&amp;quot;/etc/localtime&amp;quot;) is special and simply refers to the current local time on the computer without referring to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a &lt;/del&gt;specific timezone. If you open the &amp;quot;/etc/localtime&amp;quot; node in the tree you can see which data fields the &amp;quot;time&amp;quot; DataEngine provides. The most important fields are &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/del&gt;&amp;quot;Time&amp;quot; and &amp;quot;Date&amp;quot;. The &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; also lists what &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kind of &lt;/del&gt;data type the field is, e.g. a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;QDate&amp;lt;/tt&amp;gt;. This information is needed when hooking up a DataEngine to your applet.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;quot;time&amp;quot; DataEngine periodically publishes the current time for many different timezones. The first timezone in the list (&amp;quot;/etc/localtime&amp;quot;) is special and simply refers to the current local time on the computer without referring to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;any &lt;/ins&gt;specific timezone. If you open the &amp;quot;/etc/localtime&amp;quot; node in the tree you can see which data fields the &amp;quot;time&amp;quot; DataEngine provides. The most important fields are &amp;quot;Time&amp;quot; and &amp;quot;Date&amp;quot;. The &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; also lists what data type the field is, e.g. a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;QDate&amp;lt;/tt&amp;gt;. This information is needed when hooking up a DataEngine to your applet.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Explore some of the other DataEngines in the list. Perhaps it will give you some good ideas for new and interesting applets.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Explore some of the other DataEngines in the list. Perhaps it will give you some good ideas for new and interesting applets.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The Python clock &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;example &lt;/del&gt;code is a good example of how to connect to the &amp;quot;time&amp;quot; DateEngine. You can view the &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The Python clock code is a good example of how to connect to the &amp;quot;time&amp;quot; DateEngine. You can view the &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://websvn.kde.org/branches/KDE/4.2/kdebase/workspace/plasma/scriptengines/python/examples/applets/pyclock/contents/code/main.py?revision=906699&amp;amp;view=markup main.py code &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;online &lt;/del&gt;here online]. Let's look at how the Python clock &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;does it&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://websvn.kde.org/branches/KDE/4.2/kdebase/workspace/plasma/scriptengines/python/examples/applets/pyclock/contents/code/main.py?revision=906699&amp;amp;view=markup main.py code here online]. Let's &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;take a &lt;/ins&gt;look at how the Python clock &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;works&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code to connect to the &amp;quot;time&amp;quot; DataEngine is in the clock's &amp;lt;tt&amp;gt;connectToEngine()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code to connect to the &amp;quot;time&amp;quot; DataEngine is in the clock's &amp;lt;tt&amp;gt;connectToEngine()&amp;lt;/tt&amp;gt; method&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, shown below&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def connectToEngine(self):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;def connectToEngine(self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method on the DataEngine binds it to this applet. The first parameter is the &amp;quot;DataSource&amp;quot; name. This corresponds to the &amp;quot;DataSouce&amp;quot; column in &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt;. For the &amp;quot;time&amp;quot; DataEngine, it selects which timezone you want the time for. The next parameter is where the data should be sent. In this case it is quite simple, just send the data to this applet. The number is the &amp;quot;polling interval&amp;quot; in milliseconds. This is how often the data should be updated. Depending on how often the clock needs to update its display, it calls the &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method with either 500 or 6000 milliseconds as the polling interval.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method on the DataEngine binds it to this applet. The first parameter is the &amp;quot;DataSource&amp;quot; name. This corresponds to the &amp;quot;DataSouce&amp;quot; column in &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt;. For the &amp;quot;time&amp;quot; DataEngine, it selects which timezone you want the time for. The next parameter is where the data should be sent. In this case it is quite simple, just send the data to this applet. The number is the &amp;quot;polling interval&amp;quot; in milliseconds. This is how often the data should be updated. Depending on how often the clock needs to update its display, it calls the &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method with either 500 or 6000 milliseconds as the polling interval.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;Plasma.AlignToMinute&amp;lt;/tt&amp;gt; indicates to Plasma whether the updates should be syncronised to the system clock. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Many &lt;/del&gt;many applets syncronise &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/del&gt;the same way, then Plasma can handle the updates in large batches instead of many small &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;updates&lt;/del&gt;. This is important on mobile devices which throttle the CPU down to save battery power. It is more efficient for these devices if updates are done in big batches instead of many small batches.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;Plasma.AlignToMinute&amp;lt;/tt&amp;gt; indicates to Plasma whether the updates should be syncronised to the system clock. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;When &lt;/ins&gt;many applets syncronise the same way, then Plasma can handle the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;data &lt;/ins&gt;updates &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for all of the applets &lt;/ins&gt;in large batches instead of many small &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;batches&lt;/ins&gt;. This is important on mobile devices which throttle the CPU down to save battery power. It is more &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;energy &lt;/ins&gt;efficient for these devices if updates are done in big batches instead of many small batches.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Data is injected &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;in &lt;/del&gt;the applet via the &amp;lt;tt&amp;gt;dataUpdate()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Data is injected &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;into &lt;/ins&gt;the applet via the &amp;lt;tt&amp;gt;dataUpdate()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code python&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;@pyqtSignature(&amp;quot;dataUpdated(const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;)&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;@pyqtSignature(&amp;quot;dataUpdated(const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;)&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; and the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt and find the correct method on our applet.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method &lt;/ins&gt;takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/ins&gt;and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;then &lt;/ins&gt;the data itself. The big &amp;lt;tt&amp;gt;@pyqtSignature()&amp;lt;/tt&amp;gt; line just before &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; is a Python decorator which marks this Python method as having &amp;lt;tt&amp;gt;const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;&amp;lt;/tt&amp;gt; as its C++ method signature. This is needed so that Qt and find the correct method on our applet &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;when data is sent&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code just ignores the &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter because it knows that the data must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrates on the data. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The code just ignores the &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter because it knows that the data must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrates on the data&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. The &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter becomes important when you have multiple DataEngines attached to the same applet&lt;/ins&gt;. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock's display is only updated if really necessary, followed by &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;some &lt;/del&gt;code &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/del&gt;actually &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;updates &lt;/del&gt;the time and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;redraws &lt;/del&gt;the display.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock's display is only updated if really necessary, followed by &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;code &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/ins&gt;actually &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;update &lt;/ins&gt;the time and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;redraw &lt;/ins&gt;the display.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Conclusion ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Conclusion ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As you can see DataEngines are a great way of delivering data to applets which can also be easily reused by different applets. Connecting a DataEngine to your applet is a simple matter of fetching the data engine itself, connecting up to the wanted data source and then accepting the processing the data in your own &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As you can see DataEngines are a great way of delivering data to applets which can also be easily reused by different applets. Connecting a DataEngine to your applet is a simple matter of fetching the data engine itself, connecting up to the wanted data source and then accepting the processing the data in your own &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37564&amp;oldid=prev</id>
		<title>Sedwards: content is now complete</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37564&amp;oldid=prev"/>
				<updated>2009-01-18T15:01:12Z</updated>
		
		<summary type="html">&lt;p&gt;content is now complete&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:01, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock's display is only updated if really necessary, followed by some code which actually updates the time and redraws the display.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock's display is only updated if really necessary, followed by some code which actually updates the time and redraws the display.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;== Conclusion ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;As you can see DataEngines are a great way of delivering data to applets which can also be easily reused by different applets. Connecting a DataEngine to your applet is a simple matter of fetching the data engine itself, connecting up to the wanted data source and then accepting the processing the data in your own &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;TODO: finish tutorial&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37563&amp;oldid=prev</id>
		<title>Sedwards at 14:55, 18 January 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37563&amp;oldid=prev"/>
				<updated>2009-01-18T14:55:33Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:55, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; self.update()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; and the data itself&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. In this case we just ignore the source name because we know that it must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrate on the data&lt;/del&gt;. The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;data is delivered as a Python &lt;/del&gt;&amp;lt;tt&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dict&lt;/del&gt;&amp;lt;/tt&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;mapping &lt;/del&gt;&amp;lt;tt&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;QString&lt;/del&gt;&amp;lt;/tt&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use &lt;/del&gt;a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a key &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;not just a normal Python string. Notice how &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; &lt;/del&gt;method.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; and the data itself. The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;big &lt;/ins&gt;&amp;lt;tt&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;@pyqtSignature()&lt;/ins&gt;&amp;lt;/tt&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;line just before &lt;/ins&gt;&amp;lt;tt&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;dataUpdated()&lt;/ins&gt;&amp;lt;/tt&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Python decorator which marks this Python method as having &lt;/ins&gt;&amp;lt;tt&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;const &lt;/ins&gt;QString &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;, const Plasma::DataEngine::Data &amp;amp;&lt;/ins&gt;&amp;lt;/tt&amp;gt; as &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;its C++ method signature. This is needed so that Qt &lt;/ins&gt;and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;find &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;correct &lt;/ins&gt;method &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;on our applet&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock display is only updated if really necessary, followed by some code which actually updates the time and redraws the display.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The code just ignores the &amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt; parameter because it knows that the data must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrates on the data. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'s &lt;/ins&gt;display is only updated if really necessary, followed by some code which actually updates the time and redraws the display.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37562&amp;oldid=prev</id>
		<title>Sedwards at 14:50, 18 January 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37562&amp;oldid=prev"/>
				<updated>2009-01-18T14:50:33Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:50, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;Plasma.AlignToMinute&amp;lt;/tt&amp;gt; indicates to Plasma whether the updates should be syncronised to the system clock. Many many applets syncronise to the same way, then Plasma can handle the updates in large batches instead of many small updates. This is important on mobile devices which throttle the CPU down to save battery power. It is more efficient for these devices if updates are done in big batches instead of many small batches.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;Plasma.AlignToMinute&amp;lt;/tt&amp;gt; indicates to Plasma whether the updates should be syncronised to the system clock. Many many applets syncronise to the same way, then Plasma can handle the updates in large batches instead of many small updates. This is important on mobile devices which throttle the CPU down to save battery power. It is more efficient for these devices if updates are done in big batches instead of many small batches.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Data is injected in the applet via the &amp;lt;tt&amp;gt;dataUpdate()&amp;lt;/tt&amp;gt; method.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code python&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;@pyqtSignature(&amp;quot;dataUpdated(const QString &amp;amp;, const Plasma::DataEngine::Data &amp;amp;)&amp;quot;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;def dataUpdated(self, sourceName, data):&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; self.time = data[QString(&amp;quot;Time&amp;quot;)].toTime()&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; if self.time.minute() == self.lastTimeSeen.minute() and \&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  self.time.second() == self.lastTimeSeen.second():&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; # avoid unnecessary repaints&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; return&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; self.lastTimeSeen = self.time&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; self.update()&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/code&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; takes the normal Python &amp;lt;tt&amp;gt;self&amp;lt;/tt&amp;gt; parameter in first place, then the name of the data source (&amp;lt;tt&amp;gt;sourceName&amp;lt;/tt&amp;gt;) which called &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; and the data itself. In this case we just ignore the source name because we know that it must be from the &amp;quot;time&amp;quot; DataEngine, and just concentrate on the data. The data is delivered as a Python &amp;lt;tt&amp;gt;dict&amp;lt;/tt&amp;gt; mapping &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; keys to &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; object values. When looking up the &amp;quot;Time&amp;quot; key you need to be careful to use a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt; as a key and not just a normal Python string. Notice how the code also extracts a &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; object from the &amp;lt;tt&amp;gt;QVariant&amp;lt;/tt&amp;gt; using the &amp;lt;tt&amp;gt;toTime()&amp;lt;/tt&amp;gt; method.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Next the &amp;lt;tt&amp;gt;dataUpdated()&amp;lt;/tt&amp;gt; method has some code to make sure that the clock display is only updated if really necessary, followed by some code which actually updates the time and redraws the display.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37561&amp;oldid=prev</id>
		<title>Sedwards at 14:30, 18 January 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37561&amp;oldid=prev"/>
				<updated>2009-01-18T14:30:52Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:30, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The Python clock example code is a good example of how to connect to the &amp;quot;time&amp;quot; DateEngine. You can view the &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[http://websvn.kde.org/branches/KDE/4.2/kdebase/workspace/plasma/scriptengines/python/examples/applets/pyclock/contents/code/main.py?revision=906699&amp;amp;view=markup main.py code online here online]. Let's look at how the Python clock does it.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The code to connect to the &amp;quot;time&amp;quot; DataEngine is in the clock's &amp;lt;tt&amp;gt;connectToEngine()&amp;lt;/tt&amp;gt; method.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code python&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;def connectToEngine(self):&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; self.timeEngine = self.dataEngine(&amp;quot;time&amp;quot;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; if self.showSecondHand:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; self.timeEngine.connectSource(self.currentTimezone,&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; self, 500)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; else:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; self.timeEngine.connectSource(self.currentTimezone,&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; self, 6000, Plasma.AlignToMinute)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/code&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This method is called from the clock's &amp;lt;tt&amp;gt;init()&amp;lt;/tt&amp;gt; method. It first calls the &amp;lt;tt&amp;gt;dateEngine()&amp;lt;/tt&amp;gt; method on the &amp;lt;tt&amp;gt;plasmascript.Applet&amp;lt;/tt&amp;gt; class to get a reference to the &amp;quot;time&amp;quot; DataEngine.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method on the DataEngine binds it to this applet. The first parameter is the &amp;quot;DataSource&amp;quot; name. This corresponds to the &amp;quot;DataSouce&amp;quot; column in &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt;. For the &amp;quot;time&amp;quot; DataEngine, it selects which timezone you want the time for. The next parameter is where the data should be sent. In this case it is quite simple, just send the data to this applet. The number is the &amp;quot;polling interval&amp;quot; in milliseconds. This is how often the data should be updated. Depending on how often the clock needs to update its display, it calls the &amp;lt;tt&amp;gt;connectSource()&amp;lt;/tt&amp;gt; method with either 500 or 6000 milliseconds as the polling interval.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;Plasma.AlignToMinute&amp;lt;/tt&amp;gt; indicates to Plasma whether the updates should be syncronised to the system clock. Many many applets syncronise to the same way, then Plasma can handle the updates in large batches instead of many small updates. This is important on mobile devices which throttle the CPU down to save battery power. It is more efficient for these devices if updates are done in big batches instead of many small batches.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;TODO: finish tutorial.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37559&amp;oldid=prev</id>
		<title>Sedwards at 13:35, 18 January 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/Python/Using_DataEngines&amp;diff=37559&amp;oldid=prev"/>
				<updated>2009-01-18T13:35:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:35, 18 January 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;quot;time&amp;quot; DataEngine periodically publishes the current time for many different timezones. The first timezone in the list (&amp;quot;/etc/localtime&amp;quot;) is special and simply refers to the current local time on the computer without referring to a specific timezone. If you open the &amp;quot;/etc/localtime&amp;quot; node in the tree you can see which data fields the &amp;quot;time&amp;quot; DataEngine provides. The most important fields are the &amp;quot;Time&amp;quot; and &amp;quot;Date&amp;quot;. The &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; also lists what kind of data type the field is, e.g. a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;QDate&amp;lt;/tt&amp;gt;. This information is needed when hooking up a DataEngine to your applet.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &amp;quot;time&amp;quot; DataEngine periodically publishes the current time for many different timezones. The first timezone in the list (&amp;quot;/etc/localtime&amp;quot;) is special and simply refers to the current local time on the computer without referring to a specific timezone. If you open the &amp;quot;/etc/localtime&amp;quot; node in the tree you can see which data fields the &amp;quot;time&amp;quot; DataEngine provides. The most important fields are the &amp;quot;Time&amp;quot; and &amp;quot;Date&amp;quot;. The &amp;lt;tt&amp;gt;plasmaengineexplorer&amp;lt;/tt&amp;gt; also lists what kind of data type the field is, e.g. a &amp;lt;tt&amp;gt;QString&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;QTime&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;QDate&amp;lt;/tt&amp;gt;. This information is needed when hooking up a DataEngine to your applet.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Explore some of the other DataEngines in the list. Perhaps it will give &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;yousome &lt;/del&gt;ideas for applets.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Explore some of the other DataEngines in the list. Perhaps it will give &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;you some good &lt;/ins&gt;ideas for &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;new and interesting &lt;/ins&gt;applets.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Connecting to a DataEngine ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sedwards</name></author>	</entry>

	</feed>