# files to install
inst_desktop = ['stockthis.desktop']
-inst_py = ['stockthis.py', 'marketdata.py', 'settings.py']
+inst_py = ['stockthis.py', 'marketdata.py', 'settings.py', 'portrait.py']
pixmaps = ['pixmaps/stockthis.png', 'pixmaps/maemoorg.png']
inst_dbus = ['stockthis.service']
inst_icon = ['stockthis.png']
data_files = [
('share/applications/hildon', inst_desktop),
- ('share/stockthis', inst_py),
- ('share/stockthis/pixmaps', pixmaps),
+ ('/opt/stockthis', inst_py),
+ ('/opt/stockthis/pixmaps', pixmaps),
('share/icons/hicolor/26x26/hildon/', inst_icon),
('share/icons/hicolor/scalable/hildon/', inst_icon_sca),
('share/dbus-1/services', inst_dbus),
#detect if is ran locally or not
runningpath = sys.path[0]
-if '/usr/share' in runningpath:
+if '/opt/' in runningpath:
runninglocally = False
else:
runninglocally = True
settingsdb, imgdir, configdir, logfile = \
settings.define_paths(runninglocally, HOME)
-
logger = logging.getLogger('st')
logging.basicConfig(filename=logfile,level=logging.ERROR, filemode='w')
self.window.add(vbox)
self.window.show_all()
+ self.show_info_banner(self.window,
+ ("StockThis uses your network connection to get data.\n"
+ "Be aware of the high costs that your network provider may apply."))
+
def create_menu(self, window):
menu = hildon.AppMenu()
window.set_app_menu(menu)
window = hildon.StackableWindow()
self.create_menu(window)
- window.set_title("StockThis - " + inmodel[path][1])
+ window.set_title(inmodel[path][1])
vbox = gtk.VBox()
toolbar = self.main_toolbar(False, False, None, '', '', False)
win = hildon.StackableWindow()
self.create_menu(win)
- win.set_title("StockThis - Quotes View - " + quote[1])
+ win.set_title(quote[1])
vbox = gtk.VBox()
shares = item[2]
return shares
except:
- logger.exception("Getting shares from symbol")
+ logger.exception("Getting shares from symbol: %s" % symbol)
return shares
def add_to_portfolio(self, widget, button, symbol, name):
self.show_info_banner(widget, "Added to portfolio")
except:
- logger.exception("Adding to portfolio")
+ logger.exception("Adding to portfolio: %s, %s" % (symbol, name))
self.show_info_banner(widget, "Error adding to portfolio")
try:
data = yt.get_all(symbol)
except:
- logger.exception("Getting data from Yahoo")
+ logger.exception("Getting data from Yahoo: %s" % symbol)
data = {'price': 'N/A', 'change': 'N/A', 'volume':'N/A',
'52_week_high': 'N/A', '52_week_low': 'N/A'}
ltitle.set_markup('<b><big>Failed to get data</big></b>')
def show_graph_view(self, widget, symbol, name):
win = hildon.StackableWindow()
self.create_menu(win)
- win.set_title("StockThis - Graph View - " + name)
+ win.set_title(name)
vbox = gtk.VBox()
toolbar = self.main_toolbar(False, True, None, '', '', False)
self.graph.set_from_pixbuf(pbuf)
winprogind(win, 0)
except:
- logger.exception("Getting graph data")
+ logger.exception("Getting graph data: %s" % url)
winprogind(win, 0)
self.graphs_title.set_label('Failed to get data')
self.graph.destroy()
if allnames == []:
for market in marketdata.eunames:
for company in market:
- if not company in allnames:
- allnames.append(company)
+ allnames.append(company)
for market in marketdata.omnames:
for company in market:
- if not company in allnames:
- allnames.append(company)
+ allnames.append(company)
for market in marketdata.usnames:
for company in market:
- if not company in allnames:
- allnames.append(company)
+ allnames.append(company)
if allsymbols == []:
for market in marketdata.eusymbols:
for company in market:
- if not company in allsymbols:
- allsymbols.append(company)
+ allsymbols.append(company)
for market in marketdata.omsymbols:
for company in market:
- if not company in allsymbols:
- allsymbols.append(company)
+ allsymbols.append(company)
for market in marketdata.ussymbols:
for company in market:
- if not company in allsymbols:
- allsymbols.append(company)
+ allsymbols.append(company)
new_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
for i in range(len(allnames)):
if text.lower() in allnames[i].lower():
niter = new_model.append()
+ #print allsymbols[i], allnames[i]
+ #FIXME: repeated companies in the results list
+ #print if allnames[i]
+ #for j in new_model:
+ # if j[1] == allnames[i]:
new_model.set(niter, 0, allsymbols[i], 1, allnames[i])
if len(new_model) == 0:
def show_search_screen(self, model, text):
window = hildon.StackableWindow()
self.create_menu(window)
- window.set_title("StockThis - Search for " + text)
+ window.set_title("Search for " + text)
vbox = gtk.VBox()
toolbar = self.main_toolbar(False, False, None, '', '', False)
win = hildon.StackableWindow()
self.create_menu(win)
- win.set_title("StockThis - Portfolio")
+ win.set_title("Portfolio")
vbox = gtk.VBox()
price = yt.get_price(symbol)
return price
except:
- logger.exception("Getting price from Yahoo")
+ logger.exception("Getting price from Yahoo: %s" % symbol)
return "N/A"
def _create_portfolio_model(self, data):
elif action == "vote":
url = "http://maemo.org/downloads/product/stockthis"
- iface.load_url(url)
+ iface.open_new_window(url)
def show_info(self, widget, kind):
if kind == 'license':