[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: fixing little issues on my QML/Python program
From:       Shantanu Tushar Jha <shaan7in () gmail ! com>
Date:       2012-06-26 9:36:06
Message-ID: CABQ4Km8p_X+49r9Qj1YCKxnjiWguQ0Q1-MyjoFSedtn+ZnvS=Q () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Jun 26, 2012 at 2:46 PM, Viranch Mehta <viranch.mehta@gmail.com>wrote:

> On Tue, Jun 26, 2012 at 8:31 AM, Eric Mesa <ericsbinaryworld@gmail.com>wrote:
>
>> Thanks to everyone who's helped me over the last year or so with my
>> program.  I have one more thing to fix on my engine and then it will be
>> "perfect".  The recent help I got helped me finally perfect the GUI.  So my
>> data engine's running a function over and over with different arguments to
>> populate the sources.  Here's what it looks like:
>>
>
> Please always use pastebin.com or paste.kde.org to show your codes instead
> of putting them in emails.
>

I think its ok to paste in a mail if its a snippet not too long, because it
helps other people who will later read the ML archives, as pastebins may
expire.


>
> Viranch
>
>
>>
>> from PyQt4.QtCore import *
>> from PyKDE4.kdecore import *
>> from PyKDE4 import plasmascript
>> #for flickr
>> import views
>>
>>
>> class PyFlickrEngine(plasmascript.DataEngine):
>>   def __init__(self,parent,args=None):
>>     plasmascript.DataEngine.__init__(self,parent)
>>
>>   def init(self):
>>     self.setMinimumPollingInterval(333)
>>     #for flickr
>>     views.initialize()
>>
>>   #adding this back in 24 jan to see if it helps
>>   def sources(self):
>>     sources = ["25", "50", "75", "100", "200", "300", "400", "500",
>> "600", "700", "800", "900", "1000", "1250", "1500", "1750", "2000","3000",
>> "4000", "5000", "10000"]
>>     return sources
>>
>>   def sourceRequestEvent(self, name):
>>     #print "source request event" #debugging
>>     return self.updateSourceEvent(name)
>>
>>   def updateSourceEvent(self,group):
>>     print "updateSourceEvent"
>>     #grouplist = []
>>     if group == "25":
>>       grouplist = views.analyzeviews(views.views25, views.views50)
>>       self.setData("25", "Group 25", grouplist)
>>     elif group == "50":
>>       grouplist = views.analyzeviews(views.views50, views.views75)
>>       self.setData("50","Group 50", grouplist)
>>     elif group == "75":
>>       grouplist = views.analyzeviews(views.views75,views.views100)
>>       self.setData("75","Group 75", grouplist)
>>     elif group == "100":
>>       print "i'm @ 100" #debug
>>       grouplist = views.analyzeviews(views.views100,views.views200)
>>       self.setData("100","Group 100", grouplist)
>>     elif group == "200":
>>       print "i'm @ 200" #debug
>>       grouplist = views.analyzeviews(views.views200, views.views300)
>>       self.setData("200","Group 200", grouplist)
>> *... (cut a snippet out - I think you get the point)*
>>     elif group == "10000":
>>       print "i'm @ 10000" #debug
>>       grouplist = views.analyzeviews(views.views10000, views.views10000)
>>       self.setData("10000","Group 10000", grouplist)
>>     return True
>>
>> def CreateDataEngine(parent):
>>   return PyFlickrEngine(parent)
>>
>> So that function it's calling, views.analyzeviews(arg, arg) is calling a
>> web API and sometimes that API fails.  The cool thing about data engines vs
>> when I used to do this on the commandline is that if it fails at 25, it
>> doesn't crash the whole program.  It just moves on to 50.  So I can end up
>> in the end where when I click on 25 it tells me that there's nothing in the
>> source and then I click on 50 and I can use the data from that source.  So,
>> right now if I want the data from 25, the only way I know how to do that is
>> by re-running the program and hoping the API doesn't fail that time
>> around.  Is there a way for me to tell the data engine to update group 25
>> again from within the QML gui?
>>
>> Thanks!
>> --
>> Eric Mesa
>> http://about.me/ericmesa
>> http://www.ericsbinaryworld.com
>>
>>
>> _______________________________________________
>> Plasma-devel mailing list
>> Plasma-devel@kde.org
>> https://mail.kde.org/mailman/listinfo/plasma-devel
>>
>>
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>


-- 
Shantanu Tushar    (UTC +0530)
http://www.shantanutushar.com

[Attachment #5 (text/html)]

<br><div class="gmail_quote">On Tue, Jun 26, 2012 at 2:46 PM, Viranch Mehta <span \
dir="ltr">&lt;<a href="mailto:viranch.mehta@gmail.com" \
target="_blank">viranch.mehta@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="im">On Tue, Jun 26, 2012 at 8:31 AM, Eric Mesa \
<span dir="ltr">&lt;<a href="mailto:ericsbinaryworld@gmail.com" \
target="_blank">ericsbinaryworld@gmail.com</a>&gt;</span> wrote:<br></div><div \
class="gmail_quote"> <div class="im"><blockquote class="gmail_quote" style="margin:0 \
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Thanks to everyone who&#39;s \
helped me over the last year or so with my program.  I have one more thing to fix on \
my engine and then it will be &quot;perfect&quot;.  The recent help I got helped me \
finally perfect the GUI.  So my data engine&#39;s running a function over and over \
with different arguments to populate the sources.  Here&#39;s what it looks like:<br>

</blockquote><div><br></div></div><div>Please always use <a \
href="http://pastebin.com" target="_blank">pastebin.com</a> or <a \
href="http://paste.kde.org" target="_blank">paste.kde.org</a> to show your codes \
instead</div> <div>of putting them in emails.</div></div></blockquote><div><br>I \
think its ok to paste in a mail if its a snippet not too long, because  it helps \
other people who will later read the ML archives, as pastebins  may expire.<br> \
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
class="gmail_quote"><div> <br></div><div>Viranch</div><div> </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div class="h5"> <br>from PyQt4.QtCore import *<br>from \
PyKDE4.kdecore import *<br>from PyKDE4 import plasmascript<br>#for flickr<br>import \
views<br><br><br>class PyFlickrEngine(plasmascript.DataEngine):<br>  def \
__init__(self,parent,args=None):<br>


    plasmascript.DataEngine.__init__(self,parent)<br>    <br>  def init(self):<br>    \
self.setMinimumPollingInterval(333)<br>    #for flickr<br>    views.initialize()<br>  \
<br>  #adding this back in 24 jan to see if it helps<br>


  def sources(self):<br>    sources = [&quot;25&quot;, &quot;50&quot;, \
&quot;75&quot;, &quot;100&quot;, &quot;200&quot;, &quot;300&quot;, &quot;400&quot;, \
&quot;500&quot;, &quot;600&quot;, &quot;700&quot;, &quot;800&quot;, &quot;900&quot;, \
&quot;1000&quot;, &quot;1250&quot;, &quot;1500&quot;, &quot;1750&quot;, \
&quot;2000&quot;,&quot;3000&quot;, &quot;4000&quot;, &quot;5000&quot;, \
&quot;10000&quot;]<br>


    return sources<br>    <br>  def sourceRequestEvent(self, name):<br>    #print \
&quot;source request event&quot; #debugging<br>    return \
self.updateSourceEvent(name)<br>    <br>  def updateSourceEvent(self,group):<br>

    print &quot;updateSourceEvent&quot;<br>
    #grouplist = []<br>    if group == &quot;25&quot;:<br>      grouplist = \
views.analyzeviews(views.views25, views.views50)<br>      \
self.setData(&quot;25&quot;, &quot;Group 25&quot;, grouplist)<br>    elif group == \
&quot;50&quot;:<br>


      grouplist = views.analyzeviews(views.views50, views.views75)<br>      \
self.setData(&quot;50&quot;,&quot;Group 50&quot;, grouplist)<br>    elif group == \
&quot;75&quot;:<br>      grouplist = \
views.analyzeviews(views.views75,views.views100)<br>


      self.setData(&quot;75&quot;,&quot;Group 75&quot;, grouplist)<br>    elif group \
== &quot;100&quot;:<br>      print &quot;i&#39;m @ 100&quot; #debug<br>      \
grouplist = views.analyzeviews(views.views100,views.views200)<br>


      self.setData(&quot;100&quot;,&quot;Group 100&quot;, grouplist)<br>    elif \
group == &quot;200&quot;:<br>      print &quot;i&#39;m @ 200&quot; #debug<br>      \
grouplist = views.analyzeviews(views.views200, views.views300)<br>


      self.setData(&quot;200&quot;,&quot;Group 200&quot;, grouplist)<br><b>... (cut a \
snippet out - I think you get the point)</b><br>    elif group == \
&quot;10000&quot;:<br>      print &quot;i&#39;m @ 10000&quot; #debug<br>


      grouplist = views.analyzeviews(views.views10000, views.views10000)<br>      \
self.setData(&quot;10000&quot;,&quot;Group 10000&quot;, grouplist)<br>    return \
True<br>    <br>def CreateDataEngine(parent):<br>  return PyFlickrEngine(parent)<br>


<br>So that function it&#39;s calling, views.analyzeviews(arg, arg) is calling a web \
API and sometimes that API fails.  The cool thing about data engines vs when I used \
to do this on the commandline is that if it fails at 25, it doesn&#39;t crash the \
whole program.  It just moves on to 50.  So I can end up in the end where when I \
click on 25 it tells me that there&#39;s nothing in the source and then I click on 50 \
and I can use the data from that source.  So, right now if I want the data from 25, \
the only way I know how to do that is by re-running the program and hoping the API \
doesn&#39;t fail that time around.  Is there a way for me to tell the data engine to \
update group 25 again from within the QML gui?<br>


<br>Thanks!<br clear="all">--<br>Eric Mesa<div><a href="http://about.me/ericmesa" \
target="_blank">http://about.me/ericmesa</a><br><a \
href="http://www.ericsbinaryworld.com" \
target="_blank">http://www.ericsbinaryworld.com</a></div>


<br>
<br></div></div>_______________________________________________<br>
Plasma-devel mailing list<br>
<a href="mailto:Plasma-devel@kde.org" target="_blank">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br> \
<br></blockquote></div><br> <br>_______________________________________________<br>
Plasma-devel mailing list<br>
<a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br> \
<br></blockquote></div><br><br clear="all"><br>-- <br>Shantanu Tushar    (UTC \
+0530)<br><a href="http://www.shantanutushar.com" \
target="_blank">http://www.shantanutushar.com</a><br>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic