added proper about dlg, and fixed bug refreshing quotes view
[stockthis] / stockthis.py
index 578af6d..5f6892e 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 # -*- coding: UTF8 -*-
 # Copyright (C) 2008 by Daniel Martin Yerga
 # <dyerga@gmail.com>
@@ -28,7 +28,7 @@ import hildon
 #import osso
 #osso_c = osso.Context("net.yerga.stockthis", "0.3", False)
 
-from marketdata import markets, idmarket, localmarkets, localids
+import marketdata
 import settings
 
 
@@ -69,17 +69,19 @@ class StocksPy:
         menu = hildon.AppMenu()
         self.window.set_app_menu(menu)
         button = gtk.Button("About")
-        button.connect("clicked", self.on_about)
+        button.connect("clicked", About)
         menu.append(button)
         menu.show_all()
 
         vbox = gtk.VBox()
-        toolbar = self.main_toolbar(False, False)
+        toolbar = self.main_toolbar(False, False, None, '', '')
 
         parea = hildon.PannableArea()
         tv = hildon.GtkTreeView(ui_normal)
-        inmodel = self.__create_model(markets, idmarket)
-        tv.connect("row-activated", self.show_instrument_view, inmodel)
+        inmodel = self.__create_model(marketdata.main, marketdata.idmain)
+        tv.connect("row-activated", self.show_instrument_view, inmodel,
+                    marketdata.localmarkets, marketdata.localids,
+                    marketdata.idmain)
         tv.set_model(inmodel)
         self._tv_columns(tv)
         parea.add(tv)
@@ -91,16 +93,17 @@ class StocksPy:
         self.window.add(vbox)
         self.window.show_all()
 
-    def show_instrument_view(self, widget, path, column, inmodel):
+    def show_instrument_view(self, widget, path, column, inmodel, names,
+        ids, mindex):
         market = inmodel[path][0]
-
-        names = localmarkets[idmarket.index(market)]
-        ids = localids[idmarket.index(market)]
+        names = names[mindex.index(market)]
+        ids = ids[mindex.index(market)]
 
         window = hildon.StackableWindow()
+        window.set_title("StockThis - " + inmodel[path][1])
 
         vbox = gtk.VBox()
-        toolbar = self.main_toolbar(False, False)
+        toolbar = self.main_toolbar(False, False, None, '', '')
 
         parea = hildon.PannableArea()
         tv = hildon.GtkTreeView(ui_normal)
@@ -117,25 +120,57 @@ class StocksPy:
         window.add(vbox)
         window.show_all()
 
-
     def show_quotes_view(self, widget, path, column, model, portfolio):
         quote = model[path][0], model[path][1]
+        print "quote:", quote[0]
+        #('EURUSD=X', 'EUR/USD')
+
+        #Currencies and ETFs should show the list now -> view = True
+        #Other items show a new list with options
+        view = False
+        for i in marketdata.localids[(len(marketdata.localids)-2):]:
+            for j in i:
+                if quote[0] == j:
+                    print j
+                    view = True
+
+        if not view:
+            if quote[0] in marketdata.idindexes:
+                self.show_instrument_view(widget, path, column, model,
+                                        marketdata.wnamesindexes,
+                                        marketdata.widsindexes,
+                                        marketdata.idindexes)
+                return
+            if quote[0] in marketdata.idotmarkets:
+                self.show_instrument_view(widget, path, column, model,
+                                        marketdata.omnames,
+                                        marketdata.omsymbols,
+                                        marketdata.idotmarkets)
+                return
+            if quote[0] in marketdata.ideumarkets:
+                self.show_instrument_view(widget, path, column, model,
+                                        marketdata.eunames,
+                                        marketdata.eusymbols,
+                                        marketdata.ideumarkets)
+                return
+            if quote[0] in marketdata.idusmarkets:
+                self.show_instrument_view(widget, path, column, model,
+                                        marketdata.usnames,
+                                        marketdata.ussymbols,
+                                        marketdata.idusmarkets)
+                return
 
-        self.stocks_id = quote[0]
-        self.stocks_name = quote[1]
-        print quote
 
-        self.quotes_win = hildon.StackableWindow()
+        win = hildon.StackableWindow()
+        win.set_title("StockThis - Quotes View - " + quote[1])
 
         vbox = gtk.VBox()
