From 3134268fbfda6f681cea80c5c1278f3cdafa2657 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 15 May 2013 14:46:07 +0000 Subject: 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 --- (limited to 'toolbar.py') 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() -- cgit v0.9.1