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-05-15 14:46:07 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-05-15 16:50:52 (GMT)
commit3134268fbfda6f681cea80c5c1278f3cdafa2657 (patch)
tree3fee393f62d8eb9c1fa5eb2c7429da6f3fd05ee6 /toolbar.py
parentd259aee454c6f8cc0ae058a518c7785031ecddac (diff)
Move the list toolbar to a radiomenubutton in the paragraph toolbar
This is another change needed to use Write with rotated screen. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'toolbar.py')
-rw-r--r--toolbar.py66
1 files changed, 30 insertions, 36 deletions
diff --git a/toolbar.py b/toolbar.py
index 25d0d9b..363ce9b 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -574,52 +574,46 @@ class ParagraphToolbar(Gtk.Toolbar):
self.insert(Gtk.SeparatorToolItem(), -1)
- self.show_all()
-
-
-class ListToolbar(Gtk.Toolbar):
-
- def __init__(self, abi):
- GObject.GObject.__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.props.icon_name = icon_name
- button.props.group = group
- button.props.tooltip = tooltip
- self.insert(button, -1)
- return button
+ def append_list(icon_name, tooltip, do_abi_cb, on_abi_cb, button,
+ button_icon=None):
+ menu_item = AbiMenuItem(abi, 'style-name', do_abi_cb,
+ icon_name, tooltip, button, on_abi_cb, button_icon)
+ button.props.palette.menu.append(menu_item)
+ menu_item.show()
- group = None
+ list_btn = RadioMenuButton(icon_name='toolbar-bulletlist')
+ list_btn.props.tooltip = _('Select list')
- group = append('list-none', _('Normal'),
- lambda:
- abi.set_style('Normal'),
- lambda abi, style:
+ append_list('list-none', _('Normal'),
+ lambda: abi.set_style('Normal'),
+ lambda abi, style:
style not in ['Bullet List',
'Dashed List',
'Numbered List',
'Lower Case List',
- 'Upper Case List'])
+ 'Upper Case List'],
+ list_btn, 'toolbar-bulletlist')
+
+ append_list('list-bullet', _('Bullet List'),
+ lambda: abi.set_style('Bullet List'),
+ lambda abi, style: style == 'Bullet List', list_btn)
- append('list-bullet', _('Bullet List'),
- lambda: abi.set_style('Bullet List'),
- lambda abi, style: style == 'Bullet List')
+ append_list('list-dashed', _('Dashed List'),
+ lambda: abi.set_style('Dashed List'),
+ lambda abi, style: style == 'Dashed List', list_btn)
- append('list-dashed', _('Dashed List'),
- lambda: abi.set_style('Dashed List'),
- lambda abi, style: style == 'Dashed List')
+ append_list('list-numbered', _('Numbered List'),
+ lambda: abi.set_style('Numbered List'),
+ lambda abi, style: style == 'Numbered List', list_btn)
- append('list-numbered', _('Numbered List'),
- lambda: abi.set_style('Numbered List'),
- lambda abi, style: style == 'Numbered List')
+ append_list('list-lower-case', _('Lower Case List'),
+ lambda: abi.set_style('Lower Case List'),
+ lambda abi, style: style == 'Lower Case List', list_btn)
- append('list-lower-case', _('Lower Case List'),
- lambda: abi.set_style('Lower Case List'),
- lambda abi, style: style == 'Lower Case List')
+ append_list('list-upper-case', _('Upper Case List'),
+ lambda: abi.set_style('Upper Case List'),
+ lambda abi, style: style == 'Upper Case List', list_btn)
- append('list-upper-case', _('Upper Case List'),
- lambda: abi.set_style('Upper Case List'),
- lambda abi, style: style == 'Upper Case List')
+ self.insert(list_btn, -1)
self.show_all()