-        toolbar = self.main_toolbar(True, portfolio)
 
-
-        self.titlelbl = gtk.Label('')
-        self.titlelbl.set_markup('<b><big>' + quote[1].replace('&', '') +
+        ltitle = gtk.Label('')
+        ltitle.set_markup('<b><big>' + quote[1].replace('&', '') +
                                  '</big></b>')
         color = gtk.gdk.color_parse("#03A5FF")
-        self.titlelbl.modify_fg(gtk.STATE_NORMAL, color)
+        ltitle.modify_fg(gtk.STATE_NORMAL, color)
 
         parea = hildon.PannableArea()
 
@@ -144,43 +179,43 @@ class StocksPy:
         hbox = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>Price:</big></b>')
-        self.lprice = gtk.Label('')
+        lprice = gtk.Label('')
         hbox.pack_start(label, False, False, 20)
-        hbox.pack_start(self.lprice, False, False, 245)
+        hbox.pack_start(lprice, False, False, 245)
         vbox1.pack_start(hbox, True, True, 0)
 
         hbox = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>Change:</big></b>')
-        self.lchange = gtk.Label('')
-        self.lpercent = gtk.Label('')
+        lchange = gtk.Label('')
+        lpercent = gtk.Label('')
         hbox.pack_start(label, False, False, 20)
-        hbox.pack_start(self.lchange, False, False, 205)
-        hbox.pack_start(self.lpercent, False, False, 0)
+        hbox.pack_start(lchange, False, False, 205)
+        hbox.pack_start(lpercent, False, False, 0)
         vbox1.pack_start(hbox, True, True, 0)
 
         hbox = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>Volume:</big></b>')
-        self.lvolume = gtk.Label('')
+        lvolume = gtk.Label('')
         hbox.pack_start(label, False, False, 20)
-        hbox.pack_start(self.lvolume, False, False, 207)
+        hbox.pack_start(lvolume, False, False, 207)
         vbox1.pack_start(hbox, True, True, 0)
 
         hbox = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>52 week high:</big></b>')
-        self.l52whigh = gtk.Label('')
+        l52whigh = gtk.Label('')
         hbox.pack_start(label, False, False, 20)
-        hbox.pack_start(self.l52whigh, False, False, 110)
+        hbox.pack_start(l52whigh, False, False, 110)
         vbox1.pack_start(hbox, True, True, 0)
 
         hbox = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>52 week low:</big></b>')
-        self.l52wlow = gtk.Label('')
+        l52wlow = gtk.Label('')
         hbox.pack_start(label, False, False, 20)
-        hbox.pack_start(self.l52wlow, False, False, 125)
+        hbox.pack_start(l52wlow, False, False, 125)
         vbox1.pack_start(hbox, True, True, 0)
 
         hbox = gtk.HBox()
@@ -189,37 +224,37 @@ class StocksPy:
                 "900", "1000"]
         selector = self.create_selector(data, True)
         button1.set_selector(selector)
-        button1.set_title("Shares")
+        button1.set_title("Your shares")
         #FIXME: Improve as it's shown you have a component in your portfolio
-        shares = self.get_shares_from_symbol()
+        shares = self.get_shares_from_symbol(quote[0])
         button1.set_value(shares)
         hbox.pack_start(button1, True, True, 0)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_title("Add to Portfolio")
-        button.connect("clicked", self.add_to_portfolio, button1)
+        button.connect("clicked", self.add_to_portfolio, button1, quote[0], quote[1])
         hbox.pack_start(button, True, True, 0)
 
         hbox1 = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>Shares:</big></b>')
-        self.shares = gtk.Label(shares)
+        lshares = gtk.Label(shares)
         hbox1.pack_start(label, False, False, 20)
-        hbox1.pack_start(self.shares, False, False, 215)
+        hbox1.pack_start(lshares, False, False, 215)
 
         hbox2 = gtk.HBox()
         label = gtk.Label('')
         label.set_markup('<b><big>Holdings Value:</big></b>')
-        self.holdingsvalue = gtk.Label("")
+        holdingsvalue = gtk.Label("")
         hbox2.pack_start(label, False, False, 20)
