From 39ba0fe60e6123be18a3270f4c2224790f422244 Mon Sep 17 00:00:00 2001
From: Ishan Bansal <ishan@seeta.in>
Date: Fri, 1 Oct 2010 00:44:44 +0530
Subject: [PATCH v3] Changed symbols on the calculate activity button. (Ticket #2161)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
|
b
|
class Calculate(ShareableActivity): |
317 | 317 | |
318 | 318 | self.KEYMAP['multiply'] = self.ml.mul_sym |
319 | 319 | self.KEYMAP['divide'] = self.ml.div_sym |
| 320 | self.KEYMAP['equal'] = self.ml.equ_sym |
320 | 321 | |
321 | 322 | self.clipboard = gtk.Clipboard() |
322 | 323 | self.select_reason = self.SELECT_SELECT |
diff --git a/layout.py b/layout.py
index d439a3a..b53efc1 100644
a
|
b
|
class CalcLayout: |
47 | 47 | |
48 | 48 | mul_sym = self._parent.ml.mul_sym |
49 | 49 | div_sym = self._parent.ml.div_sym |
| 50 | equ_sym = self._parent.ml.equ_sym |
50 | 51 | |
51 | 52 | self.button_data = [ |
52 | 53 | # [x, y, width, label, bgcol, cb] |
… |
… |
class CalcLayout: |
74 | 75 | [4, 2, 1, div_sym, self.col_gray3, lambda w: self._parent.add_text(div_sym)], |
75 | 76 | [5, 2, 1, ')', self.col_gray3, lambda w: self._parent.add_text(')')], |
76 | 77 | |
77 | | [3, 3, 3, _('Enter'), self.col_gray1, lambda w: self._parent.process()], |
| 78 | [3, 3, 3, equ_sym, self.col_gray1, lambda w: self._parent.process()], |
78 | 79 | ] |
79 | 80 | |
80 | 81 | def create_dialog(self): |
diff --git a/mathlib.py b/mathlib.py
index b9bce1e..d0fabc8 100644
a
|
b
|
class MathLib: |
78 | 78 | if self.fraction_sep == "" or self.fraction_sep == None: |
79 | 79 | self.fraction_sep = "." |
80 | 80 | |
81 | | # TRANS: multiplication symbol (default: '*') |
| 81 | # TRANS: multiplication symbol (default: 'Ã') |
82 | 82 | self.mul_sym = _('mul_sym') |
83 | 83 | if len(self.mul_sym) == 0 or len(self.mul_sym) > 3: |
84 | | self.mul_sym = '*' |
| 84 | self.mul_sym = 'Ã' |
85 | 85 | |
86 | | # TRANS: division symbol (default: '/') |
| 86 | # TRANS: division symbol (default: '÷') |
87 | 87 | self.div_sym = _('div_sym') |
88 | 88 | if len(self.div_sym) == 0 or len(self.div_sym) > 3: |
89 | | self.div_sym = '/' |
| 89 | self.div_sym = '÷' |
| 90 | |
| 91 | # TRANS: equal symbol (default: '=') |
| 92 | self.equ_sym = _('equ_sym') |
| 93 | if len(self.equ_sym) == 0 or len(self.equ_sym) > 3: |
| 94 | self.equ_sym = '=' |
90 | 95 | |
91 | 96 | def set_format_type(self, fmt, digit_limit=9): |
92 | 97 | self.format_type = fmt |