← Back to team overview

cairo-dock-team team mailing list archive

[Merge] lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras

 

Eduardo Mucelli Rezende Oliveira has proposed merging lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras.

Requested reviews:
  Cairo-Dock Team (cairo-dock-team)


Automatic fetch more quotes when all of them were already showed to the user, except for Quotationspage.com.
-- 
https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote/+merge/44465
Your team Cairo-Dock Team is requested to review the proposed merge of lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras.
=== modified file 'Quote/ChangeLog'
--- Quote/ChangeLog	2010-12-02 10:17:59 +0000
+++ Quote/ChangeLog	2010-12-22 14:22:12 +0000
@@ -1,3 +1,4 @@
+0.0.6:(December/22/2010): Automatic fetch more quotes when all of them were already showed to the user, except for Quotationspage.com.
 0.0.5:(December/2/2010): Added Jokes2go.com.
 0.0.4:(November/23/2010): Added Danstonchat.com. Changed the icon, now the lamp was turned on :¬) Huge code modularization.
 0.0.3:(November/23/2010): It is possible now copy the quote to the clipboard. Added quotes from Qdb.us.

=== modified file 'Quote/Quote'
--- Quote/Quote	2010-12-02 18:15:52 +0000
+++ Quote/Quote	2010-12-22 14:22:12 +0000
@@ -148,15 +148,24 @@
         self.inform_start_of_waiting_process()                                      # ...
         interface = Interface(self.source)
         quote, author = interface.fetch()
-        self.quotes = itertools.cycle(quote)
-        self.authors = itertools.cycle(author)
+        if (self.source == quotationspage):                                         # quotationspage nao da quotes diferentes por acesso ...
+            self.quotes = itertools.cycle(quote)
+            self.authors = itertools.cycle(author)
+        else:                                                                       # ... os outros dao quotes diferentes por acesso entao
+            self.quotes = iter(quote)                                               # nao precisa usar iterador circular, pois depois de mostrar
+            self.authors = iter(author)                                             # todas, busca-se novas quotes com mais uma chamada deste metodo
         self.inform_end_of_waiting_process()                                        # done
 
     def show_quote(self):
         if (self.source == quotationspage):
             self.quotation = "\"%s\" ~ %s" % (self.quotes.next(), self.authors.next()) # N-esima quote refere-se ao N-esimo autor."quote[x]~author[x]"
         elif (self.source == bash or self.source == xkcdb or self.source == qdb or self.source == danstonchat):
-            self.quotation = "%s" % self.quotes.next()
+            try:                                                                    # ve a possibilidade de mostrar quotes ja armazenadas
+                current = self.quotes.next()
+            except StopIteration:                                                   # todas ja foram mostradas
+                self.get_quotes_from_web()                                          # buscar mais
+                current = self.quotes.next()                                        # posicionar na primeira para mostra-la
+            self.quotation = "%s" % current
         else:                                                                       # jokestogo provides only one quote per request ...
             self.quotation = "%s" % self.quotes.next().rstrip()                                 
             self.get_quotes_from_web()                                              # ... so it is necessary to request it again    

=== modified file 'Quote/Quote.conf'
--- Quote/Quote.conf	2010-12-02 10:17:59 +0000
+++ Quote/Quote.conf	2010-12-22 14:22:12 +0000
@@ -1,4 +1,4 @@
-#!en;0.0.5
+#!en;0.0.6
 
 #[gtk-about]
 [Icon]

=== added file 'Quote/README'
--- Quote/README	1970-01-01 00:00:00 +0000
+++ Quote/README	2010-12-22 14:22:12 +0000
@@ -0,0 +1,6 @@
+# Contact me
+
+Any doubt, suggestion or anything else, except asking for some money, I would be pleased to received a message from you. :¬)
+
+Author: Eduardo Mucelli Rezende Oliveira
+E-mail: edumucelli@xxxxxxxxx or eduardom@xxxxxxxxxxx

=== modified file 'Quote/auto-load.conf'
--- Quote/auto-load.conf	2010-12-02 10:17:59 +0000
+++ Quote/auto-load.conf	2010-12-22 14:22:12 +0000
@@ -10,4 +10,4 @@
 category = 7
 
 # Version of the applet; change it everytime you change something in the config file. Don't forget to update the version both in this file and in the config file.
-version = 0.0.5
+version = 0.0.6


Follow ups