[gnome-applets/f14/master] add patch file

Adam Williamson adamwill at fedoraproject.org
Mon Jan 3 12:36:50 UTC 2011


commit bb5be76165f205a268751fc8780712ae6943e4a9
Author: Adam Williamson <awilliam at redhat.com>
Date:   Mon Jan 3 12:36:31 2011 +0000

    add patch file

 gnome-applets-2.32.0-invest_fix.patch |   83 +++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)
---
diff --git a/gnome-applets-2.32.0-invest_fix.patch b/gnome-applets-2.32.0-invest_fix.patch
new file mode 100644
index 0000000..6bb4def
--- /dev/null
+++ b/gnome-applets-2.32.0-invest_fix.patch
@@ -0,0 +1,83 @@
+From d4bea685996cfb4fe38aab3a5763b2517e83bdbf Mon Sep 17 00:00:00 2001
+From: Enrico Minack <enrico-minack at gmx.de>
+Date: Fri, 15 Oct 2010 14:14:50 +0000
+Subject: invest-applet: fixed exception occuring when only purchases are configured, bug #631418
+
+  replaced *simple_quote* variables with *quote*, which now cover ALL quotes,
+  not only simple ones, this removes the erroneous if branch
+---
+diff --git a/invest-applet/invest/quotes.py b/invest-applet/invest/quotes.py
+index 53b3000..b7ec21b 100644
+--- a/invest-applet/invest/quotes.py
++++ b/invest-applet/invest/quotes.py
+@@ -148,9 +148,9 @@ class QuoteUpdater(gtk.ListStore):
+ 
+ 	def update_tooltip(self):
+ 		tooltip = []
+-		if self.simple_quotes_count > 0:
++		if self.quotes_count > 0:
+ 			# Translators: This is share-market jargon. It is the average percentage change of all stock prices. The %s gets replaced with the string value of the change (localized), including the percent sign.
+-			tooltip.append(_('Average change: %s') % self.format_percent(self.avg_simple_quotes_change))
++			tooltip.append(_('Average change: %s') % self.format_percent(self.avg_quotes_change))
+ 		for currency, stats in self.statistics.items():
+ 			# get the statsitics
+ 			balance = stats["balance"]
+@@ -231,8 +231,8 @@ class QuoteUpdater(gtk.ListStore):
+ 			quote_items = quotes.items ()
+ 			quote_items.sort ()
+ 
+-			simple_quotes_change = 0
+-			self.simple_quotes_count = 0
++			quotes_change = 0
++			self.quotes_count = 0
+ 			self.statistics = {}
+ 
+ 			for ticker, val in quote_items:
+@@ -275,9 +275,7 @@ class QuoteUpdater(gtk.ListStore):
+ 						break
+ 
+ 				if is_simple_quote:
+-					self.simple_quotes_count += 1
+ 					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"])
+ 					row = self.insert(0, [ticker, label, val["currency"], False, balance, change, val["trade"], val["variation_pct"], pb])
+@@ -292,22 +290,21 @@ class QuoteUpdater(gtk.ListStore):
+ 				image_retriever.connect("completed", self.set_pb_callback, row)
+ 				image_retriever.start()
+ 
+-			if self.simple_quotes_count > 0:
+-				self.avg_simple_quotes_change = simple_quotes_change/float(self.simple_quotes_count)
+-			else:
+-				self.avg_simple_quotes_change = 0
++				quotes_change += val['variation_pct']
++				self.quotes_count += 1
+ 
+-			if self.avg_simple_quotes_change != 0:
+-				simple_quotes_change_sign = self.avg_simple_quotes_change / abs(self.avg_simple_quotes_change)
+-			else:
+-				simple_quotes_change_sign = 0
++			# we can only compute an avg quote change if there are quotes
++			if self.quotes_count > 0:
++				self.avg_quotes_change = quotes_change/float(self.quotes_count)
+ 
+-			# change icon
+-			if self.simple_quotes_count > 0:
+-				self.change_icon_callback(simple_quotes_change_sign)
++				# change icon
++				quotes_change_sign = 0
++				if self.avg_quotes_change != 0:
++					quotes_change_sign = self.avg_quotes_change / abs(self.avg_quotes_change)
++				self.change_icon_callback(quotes_change_sign)
+ 			else:
+-				positions_balance_sign = self.positions_balance/abs(self.positions_balance)
+-				self.change_icon_callback(positions_balance_sign)
++				self.avg_quotes_change = 0
++
+ 				
+ 			# mark quotes to finally be valid
+ 			self.quotes_valid = True
+--
+cgit v0.8.3.1
+


More information about the scm-commits mailing list