diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2009-09-06 12:35:27 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2009-09-06 12:35:27 (GMT) |
commit | 19bf11e038544ace0fc6fb3e19f7b072df7e8bd2 (patch) | |
tree | 8d1167aa14144376640d42d903f724f18f0ea9d3 | |
parent | 86a95405e1dc12546e935d3f202e577195504422 (diff) |
new paragraph-style widgets
-rw-r--r-- | toolbar.py | 9 | ||||
-rw-r--r-- | widgets.py | 55 |
2 files changed, 60 insertions, 4 deletions
@@ -385,9 +385,6 @@ class ParagraphToolbar(gtk.Toolbar): def __init__(self, abi): gtk.Toolbar.__init__(self) - self.insert(ToolComboBox(widgets.StyleCombo(abi)), -1) - self.insert(gtk.SeparatorToolItem(), -1) - group = widgets.AbiButton(abi, 'left-align', abi.align_left) group.props.named_icon = 'format-justify-left' group.props.tooltip = _('Left justify') @@ -411,8 +408,14 @@ class ParagraphToolbar(gtk.Toolbar): button.props.tooltip = _('Fill justify') self.insert(button, -1) + # List of bullet types self.insert(gtk.SeparatorToolItem(), -1) lists = RadioMenuButton(palette=widgets.ListsPalette(abi)) self.insert(lists, -1) + # List of heading types + self.insert(gtk.SeparatorToolItem(), -1) + headings = RadioMenuButton(palette=widgets.HeadingsPalette(abi)) + self.insert(headings, -1) + self.show_all() @@ -121,7 +121,8 @@ class FontSizeCombo(ComboBox): self.set_active(i) self.handler_unblock(self._changed_id) break; - +""" +# Replacing ComboBox with two Radio Palettes class StyleCombo(ComboBox): def __init__(self, abi): ComboBox.__init__(self) @@ -194,6 +195,7 @@ class StyleCombo(ComboBox): self.handler_block(self._style_changed_id) self.set_active(style_index) self.handler_unblock(self._style_changed_id) +""" class AbiButton(RadioToolButton): def __init__(self, abi, abi_signal, do_abi_cb, on_abi_cb=None, **kwargs): @@ -273,6 +275,57 @@ class ListsPalette(RadioPalette): self.show_all() +class HeadingsPalette(RadioPalette): + def __init__(self, abi): + RadioPalette.__init__(self) + + def append(icon_name, tooltip, do_abi_cb, on_abi_cb): + button = AbiButton(abi, 'style-name', do_abi_cb, on_abi_cb) + button.show() + button.props.icon_name = icon_name + button.props.group = group + RadioPalette.append(self, button, tooltip) + return button + + group = None + + group = append('paragraph-heading', _('Normal'), + lambda: + abi.set_style('Normal'), + lambda abi, style: + style not in ['Heading 1', + 'Heading 2', + 'Heading 3', + 'Heading 4', + 'Plain Text', + 'Block Text]) + + append('paragraph-h1', _('Heading 1'), + lambda: abi.set_style('Heading 1'), + lambda abi, style: style == 'Heading 1') + + append('paragraph-h2', _('Heading 2'), + lambda: abi.set_style('Heading 2'), + lambda abi, style: style == 'Heading 3') + + append('paragraph-h3', _('Heading 3'), + lambda: abi.set_style('Heading 3'), + lambda abi, style: style == 'Heading 3') + + append('paragraph-h4', _('Heading 4'), + lambda: abi.set_style('Heading 4'), + lambda abi, style: style == 'Heading 4') + + append('paragraph-plaintext', _('Plain Text'), + lambda: abi.set_style('Plain Text'), + lambda abi, style: style == 'Plain Text') + + append('paragraph-blocktext', _('Block Text'), + lambda: abi.set_style('Block Text'), + lambda abi, style: style == 'Block Text') + + self.show_all() + class ExportButton(ToolButton): _EXPORT_FORMATS = [{'mime_type' : 'application/rtf', 'title' : _('Rich Text (RTF)'), |