From 368ba0d8384929bef3ff6a0fd9f5cdd1ee4e6dd5 Mon Sep 17 00:00:00 2001 From: William Friesen Date: Sun, 11 Jul 2010 22:10:35 +1000 Subject: [PATCH] calculator: Calculate action now valid for other mathematical operators --- 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 eac506a..5e6d2c8 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 " @@ -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 -- 1.7.0.4