[kupfer: 2/18] calculator: Calculate action now valid for other mathematical operators



commit 254a265cdb89a00b0b7bae41d1b4aa652cdfd0e8
Author: William Friesen <wfriesen gmail com>
Date:   Sun Jul 11 22:10:35 2010 +1000

    calculator: Calculate action now valid for other mathematical operators
    
    Signed-off-by: Karol BÄdkowski <karol bedkowski gmail com>

 kupfer/plugin/calculator.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/calculator.py b/kupfer/plugin/calculator.py
index 4597c01..2e8c00e 100644
--- a/kupfer/plugin/calculator.py
+++ b/kupfer/plugin/calculator.py
@@ -1,7 +1,8 @@
 from __future__ import division
 __kupfer_name__ = _("Calculator")
 __kupfer_actions__ = ("Calculate", )
-__description__ = _("Calculate expressions starting with '='")
+__description__ = _("Calculate expressions starting with '=', or " \
+"containing mathematical operators")
 __version__ = ""
 __author__ = "Ulrik Sverdrup <ulrik sverdrup gmail com>"
 
@@ -128,7 +129,12 @@ class Calculate (Action):
 		yield TextLeaf
 	def valid_for_item(self, leaf):
 		text = leaf.object
-		return text and text.startswith("=")
+		return text and (text.startswith("=") or
+				"+" in text or
+				"-" in text or
+				"*" in text or
+				"/" in text or
+				"^" in text)
 
 	def get_description(self):
 		return None



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