summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--invest-applet/invest/Makefile.am2
-rw-r--r--invest-applet/invest/about.py6
-rw-r--r--invest-applet/invest/applet.py24
-rw-r--r--invest-applet/invest/chart.py14
-rwxr-xr-xinvest-applet/invest/invest-applet.py28
-rwxr-xr-xinvest-applet/invest/mate-invest-chart10
-rw-r--r--invest-applet/invest/networkmanager.py10
-rw-r--r--invest-applet/invest/preferences.py38
-rw-r--r--invest-applet/invest/quotes.py56
-rwxr-xr-xinvest-applet/invest/test.py4
-rw-r--r--invest-applet/invest/widgets.py8
11 files changed, 100 insertions, 100 deletions
diff --git a/invest-applet/invest/Makefile.am b/invest-applet/invest/Makefile.am
index aa0a4945..7ab75594 100644
--- a/invest-applet/invest/Makefile.am
+++ b/invest-applet/invest/Makefile.am
@@ -5,7 +5,7 @@ bin_SCRIPTS = mate-invest-chart
libexec_SCRIPTS = invest-applet
-investdir = $(pythondir)/mate-invest
+investdir = $(pythondir)/mate_invest
invest_PYTHON = \
__init__.py \
about.py \
diff --git a/invest-applet/invest/about.py b/invest-applet/invest/about.py
index 82e7d486..2b7293f4 100644
--- a/invest-applet/invest/about.py
+++ b/invest-applet/invest/about.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from os.path import join
from gettext import gettext as _
-from mate-invest.defs import VERSION
-import mate-invest
+from mate_invest.defs import VERSION
+import mate_invest
import gtk, gtk.gdk
invest_logo = None
try:
- invest_logo = gtk.gdk.pixbuf_new_from_file_at_size(join(mate-invest.ART_DATA_DIR, "invest_neutral.svg"), 96, 96)
+ invest_logo = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest_neutral.svg"), 96, 96)
except Exception, msg:
pass
diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py
index 3bbffef2..8b134e67 100644
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@ -5,11 +5,11 @@ gobject.threads_init()
from gettext import gettext as _
import mateconf
-import mate-invest, mate-invest.about, mate-invest.chart, mate-invest.preferences, mate-invest.defs
-from mate-invest.quotes import QuoteUpdater
-from mate-invest.widgets import *
+import mate_invest, mate_invest.about, mate_invest.chart, mate_invest.preferences, mate_invest.defs
+from mate_invest.quotes import QuoteUpdater
+from mate_invest.widgets import *
-gtk.window_set_default_icon_from_file(join(mate-invest.ART_DATA_DIR, "invest_neutral.svg"))
+gtk.window_set_default_icon_from_file(join(mate_invest.ART_DATA_DIR, "invest_neutral.svg"))
class InvestApplet:
def __init__(self, applet):
@@ -45,9 +45,9 @@ class InvestApplet:
def button_clicked(self, widget,event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
# Three cases...
- if len (mate-invest.STOCKS) == 0:
+ if len (mate_invest.STOCKS) == 0:
# a) We aren't configured yet
- mate-invest.preferences.show_preferences(self, _("<b>You have not entered any stock information yet</b>"))
+ mate_invest.preferences.show_preferences(self, _("<b>You have not entered any stock information yet</b>"))
self.reload_ilw()
elif not self.quotes_updater.quotes_valid:
# b) We can't get the data (e.g. offline)
@@ -61,13 +61,13 @@ class InvestApplet:
self.ilw.toggle_show()
def on_about(self, component, verb):
- mate-invest.about.show_about()
+ mate_invest.about.show_about()
def on_help(self, component, verb):
- mate-invest.help.show_help()
+ mate_invest.help.show_help()
def on_preferences(self, component, verb):
- mate-invest.preferences.show_preferences(self)
+ mate_invest.preferences.show_preferences(self)
self.reload_ilw()
def on_refresh(self, component, verb):
@@ -75,11 +75,11 @@ class InvestApplet:
def set_applet_icon(self, change):
if change == 1:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate-invest.ART_DATA_DIR, "invest-22_up.png"), -1,-1)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest-22_up.png"), -1,-1)
elif change == 0:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate-invest.ART_DATA_DIR, "invest-22_neutral.png"), -1,-1)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest-22_neutral.png"), -1,-1)
else:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate-invest.ART_DATA_DIR, "invest-22_down.png"), -1,-1)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest-22_down.png"), -1,-1)
self.applet_icon.set_from_pixbuf(pixbuf)
def set_applet_tooltip(self, text):
diff --git a/invest-applet/invest/chart.py b/invest-applet/invest/chart.py
index 480e3bff..358c51df 100644
--- a/invest-applet/invest/chart.py
+++ b/invest-applet/invest/chart.py
@@ -3,9 +3,9 @@
import gtk, gtk.gdk
import gobject
import os
-import mate-invest
+import mate_invest
from gettext import gettext as _
-from mate-invest import *
+from mate_invest import *
import sys
from os.path import join
import urllib
@@ -48,9 +48,9 @@ class ImageRetriever(Thread, _IdleObject):
def run(self):
self.image = gtk.Image()
- try: sock = urllib.urlopen(self.image_url, proxies = mate-invest.PROXY)
+ try: sock = urllib.urlopen(self.image_url, proxies = mate_invest.PROXY)
except Exception, msg:
- mate-invest.debug("Error while opening %s: %s" % (self.image_url, msg))
+ mate_invest.debug("Error while opening %s: %s" % (self.image_url, msg))
else:
loader = gtk.gdk.PixbufLoader()
loader.connect("closed", lambda loader: self.image.set_from_pixbuf(loader.get_pixbuf()))
@@ -107,10 +107,10 @@ class FinancialChart:
win.set_title(_("Financial Chart"))
try:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate-invest.ART_DATA_DIR, "invest_neutral.svg"), 96,96)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest_neutral.svg"), 96,96)
self.ui.get_object("plot").set_from_pixbuf(pixbuf)
except Exception, msg:
- mate-invest.debug("Could not load 'invest-neutral.svg' file: %s" % msg)
+ mate_invest.debug("Could not load 'invest-neutral.svg' file: %s" % msg)
pass
# Defaut comboboxes values
@@ -249,7 +249,7 @@ class FinancialChart:
def show_chart(tickers):
ui = gtk.Builder();
- ui.add_from_file(os.path.join(mate-invest.BUILDER_DATA_DIR, "financialchart.ui"))
+ ui.add_from_file(os.path.join(mate_invest.BUILDER_DATA_DIR, "financialchart.ui"))
chart = FinancialChart(ui)
ui.get_object("s").set_text(' '.join(tickers))
chart.on_refresh_chart()
diff --git a/invest-applet/invest/invest-applet.py b/invest-applet/invest/invest-applet.py
index 81900c23..1e08c5ab 100755
--- a/invest-applet/invest/invest-applet.py
+++ b/invest-applet/invest/invest-applet.py
@@ -19,20 +19,20 @@ else:
sys.path.insert(0, abspath("@PYTHONDIR@"))
# Now the path is set, import our applet
-import mate-invest, mate-invest.applet, mate-invest.defs, mate-invest.help
+import mate_invest, mate_invest.applet, mate_invest.defs, mate_invest.help
# Prepare i18n
import gettext, locale
-gettext.bindtextdomain(mate-invest.defs.GETTEXT_PACKAGE, mate-invest.defs.MATELOCALEDIR)
-gettext.textdomain(mate-invest.defs.GETTEXT_PACKAGE)
-locale.bindtextdomain(mate-invest.defs.GETTEXT_PACKAGE, mate-invest.defs.MATELOCALEDIR)
-locale.textdomain(mate-invest.defs.GETTEXT_PACKAGE)
+gettext.bindtextdomain(mate_invest.defs.GETTEXT_PACKAGE, mate_invest.defs.MATELOCALEDIR)
+gettext.textdomain(mate_invest.defs.GETTEXT_PACKAGE)
+locale.bindtextdomain(mate_invest.defs.GETTEXT_PACKAGE, mate_invest.defs.MATELOCALEDIR)
+locale.textdomain(mate_invest.defs.GETTEXT_PACKAGE)
from gettext import gettext as _
def applet_factory(applet, iid):
- mate-invest.debug('Starting invest instance: %s %s'% ( applet, iid ))
- mate-invest.applet.InvestApplet(applet)
+ mate_invest.debug('Starting invest instance: %s %s'% ( applet, iid ))
+ mate_invest.applet.InvestApplet(applet)
return True
# Return a standalone window that holds the applet
@@ -77,12 +77,12 @@ if __name__ == "__main__":
if o in ("-h", "--help"):
usage()
elif o in ("-d", "--debug"):
- mate-invest.DEBUGGING = True
- mate-invest.debug("Debugging enabled")
- # these messages cannot be turned by mate-invest.DEBUGGING at their originating location,
+ mate_invest.DEBUGGING = True
+ mate_invest.debug("Debugging enabled")
+ # these messages cannot be turned by mate_invest.DEBUGGING at their originating location,
# because that variable was set here to be True
- mate-invest.debug("Data Dir: %s" % mate-invest.SHARED_DATA_DIR)
- mate-invest.debug("Detected PROXY: %s" % mate-invest.PROXY)
+ mate_invest.debug("Data Dir: %s" % mate_invest.SHARED_DATA_DIR)
+ mate_invest.debug("Detected PROXY: %s" % mate_invest.PROXY)
elif o in ("-w", "--window"):
standalone = True
@@ -93,6 +93,6 @@ if __name__ == "__main__":
mateapplet.matecomponent_factory(
"OAFIID:Invest_Applet_Factory",
mateapplet.Applet.__gtype__,
- mate-invest.defs.PACKAGE,
- mate-invest.defs.VERSION,
+ mate_invest.defs.PACKAGE,
+ mate_invest.defs.VERSION,
applet_factory)
diff --git a/invest-applet/invest/mate-invest-chart b/invest-applet/invest/mate-invest-chart
index 097f4c78..ead5038a 100755
--- a/invest-applet/invest/mate-invest-chart
+++ b/invest-applet/invest/mate-invest-chart
@@ -1,15 +1,15 @@
#!/usr/bin/env python
-import sys, mate-invest.chart, gtk
+import sys, mate_invest.chart, gtk
# Prepare i18n
import gettext, locale
-gettext.bindtextdomain(mate-invest.defs.GETTEXT_PACKAGE, mate-invest.defs.MATELOCALEDIR)
+gettext.bindtextdomain(mate_invest.defs.GETTEXT_PACKAGE, mate_invest.defs.MATELOCALEDIR)
gettext.textdomain(invest.defs.GETTEXT_PACKAGE)
-locale.bindtextdomain(mate-invest.defs.GETTEXT_PACKAGE, mate-invest.defs.MATELOCALEDIR)
-locale.textdomain(mate-invest.defs.GETTEXT_PACKAGE)
+locale.bindtextdomain(mate_invest.defs.GETTEXT_PACKAGE, mate_invest.defs.MATELOCALEDIR)
+locale.textdomain(mate_invest.defs.GETTEXT_PACKAGE)
if __name__ == "__main__":
- win = mate-invest.chart.show_chart(sys.argv[1:])
+ win = mate_invest.chart.show_chart(sys.argv[1:])
win.connect("destroy", lambda x: gtk.main_quit())
gtk.main()
diff --git a/invest-applet/invest/networkmanager.py b/invest-applet/invest/networkmanager.py
index a784d807..152cd862 100644
--- a/invest-applet/invest/networkmanager.py
+++ b/invest-applet/invest/networkmanager.py
@@ -1,4 +1,4 @@
-import mate-invest
+import mate_invest
from dbus.mainloop.glib import DBusGMainLoop
import dbus
@@ -19,7 +19,7 @@ class NetworkManager:
loop = DBusGMainLoop()
# get the NetworkManager object from D-Bus
- mate-invest.debug("Connecting to Network Manager via D-Bus")
+ mate_invest.debug("Connecting to Network Manager via D-Bus")
bus = dbus.SystemBus(mainloop=loop)
nmobj = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
nm = dbus.Interface(nmobj, 'org.freedesktop.NetworkManager')
@@ -32,9 +32,9 @@ class NetworkManager:
# get the current status of the network manager
self.state = nm.state()
- mate-invest.debug("Current Network Manager status is %d" % self.state)
+ mate_invest.debug("Current Network Manager status is %d" % self.state)
except Exception, msg:
- mate-invest.error("Could not connect to the Network Manager: %s" % msg )
+ mate_invest.error("Could not connect to the Network Manager: %s" % msg )
def online(self):
return self.state == STATE_UNKNOWN or self.state == STATE_CONNECTED
@@ -47,7 +47,7 @@ class NetworkManager:
if isinstance(signal, dict):
state = signal.get('State')
if state != None:
- mate-invest.debug("Network Manager change state %d => %d" % (self.state, state) );
+ mate_invest.debug("Network Manager change state %d => %d" % (self.state, state) );
self.state = state
# notify about state change
diff --git a/invest-applet/invest/preferences.py b/invest-applet/invest/preferences.py
index 14bc6f90..03a9147f 100644
--- a/invest-applet/invest/preferences.py
+++ b/invest-applet/invest/preferences.py
@@ -2,14 +2,14 @@ from gettext import gettext as _
import locale
from os.path import join
import gtk, gobject, mateconf
-import mate-invest
+import mate_invest
import currencies
import cPickle
class PrefsDialog:
def __init__(self, applet):
self.ui = gtk.Builder()
- self.ui.add_from_file(join(mate-invest.BUILDER_DATA_DIR, "prefs-dialog.ui"))
+ self.ui.add_from_file(join(mate_invest.BUILDER_DATA_DIR, "prefs-dialog.ui"))
self.dialog = self.ui.get_object("preferences")
self.treeview = self.ui.get_object("stocks")
@@ -44,8 +44,8 @@ class PrefsDialog:
completion.set_match_func(self.match_func, 0)
completion.connect("match-selected", self.on_completion_selection, 1)
- if mate-invest.CONFIG.has_key("currency"):
- code = mate-invest.CONFIG["currency"];
+ if mate_invest.CONFIG.has_key("currency"):
+ code = mate_invest.CONFIG["currency"];
if self.currencies.has_key(code):
self.currency_code = code;
currency = self.format_currency(self.currencies[self.currency_code], self.currency_code)
@@ -56,7 +56,7 @@ class PrefsDialog:
if self.currency_code != None:
self.add_exchange_column()
- stock_items = mate-invest.STOCKS.items ()
+ stock_items = mate_invest.STOCKS.items ()
stock_items.sort ()
for key, data in stock_items:
label = data["label"]
@@ -80,7 +80,7 @@ class PrefsDialog:
value = locale.atof(new_text)
self.model[path][col] = value
except Exception, msg:
- mate-invest.error('Exception while processing cell change: %s' % msg)
+ mate_invest.error('Exception while processing cell change: %s' % msg)
pass
def format(self, fmt, value):
@@ -138,16 +138,16 @@ class PrefsDialog:
pass
self.dialog.destroy()
- mate-invest.STOCKS = {}
+ mate_invest.STOCKS = {}
def save_symbol(model, path, iter):
#if int(model[iter][1]) == 0 or float(model[iter][2]) < 0.0001:
# return
- if not model[iter][0] in mate-invest.STOCKS:
- mate-invest.STOCKS[model[iter][0]] = { 'label': model[iter][1], 'purchases': [] }
+ if not model[iter][0] in mate_invest.STOCKS:
+ mate_invest.STOCKS[model[iter][0]] = { 'label': model[iter][1], 'purchases': [] }
- mate-invest.STOCKS[model[iter][0]]["purchases"].append({
+ mate_invest.STOCKS[model[iter][0]]["purchases"].append({
"amount": float(model[iter][2]),
"bought": float(model[iter][3]),
"comission": float(model[iter][4]),
@@ -155,19 +155,19 @@ class PrefsDialog:
})
self.model.foreach(save_symbol)
try:
- cPickle.dump(mate-invest.STOCKS, file(mate-invest.STOCKS_FILE, 'w'))
- mate-invest.debug('Stocks written to file')
+ cPickle.dump(mate_invest.STOCKS, file(mate_invest.STOCKS_FILE, 'w'))
+ mate_invest.debug('Stocks written to file')
except Exception, msg:
- mate-invest.error('Could not save stocks file: %s' % msg)
+ mate_invest.error('Could not save stocks file: %s' % msg)
- mate-invest.CONFIG = {}
+ mate_invest.CONFIG = {}
if self.currency_code != None and len(self.currency_code) == 3:
- mate-invest.CONFIG['currency'] = self.currency_code
+ mate_invest.CONFIG['currency'] = self.currency_code
try:
- cPickle.dump(invest.CONFIG, file(mate-invest.CONFIG_FILE, 'w'))
- mate-invest.debug('Configuration written to file')
+ cPickle.dump(invest.CONFIG, file(mate_invest.CONFIG_FILE, 'w'))
+ mate_invest.debug('Configuration written to file')
except Exception, msg:
- mate-invest.debug('Could not save configuration file: %s' % msg)
+ mate_invest.debug('Could not save configuration file: %s' % msg)
def sync_ui(self):
pass
@@ -183,7 +183,7 @@ class PrefsDialog:
model.remove(model.get_iter(path))
def on_help(self, w):
- mate-invest.help.show_help_section("invest-applet-usage")
+ mate_invest.help.show_help_section("invest-applet-usage")
def on_tree_keypress(self, w, event):
if event.keyval == 65535:
diff --git a/invest-applet/invest/quotes.py b/invest-applet/invest/quotes.py
index 42317470..0d8e028e 100644
--- a/invest-applet/invest/quotes.py
+++ b/invest-applet/invest/quotes.py
@@ -7,7 +7,7 @@ from urllib import urlopen
import datetime
from threading import Thread
-import mate-invest, mate-invest.about, mate-invest.chart
+import mate_invest, mate_invest.about, mate_invest.chart
import currencies
CHUNK_SIZE = 512*1024 # 512 kB
@@ -55,11 +55,11 @@ class QuotesRetriever(Thread, _IdleObject):
def run(self):
quotes_url = QUOTES_URL % {"s": self.tickers}
try:
- quotes_file = urlopen(quotes_url, proxies = mate-invest.PROXY)
+ quotes_file = urlopen(quotes_url, proxies = mate_invest.PROXY)
self.data = quotes_file.readlines ()
quotes_file.close ()
except Exception, msg:
- mate-invest.debug("Error while retrieving quotes data (url = %s): %s" % (quotes_url, msg))
+ mate_invest.debug("Error while retrieving quotes data (url = %s): %s" % (quotes_url, msg))
else:
self.retrieved = True
self.emit("completed")
@@ -80,37 +80,37 @@ class QuoteUpdater(gtk.ListStore):
self.refresh()
# tell the network manager to notify me when network status changes
- mate-invest.nm.set_statechange_callback(self.nm_state_changed)
+ mate_invest.nm.set_statechange_callback(self.nm_state_changed)
def set_update_interval(self, interval):
if self.timeout_id != None:
- mate-invest.debug("Canceling refresh timer")
+ mate_invest.debug("Canceling refresh timer")
gobject.source_remove(self.timeout_id)
self.timeout_id = None
if interval > 0:
- mate-invest.debug("Setting refresh timer to %s:%02d.%03d" % ( interval / 60000, interval % 60000 / 1000, interval % 1000) )
+ mate_invest.debug("Setting refresh timer to %s:%02d.%03d" % ( interval / 60000, interval % 60000 / 1000, interval % 1000) )
self.timeout_id = gobject.timeout_add(interval, self.refresh)
def nm_state_changed(self):
# when nm is online but we do not have an update timer, create it and refresh
- if mate-invest.nm.online():
+ if mate_invest.nm.online():
if self.timeout_id == None:
self.set_update_interval(AUTOREFRESH_TIMEOUT)
self.refresh()
def refresh(self):
- mate-invest.debug("Refreshing")
+ mate_invest.debug("Refreshing")
# when nm tells me I am offline, stop the update interval
- if mate-invest.nm.offline():
- mate-invest.debug("We are offline, stopping update timer")
+ if mate_invest.nm.offline():
+ mate_invest.debug("We are offline, stopping update timer")
self.set_update_interval(0)
return False
- if len(mate-invest.STOCKS) == 0:
+ if len(mate_invest.STOCKS) == 0:
return True
- tickers = '+'.join(mate-invest.STOCKS.keys())
+ tickers = '+'.join(mate_invest.STOCKS.keys())
quotes_retriever = QuotesRetriever(tickers)
quotes_retriever.connect("completed", self.on_retriever_completed)
quotes_retriever.start()
@@ -141,7 +141,7 @@ class QuoteUpdater(gtk.ListStore):
def on_currency_retriever_completed(self, retriever):
if retriever.retrieved == False:
- mate-invest.error("Failed to retrieve currency rates!")
+ mate_invest.error("Failed to retrieve currency rates!")
else:
self.convert_currencies(self.parse_yahoo_csv(csv.reader(retriever.data)))
self.update_tooltip()
@@ -239,7 +239,7 @@ class QuoteUpdater(gtk.ListStore):
pb = None
# get the label of this stock for later reuse
- label = mate-invest.STOCKS[ticker]["label"]
+ label = mate_invest.STOCKS[ticker]["label"]
if len(label) == 0:
if len(val["label"]) != 0:
label = val["label"]
@@ -260,7 +260,7 @@ class QuoteUpdater(gtk.ListStore):
# sometimes, funny currencies are returned (special characters), only consider known currencies
if len(val["currency"]) > 0 and val["currency"] not in currencies.Currencies.currencies:
- mate-invest.debug("Currency '%s' is not known, dropping" % val["currency"])
+ mate_invest.debug("Currency '%s' is not known, dropping" % val["currency"])
val["currency"] = ""
# if this is a currency not yet seen and different from the target currency, memorize it
@@ -269,7 +269,7 @@ class QuoteUpdater(gtk.ListStore):
# Check whether the symbol is a simple quote, or a portfolio value
is_simple_quote = True
- for purchase in mate-invest.STOCKS[ticker]["purchases"]:
+ for purchase in mate_invest.STOCKS[ticker]["purchases"]:
if purchase["amount"] != 0:
is_simple_quote = False
break
@@ -279,7 +279,7 @@ class QuoteUpdater(gtk.ListStore):
row = self.insert(0, [ticker, label, val["currency"], True, 0, 0, val["trade"], val["variation_pct"], pb])
simple_quotes_change += val['variation_pct']
else:
- (balance, change) = self.balance(mate-invest.STOCKS[ticker]["purchases"], val["trade"])
+ (balance, change) = self.balance(mate_invest.STOCKS[ticker]["purchases"], val["trade"])
row = self.insert(0, [ticker, label, val["currency"], False, balance, change, val["trade"], val["variation_pct"], pb])
self.add_balance_change(balance, change, val["currency"])
@@ -288,7 +288,7 @@ class QuoteUpdater(gtk.ListStore):
else:
url = 'http://ichart.yahoo.com/h?s=%s' % ticker
- image_retriever = mate-invest.chart.ImageRetriever(url)
+ image_retriever = mate_invest.chart.ImageRetriever(url)
image_retriever.connect("completed", self.set_pb_callback, row)
image_retriever.start()
@@ -313,21 +313,21 @@ class QuoteUpdater(gtk.ListStore):
self.quotes_valid = True
except Exception, msg:
- mate-invest.debug("Failed to populate quotes: %s" % msg)
- mate-invest.debug(quotes)
+ mate_invest.debug("Failed to populate quotes: %s" % msg)
+ mate_invest.debug(quotes)
self.quotes_valid = False
# start retrieving currency conversion rates
- if mate-invest.CONFIG.has_key("currency"):
- target_currency = mate-invest.CONFIG["currency"]
+ if mate_invest.CONFIG.has_key("currency"):
+ target_currency = mate_invest.CONFIG["currency"]
symbols = []
- mate-invest.debug("These currencies occur: %s" % self.currencies)
+ mate_invest.debug("These currencies occur: %s" % self.currencies)
for currency in self.currencies:
if currency == target_currency:
continue
- mate-invest.debug("%s will be converted to %s" % ( currency, target_currency ))
+ mate_invest.debug("%s will be converted to %s" % ( currency, target_currency ))
symbol = currency + target_currency + "=X"
symbols.append(symbol)
@@ -339,7 +339,7 @@ class QuoteUpdater(gtk.ListStore):
def convert_currencies(self, quotes):
# if there is no target currency, this method should never have been called
- if not mate-invest.CONFIG.has_key("currency"):
+ if not mate_invest.CONFIG.has_key("currency"):
return
# reset the overall balance
@@ -353,7 +353,7 @@ class QuoteUpdater(gtk.ListStore):
rates[currency] = rate
# convert all non target currencies
- target_currency = mate-invest.CONFIG["currency"]
+ target_currency = mate_invest.CONFIG["currency"]
iter = self.get_iter_first()
while iter != None:
currency = self.get_value(iter, self.CURRENCY)
@@ -367,7 +367,7 @@ class QuoteUpdater(gtk.ListStore):
if not self.get_value(iter, self.TICKER_ONLY):
ticker = self.get_value(iter, self.SYMBOL)
value = self.get_value(iter, self.VALUE)
- (balance, change) = self.balance(mate-invest.STOCKS[ticker]["purchases"], value, rates[currency])
+ (balance, change) = self.balance(mate_invest.STOCKS[ticker]["purchases"], value, rates[currency])
self.set(iter, self.BALANCE, balance)
self.set(iter, self.BALANCE_PCT, change)
self.add_balance_change(balance, change, target_currency)
@@ -402,7 +402,7 @@ class QuoteUpdater(gtk.ListStore):
# check if we have only simple quotes
def simple_quotes_only(self):
res = True
- for entry, data in mate-invest.STOCKS.iteritems():
+ for entry, data in mate_invest.STOCKS.iteritems():
purchases = data["purchases"]
for purchase in purchases:
if purchase["amount"] != 0:
diff --git a/invest-applet/invest/test.py b/invest-applet/invest/test.py
index 47ae2167..046881bb 100755
--- a/invest-applet/invest/test.py
+++ b/invest-applet/invest/test.py
@@ -9,7 +9,7 @@ sys.path.insert(0, abspath(dirname(__file__) + "/.."))
print sys.path
import quotes
-import mate-invest
+import mate_invest
def null_function (*args):
pass
@@ -17,7 +17,7 @@ def null_function (*args):
class TestQuotes (unittest.TestCase):
def testQuoteUpdater_populate (self):
qu = quotes.QuoteUpdater (null_function, null_function)
- mate-invest.STOCKS = {'GOGO': {'label': "Google Inc.", 'purchases': [{'amount' : 1, 'comission' : 0.0, 'bought': 0.0}]}, 'JAVA': {'label':"Sun Microsystems Inc.", 'purchases': [{'amount' : 1, 'comission' : 0.0, 'bought': 0.0}]}}
+ mate_invest.STOCKS = {'GOGO': {'label': "Google Inc.", 'purchases': [{'amount' : 1, 'comission' : 0.0, 'bought': 0.0}]}, 'JAVA': {'label':"Sun Microsystems Inc.", 'purchases': [{'amount' : 1, 'comission' : 0.0, 'bought': 0.0}]}}
quote = { 'GOGO': { "ticker": 'GOGO', "trade": 386.91, "time": "10/3/2008", "date": "4.00pm", "variation": -3.58, "open": 397.14, "variation_pct": 10 }}
qu.populate (quote)
self.assertEqual (qu.quotes_valid, True)
diff --git a/invest-applet/invest/widgets.py b/invest-applet/invest/widgets.py
index c8083450..0a897e30 100644
--- a/invest-applet/invest/widgets.py
+++ b/invest-applet/invest/widgets.py
@@ -4,7 +4,7 @@ import mateapplet, gtk, gtk.gdk, mateconf, gobject, pango
from gettext import gettext as _
import locale
import csv
-import mate-invest, mate-invest.about, mate-invest.chart
+import mate_invest, mate_invest.about, mate_invest.chart
COLORSCALE_POSITIVE = [
"white",
@@ -154,7 +154,7 @@ class InvestWidget(gtk.TreeView):
if ticker == None:
return
- mate-invest.chart.show_chart([ticker])
+ mate_invest.chart.show_chart([ticker])
#class InvestTicker(gtk.Label):
# def __init__(self):
@@ -215,7 +215,7 @@ class InvestTrend(gtk.Image):
int(color.red*factor)<<24|int(color.green*factor)<<16|int(color.blue*factor)<<8|opacity)
self.set_from_pixbuf(self.pixbuf)
except Exception, msg:
- mate-invest.error("Could not set color: %s" % msg)
+ mate_invest.error("Could not set color: %s" % msg)
def on_quotes_update(self, updater):
start_total = 0
@@ -230,7 +230,7 @@ class InvestTrend(gtk.Image):
start = now / (1 + var)
- portfolio_number = sum([purchase["amount"] for purchase in mate-invest.STOCKS[row[updater.SYMBOL]]["purchases"]])
+ portfolio_number = sum([purchase["amount"] for purchase in mate_invest.STOCKS[row[updater.SYMBOL]]["purchases"]])
start_total += start * portfolio_number
now_total += now * portfolio_number