diff options
author | Reinier Heeres <reinier@heeres.eu> | 2008-01-26 14:28:34 (GMT) |
---|---|---|
committer | Reinier Heeres <reinier@heeres.eu> | 2008-01-26 14:28:34 (GMT) |
commit | 68f3c107e5cc6edd462bbaa1fa18f6f541bda684 (patch) | |
tree | a159f9b440c5302a31533d0f2fbb1554be90ba12 /toolbars.py | |
parent | 2f99ed5343d12d4cdc377df65634d26d24cf9b25 (diff) |
Nicer square/sqrt/exp buttons
Diffstat (limited to 'toolbars.py')
-rw-r--r-- | toolbars.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/toolbars.py b/toolbars.py index ea67357..6e478b2 100644 --- a/toolbars.py +++ b/toolbars.py @@ -1,3 +1,4 @@ +# -*- coding: UTF-8 -*- # toolbars.py, see CalcActivity.py for info import pygtk @@ -19,7 +20,11 @@ class IconToolButton(ToolButton): def __init__(self, icon_name, text, cb, help_cb=None): ToolButton.__init__(self) - self.set_label(icon_name) + label = gtk.Label() + label.set_markup(icon_name) + label.show() + self.set_label_widget(label) + self.create_palette(text, help_cb) self.connect('clicked', cb) @@ -91,20 +96,24 @@ class AlgebraToolbar(gtk.Toolbar): def __init__(self, calc): gtk.Toolbar.__init__(self) - self.insert(IconToolButton('square', _('Square'), + self.insert(IconToolButton('x<sup>2</sup>', _('Square'), lambda x: calc.button_pressed(calc.TYPE_OP_POST, '^2'), lambda x: calc.button_pressed(calc.TYPE_TEXT, 'help(square)')), -1) - self.insert(IconToolButton('sqrt', _('Square root'), + self.insert(IconToolButton('√x', _('Square root'), lambda x: calc.button_pressed(calc.TYPE_FUNCTION, 'sqrt'), lambda x: calc.button_pressed(calc.TYPE_TEXT, 'help(sqrt)')), -1) self.insert(LineSeparator(), -1) - self.insert(IconToolButton('exp', _('e to the power x'), + self.insert(IconToolButton('e<sup>x</sup>', _('e to the power x'), lambda x: calc.button_pressed(calc.TYPE_FUNCTION, 'exp'), lambda x: calc.button_pressed(calc.TYPE_TEXT, 'help(exp)')), -1) + self.insert(IconToolButton('x<sup>y</sup>', _('x to the power y'), + lambda x: calc.button_pressed(calc.TYPE_FUNCTION, 'pow'), + lambda x: calc.button_pressed(calc.TYPE_TEXT, 'help(pow)')), -1) + self.insert(IconToolButton('ln', _('Natural logarithm'), lambda x: calc.button_pressed(calc.TYPE_FUNCTION, 'ln'), lambda x: calc.button_pressed(calc.TYPE_TEXT, 'help(sqrt)')), -1) @@ -187,7 +196,7 @@ class ConstantsToolbar(gtk.Toolbar): def __init__(self, calc): gtk.Toolbar.__init__(self) - self.insert(IconToolButton('pi', _('Pi'), + self.insert(IconToolButton('π', _('Pi'), lambda x: calc.button_pressed(calc.TYPE_TEXT, 'pi')), -1) self.insert(IconToolButton('e', _('e'), |