-        hbox2.pack_start(self.holdingsvalue, False, False, 85)
+        hbox2.pack_start(holdingsvalue, False, False, 85)
 
         hbox3 = gtk.HBox()
         label = gtk.Label('')
         label.set_markup("<b><big>Day's Value Change:</big></b>")
-        self.dayvaluechange = gtk.Label("")
+        dayvaluechange = gtk.Label("")
         hbox3.pack_start(label, False, False, 20)
-        hbox3.pack_start(self.dayvaluechange, False, False, 10)
+        hbox3.pack_start(dayvaluechange, False, False, 10)
 
         if not portfolio:
             vbox1.pack_start(hbox, False, False, 0)
@@ -230,41 +265,44 @@ class StocksPy:
 
         parea.add_with_viewport(vbox1)
 
-        vbox.pack_start(self.titlelbl, False, False, 0)
+        widgets = [win, ltitle, lprice, lchange,  lpercent, lvolume, l52whigh, l52wlow, lshares, holdingsvalue, dayvaluechange]
+
+        toolbar = self.main_toolbar(True, portfolio, widgets, quote[0], quote[1])
+
+        vbox.pack_start(ltitle, False, False, 0)
         vbox.pack_start(gtk.HSeparator(), False, False, 0)
         vbox.pack_start(parea, True, True, 0)
         vbox.pack_start(gtk.HSeparator(), False, False, 5)
         vbox.pack_start(toolbar, False, False, 0)
 
-        self.quotes_win.add(vbox)
-        self.quotes_win.show_all()
-        self.show_data(quote[0], self.quotes_win, shares)
 
-    def get_shares_from_symbol(self):
+        win.add(vbox)
+        win.show_all()
+        self.show_data(quote[0], widgets, shares)
+
+    def get_shares_from_symbol(self, symbol):
         portfolio_data = settings.load_portfolio(settingsdb)
         shares = "0"
         for item in portfolio_data :
-            if self.stocks_id in item:
+            if symbol in item:
                 shares = item[2]
         return shares
 
-    def add_to_portfolio(self, widget, button):
+    def add_to_portfolio(self, widget, button, symbol, name):
         shares = button.get_value()
-        self.stocks_id
-        self.stocks_name
 
         portfolio = settings.load_portfolio(settingsdb)
         index = "None"
         for item in portfolio:
-            if self.stocks_id in item:
+            if symbol in item:
                 index = portfolio.index(item)
 
-        item = [self.stocks_id, self.stocks_name, shares, '-']
+        item = [symbol, name, shares, '-']
 
         if index is "None":
             settings.insert_new_item_to_portfolio(settingsdb, item)
         else:
-            settings.delete_item_from_portfolio(settingsdb, self.stocks_id)
+            settings.delete_item_from_portfolio(settingsdb, symbol)
             settings.insert_new_item_to_portfolio(settingsdb, item)
 
         self.show_info_banner(widget, "Added to portfolio")
@@ -280,20 +318,22 @@ class StocksPy:
 
         return selector
 
-    def show_data(self, quote, win, shares):
+    def show_data(self, symbol, widgets, shares):
         import thread
-        winprogind(win, 1)
-        thread.start_new_thread(self.get_data, (quote, win, shares))
+        winprogind(widgets[0], 1)
+        thread.start_new_thread(self.get_data, (symbol, widgets, shares))
 
-    def get_data(self, quote, win, shares):
+    def get_data(self, symbol, widgets, shares):
         from ystockquote import ystockquote as yt
+        win, ltitle, lprice, lchange,  lpercent, lvolume, l52whigh, l52wlow, lshares, holdingsvalue, dayvaluechange = widgets
+
         try:
-            data = yt.get_all(quote)
+            data = yt.get_all(symbol)
         except:
             print 'Failed to get internet data'
             data = {'price': 'N/A', 'change': 'N/A', 'volume':'N/A',
                     '52_week_high': 'N/A', '52_week_low': 'N/A'}
-            self.titlelbl.set_markup('<b><big>Failed to get data</big></b>')
+            ltitle.set_markup('<b><big>Failed to get data</big></b>')
 
         try:
             ch_percent = \
@@ -302,21 +342,21 @@ class StocksPy:
         except ValueError:
             ch_percent = 0.0
 
