Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter 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)
commit19bf11e038544ace0fc6fb3e19f7b072df7e8bd2 (patch)
tree8d1167aa14144376640d42d903f724f18f0ea9d3
parent86a95405e1dc12546e935d3f202e577195504422 (diff)
new paragraph-style widgets
-rw-r--r--toolbar.py9
-rw-r--r--widgets.py55
2 files changed, 60 insertions, 4 deletions
diff --git a/toolbar.py b/toolbar.py
index 3054dec..0c6f1f3 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -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()
diff --git a/widgets.py b/widgets.py
index 0317ad0..e3a1cd9 100644
--- a/widgets.py
+++ b/widgets.py
@@ -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)'),