From 8bc57d44c30deaf7529c4733205eeccd373d62d9 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 27 Jan 2012 01:12:17 +0100 Subject: fix conflict with gnome-applets --- invest-applet/data/Invest_Applet.server.in.in | 2 +- invest-applet/data/art/Makefile.am | 2 +- invest-applet/data/art/invest-applet.16.png | Bin 566 -> 0 bytes invest-applet/data/art/invest-applet.22.png | Bin 795 -> 0 bytes invest-applet/data/art/invest-applet.48.png | Bin 1864 -> 0 bytes invest-applet/data/art/invest-applet.svg | 380 ----------------------- invest-applet/data/art/mate-invest-applet.16.png | Bin 0 -> 566 bytes invest-applet/data/art/mate-invest-applet.22.png | Bin 0 -> 795 bytes invest-applet/data/art/mate-invest-applet.48.png | Bin 0 -> 1864 bytes invest-applet/data/art/mate-invest-applet.svg | 380 +++++++++++++++++++++++ 10 files changed, 382 insertions(+), 382 deletions(-) delete mode 100644 invest-applet/data/art/invest-applet.16.png delete mode 100644 invest-applet/data/art/invest-applet.22.png delete mode 100644 invest-applet/data/art/invest-applet.48.png delete mode 100644 invest-applet/data/art/invest-applet.svg create mode 100644 invest-applet/data/art/mate-invest-applet.16.png create mode 100644 invest-applet/data/art/mate-invest-applet.22.png create mode 100644 invest-applet/data/art/mate-invest-applet.48.png create mode 100644 invest-applet/data/art/mate-invest-applet.svg diff --git a/invest-applet/data/Invest_Applet.server.in.in b/invest-applet/data/Invest_Applet.server.in.in index b2861c28..fe4c6da5 100644 --- a/invest-applet/data/Invest_Applet.server.in.in +++ b/invest-applet/data/Invest_Applet.server.in.in @@ -19,7 +19,7 @@ - + diff --git a/invest-applet/data/art/Makefile.am b/invest-applet/data/art/Makefile.am index 7f304f4a..1a5585e5 100644 --- a/invest-applet/data/art/Makefile.am +++ b/invest-applet/data/art/Makefile.am @@ -1,7 +1,7 @@ # ****************************************************************************** # Images and icon # ****************************************************************************** -icons = invest-applet.16.png invest-applet.22.png invest-applet.48.png invest-applet.svg +icons = mate-invest-applet.16.png mate-invest-applet.22.png mate-invest-applet.48.png mate-invest-applet.svg artdir = $(pkgdatadir)/invest-applet art_DATA = invest-16_neutral.png invest-22_neutral.png invest_neutral.svg \ diff --git a/invest-applet/data/art/invest-applet.16.png b/invest-applet/data/art/invest-applet.16.png deleted file mode 100644 index c5d6f815..00000000 Binary files a/invest-applet/data/art/invest-applet.16.png and /dev/null differ diff --git a/invest-applet/data/art/invest-applet.22.png b/invest-applet/data/art/invest-applet.22.png deleted file mode 100644 index eba0caff..00000000 Binary files a/invest-applet/data/art/invest-applet.22.png and /dev/null differ diff --git a/invest-applet/data/art/invest-applet.48.png b/invest-applet/data/art/invest-applet.48.png deleted file mode 100644 index 14e2f9ec..00000000 Binary files a/invest-applet/data/art/invest-applet.48.png and /dev/null differ diff --git a/invest-applet/data/art/invest-applet.svg b/invest-applet/data/art/invest-applet.svg deleted file mode 100644 index b5808216..00000000 --- a/invest-applet/data/art/invest-applet.svg +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Invest - - - Vinicius Depizzol <vdepizzol@gmail.com> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/invest-applet/data/art/mate-invest-applet.16.png b/invest-applet/data/art/mate-invest-applet.16.png new file mode 100644 index 00000000..c5d6f815 Binary files /dev/null and b/invest-applet/data/art/mate-invest-applet.16.png differ diff --git a/invest-applet/data/art/mate-invest-applet.22.png b/invest-applet/data/art/mate-invest-applet.22.png new file mode 100644 index 00000000..eba0caff Binary files /dev/null and b/invest-applet/data/art/mate-invest-applet.22.png differ diff --git a/invest-applet/data/art/mate-invest-applet.48.png b/invest-applet/data/art/mate-invest-applet.48.png new file mode 100644 index 00000000..14e2f9ec Binary files /dev/null and b/invest-applet/data/art/mate-invest-applet.48.png differ diff --git a/invest-applet/data/art/mate-invest-applet.svg b/invest-applet/data/art/mate-invest-applet.svg new file mode 100644 index 00000000..b5808216 --- /dev/null +++ b/invest-applet/data/art/mate-invest-applet.svg @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + Invest + + + Vinicius Depizzol <vdepizzol@gmail.com> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From 843576a9e066a18dce191d96eb962d3b0bbde63b Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 27 Jan 2012 01:17:45 +0100 Subject: 1.1.2 release --- configure.in | 2 +- distro/archlinux/PKGBUILD | 2 +- distro/ubuntu/build | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 5692356b..57c2dc92 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl *************************************************************************** dnl *** configure.in for MATE-APPLETS *** dnl *************************************************************************** -AC_INIT(mate-applets, 1.1.1) +AC_INIT(mate-applets, 1.1.2) AC_PREREQ(2.59) AM_CONFIG_HEADER(config.h) diff --git a/distro/archlinux/PKGBUILD b/distro/archlinux/PKGBUILD index 294a98f9..e31c03ac 100644 --- a/distro/archlinux/PKGBUILD +++ b/distro/archlinux/PKGBUILD @@ -1,5 +1,5 @@ pkgname=mate-applets -pkgver=1.1.1 +pkgver=1.1.2 pkgrel=1 pkgdesc="Applets for MATE panel" arch=(i686 x86_64) diff --git a/distro/ubuntu/build b/distro/ubuntu/build index ed5c5569..cb0a6424 100755 --- a/distro/ubuntu/build +++ b/distro/ubuntu/build @@ -2,7 +2,7 @@ # fill it pkgname=mate-applets -pkgver=1.1.1 +pkgver=1.1.2 pkgrel=1 pkgdesc="MATE Applets" depends=('gstreamer0.10-plugins-base' 'mate-panel' 'mate-character-map' 'libgtop2-7' 'libmatenotify' 'cpufrequtils') -- cgit v1.2.1 From c7b2e180e6cfb4aec22f8ab3e0aebc6773032216 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 27 Jan 2012 11:19:49 +0100 Subject: 'invest' python module is now 'mate-invest' to solve conflicts with gnome --- invest-applet/invest/Makefile.am | 6 ++-- invest-applet/invest/about.py | 6 ++-- invest-applet/invest/applet.py | 24 +++++++-------- invest-applet/invest/chart.py | 14 ++++----- invest-applet/invest/invest-applet.py | 28 ++++++++--------- invest-applet/invest/invest-chart | 15 --------- invest-applet/invest/mate-invest-chart | 15 +++++++++ invest-applet/invest/networkmanager.py | 10 +++--- invest-applet/invest/preferences.py | 38 +++++++++++------------ invest-applet/invest/quotes.py | 56 +++++++++++++++++----------------- invest-applet/invest/test.py | 4 +-- invest-applet/invest/widgets.py | 8 ++--- 12 files changed, 112 insertions(+), 112 deletions(-) delete mode 100755 invest-applet/invest/invest-chart create mode 100755 invest-applet/invest/mate-invest-chart diff --git a/invest-applet/invest/Makefile.am b/invest-applet/invest/Makefile.am index 286b974c..aa0a4945 100644 --- a/invest-applet/invest/Makefile.am +++ b/invest-applet/invest/Makefile.am @@ -1,11 +1,11 @@ invest-applet: invest-applet.py sed -e "s|\@PYTHONDIR\@|$(pythondir)/|" $< > $@ -bin_SCRIPTS = invest-chart +bin_SCRIPTS = mate-invest-chart libexec_SCRIPTS = invest-applet -investdir = $(pythondir)/invest +investdir = $(pythondir)/mate-invest invest_PYTHON = \ __init__.py \ about.py \ @@ -33,7 +33,7 @@ DISTCLEANFILES = \ EXTRA_DIST = \ defs.py.in \ invest-applet.py \ - invest-chart \ + mate-invest-chart \ test.py #TESTS = test.py diff --git a/invest-applet/invest/about.py b/invest-applet/invest/about.py index e2829e86..82e7d486 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 invest.defs import VERSION -import 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(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 c1689586..3bbffef2 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 invest, invest.about, invest.chart, invest.preferences, invest.defs -from invest.quotes import QuoteUpdater -from 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(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 (invest.STOCKS) == 0: + if len (mate-invest.STOCKS) == 0: # a) We aren't configured yet - invest.preferences.show_preferences(self, _("You have not entered any stock information yet")) + mate-invest.preferences.show_preferences(self, _("You have not entered any stock information yet")) 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): - invest.about.show_about() + mate-invest.about.show_about() def on_help(self, component, verb): - invest.help.show_help() + mate-invest.help.show_help() def on_preferences(self, component, verb): - 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(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(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(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 c6caff74..480e3bff 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 invest +import mate-invest from gettext import gettext as _ -from 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 = invest.PROXY) + try: sock = urllib.urlopen(self.image_url, proxies = mate-invest.PROXY) except Exception, msg: - 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(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: - 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(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 884bcba8..81900c23 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 invest, invest.applet, invest.defs, invest.help +import mate-invest, mate-invest.applet, mate-invest.defs, mate-invest.help # Prepare i18n import gettext, locale -gettext.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.MATELOCALEDIR) -gettext.textdomain(invest.defs.GETTEXT_PACKAGE) -locale.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.MATELOCALEDIR) -locale.textdomain(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): - invest.debug('Starting invest instance: %s %s'% ( applet, iid )) - 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"): - invest.DEBUGGING = True - invest.debug("Debugging enabled") - # these messages cannot be turned by 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 - invest.debug("Data Dir: %s" % invest.SHARED_DATA_DIR) - invest.debug("Detected PROXY: %s" % 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__, - invest.defs.PACKAGE, - invest.defs.VERSION, + mate-invest.defs.PACKAGE, + mate-invest.defs.VERSION, applet_factory) diff --git a/invest-applet/invest/invest-chart b/invest-applet/invest/invest-chart deleted file mode 100755 index 37df77cb..00000000 --- a/invest-applet/invest/invest-chart +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import sys, invest.chart, gtk - -# Prepare i18n -import gettext, locale -gettext.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.MATELOCALEDIR) -gettext.textdomain(invest.defs.GETTEXT_PACKAGE) -locale.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.MATELOCALEDIR) -locale.textdomain(invest.defs.GETTEXT_PACKAGE) - -if __name__ == "__main__": - win = invest.chart.show_chart(sys.argv[1:]) - win.connect("destroy", lambda x: gtk.main_quit()) - gtk.main() diff --git a/invest-applet/invest/mate-invest-chart b/invest-applet/invest/mate-invest-chart new file mode 100755 index 00000000..097f4c78 --- /dev/null +++ b/invest-applet/invest/mate-invest-chart @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import sys, mate-invest.chart, gtk + +# Prepare i18n +import gettext, locale +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) + +if __name__ == "__main__": + 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 415e9ce4..a784d807 100644 --- a/invest-applet/invest/networkmanager.py +++ b/invest-applet/invest/networkmanager.py @@ -1,4 +1,4 @@ -import 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 - 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() - invest.debug("Current Network Manager status is %d" % self.state) + mate-invest.debug("Current Network Manager status is %d" % self.state) except Exception, msg: - 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: - 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 3c48ee42..14bc6f90 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 invest +import mate-invest import currencies import cPickle class PrefsDialog: def __init__(self, applet): self.ui = gtk.Builder() - self.ui.add_from_file(join(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 invest.CONFIG.has_key("currency"): - code = 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 = 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: - 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() - 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 invest.STOCKS: - 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': [] } - 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(invest.STOCKS, file(invest.STOCKS_FILE, 'w')) - 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: - invest.error('Could not save stocks file: %s' % msg) + mate-invest.error('Could not save stocks file: %s' % msg) - invest.CONFIG = {} + mate-invest.CONFIG = {} if self.currency_code != None and len(self.currency_code) == 3: - invest.CONFIG['currency'] = self.currency_code + mate-invest.CONFIG['currency'] = self.currency_code try: - cPickle.dump(invest.CONFIG, file(invest.CONFIG_FILE, 'w')) - 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: - 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): - 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 e8f6145b..42317470 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 invest, invest.about, 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 = invest.PROXY) + quotes_file = urlopen(quotes_url, proxies = mate-invest.PROXY) self.data = quotes_file.readlines () quotes_file.close () except Exception, msg: - 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 - 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: - invest.debug("Canceling refresh timer") + mate-invest.debug("Canceling refresh timer") gobject.source_remove(self.timeout_id) self.timeout_id = None if interval > 0: - 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 invest.nm.online(): + if mate-invest.nm.online(): if self.timeout_id == None: self.set_update_interval(AUTOREFRESH_TIMEOUT) self.refresh() def refresh(self): - invest.debug("Refreshing") + mate-invest.debug("Refreshing") # when nm tells me I am offline, stop the update interval - if invest.nm.offline(): - 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(invest.STOCKS) == 0: + if len(mate-invest.STOCKS) == 0: return True - tickers = '+'.join(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: - 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 = 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: - 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 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(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 = 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: - invest.debug("Failed to populate quotes: %s" % msg) - 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 invest.CONFIG.has_key("currency"): - target_currency = invest.CONFIG["currency"] + if mate-invest.CONFIG.has_key("currency"): + target_currency = mate-invest.CONFIG["currency"] symbols = [] - 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 - 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 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 = 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(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 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 aea5f5f3..47ae2167 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 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) - 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 3f5bc91b..c8083450 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 invest, invest.about, 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 - 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: - 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 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 -- cgit v1.2.1 From bf8f363ef056cee972185e18b3793b5d5551a1a3 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 27 Jan 2012 14:37:19 +0100 Subject: 'mate-invest' => 'mate_invest' --- invest-applet/invest/Makefile.am | 2 +- invest-applet/invest/about.py | 6 ++-- invest-applet/invest/applet.py | 24 +++++++-------- invest-applet/invest/chart.py | 14 ++++----- invest-applet/invest/invest-applet.py | 28 ++++++++--------- invest-applet/invest/mate-invest-chart | 10 +++--- invest-applet/invest/networkmanager.py | 10 +++--- invest-applet/invest/preferences.py | 38 +++++++++++------------ invest-applet/invest/quotes.py | 56 +++++++++++++++++----------------- invest-applet/invest/test.py | 4 +-- invest-applet/invest/widgets.py | 8 ++--- 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, _("You have not entered any stock information yet")) + mate_invest.preferences.show_preferences(self, _("You have not entered any stock information yet")) 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 -- cgit v1.2.1 From 0c7fa5832b5b2a1d5bd321851ceb64690435aa11 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 27 Jan 2012 15:15:38 +0100 Subject: 1.1.3 release --- configure.in | 5 ++--- distro/archlinux/PKGBUILD | 2 +- distro/ubuntu/build | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 57c2dc92..935a4f92 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl *************************************************************************** dnl *** configure.in for MATE-APPLETS *** dnl *************************************************************************** -AC_INIT(mate-applets, 1.1.2) +AC_INIT(mate-applets, 1.1.3) AC_PREREQ(2.59) AM_CONFIG_HEADER(config.h) @@ -31,7 +31,6 @@ PYGOBJECT_REQUIRED=2.6 MATE_PYTHON_REQUIRED=1.1.0 MATE_ICON_THEME_REQUIRED=1.1.0 LIBXML_REQUIRED=2.5.0 -MATEWEATHER_REQUIRED=1.1.0 GUCHARMAP2_REQUIRED=2.23.0 GUCHARMAP_REQUIRED=1.4.0 POLKIT_REQUIRED=0.92 @@ -268,7 +267,7 @@ AC_SUBST(XML2_LIBS) dnl -- check for libmateweather (required for mateweather applet) ------------------ build_libmateweather_applets=false -PKG_CHECK_MODULES(LIBMATEWEATHER, mateweather >= $MATEWEATHER_REQUIRED, +PKG_CHECK_MODULES(LIBMATEWEATHER, mateweather, build_libmateweather_applets=true, AC_MSG_WARN([libmateweather not found. Not building the weather applet.])) AC_SUBST(LIBMATEWEATHER_CFLAGS) diff --git a/distro/archlinux/PKGBUILD b/distro/archlinux/PKGBUILD index e31c03ac..92cd1ba0 100644 --- a/distro/archlinux/PKGBUILD +++ b/distro/archlinux/PKGBUILD @@ -1,5 +1,5 @@ pkgname=mate-applets -pkgver=1.1.2 +pkgver=1.1.3 pkgrel=1 pkgdesc="Applets for MATE panel" arch=(i686 x86_64) diff --git a/distro/ubuntu/build b/distro/ubuntu/build index cb0a6424..772cda64 100755 --- a/distro/ubuntu/build +++ b/distro/ubuntu/build @@ -2,7 +2,7 @@ # fill it pkgname=mate-applets -pkgver=1.1.2 +pkgver=1.1.3 pkgrel=1 pkgdesc="MATE Applets" depends=('gstreamer0.10-plugins-base' 'mate-panel' 'mate-character-map' 'libgtop2-7' 'libmatenotify' 'cpufrequtils') -- cgit v1.2.1 From e094167059fd482d254e3724ddc28a640d8a4156 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Sat, 28 Jan 2012 00:05:21 +0100 Subject: missing one rename in invest applet --- invest-applet/invest/mate-invest-chart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invest-applet/invest/mate-invest-chart b/invest-applet/invest/mate-invest-chart index ead5038a..ea025de8 100755 --- a/invest-applet/invest/mate-invest-chart +++ b/invest-applet/invest/mate-invest-chart @@ -5,7 +5,7 @@ import sys, mate_invest.chart, gtk # Prepare i18n import gettext, locale gettext.bindtextdomain(mate_invest.defs.GETTEXT_PACKAGE, mate_invest.defs.MATELOCALEDIR) -gettext.textdomain(invest.defs.GETTEXT_PACKAGE) +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) -- cgit v1.2.1