diff options
author | Marc Maurer <uwog@uwog.net> | 2007-09-02 19:27:49 (GMT) |
---|---|---|
committer | Marc Maurer <uwog@uwog.net> | 2007-09-02 19:27:49 (GMT) |
commit | bdbbaa8a3ad17b65f96e0fb43f492a1a4c33db29 (patch) | |
tree | bf30cceb96b231d3f46bd551e5d9c3a47717e6db | |
parent | c6a2ece03409e50233d868f5e7b34238d8fec673 (diff) |
Hook up the abiword canvas 'font-family' signal to the Write toolbar
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | toolbar.py | 16 |
2 files changed, 15 insertions, 4 deletions
@@ -1,7 +1,8 @@ +* Hook up the abiword canvas 'font-family' signal to the Write toolbar (uwog) * Add a format-text-size icon before the text size selection dropdown (uwog) * Don't forget to actually show the separators in the Text toolbar (uwog) * Add a Style label before the Style combobox (uwog) -* Hook up the abiword canvas font size signal to the Write toolbar (uwog) +* Hook up the abiword canvas 'font-size' signal to the Write toolbar (uwog) 36 @@ -131,7 +131,9 @@ class TextToolbar(gtk.Toolbar): tool_item.show() self._abiword_canvas.connect('color', self._color_cb) + self._abiword_canvas.connect('font-size', self._font_size_cb) + self._abiword_canvas.connect('font-family', self._font_family_cb) self._abiword_canvas.connect('left-align', self._isLeftAlign_cb) self._abiword_canvas.connect('center-align', self._isCenterAlign_cb) @@ -181,12 +183,11 @@ class TextToolbar(gtk.Toolbar): self._abiword_canvas.set_text_color(newcolor.red // 256.0, newcolor.green // 256.0, newcolor.blue // 256.0) def _font_size_cb(self, abi, size): - logger.debug('Font size callback: %d', int(size)); for i, s in enumerate(self._font_sizes): if int(s) == int(size): - self._font_combo.handler_block(self._font_size_changed_id); + self._font_size_combo.handler_block(self._font_size_changed_id) self._font_size_combo.set_active(i) - self._font_combo.handler_unblock(self._font_size_changed_id); + self._font_size_combo.handler_unblock(self._font_size_changed_id) break; def _font_size_changed_cb(self, combobox): @@ -194,6 +195,15 @@ class TextToolbar(gtk.Toolbar): logger.debug('Setting font size: %d', int(self._font_sizes[self._font_size_combo.get_active()])) self._abiword_canvas.set_font_size(self._font_sizes[self._font_size_combo.get_active()]) + def _font_family_cb(self, abi, font_family): + for i, f in enumerate(self._fonts): + if f == font_family: + self._font_combo.handler_block(self._fonts_changed_id) + self._font_combo.set_active(i) + self._font_combo.handler_unblock(self._fonts_changed_id) + break; + # TODO: if no match is found, then add the font to the font family dropdown + def _font_changed_cb(self, combobox): if self._font_combo.get_active() != -1: logger.debug('Setting font name: %s', self._fonts[self._font_combo.get_active()]) |