[Sugar-devel] [PATCH v3] Changed symbols on the calculate activity button. (Ticket #2161)
Ishan Bansal
ishan at seeta.in
Thu Sep 30 15:35:32 EDT 2010
New symbols "×", "÷" and "=" (instead of "*","/" and "Enter" respectively)
variable equ_sym added to translate '=') defined for the in order to give a
calculator look to activity.
---
calculate.py | 1 +
layout.py | 3 ++-
mathlib.py | 13 +++++++++----
3 files changed, 12 insertions(+), 5 deletions(-)
v1->v2 : Symbol for "x" changed to "×"and bug description changed.
v2->v3 : Code added to translate '=' as being done for other symbols.
diff --git a/calculate.py b/calculate.py
index bda756c..d49f1f6 100644
--- a/calculate.py
+++ b/calculate.py
@@ -317,6 +317,7 @@ class Calculate(ShareableActivity):
self.KEYMAP['multiply'] = self.ml.mul_sym
self.KEYMAP['divide'] = self.ml.div_sym
+ self.KEYMAP['equal'] = self.ml.equ_sym
self.clipboard = gtk.Clipboard()
self.select_reason = self.SELECT_SELECT
diff --git a/layout.py b/layout.py
index d439a3a..b53efc1 100644
--- a/layout.py
+++ b/layout.py
@@ -47,6 +47,7 @@ class CalcLayout:
mul_sym = self._parent.ml.mul_sym
div_sym = self._parent.ml.div_sym
+ equ_sym = self._parent.ml.equ_sym
self.button_data = [
# [x, y, width, label, bgcol, cb]
@@ -74,7 +75,7 @@ class CalcLayout:
[4, 2, 1, div_sym, self.col_gray3, lambda w: self._parent.add_text(div_sym)],
[5, 2, 1, ')', self.col_gray3, lambda w: self._parent.add_text(')')],
- [3, 3, 3, _('Enter'), self.col_gray1, lambda w: self._parent.process()],
+ [3, 3, 3, equ_sym, self.col_gray1, lambda w: self._parent.process()],
]
def create_dialog(self):
diff --git a/mathlib.py b/mathlib.py
index b9bce1e..d0fabc8 100644
--- a/mathlib.py
+++ b/mathlib.py
@@ -78,15 +78,20 @@ class MathLib:
if self.fraction_sep == "" or self.fraction_sep == None:
self.fraction_sep = "."
- # TRANS: multiplication symbol (default: '*')
+ # TRANS: multiplication symbol (default: '×')
self.mul_sym = _('mul_sym')
if len(self.mul_sym) == 0 or len(self.mul_sym) > 3:
- self.mul_sym = '*'
+ self.mul_sym = '×'
- # TRANS: division symbol (default: '/')
+ # TRANS: division symbol (default: '÷')
self.div_sym = _('div_sym')
if len(self.div_sym) == 0 or len(self.div_sym) > 3:
- self.div_sym = '/'
+ self.div_sym = '÷'
+
+ # TRANS: equal symbol (default: '=')
+ self.equ_sym = _('equ_sym')
+ if len(self.equ_sym) == 0 or len(self.equ_sym) > 3:
+ self.equ_sym = '='
def set_format_type(self, fmt, digit_limit=9):
self.format_type = fmt
--
1.7.0.4
More information about the Sugar-devel
mailing list