[gnome-applets] invest-applet: Remove unused code



commit 0c927816a287a9d2ea42dcc343fc9aa5da2ebffb
Author: Dmitry Shachnev <mitya57 gmail com>
Date:   Mon Oct 13 19:54:45 2014 +0400

    invest-applet: Remove unused code

 invest-applet/invest/quotes.py  |    3 -
 invest-applet/invest/widgets.py |   95 +--------------------------------------
 2 files changed, 1 insertions(+), 97 deletions(-)
---
diff --git a/invest-applet/invest/quotes.py b/invest-applet/invest/quotes.py
index 6470add..9357bb3 100644
--- a/invest-applet/invest/quotes.py
+++ b/invest-applet/invest/quotes.py
@@ -410,9 +410,6 @@ class QuoteUpdater(Gtk.TreeStore):
                self.currencies = []
 
                try:
-                       quote_items = quotes.items ()
-                       quote_items.sort ()
-
                        self.quotes_change = 0
                        self.quotes_count = 0
                        self.statistics = {}
diff --git a/invest-applet/invest/widgets.py b/invest-applet/invest/widgets.py
index 868d5be..5518491 100644
--- a/invest-applet/invest/widgets.py
+++ b/invest-applet/invest/widgets.py
@@ -1,4 +1,4 @@
-from gi.repository import GObject, Gtk, GdkPixbuf, Pango
+from gi.repository import Gtk
 from gettext import gettext as _
 import locale
 import invest, invest.about, invest.chart
@@ -171,96 +171,3 @@ class InvestWidget(Gtk.TreeView):
 
        def is_stock(self, iter):
                return not self.is_group(iter)
-
-#class InvestTicker(Gtk.Label):
-#      def __init__(self):
-#              Gtk.Label.__init__(self, _("Waiting..."))
-#
-#              self.quotes = []
-#              GObject.timeout_add(TICKER_TIMEOUT, self.scroll_quotes)
-#
-#              get_quotes_updater().connect('quotes-updated', self.on_quotes_update)
-#
-#      def on_quotes_update(self, updater):
-#              self.quotes = []
-#              updater.foreach(self.update_quote, None)
-#
-#      def update_quote(self, model, path, iter, user_data):
-#              color = GREEN
-#              if model[iter][model.BALANCE] < 0:
-#                      color = RED
-#
-#              self.quotes.append(
-#                      "%s: <span foreground='%s'>%+.2f (%+.2f%%)</span> %.2f" %
-#                      (model[iter][model.SYMBOL], color, model[iter][model.BALANCE], 
model[iter][model.BALANCE_PCT], model[iter][model.VALUE]))
-#
-#      def scroll_quotes(self):
-#              if len(self.quotes) == 0:
-#                      return True
-#
-#              q = self.quotes.pop()
-#              self.set_markup("<span face='Monospace'>%s</span>" % q)
-#              self.quotes.insert(0, q)
-#
-#              return True
-#
-#gobject.type_register(InvestTicker)
-
-class InvestTrend(Gtk.Image):
-       def __init__(self):
-               Gtk.Image.__init__(self)
-               self.pixbuf = None
-               self.previous_allocation = (0,0)
-               self.connect('size-allocate', self.on_size_allocate)
-               get_quotes_updater().connect('quotes-updated', self.on_quotes_update)
-
-       def on_size_allocate(self, widget, allocation):
-               if self.previous_allocation == (allocation.width, allocation.height):
-                       return
-
-               self.pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, allocation.height, 
allocation.height)
-               self.set_color("grey")
-               self.previous_allocation = (allocation.width, allocation.height)
-
-       def set_color(self, color, opacity=0xFF):
-               if self.pixbuf != None:
-                       try:
-                               color = Pango.Color(color)
-                               factor = float(0xFF)/0xFFFF
-                               self.pixbuf.fill(
-                                       
int(color.red*factor)<<24|int(color.green*factor)<<16|int(color.blue*factor)<<8|opacity)
-                               self.set_from_pixbuf(self.pixbuf)
-                       except Exception as msg:
-                               invest.error("Could not set color: %s" % msg)
-
-       def on_quotes_update(self, updater):
-               start_total = 0
-               now_total = 0
-               for row in updater:
-                       # Don't count the ticker only symbols in the color-trend
-                       if row[updater.TICKER_ONLY]:
-                               continue
-
-                       var = row[updater.VARIATION]/100
-                       now = row[updater.VALUE]
-
-                       start = now / (1 + var)
-
-                       portfolio_number = sum([purchase["amount"] for purchase in 
invest.STOCKS[row[updater.SYMBOL]]["purchases"]])
-                       start_total += start * portfolio_number
-                       now_total += now * portfolio_number
-
-               day_var = 0
-               if start_total != 0:
-                       day_var = (now_total - start_total) / start_total * 100
-
-               color = int(2*day_var)
-               opacity = min(0xFF, int(abs(127.5*day_var)))
-               if day_var < 0:
-                       color = COLORSCALE_NEGATIVE[min(len(COLORSCALE_NEGATIVE)-1, abs(color))]
-               else:
-                       color = COLORSCALE_POSITIVE[min(len(COLORSCALE_POSITIVE)-1, abs(color))]
-
-               self.set_color(color, opacity)
-
-GObject.type_register(InvestTrend)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]