Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/toolbar.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-06-11 15:24:45 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-06-11 22:18:33 (GMT)
commit6a04f9cc7427e6d3e204e0202418394aea9c8cd8 (patch)
tree7a2332d6a8f2ada6e46b05d54be5fe63fb213c15 /toolbar.py
parent75b84c723de83a823c18799d9c1becd9e1ca4b8a (diff)
Improve widgets to select font family and size with touch
Combos do not work well with touch, are replaced by new widgets provided in fontcombobox.py Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'toolbar.py')
-rw-r--r--toolbar.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/toolbar.py b/toolbar.py
index e344776..3b18f13 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -41,8 +41,8 @@ from sugar3.activity.widgets import RedoButton
from widgets import AbiButton
from widgets import AbiMenuItem
-from widgets import FontSizeCombo
from fontcombobox import FontComboBox
+from fontcombobox import FontSize
from gridcreate import GridCreateWidget
logger = logging.getLogger('write-activity')
@@ -430,8 +430,12 @@ class TextToolbar(Gtk.Toolbar):
self._font_family_cb)
self.insert(ToolComboBox(self.font_name_combo), -1)
- font_size = ToolComboBox(FontSizeCombo(abiword_canvas))
- self.insert(font_size, -1)
+ self.font_size = FontSize()
+ self._abi_handler = abiword_canvas.connect('font-size',
+ self._font_size_cb)
+ self._changed_id = self.font_size.connect(
+ 'changed', self._font_size_changed_cb, abiword_canvas)
+ self.insert(self.font_size, -1)
bold = ToggleToolButton('format-text-bold')
bold.set_tooltip(_('Bold'))
@@ -520,6 +524,19 @@ class TextToolbar(Gtk.Toolbar):
logging.debug('Abiword font changed to %s', font_family)
self.font_name_combo.set_font_name(font_family)
+ def _font_size_changed_cb(self, widget, abi):
+ abi.handler_block(self._abi_handler)
+ try:
+ abi.set_font_size(str(widget.get_font_size()))
+ finally:
+ abi.handler_unblock(self._abi_handler)
+
+ def _font_size_cb(self, abi, size):
+ logging.debug('Abiword font size changed to %s', size)
+ self.handler_block(self._changed_id)
+ self.font_size.set_font_size(int(size))
+ self.handler_unblock(self._changed_id)
+
def _setToggleButtonState(self, button, b, id):
button.handler_block(id)
button.set_active(b)