-        self.lprice.set_label(data['price'])
-        self.lchange.set_label(data['change'])
-        self.lpercent.set_label('%6.2f %%' % ch_percent)
+        lprice.set_label(data['price'])
+        lchange.set_label(data['change'])
+        lpercent.set_label('%6.2f %%' % ch_percent)
 
         if '-' in data['change']:
             color = gtk.gdk.color_parse("#FF0000")
         else:
             color = gtk.gdk.color_parse("#16EB78")
 
-        self.lpercent.modify_fg(gtk.STATE_NORMAL, color)
-        self.lchange.modify_fg(gtk.STATE_NORMAL, color)
+        lpercent.modify_fg(gtk.STATE_NORMAL, color)
+        lchange.modify_fg(gtk.STATE_NORMAL, color)
 
-        self.lvolume.set_label(data['volume'])
-        self.l52whigh.set_label(data['52_week_high'])
-        self.l52wlow.set_label(data['52_week_low'])
+        lvolume.set_label(data['volume'])
+        l52whigh.set_label(data['52_week_high'])
+        l52wlow.set_label(data['52_week_low'])
 
         try:
             daychange = float(shares)*float(data['change'])
@@ -327,26 +367,27 @@ class StocksPy:
         except ValueError:
             holdvalue = 'N/A'
 
-        self.dayvaluechange.set_label(str(daychange))
-        self.holdingsvalue.set_label(str(holdvalue))
+        dayvaluechange.set_label(str(daychange))
+        holdingsvalue.set_label(str(holdvalue))
 
         winprogind(win, 0)
 
-    def refresh_stock_data(self, widget, portfolio):
+    def refresh_stock_data(self, widget, portfolio, widgets, symbol):
         if portfolio:
-            shares = self.get_shares_from_symbol()
+            shares = self.get_shares_from_symbol(symbol)
         else:
             shares = "0"
 
-        self.show_data(self.stocks_id, self.quotes_win, shares)
+        self.show_data(symbol, widgets, shares)
 
-    def show_graph_view(self, widget):
+    def show_graph_view(self, widget, symbol, name):
         win = hildon.StackableWindow()
+        win.set_title("StockThis - Graph View - " + name)
 
         vbox = gtk.VBox()
-        toolbar = self.main_toolbar(False, True)
+        toolbar = self.main_toolbar(False, True, None, '', '')
 
-        self.graphs_title = gtk.Label(self.stocks_name)
+        self.graphs_title = gtk.Label(name)
         color = gtk.gdk.color_parse("#03A5FF")
         self.graphs_title.modify_fg(gtk.STATE_NORMAL, color)
 
