Ticket #2479: 0006-make-widgets.py-pep8-complaint.patch

File 0006-make-widgets.py-pep8-complaint.patch, 3.3 KB (added by godiard, 14 years ago)
  • widgets.py

    From b8d3e2a836c980904d4b72ce1e3805453abe3de6 Mon Sep 17 00:00:00 2001
    From: Gonzalo Odiard <godiard@sugarlabs.org>
    Date: Tue, 26 Oct 2010 09:10:54 -0300
    Subject: [PATCH 6/8] make widgets.py pep8 complaint
    
    ---
     widgets.py |   37 +++++++++++++++++++++++--------------
     1 files changed, 23 insertions(+), 14 deletions(-)
    
    diff --git a/widgets.py b/widgets.py
    index ecdaf19..ce2a601 100644
    a b from sugar.datastore import datastore 
    2727
    2828logger = logging.getLogger('write-activity')
    2929
     30
    3031class FontCombo(ComboBox):
     32
    3133    def __init__(self, abi):
    3234        ComboBox.__init__(self)
    3335
    class FontCombo(ComboBox): 
    8587            self.set_active(font_index)
    8688            self.handler_unblock(self._fonts_changed_id)
    8789
     90
    8891class FontSizeCombo(ComboBox):
     92
    8993    def __init__(self, abi):
    9094        ComboBox.__init__(self)
    9195
    class FontSizeCombo(ComboBox): 
    120124                self.handler_unblock(self._changed_id)
    121125                break
    122126
     127
    123128class AbiButton(RadioToolButton):
     129
    124130    def __init__(self, abi, abi_signal, do_abi_cb, on_abi_cb=None, **kwargs):
    125131        RadioToolButton.__init__(self, **kwargs)
    126132
    class AbiButton(RadioToolButton): 
    152158        finally:
    153159            self.handler_unblock(self._toggled_handler)
    154160
     161
    155162class ExportButton(ToolButton):
    156     _EXPORT_FORMATS = [{'mime_type' : 'application/rtf',
    157                         'title'     : _('Rich Text (RTF)'),
    158                         'jpostfix'  : _('RTF'),
    159                         'exp_props' : ''},
    160 
    161                        {'mime_type' : 'text/html',
    162                         'title'     : _('Hypertext (HTML)'),
    163                         'jpostfix'  : _('HTML'),
    164                         'exp_props' : 'html4:yes; declare-xml:no; ' \
     163
     164    _EXPORT_FORMATS = [{'mime_type': 'application/rtf',
     165                        'title': _('Rich Text (RTF)'),
     166                        'jpostfix': _('RTF'),
     167                        'exp_props': ''},
     168
     169                       {'mime_type': 'text/html',
     170                        'title': _('Hypertext (HTML)'),
     171                        'jpostfix': _('HTML'),
     172                        'exp_props': 'html4:yes; declare-xml:no; ' \
    165173                                      'embed-css:yes; embed-images:yes;'},
    166174
    167                        {'mime_type' : 'text/plain',
    168                         'title'     : _('Plain Text (TXT)'),
    169                         'jpostfix'  : _('TXT'),
    170                         'exp_props' : ''}]
     175                       {'mime_type': 'text/plain',
     176                        'title': _('Plain Text (TXT)'),
     177                        'jpostfix': _('TXT'),
     178                        'exp_props': ''}]
    171179
    172180    def __init__(self, activity, abi):
    173181        ToolButton.__init__(self, 'document-save')
    class ExportButton(ToolButton): 
    200208        act_meta = activity.metadata
    201209        fileObject.metadata['title'] = \
    202210                act_meta['title'] + ' (' + format['jpostfix'] + ')'
    203         fileObject.metadata['title_set_by_user'] = act_meta['title_set_by_user']
     211        fileObject.metadata['title_set_by_user'] = \
     212            act_meta['title_set_by_user']
    204213        fileObject.metadata['mime_type'] = format['mime_type']
    205214        fileObject.metadata['fulltext'] = abi.get_content(
    206215                extension_or_mimetype=".txt")[:3000]