Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/widgets.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2011-08-30 17:35:32 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2011-08-30 17:35:32 (GMT)
commit5e1f45d74b76b5716cac328ef23cb88ec391612f (patch)
treee453ef2e798e7f4329b9cb61205801e694ee4c06 /widgets.py
parent26b50bc9996d3c0abd0754b42f2098f4c4d90d89 (diff)
Replace the export combo by a group of buttons
This change do more discoverable the functionality and improve consistencywith other activities. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'widgets.py')
-rw-r--r--widgets.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/widgets.py b/widgets.py
index 0a525bf..728963d 100644
--- a/widgets.py
+++ b/widgets.py
@@ -159,47 +159,44 @@ class AbiButton(RadioToolButton):
self.handler_unblock(self._toggled_handler)
-class ExportButton(ToolButton):
+class ExportButtonFactory():
_EXPORT_FORMATS = [{'mime_type': 'application/rtf',
'title': _('Rich Text (RTF)'),
+ 'icon':'save-as-rtf',
'jpostfix': _('RTF'),
'exp_props': ''},
{'mime_type': 'text/html',
'title': _('Hypertext (HTML)'),
+ 'icon':'save-as-html',
'jpostfix': _('HTML'),
'exp_props': 'html4:yes; declare-xml:no; ' \
'embed-css:yes; embed-images:yes;'},
{'mime_type': 'text/plain',
'title': _('Plain Text (TXT)'),
+ 'icon':'save-as-txt',
'jpostfix': _('TXT'),
'exp_props': ''},
{'mime_type': 'application/pdf',
'title': _('Portable Document Format (PDF)'),
+ 'icon':'save-as-pdf',
'jpostfix': _('PDF'),
'exp_props': ''}]
def __init__(self, activity, abi):
- ToolButton.__init__(self, 'document-save')
- self.props.tooltip = _('Export')
- self.props.label = _('Export')
+ toolbar = activity.activity_button.props.page
for i in self._EXPORT_FORMATS:
- menu_item = MenuItem(i['title'])
- menu_item.connect('activate', self.__activate_cb, activity, abi, i)
- self.props.palette.menu.append(menu_item)
- menu_item.show()
-
- def do_clicked(self):
- if self.props.palette.is_up():
- self.props.palette.popdown(immediate=True)
- else:
- self.props.palette.popup(immediate=True, state=Palette.SECONDARY)
-
- def __activate_cb(self, menu_item, activity, abi, format):
+ button = ToolButton(i['icon'])
+ button.set_tooltip(i['title'])
+ button.connect('clicked', self.__clicked_cb, activity, abi, i)
+ toolbar.insert(button, -1)
+ button.show()
+
+ def __clicked_cb(self, menu_item, activity, abi, format):
logger.debug('exporting file: %r' % format)
exp_props = format['exp_props']