@@ -357,42 +398,42 @@ class StocksPy:
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('1d')
-        button.connect("clicked", self.show_graph, '1d', win)
+        button.connect("clicked", self.show_graph, '1d', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('5d')
-        button.connect("clicked", self.show_graph, '5d', win)
+        button.connect("clicked", self.show_graph, '5d', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('3m')
-        button.connect("clicked", self.show_graph, '3m', win)
+        button.connect("clicked", self.show_graph, '3m', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('6m')
-        button.connect("clicked", self.show_graph, '6m', win)
+        button.connect("clicked", self.show_graph, '6m', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('1y')
-        button.connect("clicked", self.show_graph, '1y', win)
+        button.connect("clicked", self.show_graph, '1y', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('2y')
-        button.connect("clicked", self.show_graph, '2y', win)
+        button.connect("clicked", self.show_graph, '2y', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('5y')
-        button.connect("clicked", self.show_graph, '5y', win)
+        button.connect("clicked", self.show_graph, '5y', win, symbol)
         hbox.pack_start(button)
 
         button = hildon.Button(fhsize, horbtn)
         button.set_label('Max')
-        button.connect("clicked", self.show_graph, 'max', win)
+        button.connect("clicked", self.show_graph, 'max', win, symbol)
         hbox.pack_start(button)
 
         vbox1 = gtk.VBox()
@@ -412,31 +453,30 @@ class StocksPy:
         win.add(vbox)
         win.show_all()
 
-        self.show_graph(None, '1d', win)
+        self.show_graph(None, '1d', win, symbol)
 
-    def show_graph(self, widget, option, win):
+    def show_graph(self, widget, option, win, symbol):
         import thread
         winprogind(win, 1)
-        thread.start_new_thread(self.get_graph_data, (option, win))
+        thread.start_new_thread(self.get_graph_data, (option, win, symbol))
 
-    def get_graph_data(self, option, win):
-        kind = self.stocks_id
+    def get_graph_data(self, option, win, symbol):
         if option == '1d':
-            url = 'http://uk.ichart.yahoo.com/b?s=%s' % kind
+            url = 'http://uk.ichart.yahoo.com/b?s=%s' % symbol
         elif option == '5d':
-            url = 'http://uk.ichart.yahoo.com/w?s=%s' % kind
+            url = 'http://uk.ichart.yahoo.com/w?s=%s' % symbol
         elif option == '3m':
-            url = 'http://chart.finance.yahoo.com/c/3m/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/3m/s/%s' % symbol.lower()
         elif option == '6m':
-            url = 'http://chart.finance.yahoo.com/c/6m/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/6m/s/%s' % symbol.lower()
         elif option == '1y':
-            url = 'http://chart.finance.yahoo.com/c/1y/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/1y/s/%s' % symbol.lower()
         elif option == '2y':
-            url = 'http://chart.finance.yahoo.com/c/2y/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/2y/s/%s' % symbol.lower()
         elif option == '5y':
-            url = 'http://chart.finance.yahoo.com/c/5y/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/5y/s/%s' % symbol.lower()
         elif option == 'max':
-            url = 'http://chart.finance.yahoo.com/c/my/s/%s' % kind.lower()
+            url = 'http://chart.finance.yahoo.com/c/my/s/%s' % symbol.lower()
 
         try:
             myimg = urllib2.urlopen(url)
@@ -469,7 +509,7 @@ class StocksPy:
             lstore.set(iter, 0, ids[item], 1, names[item])
         return lstore
 
-    def main_toolbar(self, quotesview, portfolio):
+    def main_toolbar(self, quotesview, portfolio, widgets, symbol, name):
         toolbar = gtk.HBox()
         toolbar.set_homogeneous(True)
 
@@ -479,11 +519,12 @@ class StocksPy:
 
         graph_btn = hildon.Button(fhsize, horbtn)
         graph_btn.set_title("Graph")
-        graph_btn.connect("clicked", self.show_graph_view)
+        graph_btn.connect("clicked", self.show_graph_view, symbol, name)
 
         refresh_btn = hildon.Button(fhsize, horbtn)
         refresh_btn.set_title("Refresh")
-        refresh_btn.connect("clicked", self.refresh_stock_data, portfolio)
+        refresh_btn.connect("clicked", self.refresh_stock_data, portfolio,
+                            widgets, symbol)
 
         if not portfolio:
             toolbar.pack_start(portfolio_btn)
@@ -499,6 +540,7 @@ class StocksPy:
         data = settings.load_portfolio(settingsdb)
 
         win = hildon.StackableWindow()
+        win.set_title("StockThis - Portfolio")
 
         vbox = gtk.VBox()
 
@@ -646,20 +688,133 @@ class StocksPy:
         else:
             return True
 
-    def on_about(self, widget):
-        dialog = gtk.AboutDialog()
-        dialog.set_name("StockThis")
-        dialog.set_version("0.3")
-        dialog.set_copyright("Copyright © 2009")
-        dialog.set_website("http://stockthis.garage.maemo.org")
-        dialog.set_authors(["Daniel Martin Yerga <dyerga@gmail.com>"])
-        logo = gtk.gdk.pixbuf_new_from_file(imgdir + "stockthis.png")
-        dialog.set_logo(logo)
-        dialog.set_license("This program is released under the GNU\nGeneral Public License. Please visit \nhttp://www.gnu.org/copyleft/gpl.html\nfor details.")
-        dialog.set_artists(["Logo by Daniel Martin Yerga"])
+class About:
+
+    def __init__(self, widget):
+        dialog = gtk.Dialog(title='About', parent=None, flags=0)
+        dialog.set_has_separator(False)
+        dialog.set_size_request(-1, 400)
+
+        self.info_lb = gtk.Label()
+        self.info_lb.set_line_wrap(True)
+
+        hbox1 = gtk.HBox()
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title('Description')
+        button.connect("clicked", self.show_info, 'description')
+        hbox1.pack_start(button, True, True, 0)
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title('Credits')
+        button.connect("clicked", self.show_info, 'credits')
+        hbox1.pack_start(button, True, True, 0)
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title('License')
+        button.connect("clicked", self.show_info, 'license')
+        hbox1.pack_start(button, True, True, 0)
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title('Donate')
+        button.connect("clicked", self.show_info, 'donate')
+        hbox1.pack_start(button, True, True, 0)
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title('Report ')
+        button.connect("clicked", self.show_info, 'report')
+        hbox1.pack_start(button, True, True, 0)
+
+        button = hildon.Button(fhsize, horbtn)
+        button.set_title(' Vote ')
+        button.connect("clicked", self.show_info, 'vote')
+        hbox1.pack_start(button, True, True, 0)
+
+        self.action_btn = hildon.Button(fhsize, horbtn)
+        self.image = gtk.Image()
+
+        self.show_info(None, 'description')
+
+        dialog.vbox.pack_start(self.action_btn, False, False, 0)
+        dialog.vbox.pack_start(self.image, False, False, 5)
+        dialog.vbox.pack_start(self.info_lb, True, True, 0)
+        dialog.vbox.pack_start(hbox1, False, False, 0)
+
+        dialog.show_all()
+        self.action_btn.hide()
+        self.image.hide()
         dialog.run()
         dialog.destroy()
 
+    def do_action(self, widget, action):
+        import webbrowser
+        if action == "donate":
+            url = "http://stockthis.garage.maemo.org/donate.html"
+        elif action == "report":
+            url = "http://stockthis.garage.maemo.org/reporting.html"
+        elif action == "vote":
+            url = "http://maemo.org/downloads/product/stockthis"
+        webbrowser.open_new(url)
+
+    def show_info(self, widget, kind):
+        if kind == 'license':
+            self.action_btn.hide()
+            self.image.hide()
+            info = """<small><b>StockThis</b> is free software. It's using a GPL version 2 license or at your election any later version.
+
+Logo by Daniel Martin Yerga.
+</small>"""
+        elif kind == 'credits':
+            self.action_btn.hide()
+            self.image.hide()
+            info = """<small><b>Written by</b> Daniel Martin Yerga (dyerga@gmail.com)
+
+<b>Thanks</b> to everyone who has reported bugs, suggestions, giving spirits, critiques, writing blog articles about StockThis, and so on. Like always the list is extremely big and for not forget anybody, THANKS TO ALL!</small>"""
+        elif kind == 'description':
+            self.action_btn.hide()
+            self.image.hide()
+            info = """<b><big>StockThis 0.3</big></b>
+
+<i>StockThis is a stocks application for Maemo</i>
+
+<b>Web Page</b>:
+stockthis.garage.maemo.org"""
+
+        elif kind == 'donate':
+            self.action_btn.show()
+            self.image.hide()
+            self.action_btn.set_title('I want donate')
+            self.action_btn.connect("clicked", self.do_action, "donate")
+            info = """<small><b>StockThis</b> is a free (and gratis) software application.
+Developing good software takes time and hard work.
+
+<b>StockThis's author</b> develops the program in him spare time.
+If you like the program and it's helpful, consider donating a small amount of money.
+Donations are a great incentive and help to feel that the hard work is appreciated.</small>
+"""
+
+        elif kind == 'report':
+            self.action_btn.show()
+            self.image.hide()
+            self.action_btn.set_title('Report bug')
+            self.action_btn.connect("clicked", self.do_action, "report")
+            info = """<small>StockThis is being improved thanks to bug reports. The author appreciates very much all these reports.
+If the application is raising an error when you're using it, you have two choices to report this error:
+1) Send the log from the application menu (if there's an error in the log).
+2) Write a bug report in the bugtracker of StockThis with as much information as possible (especially the log from the menu).</small>"""
+
+        elif kind == 'vote':
+            self.action_btn.show()
+            self.image.show()
+            self.image.set_from_file(imgdir + "maemoorg.png")
+            self.action_btn.set_title('Vote for StockThis')
+            self.action_btn.connect("clicked", self.do_action, "vote")
+            info = """<small>The downloads section in maemo.org has a nice system where you can rate applications.
+If you consider StockThis a good application (or a bad one too), you could rate it in maemo.org site.</small>"""
+
+        self.info_lb.set_markup(info)
+
+
 if __name__ == "__main__":
     stockspy = StocksPy()
     gtk.gdk.threads_enter()