--- /dev/null
+#!/usr/bin/env python
+# -*- coding: UTF8 -*-
+# Copyright (C) 2008 by Daniel Martin Yerga
+# <dyerga@gmail.com>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# StocksPy: Application to get stocks data from Yahoo Finance.
+# Version 0.1
+#
+
+import urllib2
+import gtk, gobject
+try:
+ import hildon
+ HILDON = True
+except:
+ HILDON = False
+
+try:
+ import osso
+ OSSO = True
+ osso_c = osso.Context("net.yerga.stockthis", "0.2", False)
+except:
+ OSSO = False
+
+from marketdata import markets, idmarket, localmarkets, localids
+
+#TODO: detect if running in Fremantle
+FREMANTLE=True
+
+#detect if is ran locally or not
+import sys
+runningpath = sys.path[0]
+
+if '/usr/share' in runningpath:
+ running_locally = False
+else:
+ running_locally = True
+
+if running_locally:
+ imgdir = 'pixmaps/'
+else:
+ imgdir = '/usr/share/stockthis/pixmaps/'
+
+loading_img = imgdir + 'loading.gif'
+
+gtk.gdk.threads_init()
+
+class StocksPy:
+
+ def __init__(self):
+ if HILDON:
+ self.program = hildon.Program()
+ self.program.__init__()
+ gtk.set_application_name('')
+ if FREMANTLE:
+ self.window = hildon.StackableWindow()
+ else:
+ self.window = hildon.Window()
+ self.program.add_window(self.window)
+ else:
+ self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+
+ self.window.set_default_size(800, 480)
+ self.window.set_title('StockThis')
+ self.window.connect("destroy", gtk.main_quit)
+ self.window.connect("key-press-event", self.on_key_press)
+ self.window.connect("window-state-event", self.on_window_state_change)
+ self.window_in_fullscreen = False
+
+ if HILDON:
+ if FREMANTLE:
+ menu = hildon.AppMenu()
+ self.window.set_app_menu(menu)
+ about_menu = gtk.Button("About")
+ about_menu.connect("clicked", self.on_about)
+ else:
+ menu = gtk.Menu()
+ self.window.set_menu(menu)
+ about_menu = gtk.MenuItem("About")
+ about_menu.set_size_request(-1, 55)
+ about_menu.connect("activate", self.on_about)
+
+ menu.append(about_menu)
+ menu.show_all()
+ else:
+ #TODO: create a gtk.menubar
+ pass
+
+
+ vbox = gtk.VBox()
+
+ self.toolbar = gtk.HBox()
+ self.toolbar.set_property("no-show-all", True)
+ self.toolbar.hide()
+ self.toolbar.set_homogeneous(True)
+ self.toolbar.set_size_request(-1, 55)
+
+ self.markets_btn = gtk.Button('Markets')
+ self.markets_btn.connect("clicked", self.create_markets_view)
+ self.markets_btn.set_property("can_focus", False)
+
+ self.components_btn = gtk.Button('Instruments')
+ self.components_btn.connect("clicked", self.show_components_view)
+ self.components_btn.set_property("can_focus", False)
+
+ self.graph_btn = gtk.Button('Graph')
+ self.graph_btn.connect("clicked", self.create_graphs_view)
+ self.graph_btn.set_property("can_focus", False)
+
+ self.refresh_btn = gtk.Button('Refresh')
+ self.refresh_btn.connect("clicked", self.refresh_stock_data)
+ self.refresh_btn.set_property("can_focus", False)
+
+ self.quotes_btn = gtk.Button('Quote')
+ self.quotes_btn.connect("clicked", self.show_quotes_view)
+ self.quotes_btn.set_property("can_focus", False)
+
+ self.toolbar.pack_start(self.markets_btn)
+ self.toolbar.pack_start(self.components_btn)
+ self.toolbar.pack_start(self.graph_btn)
+ self.toolbar.pack_start(self.quotes_btn)
+ self.toolbar.pack_start(self.refresh_btn)
+
+ self.mainbox = gtk.VBox()
+
+
+ if FREMANTLE:
+ self.swin = hildon.PannableArea()
+ else:
+ self.swin = gtk.ScrolledWindow()
+ if HILDON:
+ hildon.hildon_helper_set_thumb_scrollbar(self.swin, True)
+ self.swin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ self.swin.add_with_viewport(self.mainbox)
+
+ vbox.pack_start(self.swin, True, True, 0)
+ vbox.pack_start(gtk.HSeparator(), False, False, 5)
+ vbox.pack_start(self.toolbar, False, False, 0)
+
+ self.create_markets_view(self.mainbox)
+ self.window.add(vbox)
+
+ self.window.show_all()
+
+ def create_markets_view(self, widget):
+ names = markets
+ ids = idmarket
+ self.toolbar.hide()
+
+ actual_view = self.mainbox.get_children()
+ if len(actual_view) > 0:
+ for a_widget in actual_view:
+ a_widget.destroy()
+
+ self.marketsbox = gtk.VBox()
+ lnames = len(names)
+
+ for i in range(lnames):
+ button = gtk.Button(names[i])
+ button.connect("clicked", self.create_components_view, ids[i])
+ button.set_size_request(-1, 65)
+ button.set_property("can_focus", False)
+ self.marketsbox.pack_start(button, True, True, 2)
+
+ self.mainbox.pack_start(self.marketsbox, True, True, 2)
+ self.mainbox.show_all()
+
+ def show_components_view(self, widget):
+ kind = self.market_id
+ self.create_components_view(widget, kind)
+
+ def create_components_view(self, widget, kind):
+ actual_view = self.mainbox.get_children()
+ for i in actual_view:
+ i.destroy()
+
+ self.market_id = kind
+ self.toolbar.show()
+ self.components_btn.hide()
+ self.markets_btn.show()
+ self.refresh_btn.hide()
+ self.graph_btn.hide()
+ self.quotes_btn.hide()
+
+ names = localmarkets[idmarket.index(kind)]
+ ids = localids[idmarket.index(kind)]
+
+ self.compbox = gtk.VBox()
+
+ self.components_trv = gtk.TreeView()
+ self.components_trv.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_HORIZONTAL)
+
+ if not FREMANTLE:
+ selection = self.components_trv.get_selection()
+ selection.connect("changed", self.changed_selection, ids)
+ else:
+ self.components_trv.connect("row-activated", self.select_component, ids)
+
+ self.components_trv.set_rubber_banding(True)
+ self.components_trv.set_headers_visible(False)
+ self.components_model = self.__create_components_model()
+ self.components_trv.set_model(self.components_model)
+ self._components_trv_columns(self.components_trv)
+ self.add_initial_components(names, ids)
+
+ self.compbox.pack_start(self.components_trv, True, True, 0)
+
+ self.mainbox.pack_start(self.compbox, True, True, 0)
+ self.mainbox.show_all()
+
+ def select_component(self, widget, path, column, ids):
+ self.create_quotes_view(widget,self.components_model[path][1] )
+
+ def changed_selection(self, widget, ids):
+ n, i, m = self.get_selected_from_treeview(self.components_trv, self.components_model, 1)
+ if n is not None:
+ self.create_quotes_view(widget, n)
+
+ def __create_components_model(self):
+ lstore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
+ return lstore
+
+ def _components_trv_columns(self, treeview):
+ renderer = gtk.CellRendererText()
+ renderer.set_property('scale', 1.3)
+ #renderer.set_property("background", 'lightgray')
+ renderer.set_property("xpad", 15)
+ column = gtk.TreeViewColumn('Name', renderer, text=0)
+ column.set_expand(True)
+ treeview.append_column(column)
+
+ renderer = gtk.CellRendererText()
+ column = gtk.TreeViewColumn('IDS', renderer, text=1)
+ column.set_visible(False)
+ treeview.append_column(column)
+
+ def add_initial_components(self, kind, ids):
+ for i in range(len(kind)):
+ niter = self.components_model.append()
+ self.components_model.set(niter, 0, kind[i], 1, ids[i])
+
+ def get_selected_from_treeview(self, treeview, model, setting):
+ selection = treeview.get_selection()
+ selected_model, selected_iter = selection.get_selected()
+ if selected_iter:
+ selected_name = model.get_value(selected_iter, setting)
+ else:
+ selected_name = None
+ return selected_name, selected_iter, selected_model
+
+ def show_quotes_view(self, widget):
+ kind = self.stocks_id
+ self.create_quotes_view(widget, kind)
+
+ def create_quotes_view(self, widget, kind):
+ self.stocks_id = kind
+ self.toolbar.show()
+ self.components_btn.show()
+ self.markets_btn.show()
+ self.refresh_btn.show()
+ self.graph_btn.show()
+ self.quotes_btn.hide()
+
+ #actual_view = self.mainbox.get_children()
+ #actual_view[0].destroy()
+
+ try:
+ self.graphbox.destroy()
+ except:
+ pass
+
+ for i in range(len(localids)):
+ if kind in localids[i]:
+ ind1, ind2 = i, localids[i].index(kind)
+
+ self.quotesbox = gtk.VBox()
+
+ self.titlelbl = gtk.Label('')
+ self.titlelbl.set_markup('<b><big>'+localmarkets[ind1][ind2].replace('&', '')+'</big></b>')
+ color = gtk.gdk.color_parse("#03A5FF")
+ self.titlelbl.modify_fg(gtk.STATE_NORMAL, color)
+
+ self.databox = gtk.VBox()
+
+ self.imagebox = gtk.VBox()
+ self.dataimg = gtk.Image()
+ self.imagebox.pack_start(self.dataimg)
+
+ self.show_data(kind)
+
+ hbox1 = gtk.HBox()
+
+ label2 = gtk.Label('')
+ label2.set_markup('<b><big>Price:</big></b>')
+ self.lprice = gtk.Label('')
+
+ hbox1.pack_start(label2, False, False, 50)
+ hbox1.pack_start(self.lprice, False, False, 185)
+
+ hbox2 = gtk.HBox()
+
+ label4 = gtk.Label('')
+ label4.set_markup('<b><big>Change:</big></b>')
+ self.lchange = gtk.Label('')
+ self.lpercent = gtk.Label('')
+
+ hbox2.pack_start(label4, False, False, 50)
+ hbox2.pack_start(self.lchange , False, False, 145)
+ hbox2.pack_start(self.lpercent, False, False, 0)
+
+ hbox3 = gtk.HBox()
+
+ label7 = gtk.Label('')
+ label7.set_markup('<b><big>Volume:</big></b>')
+ self.lvolume = gtk.Label('')
+
+ hbox3.pack_start(label7, False, False, 50)
+ hbox3.pack_start(self.lvolume , False, False, 145)
+
+ hbox4 = gtk.HBox()
+
+ label9 = gtk.Label('')
+ label9.set_markup('<b><big>52 week high:</big></b>')
+ self.l52whigh = gtk.Label('')
+
+ hbox4.pack_start(label9, False, False, 50)
+ hbox4.pack_start(self.l52whigh , False, False, 55)
+
+ hbox5 = gtk.HBox()
+
+ label11 = gtk.Label('')
+ label11.set_markup('<b><big>52 week low:</big></b>')
+ self.l52wlow = gtk.Label('')
+
+ hbox5.pack_start(label11, False, False, 50)
+ hbox5.pack_start(self.l52wlow , False, False, 70)
+
+ self.databox.pack_start(hbox1, True, True, 0)
+ self.databox.pack_start(hbox2, True, True, 0)
+ self.databox.pack_start(hbox3, True, True, 0)
+ self.databox.pack_start(hbox4, True, True, 0)
+ self.databox.pack_start(hbox5, True, True, 0)
+
+ self.quotesbox.pack_start(self.titlelbl, False, False, 0)
+ self.quotesbox.pack_start(gtk.HSeparator(), False, False, 0)
+ self.quotesbox.pack_start(self.databox, True, True, 0)
+ self.quotesbox.pack_start(self.imagebox, True, True, 0)
+
+ self.mainbox.pack_start(self.quotesbox, True, True, 0)
+ self.mainbox.show_all()
+ self.compbox.hide()
+ self.databox.hide()
+
+ def show_data(self, kind):
+ import thread
+ self.dataimg.set_from_file(loading_img)
+ self.imagebox.show()
+ self.databox.hide()
+ thread.start_new_thread(self.get_data, (kind,))
+
+ def get_data(self, kind):
+ self.graph_btn.show()
+ self.refresh_btn.show()
+ self.quotes_btn.hide()
+
+ from ystockquote import ystockquote as yt
+ try:
+ data = yt.get_all(kind)
+ 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>')
+
+ try:
+ ch_percent = 100.0 * float(data['change'])/(float(data['price'])-float(data['change']))
+ 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)
+
+ 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)
+
+ self.lvolume.set_label(data['volume'])
+ self.l52whigh.set_label(data['52_week_high'])
+ self.l52wlow.set_label(data['52_week_low'])
+
+ self.databox.show_all()
+ self.imagebox.hide()
+
+ def refresh_stock_data(self, widget):
+ self.show_data(self.stocks_id)
+
+ def create_graphs_view(self, widget):
+ self.graph_btn.hide()
+ self.refresh_btn.hide()
+ self.quotes_btn.show()
+
+ self.graph = gtk.Image()
+
+ kind = self.stocks_id
+
+ self.show_graph(None, '1d', kind)
+
+ for i in range(len(localids)):
+ if kind in localids[i]:
+ ind1, ind2 = i, localids[i].index(kind)
+
+ #self.mainbox.destroy()
+ #self.mainbox = gtk.VBox()
+ #self.swin.add_with_viewport(self.mainbox)
+
+ actual_view = self.mainbox.get_children()
+ for a_widget in actual_view:
+ a_widget.destroy()
+
+ self.graphbox = gtk.VBox()
+
+ self.graphs_title = gtk.Label(localmarkets[ind1][ind2])
+ color = gtk.gdk.color_parse("#03A5FF")
+ self.graphs_title.modify_fg(gtk.STATE_NORMAL, color)
+
+ hbox1 = gtk.HBox()
+ hbox1.set_size_request(-1, 55)
+ hbox1.set_homogeneous(True)
+
+ self.btn1d = gtk.Button('1d')
+ self.btn1d.set_property("can_focus", False)
+ self.btn1d.connect("clicked", self.show_graph, '1d', kind)
+ self.btn5d = gtk.Button('5d')
+ self.btn5d.set_property("can_focus", False)
+ self.btn5d.connect("clicked", self.show_graph, '5d', kind)
+ self.btn3m = gtk.Button('3m')
+ self.btn3m.set_property("can_focus", False)
+ self.btn3m.connect("clicked", self.show_graph, '3m', kind)
+ self.btn6m = gtk.Button('6m')
+ self.btn6m.set_property("can_focus", False)
+ self.btn6m.connect("clicked", self.show_graph, '6m', kind)
+ self.btn1y = gtk.Button('1y')
+ self.btn1y.set_property("can_focus", False)
+ self.btn1y.connect("clicked", self.show_graph, '1y', kind)
+ self.btn2y = gtk.Button('2y')
+ self.btn2y.set_property("can_focus", False)
+ self.btn2y.connect("clicked", self.show_graph, '2y', kind)
+ self.btn5y = gtk.Button('5y')
+ self.btn5y.set_property("can_focus", False)
+ self.btn5y.connect("clicked", self.show_graph, '5y', kind)
+ self.btnmax = gtk.Button('max')
+ self.btnmax.set_property("can_focus", False)
+ self.btnmax.connect("clicked", self.show_graph, 'max', kind)
+
+ hbox1.pack_start(self.btn1d)
+ hbox1.pack_start(self.btn5d)
+ hbox1.pack_start(self.btn3m)
+ hbox1.pack_start(self.btn6m)
+ hbox1.pack_start(self.btn1y)
+ hbox1.pack_start(self.btn2y)
+ hbox1.pack_start(self.btn5y)
+ hbox1.pack_start(self.btnmax)
+
+ self.graphbox.pack_start(self.graphs_title, False, False, 2)
+ self.graphbox.pack_start(hbox1, False, False, 0)
+ self.graphbox.pack_start(self.graph, True, True, 5)
+
+ self.mainbox.pack_start(self.graphbox, False, False, 2)
+ self.mainbox.show_all()
+
+ def show_graph(self, widget, option, kind):
+ import thread
+ self.graph.set_from_file(loading_img)
+ thread.start_new_thread(self.get_graph_data, (option, kind))
+
+ def get_graph_data(self, option, kind):
+ if option == '1d':
+ url = 'http://uk.ichart.yahoo.com/b?s=%s' % kind
+ elif option == '5d':
+ url = 'http://uk.ichart.yahoo.com/w?s=%s' % kind
+ elif option == '3m':
+ url = 'http://chart.finance.yahoo.com/c/3m/s/%s' % kind.lower()
+ elif option == '6m':
+ url = 'http://chart.finance.yahoo.com/c/6m/s/%s' % kind.lower()
+ elif option == '1y':
+ url = 'http://chart.finance.yahoo.com/c/1y/s/%s' % kind.lower()
+ elif option == '2y':
+ url = 'http://chart.finance.yahoo.com/c/2y/s/%s' % kind.lower()
+ elif option == '5y':
+ url = 'http://chart.finance.yahoo.com/c/5y/s/%s' % kind.lower()
+ elif option == 'max':
+ url = 'http://chart.finance.yahoo.com/c/my/s/%s' % kind.lower()
+
+ try:
+ myimg = urllib2.urlopen(url)
+ imgdata=myimg.read()
+
+ pbl = gtk.gdk.PixbufLoader()
+ pbl.write(imgdata)
+
+ pbuf = pbl.get_pixbuf()
+ pbl.close()
+ self.graph.set_from_pixbuf(pbuf)
+ except:
+ print 'no internet data'
+ self.graphs_title.set_label('Failed to get data')
+ self.graph.destroy()
+
+
+ #Functions for fullscreen
+ def on_window_state_change(self, widget, event, *args):
+ if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
+ self.window_in_fullscreen = True
+ else:
+ self.window_in_fullscreen = False
+
+ #F6 fullscreen, F7 bigger font, F8 smaller font
+ def on_key_press(self, widget, event, *args):
+ if event.keyval == gtk.keysyms.F6:
+ if self.window_in_fullscreen:
+ self.window.unfullscreen ()
+ else:
+ self.window.fullscreen ()
+
+ def on_about(self, widget):
+ dialog = gtk.AboutDialog()
+ dialog.set_name("StockThis")
+ dialog.set_version("0.2")
+ 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"])
+ dialog.run()
+ dialog.destroy()
+
+if __name__ == "__main__":
+ stockspy = StocksPy()
+ gtk.gdk.threads_enter()
+ gtk.main()
+ gtk.gdk.threads_leave()
import urllib2
import gtk, gobject
-try:
- import hildon
- HILDON = True
-except:
- HILDON = False
-
-try:
- import osso
- OSSO = True
- osso_c = osso.Context("net.yerga.stockthis", "0.2", False)
-except:
- OSSO = False
-from marketdata import markets, idmarket, localmarkets, localids
+import hildon
+
+#import osso
+#osso_c = osso.Context("net.yerga.stockthis", "0.2", False)
-#TODO: detect if running in Fremantle
-FREMANTLE=True
+from marketdata import markets, idmarket, localmarkets, localids
#detect if is ran locally or not
import sys
loading_img = imgdir + 'loading.gif'
+fhsize = gtk.HILDON_SIZE_FINGER_HEIGHT
+horbtn = hildon.BUTTON_ARRANGEMENT_HORIZONTAL
+ui_normal = gtk.HILDON_UI_MODE_NORMAL
+winprogind = hildon.hildon_gtk_window_set_progress_indicator
+
gtk.gdk.threads_init()
class StocksPy:
def __init__(self):
- if HILDON:
- self.program = hildon.Program()
- self.program.__init__()
- gtk.set_application_name('')
- if FREMANTLE:
- self.window = hildon.StackableWindow()
- else:
- self.window = hildon.Window()
- self.program.add_window(self.window)
- else:
- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-
+ self.program = hildon.Program()
+ self.program.__init__()
+ gtk.set_application_name("StockThis")
+ self.window = hildon.StackableWindow()
self.window.set_default_size(800, 480)
- self.window.set_title('StockThis')
+ self.program.add_window(self.window)
self.window.connect("destroy", gtk.main_quit)
- self.window.connect("key-press-event", self.on_key_press)
- self.window.connect("window-state-event", self.on_window_state_change)
- self.window_in_fullscreen = False
-
- if HILDON:
- if FREMANTLE:
- menu = hildon.AppMenu()
- self.window.set_app_menu(menu)
- about_menu = gtk.Button("About")
- about_menu.connect("clicked", self.on_about)
- else:
- menu = gtk.Menu()
- self.window.set_menu(menu)
- about_menu = gtk.MenuItem("About")
- about_menu.set_size_request(-1, 55)
- about_menu.connect("activate", self.on_about)
-
- menu.append(about_menu)
- menu.show_all()
- else:
- #TODO: create a gtk.menubar
- pass
+ menu = hildon.AppMenu()
+ self.window.set_app_menu(menu)
+ button = gtk.Button("About")
+ button.connect("clicked", self.on_about)
+ menu.append(button)
+ menu.show_all()
vbox = gtk.VBox()
+ toolbar = self.main_toolbar(False)
- self.toolbar = gtk.HBox()
- self.toolbar.set_property("no-show-all", True)
- self.toolbar.hide()
- self.toolbar.set_homogeneous(True)
- self.toolbar.set_size_request(-1, 55)
-
- self.markets_btn = gtk.Button('Markets')
- self.markets_btn.connect("clicked", self.create_markets_view)
- self.markets_btn.set_property("can_focus", False)
-
- self.components_btn = gtk.Button('Instruments')
- self.components_btn.connect("clicked", self.show_components_view)
- self.components_btn.set_property("can_focus", False)
-
- self.graph_btn = gtk.Button('Graph')
- self.graph_btn.connect("clicked", self.create_graphs_view)
- self.graph_btn.set_property("can_focus", False)
-
- self.refresh_btn = gtk.Button('Refresh')
- self.refresh_btn.connect("clicked", self.refresh_stock_data)
- self.refresh_btn.set_property("can_focus", False)
-
- self.quotes_btn = gtk.Button('Quote')
- self.quotes_btn.connect("clicked", self.show_quotes_view)
- self.quotes_btn.set_property("can_focus", False)
-
- self.toolbar.pack_start(self.markets_btn)
- self.toolbar.pack_start(self.components_btn)
- self.toolbar.pack_start(self.graph_btn)
- self.toolbar.pack_start(self.quotes_btn)
- self.toolbar.pack_start(self.refresh_btn)
-
- self.mainbox = gtk.VBox()
+ parea = hildon.PannableArea()
+ tv = hildon.GtkTreeView(ui_normal)
+ inmodel = self.__create_model(markets, idmarket)
+ tv.connect("row-activated", self.show_instrument_view, inmodel)
+ tv.set_model(inmodel)
+ self._tv_columns(tv)
+ parea.add(tv)
-
- if FREMANTLE:
- self.swin = hildon.PannableArea()
- else:
- self.swin = gtk.ScrolledWindow()
- if HILDON:
- hildon.hildon_helper_set_thumb_scrollbar(self.swin, True)
- self.swin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- self.swin.add_with_viewport(self.mainbox)
-
- vbox.pack_start(self.swin, True, True, 0)
+ vbox.pack_start(parea, True, True, 0)
vbox.pack_start(gtk.HSeparator(), False, False, 5)
- vbox.pack_start(self.toolbar, False, False, 0)
+ vbox.pack_start(toolbar, False, False, 0)
- self.create_markets_view(self.mainbox)
self.window.add(vbox)
-
self.window.show_all()
- def create_markets_view(self, widget):
- names = markets
- ids = idmarket
- self.toolbar.hide()
-
- actual_view = self.mainbox.get_children()
- if len(actual_view) > 0:
- for a_widget in actual_view:
- a_widget.destroy()
-
- self.marketsbox = gtk.VBox()
- lnames = len(names)
-
- for i in range(lnames):
- button = gtk.Button(names[i])
- button.connect("clicked", self.create_components_view, ids[i])
- button.set_size_request(-1, 65)
- button.set_property("can_focus", False)
- self.marketsbox.pack_start(button, True, True, 2)
-
- self.mainbox.pack_start(self.marketsbox, True, True, 2)
- self.mainbox.show_all()
-
- def show_components_view(self, widget):
- kind = self.market_id
- self.create_components_view(widget, kind)
-
- def create_components_view(self, widget, kind):
- actual_view = self.mainbox.get_children()
- for i in actual_view:
- i.destroy()
-
- self.market_id = kind
- self.toolbar.show()
- self.components_btn.hide()
- self.markets_btn.show()
- self.refresh_btn.hide()
- self.graph_btn.hide()
- self.quotes_btn.hide()
-
- names = localmarkets[idmarket.index(kind)]
- ids = localids[idmarket.index(kind)]
-
- self.compbox = gtk.VBox()
-
- self.components_trv = gtk.TreeView()
- self.components_trv.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_HORIZONTAL)
-
- if not FREMANTLE:
- selection = self.components_trv.get_selection()
- selection.connect("changed", self.changed_selection, ids)
- else:
- self.components_trv.connect("row-activated", self.select_component, ids)
-
- self.components_trv.set_rubber_banding(True)
- self.components_trv.set_headers_visible(False)
- self.components_model = self.__create_components_model()
- self.components_trv.set_model(self.components_model)
- self._components_trv_columns(self.components_trv)
- self.add_initial_components(names, ids)
-
- self.compbox.pack_start(self.components_trv, True, True, 0)
+ def show_instrument_view(self, widget, path, column, inmodel):
+ market = inmodel[path][0]
- self.mainbox.pack_start(self.compbox, True, True, 0)
- self.mainbox.show_all()
+ names = localmarkets[idmarket.index(market)]
+ ids = localids[idmarket.index(market)]
- def select_component(self, widget, path, column, ids):
- self.create_quotes_view(widget,self.components_model[path][1] )
+ window = hildon.StackableWindow()
- def changed_selection(self, widget, ids):
- n, i, m = self.get_selected_from_treeview(self.components_trv, self.components_model, 1)
- if n is not None:
- self.create_quotes_view(widget, n)
-
- def __create_components_model(self):
- lstore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
- return lstore
-
- def _components_trv_columns(self, treeview):
- renderer = gtk.CellRendererText()
- renderer.set_property('scale', 1.3)
- #renderer.set_property("background", 'lightgray')
- renderer.set_property("xpad", 15)
- column = gtk.TreeViewColumn('Name', renderer, text=0)
- column.set_expand(True)
- treeview.append_column(column)
+ vbox = gtk.VBox()
+ toolbar = self.main_toolbar(False)
- renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn('IDS', renderer, text=1)
- column.set_visible(False)
- treeview.append_column(column)
+ parea = hildon.PannableArea()
+ tv = hildon.GtkTreeView(ui_normal)
+ model = self.__create_model(names, ids)
+ tv.connect("row-activated", self.show_quotes_view, model)
+ tv.set_model(model)
+ self._tv_columns(tv)
+ parea.add(tv)
- def add_initial_components(self, kind, ids):
- for i in range(len(kind)):
- niter = self.components_model.append()
- self.components_model.set(niter, 0, kind[i], 1, ids[i])
+ vbox.pack_start(parea, True, True, 0)
+ vbox.pack_start(gtk.HSeparator(), False, False, 5)
+ vbox.pack_start(toolbar, False, False, 0)
- def get_selected_from_treeview(self, treeview, model, setting):
- selection = treeview.get_selection()
- selected_model, selected_iter = selection.get_selected()
- if selected_iter:
- selected_name = model.get_value(selected_iter, setting)
- else:
- selected_name = None
- return selected_name, selected_iter, selected_model
+ window.add(vbox)
+ window.show_all()
- def show_quotes_view(self, widget):
- kind = self.stocks_id
- self.create_quotes_view(widget, kind)
- def create_quotes_view(self, widget, kind):
- self.stocks_id = kind
- self.toolbar.show()
- self.components_btn.show()
- self.markets_btn.show()
- self.refresh_btn.show()
- self.graph_btn.show()
- self.quotes_btn.hide()
+ def show_quotes_view(self, widget, path, column, model):
+ quote = model[path][0], model[path][1]
- #actual_view = self.mainbox.get_children()
- #actual_view[0].destroy()
+ self.stocks_id = quote[0]
+ self.stocks_name = quote[1]
+ print quote
- try:
- self.graphbox.destroy()
- except:
- pass
+ self.quotes_win = hildon.StackableWindow()
- for i in range(len(localids)):
- if kind in localids[i]:
- ind1, ind2 = i, localids[i].index(kind)
+ vbox = gtk.VBox()
+ toolbar = self.main_toolbar(True)
- self.quotesbox = gtk.VBox()
self.titlelbl = gtk.Label('')
- self.titlelbl.set_markup('<b><big>'+localmarkets[ind1][ind2].replace('&', '')+'</big></b>')
+ self.titlelbl.set_markup('<b><big>' + quote[1].replace('&', '') +
+ '</big></b>')
color = gtk.gdk.color_parse("#03A5FF")
self.titlelbl.modify_fg(gtk.STATE_NORMAL, color)
- self.databox = gtk.VBox()
-
- self.imagebox = gtk.VBox()
- self.dataimg = gtk.Image()
- self.imagebox.pack_start(self.dataimg)
+ parea = hildon.PannableArea()
- self.show_data(kind)
+ vbox1 = gtk.VBox()
- hbox1 = gtk.HBox()
-
- label2 = gtk.Label('')
- label2.set_markup('<b><big>Price:</big></b>')
+ hbox = gtk.HBox()
+ label = gtk.Label('')
+ label.set_markup('<b><big>Price:</big></b>')
self.lprice = gtk.Label('')
+ hbox.pack_start(label, False, False, 50)
+ hbox.pack_start(self.lprice, False, False, 185)
+ vbox1.pack_start(hbox, True, True, 0)
- hbox1.pack_start(label2, False, False, 50)
- hbox1.pack_start(self.lprice, False, False, 185)
-
- hbox2 = gtk.HBox()
-
- label4 = gtk.Label('')
- label4.set_markup('<b><big>Change:</big></b>')
+ hbox = gtk.HBox()
+ label = gtk.Label('')
+ label.set_markup('<b><big>Change:</big></b>')
self.lchange = gtk.Label('')
self.lpercent = gtk.Label('')
-
- hbox2.pack_start(label4, False, False, 50)
- hbox2.pack_start(self.lchange , False, False, 145)
- hbox2.pack_start(self.lpercent, False, False, 0)
-
- hbox3 = gtk.HBox()
-
- label7 = gtk.Label('')
- label7.set_markup('<b><big>Volume:</big></b>')
+ hbox.pack_start(label, False, False, 50)
+ hbox.pack_start(self.lchange, False, False, 145)
+ hbox.pack_start(self.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('')
+ hbox.pack_start(label, False, False, 50)
+ hbox.pack_start(self.lvolume, False, False, 145)
+ vbox1.pack_start(hbox, True, True, 0)
- hbox3.pack_start(label7, False, False, 50)
- hbox3.pack_start(self.lvolume , False, False, 145)
-
- hbox4 = gtk.HBox()
-
- label9 = gtk.Label('')
- label9.set_markup('<b><big>52 week high:</big></b>')
+ hbox = gtk.HBox()
+ label = gtk.Label('')
+ label.set_markup('<b><big>52 week high:</big></b>')
self.l52whigh = gtk.Label('')
+ hbox.pack_start(label, False, False, 50)
+ hbox.pack_start(self.l52whigh, False, False, 55)
+ vbox1.pack_start(hbox, True, True, 0)
- hbox4.pack_start(label9, False, False, 50)
- hbox4.pack_start(self.l52whigh , False, False, 55)
-
- hbox5 = gtk.HBox()
-
- label11 = gtk.Label('')
- label11.set_markup('<b><big>52 week low:</big></b>')
+ hbox = gtk.HBox()
+ label = gtk.Label('')
+ label.set_markup('<b><big>52 week low:</big></b>')
self.l52wlow = gtk.Label('')
+ hbox.pack_start(label, False, False, 50)
+ hbox.pack_start(self.l52wlow, False, False, 70)
+ vbox1.pack_start(hbox, True, True, 0)
+
+ hbox = gtk.HBox()
+
+ button = hildon.PickerButton(fhsize, horbtn)
+ #FIXME: touchentry selector
+ data = ["50", "100", "200", "300", "400", "500", "600", "700", "800",
+ "900", "1000"]
+ selector = self.create_selector(data)
+ button.set_selector(selector)
+ button.set_title("Shares")
+ #FIXME: check portfolio and see if there's quotes
+ button.set_value(data[0])
+ hbox.pack_start(button, True, True, 0)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_title("Add to Portfolio")
+ #button.connect("clicked", self.publish_opt_screen)
+ hbox.pack_start(button, True, True, 0)
+ vbox1.pack_start(hbox, False, False, 0)
+
+ parea.add_with_viewport(vbox1)
+
+ vbox.pack_start(self.titlelbl, 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)
- hbox5.pack_start(label11, False, False, 50)
- hbox5.pack_start(self.l52wlow , False, False, 70)
-
- self.databox.pack_start(hbox1, True, True, 0)
- self.databox.pack_start(hbox2, True, True, 0)
- self.databox.pack_start(hbox3, True, True, 0)
- self.databox.pack_start(hbox4, True, True, 0)
- self.databox.pack_start(hbox5, True, True, 0)
+ self.quotes_win.add(vbox)
+ self.quotes_win.show_all()
+ self.show_data(quote[0], self.quotes_win)
- self.quotesbox.pack_start(self.titlelbl, False, False, 0)
- self.quotesbox.pack_start(gtk.HSeparator(), False, False, 0)
- self.quotesbox.pack_start(self.databox, True, True, 0)
- self.quotesbox.pack_start(self.imagebox, True, True, 0)
+ def create_selector(self, data):
+ selector = hildon.hildon_touch_selector_new_text()
+ for i in range(len(data)):
+ selector.append_text(data[i])
- self.mainbox.pack_start(self.quotesbox, True, True, 0)
- self.mainbox.show_all()
- self.compbox.hide()
- self.databox.hide()
+ return selector
- def show_data(self, kind):
+ def show_data(self, quote, win):
import thread
- self.dataimg.set_from_file(loading_img)
- self.imagebox.show()
- self.databox.hide()
- thread.start_new_thread(self.get_data, (kind,))
-
- def get_data(self, kind):
- self.graph_btn.show()
- self.refresh_btn.show()
- self.quotes_btn.hide()
+ winprogind(win, 1)
+ thread.start_new_thread(self.get_data, (quote, win))
+ def get_data(self, quote, win):
from ystockquote import ystockquote as yt
try:
- data = yt.get_all(kind)
+ data = yt.get_all(quote)
except:
print 'Failed to get internet data'
data = {'price': 'N/A', 'change': 'N/A', 'volume':'N/A',
self.titlelbl.set_markup('<b><big>Failed to get data</big></b>')
try:
- ch_percent = 100.0 * float(data['change'])/(float(data['price'])-float(data['change']))
+ ch_percent = \
+ 100.0 * float(data['change'])/(float(data['price']) - \
+ float(data['change']))
except ValueError:
ch_percent = 0.0
self.l52whigh.set_label(data['52_week_high'])
self.l52wlow.set_label(data['52_week_low'])
- self.databox.show_all()
- self.imagebox.hide()
+ winprogind(win, 0)
def refresh_stock_data(self, widget):
- self.show_data(self.stocks_id)
+ self.show_data(self.stocks_id, self.quotes_win)
- def create_graphs_view(self, widget):
- self.graph_btn.hide()
- self.refresh_btn.hide()
- self.quotes_btn.show()
- self.graph = gtk.Image()
+ def show_graph_view(self, widget):
+ win = hildon.StackableWindow()
- kind = self.stocks_id
+ vbox = gtk.VBox()
+ toolbar = self.main_toolbar(False)
+
+ self.graphs_title = gtk.Label(self.stocks_name)
+ color = gtk.gdk.color_parse("#03A5FF")
+ self.graphs_title.modify_fg(gtk.STATE_NORMAL, color)
- self.show_graph(None, '1d', kind)
+ parea = hildon.PannableArea()
- for i in range(len(localids)):
- if kind in localids[i]:
- ind1, ind2 = i, localids[i].index(kind)
+ hbox = gtk.HBox()
+ hbox.set_homogeneous(True)
- #self.mainbox.destroy()
- #self.mainbox = gtk.VBox()
- #self.swin.add_with_viewport(self.mainbox)
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('1d')
+ button.connect("clicked", self.show_graph, '1d', win)
+ hbox.pack_start(button)
- actual_view = self.mainbox.get_children()
- for a_widget in actual_view:
- a_widget.destroy()
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('5d')
+ button.connect("clicked", self.show_graph, '5d', win)
+ hbox.pack_start(button)
- self.graphbox = gtk.VBox()
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('3m')
+ button.connect("clicked", self.show_graph, '3m', win)
+ hbox.pack_start(button)
- self.graphs_title = gtk.Label(localmarkets[ind1][ind2])
- color = gtk.gdk.color_parse("#03A5FF")
- self.graphs_title.modify_fg(gtk.STATE_NORMAL, color)
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('6m')
+ button.connect("clicked", self.show_graph, '6m', win)
+ hbox.pack_start(button)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('1y')
+ button.connect("clicked", self.show_graph, '1y', win)
+ hbox.pack_start(button)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('2y')
+ button.connect("clicked", self.show_graph, '2y', win)
+ hbox.pack_start(button)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('5y')
+ button.connect("clicked", self.show_graph, '5y', win)
+ hbox.pack_start(button)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_label('Max')
+ button.connect("clicked", self.show_graph, 'max', win)
+ hbox.pack_start(button)
+
+ vbox1 = gtk.VBox()
+ vbox1.pack_start(hbox, False, False, 0)
+
+ self.graph = gtk.Image()
+ vbox1.pack_start(self.graph, True, True, 0)
+
+ parea.add_with_viewport(vbox1)
+
+ vbox.pack_start(self.graphs_title, 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)
+
+ win.add(vbox)
+ win.show_all()
- hbox1 = gtk.HBox()
- hbox1.set_size_request(-1, 55)
- hbox1.set_homogeneous(True)
-
- self.btn1d = gtk.Button('1d')
- self.btn1d.set_property("can_focus", False)
- self.btn1d.connect("clicked", self.show_graph, '1d', kind)
- self.btn5d = gtk.Button('5d')
- self.btn5d.set_property("can_focus", False)
- self.btn5d.connect("clicked", self.show_graph, '5d', kind)
- self.btn3m = gtk.Button('3m')
- self.btn3m.set_property("can_focus", False)
- self.btn3m.connect("clicked", self.show_graph, '3m', kind)
- self.btn6m = gtk.Button('6m')
- self.btn6m.set_property("can_focus", False)
- self.btn6m.connect("clicked", self.show_graph, '6m', kind)
- self.btn1y = gtk.Button('1y')
- self.btn1y.set_property("can_focus", False)
- self.btn1y.connect("clicked", self.show_graph, '1y', kind)
- self.btn2y = gtk.Button('2y')
- self.btn2y.set_property("can_focus", False)
- self.btn2y.connect("clicked", self.show_graph, '2y', kind)
- self.btn5y = gtk.Button('5y')
- self.btn5y.set_property("can_focus", False)
- self.btn5y.connect("clicked", self.show_graph, '5y', kind)
- self.btnmax = gtk.Button('max')
- self.btnmax.set_property("can_focus", False)
- self.btnmax.connect("clicked", self.show_graph, 'max', kind)
-
- hbox1.pack_start(self.btn1d)
- hbox1.pack_start(self.btn5d)
- hbox1.pack_start(self.btn3m)
- hbox1.pack_start(self.btn6m)
- hbox1.pack_start(self.btn1y)
- hbox1.pack_start(self.btn2y)
- hbox1.pack_start(self.btn5y)
- hbox1.pack_start(self.btnmax)
-
- self.graphbox.pack_start(self.graphs_title, False, False, 2)
- self.graphbox.pack_start(hbox1, False, False, 0)
- self.graphbox.pack_start(self.graph, True, True, 5)
-
- self.mainbox.pack_start(self.graphbox, False, False, 2)
- self.mainbox.show_all()
-
- def show_graph(self, widget, option, kind):
+ self.show_graph(None, '1d', win)
+
+ def show_graph(self, widget, option, win):
import thread
- self.graph.set_from_file(loading_img)
- thread.start_new_thread(self.get_graph_data, (option, kind))
+ winprogind(win, 1)
+ thread.start_new_thread(self.get_graph_data, (option, win))
- def get_graph_data(self, option, kind):
+ def get_graph_data(self, option, win):
+ kind = self.stocks_id
if option == '1d':
url = 'http://uk.ichart.yahoo.com/b?s=%s' % kind
elif option == '5d':
try:
myimg = urllib2.urlopen(url)
- imgdata=myimg.read()
+ imgdata = myimg.read()
pbl = gtk.gdk.PixbufLoader()
pbl.write(imgdata)
pbuf = pbl.get_pixbuf()
pbl.close()
self.graph.set_from_pixbuf(pbuf)
+ winprogind(win, 0)
except:
- print 'no internet data'
+ winprogind(win, 0)
self.graphs_title.set_label('Failed to get data')
self.graph.destroy()
- #Functions for fullscreen
- def on_window_state_change(self, widget, event, *args):
- if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
- self.window_in_fullscreen = True
- else:
- self.window_in_fullscreen = False
-
- #F6 fullscreen, F7 bigger font, F8 smaller font
- def on_key_press(self, widget, event, *args):
- if event.keyval == gtk.keysyms.F6:
- if self.window_in_fullscreen:
- self.window.unfullscreen ()
- else:
- self.window.fullscreen ()
+
+ def _tv_columns(self, treeview):
+ column = gtk.TreeViewColumn('ID', gtk.CellRendererText(), text=0)
+ column.set_visible(False)
+ treeview.append_column(column)
+
+ column = gtk.TreeViewColumn('Name', gtk.CellRendererText(), text=1)
+ treeview.append_column(column)
+
+ def __create_model(self, names, ids):
+ lstore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
+ for item in range(len(names)):
+ iter = lstore.append()
+ lstore.set(iter, 0, ids[item], 1, names[item])
+ return lstore
+
+ def main_toolbar(self, quotesview):
+ toolbar = gtk.HBox()
+ toolbar.set_homogeneous(True)
+
+ portfolio_btn = hildon.Button(fhsize, horbtn)
+ portfolio_btn.set_title("Portfolio")
+ portfolio_btn.connect("clicked", self.show_portfolio_view)
+
+ graph_btn = hildon.Button(fhsize, horbtn)
+ graph_btn.set_title("Graph")
+ graph_btn.connect("clicked", self.show_graph_view)
+
+ refresh_btn = hildon.Button(fhsize, horbtn)
+ refresh_btn.set_title("Refresh")
+ refresh_btn.connect("clicked", self.refresh_stock_data)
+
+ toolbar.pack_start(portfolio_btn)
+ if quotesview:
+ toolbar.pack_start(graph_btn)
+ toolbar.pack_start(refresh_btn)
+
+ toolbar.show_all()
+
+ return toolbar
+
+ def show_portfolio_view(self, widget):
+ #FIXME: get data from sqlite settings
+ data = [["SAN.MC", "BANCO SANTANDER R", "200", "-"],
+ ["BBVA.MC", "BBVA R", "300", "-"]]
+ win = hildon.StackableWindow()
+
+ vbox = gtk.VBox()
+
+ parea = hildon.PannableArea()
+ tv = hildon.GtkTreeView(ui_normal)
+ tv.set_headers_visible(True)
+ inmodel = self._create_portfolio_model(data)
+ #tv.connect("row-activated", self.show_instrument_view, inmodel)
+ tv.set_model(inmodel)
+ self._tv_portfolio_columns(tv)
+ parea.add(tv)
+
+ button = hildon.Button(fhsize, horbtn)
+ button.set_title("Refresh All")
+ button.connect("clicked", self.refresh_portfolio, tv, win, data)
+
+ vbox.pack_start(parea, True, True, 0)
+ vbox.pack_start(button, False, False, 0)
+ win.add(vbox)
+ win.show_all()
+
+ def refresh_portfolio(self, widget, tv, win, data):
+ import thread
+ winprogind(win, 1)
+ thread.start_new_thread(self._do_refresh_portfolio, (data, tv, win))
+
+
+ def _do_refresh_portfolio(self, data, tv, win):
+ for item in data:
+ item[3] = self.get_price(item[0])
+
+ model = self._create_portfolio_model(data)
+ tv.set_model(model)
+ winprogind(win, 0)
+
+ def get_price(self, symbol):
+ from ystockquote import ystockquote as yt
+ price = yt.get_price(symbol)
+
+ return price
+
+ def _create_portfolio_model(self, data):
+ lstore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
+ gobject.TYPE_STRING, gobject.TYPE_STRING)
+ for item in data:
+ iter = lstore.append()
+ lstore.set(iter, 0, item[0], 1, item[1], 2, item[2], 3, item[3])
+ return lstore
+
+ def _tv_portfolio_columns(self, treeview):
+ column = gtk.TreeViewColumn('ID', gtk.CellRendererText(), text=0)
+ column.set_visible(False)
+ treeview.append_column(column)
+
+ column = gtk.TreeViewColumn('Name', gtk.CellRendererText(), text=1)
+ column.set_property("expand", True)
+ treeview.append_column(column)
+
+ column = gtk.TreeViewColumn('Shares', gtk.CellRendererText(), text=2)
+ treeview.append_column(column)
+
+ column = gtk.TreeViewColumn('Price', gtk.CellRendererText(), text=3)
+ treeview.append_column(column)
def on_about(self, widget):
dialog = gtk.AboutDialog()