Ticket #1109: 0001-EOL-fixes.patch

File 0001-EOL-fixes.patch, 104.8 KB (added by sascha_silbe, 12 years ago)

Trim end of line on all source files

  • src/sugar/Makefile.am

    From 5288bf7015decb1055774c4c481be3dc186fd336 Mon Sep 17 00:00:00 2001
    From: Sascha Silbe <sascha@silbe.org>
    Date: Mon, 17 Aug 2009 20:38:00 +0200
    Subject: [PATCH] EOL fixes
    
    ---
     src/sugar/Makefile.am                  |    2 +-
     src/sugar/activity/__init__.py         |   20 +++---
     src/sugar/activity/activity.py         |  140 ++++++++++++++++----------------
     src/sugar/activity/activityfactory.py  |    4 +-
     src/sugar/activity/activityhandle.py   |   28 +++---
     src/sugar/activity/activityservice.py  |   12 ++--
     src/sugar/activity/bundlebuilder.py    |   22 +++---
     src/sugar/activity/main.py             |    6 +-
     src/sugar/activity/namingalert.py      |   22 +++---
     src/sugar/bundle/activitybundle.py     |   28 +++---
     src/sugar/bundle/bundle.py             |    6 +-
     src/sugar/datastore/datastore.py       |   14 ++--
     src/sugar/datastore/dbus_helpers.py    |    2 +-
     src/sugar/eggaccelerators.c            |   62 +++++++-------
     src/sugar/eggaccelerators.h            |    8 +-
     src/sugar/eggdesktopfile.c             |    8 +-
     src/sugar/eggsmclient-xsmp.c           |    8 +-
     src/sugar/eggsmclient.c                |    2 +-
     src/sugar/graphics/alert.py            |   38 +++++-----
     src/sugar/graphics/animator.py         |    2 +-
     src/sugar/graphics/canvastextview.py   |    4 +-
     src/sugar/graphics/colorbutton.py      |   28 +++---
     src/sugar/graphics/combobox.py         |    4 +-
     src/sugar/graphics/icon.py             |    8 +-
     src/sugar/graphics/notebook.py         |   16 ++--
     src/sugar/graphics/objectchooser.py    |    2 +-
     src/sugar/graphics/palette.py          |   10 +-
     src/sugar/graphics/palettegroup.py     |    2 +-
     src/sugar/graphics/palettewindow.py    |   10 +-
     src/sugar/graphics/radiotoolbutton.py  |    2 +-
     src/sugar/graphics/roundbox.py         |    4 +-
     src/sugar/graphics/toggletoolbutton.py |    6 +-
     src/sugar/graphics/toolbox.py          |   12 ++--
     src/sugar/graphics/toolbutton.py       |    2 +-
     src/sugar/graphics/tray.py             |    4 +-
     src/sugar/graphics/window.py           |   20 +++---
     src/sugar/gsm-app.c                    |    2 +-
     src/sugar/gsm-app.h                    |    2 +-
     src/sugar/gsm-client-xsmp.c            |   10 +-
     src/sugar/gsm-client.h                 |    2 +-
     src/sugar/gsm-session.c                |   12 ++--
     src/sugar/gsm-session.h                |   14 ++--
     src/sugar/network.py                   |    2 +-
     src/sugar/presence/__init__.py         |    2 +-
     src/sugar/presence/activity.py         |   28 +++---
     src/sugar/presence/buddy.py            |   58 +++++++-------
     src/sugar/presence/presenceservice.py  |   86 ++++++++++----------
     src/sugar/profile.py                   |   22 +++---
     src/sugar/sugar-address-entry.c        |   48 ++++++------
     src/sugar/sugar-key-grabber.c          |    8 +-
     src/sugar/util.py                      |   20 +++---
     src/sugar/wm.py                        |    2 +-
     tests/graphics/iconwidget.py           |    2 +-
     tests/lib/test_mime.py                 |    2 +-
     54 files changed, 445 insertions(+), 445 deletions(-)
    
    diff --git a/src/sugar/Makefile.am b/src/sugar/Makefile.am
    index fb87bf6..236e337 100644
    a b _sugarext.c: _sugarext.defs _sugarext.override 
    7474            --prefix py$* $*.defs) > gen-$*.c \
    7575        && cp gen-$*.c $*.c \
    7676        && rm -f gen-$*.c
    77        
     77
    7878sugar-marshal.c: sugar-marshal.list
    7979        $(GLIB_GENMARSHAL) --prefix=sugar_marshal \
    8080                $(srcdir)/sugar-marshal.list --header --body > sugar-marshal.c
  • src/sugar/activity/__init__.py

    diff --git a/src/sugar/activity/__init__.py b/src/sugar/activity/__init__.py
    index 8d3ef2b..b69646c 100644
    a b  
    1818"""Activity implementation code for Sugar-based activities
    1919
    2020Each activity within the OLPC environment must provide two
    21 dbus services.  The first, patterned after the 
     21dbus services.  The first, patterned after the
    2222
    2323    sugar.activity.activityfactory.ActivityFactory
    2424
    25 class is responsible for providing a "create" method which 
    26 takes a small dictionary with values corresponding to a 
     25class is responsible for providing a "create" method which
     26takes a small dictionary with values corresponding to a
    2727
    2828    sugar.activity.activityhandle.ActivityHandle
    2929
    Each activity so registered is described by a 
    3333
    3434    sugar.activity.bundle.Bundle
    3535
    36 instance, which parses a specially formatted activity.info 
    37 file (stored in the activity directory's ./activity 
    38 subdirectory).  The 
     36instance, which parses a specially formatted activity.info
     37file (stored in the activity directory's ./activity
     38subdirectory).  The
    3939
    4040    sugar.activity.bundlebuilder
    4141
    42 module provides facilities for the standard setup.py module 
    43 which produces and registers bundles from activity source 
     42module provides facilities for the standard setup.py module
     43which produces and registers bundles from activity source
    4444directories.
    4545
    4646Once instantiated by the ActivityFactory's create method,
    47 each activity must provide an introspection API patterned 
     47each activity must provide an introspection API patterned
    4848after the
    4949
    5050    sugar.activity.activityservice.ActivityService
    5151
    52 class.  This class allows for querying the ID of the root 
     52class.  This class allows for querying the ID of the root
    5353window, requesting sharing across the network, and basic
    5454"what type of application are you" queries.
    5555"""
  • src/sugar/activity/activity.py

    diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
    index f20d402..b286af1 100644
    a b  
    11"""Base class for activities written in Python
    22
    3 This is currently the only definitive reference for what an 
     3This is currently the only definitive reference for what an
    44activity must do to participate in the Sugar desktop.
    55
    66   A Basic Activity
    The convention is to call it ActivitynameActivity, but this is not required as 
    1010the activity.info file associated with your activity will tell the sugar-shell
    1111which class to start.
    1212
    13 For example the most minimal Activity:
     13For example the most minimal Activity:
     14
    1415
    15  
    1616   from sugar.activity import activity
    17    
     17
    1818   class ReadActivity(activity.Activity):
    1919        pass
    2020
    import dbus 
    6161import dbus.service
    6262import cjson
    6363
    64 from sugar import util       
     64from sugar import util
    6565from sugar.presence import presenceservice
    6666from sugar.activity.activityservice import ActivityService
    6767from sugar.activity.namingalert import NamingAlert
    class _ActivitySession(gobject.GObject): 
    136136class Activity(Window, gtk.Container):
    137137    """This is the base Activity class that all other Activities derive from.
    138138       This is where your activity starts.
    139    
     139
    140140    To get a working Activity:
    141141        0. Derive your Activity from this class:
    142142                class MyActivity(activity.Activity):
    143143                    ...
    144                    
     144
    145145        1. implement an __init__() method for your Activity class.
    146        
     146
    147147           Use your init method to create your own ActivityToolbar which will
    148            contain some standard buttons: 
     148           contain some standard buttons:
    149149                toolbox = activity.ActivityToolbox(self)
    150            
     150
    151151           Add extra Toolbars to your toolbox.
    152            
     152
    153153           You should setup Activity sharing here too.
    154            
     154
    155155           Finaly, your Activity may need some resources which you can claim
    156156           here too.
    157            
     157
    158158           The __init__() method is also used to make the distinction between
    159            being resumed from the Journal, or starting with a blank document. 
    160            
     159           being resumed from the Journal, or starting with a blank document.
     160
    161161        2. Implement read_file() and write_file()
    162162           Most activities revolve around creating and storing Journal entries.
    163163           For example, Write: You create a document, it is saved to the Journal
    164164           and then later you resume working on the document.
    165            
     165
    166166           read_file() and write_file() will be called by sugar to tell your
    167167           Activity that it should load or save the document the user is working
    168168           on.
    169            
     169
    170170        3. Implement our Activity Toolbars.
    171171           The Toolbars are added to your Activity in step 1 (the toolbox), but
    172172           you need to implement them somewhere. Now is a good time.
    173            
     173
    174174           There are a number of standard Toolbars. The most basic one, the one
    175175           your almost absolutely MUST have is the ActivityToolbar. Without
    176176           this, you're not really making a proper Sugar Activity (which may be
    177177           okay, but you should really stop and think about why not!) You do
    178            this with the ActivityToolbox(self) call in step 1. 
    179            
     178           this with the ActivityToolbox(self) call in step 1.
     179
    180180           Usually, you will also need the standard EditToolbar. This is the one
    181181           which has the standard copy and paste buttons. You need to derive
    182182           your own EditToolbar class from sugar.EditToolbar:
    183183                class EditToolbar(activity.EditToolbar):
    184184                    ...
    185                    
     185
    186186           See EditToolbar for the methods you should implement in your class.
    187            
     187
    188188           Finaly, your Activity will very likely need some activity specific
    189189           buttons and options you can create your own toolbars by deriving a
    190190           class from gtk.Toolbar:
    191191                class MySpecialToolbar(gtk.Toolbar):
    192192                    ...
    193                    
     193
    194194        4. Use your creativity. Make your Activity something special and share
    195195           it with your friends!
    196            
     196
    197197    Read through the methods of the Activity class below, to learn more about
    198     how to make an Activity work. 
    199    
     198    how to make an Activity work.
     199
    200200    Hint: A good and simple Activity to learn from is the Read activity. To
    201201    create your own activity, you may want to copy it and use it as a template.
    202202    """
    class Activity(Window, gtk.Container): 
    208208    }
    209209
    210210    def __init__(self, handle, create_jobject=True):
    211         """Initialise the Activity 
    212        
     211        """Initialise the Activity
     212
    213213        handle -- sugar.activity.activityhandle.ActivityHandle
    214             instance providing the activity id and access to the 
    215             presence service which *may* provide sharing for this 
     214            instance providing the activity id and access to the
     215            presence service which *may* provide sharing for this
    216216            application
    217217
    218218        create_jobject -- boolean
    219219            define if it should create a journal object if we are
    220220            not resuming
    221221
    222         Side effects: 
    223        
    224             Sets the gdk screen DPI setting (resolution) to the 
     222        Side effects:
     223
     224            Sets the gdk screen DPI setting (resolution) to the
    225225            Sugar screen resolution.
    226            
     226
    227227            Connects our "destroy" message to our _destroy_cb
    228228            method.
    229        
     229
    230230            Creates a base gtk.Window within this window.
    231            
     231
    232232            Creates an ActivityService (self._bus) servicing
    233233            this application.
    234        
    235         Usage:       
     234
     235        Usage:
    236236            If your Activity implements __init__(), it should call
    237237            the base class __init()__ before doing Activity specific things.
    238            
     238
    239239        """
    240240        Window.__init__(self)
    241241
    class Activity(Window, gtk.Container): 
    280280        share_scope = SCOPE_PRIVATE
    281281
    282282        if handle.object_id:
    283             self._jobject = datastore.get(handle.object_id)           
     283            self._jobject = datastore.get(handle.object_id)
    284284            self.set_title(self._jobject.metadata['title'])
    285                
     285
    286286            if self._jobject.metadata.has_key('share-scope'):
    287287                share_scope = self._jobject.metadata['share-scope']
    288288
    class Activity(Window, gtk.Container): 
    364364
    365365    def get_id(self):
    366366        """Returns the activity id of the current instance of your activity.
    367        
     367
    368368        The activity id is sort-of-like the unix process id (PID). However,
    369369        unlike PIDs it is only different for each new instance (with
    370370        create_jobject = True set) and stays the same everytime a user
    class Activity(Window, gtk.Container): 
    379379
    380380    def set_canvas(self, canvas):
    381381        """Sets the 'work area' of your activity with the canvas of your choice.
    382        
     382
    383383        One commonly used canvas is gtk.ScrolledWindow
    384384        """
    385385        Window.set_canvas(self, canvas)
    class Activity(Window, gtk.Container): 
    412412        logging.debug("Error creating activity datastore object: %s" % err)
    413413
    414414    def get_activity_root(self):
    415         """ FIXME: Deprecated. This part of the API has been moved 
     415        """ FIXME: Deprecated. This part of the API has been moved
    416416        out of this class to the module itself
    417417
    418418        Returns a path for saving Activity specific preferences, etc.
    419        
     419
    420420        Returns a path to the location in the filesystem where the activity can
    421421        store activity related data that doesn't pertain to the current
    422422        execution of the activity and thus cannot go into the DataStore.
    423        
     423
    424424        Currently, this will return something like
    425425        ~/.sugar/default/MyActivityName/
    426        
     426
    427427        Activities should ONLY save settings, user preferences and other data
    428428        which isn't specific to a journal item here. If (meta-)data is in anyway
    429         specific to a journal entry, it MUST be stored in the DataStore.       
     429        specific to a journal entry, it MUST be stored in the DataStore.
    430430        """
    431431        if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \
    432432           os.environ['SUGAR_ACTIVITY_ROOT']:
    class Activity(Window, gtk.Container): 
    438438        """
    439439        Subclasses implement this method if they support resuming objects from
    440440        the journal. 'file_path' is the file to read from.
    441        
     441
    442442        You should immediately open the file from the file_path, because the
    443443        file_name will be deleted immediately after returning from read_file().
    444444        Once the file has been opened, you do not have to read it immediately:
    445445        After you have opened it, the file will only be really gone when you
    446446        close it.
    447        
     447
    448448        Although not required, this is also a good time to read all meta-data:
    449449        the file itself cannot be changed externally, but the title, description
    450450        and other metadata['tags'] may change. So if it is important for you to
    451         notice changes, this is the time to record the originals.       
     451        notice changes, this is the time to record the originals.
    452452        """
    453453        raise NotImplementedError
    454454
    class Activity(Window, gtk.Container): 
    456456        """
    457457        Subclasses implement this method if they support saving data to objects
    458458        in the journal. 'file_path' is the file to write to.
    459        
     459
    460460        If the user did make changes, you should create the file_path and save
    461461        all document data to it.
    462        
     462
    463463        Additionally, you should also write any metadata needed to resume your
    464464        activity. For example, the Read activity saves the current page and zoom
    465465        level, so it can display the page.
    466        
     466
    467467        Note: Currently, the file_path *WILL* be different from the one you
    468468        received in file_read(). Even if you kept the file_path from file_read()
    469         open until now, you must still write the entire file to this file_path.     
     469        open until now, you must still write the entire file to this file_path.
    470470        """
    471471        raise NotImplementedError
    472472
    class Activity(Window, gtk.Container): 
    539539
    540540    def save(self):
    541541        """Request that the activity is saved to the Journal.
    542        
     542
    543543        This method is called by the close() method below. In general,
    544544        activities should not override this method. This method is part of the
    545545        public API of an Acivity, and should behave in standard ways. Use your
    546         own implementation of write_file() to save your Activity specific data.       
     546        own implementation of write_file() to save your Activity specific data.
    547547        """
    548548
    549549        if self._jobject is None:
    class Activity(Window, gtk.Container): 
    590590    def copy(self):
    591591        """Request that the activity 'Keep in Journal' the current state
    592592           of the activity.
    593        
     593
    594594        Activities should not override this method. Instead, like save() do any
    595595        copy work that needs to be done in write_file()
    596596        """
    class Activity(Window, gtk.Container): 
    656656
    657657    def _send_invites(self):
    658658        while self._invites_queue:
    659             buddy_key = self._invites_queue.pop()             
     659            buddy_key = self._invites_queue.pop()
    660660            buddy = self._pservice.get_buddy(buddy_key)
    661661            if buddy:
    662662                self.shared_activity.invite(
    class Activity(Window, gtk.Container): 
    666666
    667667    def invite(self, buddy_key):
    668668        """Invite a buddy to join this Activity.
    669        
     669
    670670        Side Effects:
    671671            Calls self.share(True) to privately share the activity if it wasn't
    672             shared before.           
     672            shared before.
    673673        """
    674674        self._invites_queue.append(buddy_key)
    675675
    class Activity(Window, gtk.Container): 
    681681
    682682    def share(self, private=False):
    683683        """Request that the activity be shared on the network.
    684        
     684
    685685        private -- bool: True to share by invitation only,
    686686            False to advertise as shared to everyone.
    687687
    class Activity(Window, gtk.Container): 
    694694        verb = private and 'private' or 'public'
    695695        logging.debug('Requesting %s share of activity %s.' %
    696696                      (verb, self._activity_id))
    697         self._share_id = self._pservice.connect("activity-shared", 
     697        self._share_id = self._pservice.connect("activity-shared",
    698698                                                self.__share_cb)
    699699        self._pservice.share_activity(self, private=private)
    700700
    class Activity(Window, gtk.Container): 
    752752
    753753    def close(self, skip_save=False):
    754754        """Request that the activity be stopped and saved to the Journal
    755        
     755
    756756        Activities should not override this method, but should implement
    757757        write_file() to do any state saving instead. If the application wants
    758758        to control wether it can close, it should override can_close().
    class Activity(Window, gtk.Container): 
    783783
    784784    def get_metadata(self):
    785785        """Returns the jobject metadata or None if there is no jobject.
    786        
    787         Activities can set metadata in write_file() using:                   
     786
     787        Activities can set metadata in write_file() using:
    788788            self.metadata['MyKey'] = "Something"
    789            
    790         and retrieve metadata in read_file() using:       
     789
     790        and retrieve metadata in read_file() using:
    791791            self.metadata.get('MyKey', 'aDefaultValue')
    792                
     792
    793793        Note: Make sure your activity works properly if one or more of the
    794794        metadata items is missing. Never assume they will all be present.
    795795        """
    def _get_session(): 
    822822def get_bundle_name():
    823823    """Return the bundle name for the current process' bundle"""
    824824    return os.environ['SUGAR_BUNDLE_NAME']
    825    
     825
    826826def get_bundle_path():
    827827    """Return the bundle path for the current process' bundle"""
    828828    return os.environ['SUGAR_BUNDLE_PATH']
  • src/sugar/activity/activityfactory.py

    diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
    index dcd840f..6d4c1c3 100644
    a b def get_environment(activity): 
    114114    if activity.get_path().startswith(env.get_user_activities_path()):
    115115        environ['SUGAR_LOCALEDIR'] = os.path.join(activity.get_path(), 'locale')
    116116
    117     if activity.get_bundle_id() in [ 'org.laptop.WebActivity', 
     117    if activity.get_bundle_id() in [ 'org.laptop.WebActivity',
    118118                                     'org.laptop.GmailActivity',
    119119                                     'org.laptop.WikiBrowseActivity'
    120120                                   ]:
    class ActivityCreationHandler(gobject.GObject): 
    204204        self._bundle = bundle
    205205        self._service_name = bundle.get_bundle_id()
    206206        self._handle = handle
    207    
     207
    208208        bus = dbus.SessionBus()
    209209        bus_object = bus.get_object(_SHELL_SERVICE, _SHELL_PATH)
    210210        self._shell = dbus.Interface(bus_object, _SHELL_IFACE)
  • src/sugar/activity/activityhandle.py

    diff --git a/src/sugar/activity/activityhandle.py b/src/sugar/activity/activityhandle.py
    index f255fd5..7240e3c 100644
    a b class ActivityHandle(object): 
    2525        self, activity_id=None, object_id=None, uri=None
    2626    ):
    2727        """Initialise the handle from activity_id
    28        
     28
    2929        activity_id -- unique id for the activity to be
    3030            created
    31         object_id -- identity of the journal object 
    32             associated with the activity. It was used by 
    33             the journal prototype implementation, might 
    34             change when we do the real one. 
    35            
    36             When you resume an activity from the journal 
    37             the object_id will be passed in. It's optional 
    38             since new activities does not have an 
     31        object_id -- identity of the journal object
     32            associated with the activity. It was used by
     33            the journal prototype implementation, might
     34            change when we do the real one.
     35
     36            When you resume an activity from the journal
     37            the object_id will be passed in. It's optional
     38            since new activities does not have an
    3939            associated object (yet).
    40            
     40
    4141            XXX Not clear how this relates to the activity
    4242            id yet, i.e. not sure we really need both. TBF
    43         uri -- URI associated with the activity. Used when 
    44             opening an external file or resource in the 
    45             activity, rather than a journal object 
    46             (downloads stored on the file system for 
     43        uri -- URI associated with the activity. Used when
     44            opening an external file or resource in the
     45            activity, rather than a journal object
     46            (downloads stored on the file system for
    4747            example or web pages)
    4848        """
    4949        self.activity_id = activity_id
  • src/sugar/activity/activityservice.py

    diff --git a/src/sugar/activity/activityservice.py b/src/sugar/activity/activityservice.py
    index ff806f3..0d6cf03 100644
    a b _ACTIVITY_INTERFACE = "org.laptop.Activity" 
    3030
    3131class ActivityService(dbus.service.Object):
    3232    """Base dbus service object that each Activity uses to export dbus methods.
    33    
     33
    3434    The dbus service is separate from the actual Activity object so that we can
    3535    tightly control what stuff passes through the dbus python bindings."""
    3636
    3737    def __init__(self, activity):
    3838        """Initialise the service for the given activity
    39        
     39
    4040        activity -- sugar.activity.activity.Activity instance
    41        
     41
    4242        Creates dbus services that use the instance's activity_id
    43         as discriminants among all active services 
    44         of this type.  That is, the services are all available 
     43        as discriminants among all active services
     44        of this type.  That is, the services are all available
    4545        as names/paths derived from the instance's activity_id.
    46        
     46
    4747        The various methods exposed on dbus are just forwarded
    4848        to the client Activity object's equally-named methods.
    4949        """
  • src/sugar/activity/bundlebuilder.py

    diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
    index 555fe98..b11c7d0 100644
    a b from sugar.bundle.activitybundle import ActivityBundle 
    3636
    3737IGNORE_DIRS = ['dist', '.git']
    3838IGNORE_FILES = ['.gitignore', 'MANIFEST', '*.pyc', '*~', '*.bak', 'pseudo.po']
    39        
     39
    4040def list_files(base_dir, ignore_dirs=None, ignore_files=None):
    4141    result = []
    4242
    def list_files(base_dir, ignore_dirs=None, ignore_files=None): 
    4646        if ignore_files:
    4747            for pattern in ignore_files:
    4848                files = [f for f in files if not fnmatch(f, pattern)]
    49                
     49
    5050        rel_path = root[len(base_dir) + 1:]
    5151        for f in files:
    5252            result.append(os.path.join(rel_path, f))
    class Config(object): 
    8383        self.bundle_name = reduce(lambda x, y:x+y, self.activity_name.split())
    8484        self.bundle_root_dir = self.bundle_name + '.activity'
    8585        self.tar_root_dir = '%s-%d' % (self.bundle_name, self.version)
    86            
     86
    8787        if self.dist_name:
    8888            self.xo_name = self.tar_name = self.dist_name
    8989        else:
    class Builder(object): 
    103103        if not self.config.bundle.is_dir(po_dir):
    104104            logging.warn("Missing po/ dir, cannot build_locale")
    105105            return
    106        
     106
    107107        locale_dir = os.path.join(self.config.source_dir, 'locale')
    108108
    109109        if os.path.exists(locale_dir):
    class Builder(object): 
    154154                missing_files.append(path)
    155155
    156156        return missing_files
    157        
     157
    158158    def fix_manifest(self):
    159159        self.build()
    160160
    161161        manifest = self.config.bundle.manifest
    162        
     162
    163163        for path in self.check_manifest():
    164164            manifest.append(path)
    165        
     165
    166166        f = open(os.path.join(self.config.source_dir, "MANIFEST"), "wb")
    167167        for line in manifest:
    168168            f.write(line + "\n")
    class XOPackager(Packager): 
    186186    def package(self):
    187187        bundle_zip = zipfile.ZipFile(self.package_path, 'w',
    188188                                     zipfile.ZIP_DEFLATED)
    189        
     189
    190190        missing_files = self.builder.check_manifest()
    191191        if missing_files:
    192192            logging.warn('These files are not included in the manifest ' \
    class SourcePackager(Packager): 
    207207                                         self.config.tar_name)
    208208
    209209    def get_files(self):
    210         git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE, 
     210        git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE,
    211211                                  cwd=self.config.source_dir)
    212212        stdout, _ = git_ls.communicate()
    213213        if git_ls.returncode :
    214214            # Fall back to filtered list
    215215            return list_files(self.config.source_dir,
    216216                              IGNORE_DIRS, IGNORE_FILES)
    217        
     217
    218218        return [path.strip() for path in stdout.strip('\n').split('\n')]
    219219
    220220    def package(self):
    def cmd_dist_xo(config, args): 
    286286    if args:
    287287        print 'Usage: %prog dist_xo'
    288288        return
    289    
     289
    290290    packager = XOPackager(Builder(config))
    291291    packager.package()
    292292
  • src/sugar/activity/main.py

    diff --git a/src/sugar/activity/main.py b/src/sugar/activity/main.py
    index 721595c..168b2f4 100644
    a b def get_single_process_path(bundle_id): 
    4343class SingleProcess(dbus.service.Object):
    4444    def __init__(self, name_service, constructor):
    4545        self.constructor = constructor
    46    
     46
    4747        bus = dbus.SessionBus()
    4848        bus_name = dbus.service.BusName(name_service, bus=bus)
    4949        object_path = get_single_process_path(name_service)
    def main(): 
    7777
    7878    if len(args) == 0:
    7979        print 'A python class must be specified as first argument.'
    80         sys.exit(1)   
     80        sys.exit(1)
    8181
    8282    bundle_path = os.environ['SUGAR_BUNDLE_PATH']
    8383    sys.path.append(bundle_path)
    def main(): 
    102102    module_name = splitted_module[0]
    103103    class_name = splitted_module[1]
    104104
    105     module = __import__(module_name)       
     105    module = __import__(module_name)
    106106    for comp in module_name.split('.')[1:]:
    107107        module = getattr(module, comp)
    108108
  • src/sugar/activity/namingalert.py

    diff --git a/src/sugar/activity/namingalert.py b/src/sugar/activity/namingalert.py
    index 11b7688..18e84a7 100644
    a b class NamingToolbar(gtk.Toolbar): 
    6969        client = gconf.client_get_default()
    7070        color = XoColor(client.get_string('/desktop/sugar/user/color'))
    7171        icon = Icon()
    72         icon.set_from_icon_name('activity-journal', 
     72        icon.set_from_icon_name('activity-journal',
    7373                                gtk.ICON_SIZE_LARGE_TOOLBAR)
    7474        icon.props.xo_color = color
    7575        self._add_widget(icon)
    class NamingToolbar(gtk.Toolbar): 
    7878
    7979        self._title = gtk.Label(_('Name this entry'))
    8080        self._add_widget(self._title)
    81        
     81
    8282        self._add_separator(True)
    8383
    8484        self._keep_button = ToolButton('dialog-ok', tooltip=_('Keep'))
    class NamingAlert(gtk.Window): 
    170170        width = gtk.gdk.screen_width() - offset * 2
    171171        height = gtk.gdk.screen_height() - offset * 2
    172172        self.set_size_request(width, height)
    173         self.set_position(gtk.WIN_POS_CENTER_ALWAYS) 
     173        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
    174174        self.set_decorated(False)
    175175        self.set_resizable(False)
    176176        self.set_modal(True)
    class NamingAlert(gtk.Window): 
    230230
    231231        self._favorite_icon = self._create_favorite_icon()
    232232        header.append(self._favorite_icon)
    233        
     233
    234234        entry_icon = self._create_entry_icon()
    235235        header.append(entry_icon)
    236        
     236
    237237        self._title = self._create_title()
    238238        header.append(self._title, hippo.PACK_EXPAND)
    239        
     239
    240240        if gtk.widget_get_default_direction() == gtk.TEXT_DIR_RTL:
    241241            header.reverse()
    242242
    class NamingAlert(gtk.Window): 
    251251    def _create_favorite_icon(self):
    252252        favorite_icon = FavoriteIcon(False)
    253253        return favorite_icon
    254    
     254
    255255    def _create_entry_icon(self):
    256256        bundle_id = self._activity.metadata.get('activity', '')
    257257        if not bundle_id:
    class NamingAlert(gtk.Window): 
    259259
    260260        if bundle_id == '':
    261261            file_name = _get_icon_name(self._activity.metadata)
    262         else:   
     262        else:
    263263            activity_bundle = ActivityBundle(self._bundle_path)
    264264            file_name = activity_bundle.get_icon()
    265265        entry_icon = CanvasIcon(file_name=file_name)
    class NamingAlert(gtk.Window): 
    268268            entry_icon.props.xo_color = XoColor( \
    269269                self._activity.metadata['icon-color'])
    270270        return entry_icon
    271    
     271
    272272    def _create_title(self):
    273273        title = CanvasEntry()
    274274        title.set_background(style.COLOR_WHITE.get_html())
    class NamingAlert(gtk.Window): 
    302302    def _create_tags(self):
    303303        vbox = hippo.CanvasBox()
    304304        vbox.props.spacing = style.DEFAULT_SPACING
    305        
     305
    306306        text = hippo.CanvasText(text=_('Tags:'),
    307307                                font_desc=style.FONT_NORMAL.get_pango_desc())
    308308        text.props.color = style.COLOR_BUTTON_GREY.get_int()
    class NamingAlert(gtk.Window): 
    313313            text.props.xalign = hippo.ALIGNMENT_START
    314314
    315315        vbox.append(text)
    316        
     316
    317317        tags = self._activity.metadata.get('tags', '')
    318318        text_view = CanvasTextView(tags, box_height=style.GRID_CELL_SIZE * 2)
    319319        vbox.append(text_view, hippo.PACK_EXPAND)
  • src/sugar/bundle/activitybundle.py

    diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
    index 7877229..f58181e 100644
    a b from sugar.bundle.bundle import Bundle, \ 
    3333
    3434class ActivityBundle(Bundle):
    3535    """A Sugar activity bundle
    36    
     36
    3737    See http://wiki.laptop.org/go/Activity_bundles for details
    3838    """
    3939
    class ActivityBundle(Bundle): 
    4848        Bundle.__init__(self, path)
    4949        self.activity_class = None
    5050        self.bundle_exec = None
    51        
     51
    5252        self._name = None
    5353        self._icon = None
    5454        self._bundle_id = None
    class ActivityBundle(Bundle): 
    8383        if not f:
    8484            logging.warning("Activity directory lacks a MANIFEST file.")
    8585            return []
    86        
    87         ret = [line.strip() for line in f.readlines()] 
     86
     87        ret = [line.strip() for line in f.readlines()]
    8888        f.close()
    8989        return ret
    90        
     90
    9191    def _read_manifest(self):
    9292        """return a list with the lines in MANIFEST, with invalid lines replaced
    9393        by empty lines.
    94        
    95         Since absolute order carries information on file history, it should 
     94
     95        Since absolute order carries information on file history, it should
    9696        be preserved. For instance, when renaming a file, you should leave
    9797        the new name on the same line as the old one.
    9898        """
    class ActivityBundle(Bundle): 
    113113                logging.warning("Bundle %s: duplicate entry in MANIFEST: %s"
    114114                                % (self._name,line))
    115115                continue
    116            
     116
    117117            # Remove MANIFEST
    118118            if line == "MANIFEST":
    119119                lines[num] = ""
    120120                logging.warning("Bundle %s: MANIFEST includes itself: %s"
    121121                                % (self._name,line))
    122                
     122
    123123            # Remove invalid files
    124124            if not self.is_file(line):
    125125                lines[num] = ""
    class ActivityBundle(Bundle): 
    127127                                % (self._name,line))
    128128
    129129        return lines
    130    
     130
    131131    def get_files(self, manifest = None):
    132132        files = [line for line in (manifest or self.manifest) if line]
    133133
    class ActivityBundle(Bundle): 
    135135            files.append('MANIFEST')
    136136
    137137        return files
    138      
     138
    139139    def _parse_info(self, info_file):
    140140        cp = ConfigParser()
    141141        cp.readfp(info_file)
    class ActivityBundle(Bundle): 
    297297        self._unzip(install_dir)
    298298
    299299        install_path = os.path.join(install_dir, self._zip_root_dir)
    300        
     300
    301301        # List installed files
    302302        manifestfiles = self.get_files(self._raw_manifest())
    303303        paths  = []
    class ActivityBundle(Bundle): 
    305305            rel_path = root[len(install_path) + 1:]
    306306            for f in files:
    307307                paths.append(os.path.join(rel_path, f))
    308                
     308
    309309        # Check the list against the MANIFEST
    310310        for path in paths:
    311311            if path in manifestfiles:
    class ActivityBundle(Bundle): 
    315315                                (self._name,path))
    316316                if strict_manifest:
    317317                    os.remove(os.path.join(install_path, path))
    318                    
     318
    319319        # Is anything in MANIFEST left over after accounting for all files?
    320320        if manifestfiles:
    321321            err = ("Bundle %s: files in MANIFEST not included: %s"%
  • src/sugar/bundle/bundle.py

    diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
    index a1b2686..14fb7c9 100644
    a b class MalformedBundleException(Exception): 
    4646
    4747class Bundle(object):
    4848    """A Sugar activity, content module, etc.
    49    
     49
    5050    The bundle itself may be either a zip file or a directory
    5151    hierarchy, with metadata about the bundle stored various files
    5252    inside it.
    class Bundle(object): 
    7171        # manifest = self._get_file(self._infodir + '/contents')
    7272        # if manifest is None:
    7373        #     raise MalformedBundleException('No manifest file')
    74         # 
     74        #
    7575        # signature = self._get_file(self._infodir + '/contents.sig')
    7676        # if signature is None:
    7777        #     raise MalformedBundleException('No signature file')
    class Bundle(object): 
    124124                logging.debug('%s not found.' % filename)
    125125
    126126        return f
    127    
     127
    128128    def is_file(self, filename):
    129129        if self._zip_file is None:
    130130            path = os.path.join(self._path, filename)
  • src/sugar/datastore/datastore.py

    diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
    index 80d5936..648a04c 100644
    a b class DSMetadata(gobject.GObject): 
    4141            self._props = {}
    4242        else:
    4343            self._props = props
    44        
     44
    4545        default_keys = ['activity', 'activity_id',
    4646                        'mime_type', 'title_set_by_user']
    4747        for key in default_keys:
    class DSMetadata(gobject.GObject): 
    6161
    6262    def __contains__(self, key):
    6363        return self._props.__contains__(key)
    64    
     64
    6565    def has_key(self, key):
    6666        return self._props.has_key(key)
    6767
    6868    def keys(self):
    6969        return self._props.keys()
    70    
     70
    7171    def get_dictionary(self):
    7272        return self._props
    7373
    class DSObject(object): 
    9393            metadata = DSMetadata(dbus_helpers.get_properties(self.object_id))
    9494            self._metadata = metadata
    9595        return self._metadata
    96    
     96
    9797    def set_metadata(self, metadata):
    9898        if self._metadata != metadata:
    9999            self._metadata = metadata
    class DSObject(object): 
    105105            self.set_file_path(dbus_helpers.get_filename(self.object_id))
    106106            self._owns_file = True
    107107        return self._file_path
    108    
     108
    109109    def set_file_path(self, file_path):
    110110        if self._file_path != file_path:
    111111            if self._file_path and self._owns_file:
    def find(query, sorting=None, limit=None, offset=None, properties=None, 
    203203        query['limit'] = limit
    204204    if offset:
    205205        query['offset'] = offset
    206    
     206
    207207    props_list, total_count = dbus_helpers.find(query, properties,
    208208                                                reply_handler, error_handler)
    209    
     209
    210210    objects = []
    211211    for props in props_list:
    212212        object_id = props['uid']
  • src/sugar/datastore/dbus_helpers.py

    diff --git a/src/sugar/datastore/dbus_helpers.py b/src/sugar/datastore/dbus_helpers.py
    index 9115382..7eaa912 100644
    a b def update(uid, properties, filename, transfer_ownership=False, 
    6767def delete(uid):
    6868    logging.debug('dbus_helpers.delete: %r' % uid)
    6969    _get_data_store().delete(uid)
    70        
     70
    7171def get_properties(uid):
    7272    logging.debug('dbus_helpers.get_properties: %s' % uid)
    7373    return _get_data_store().get_properties(uid, byte_arrays=True)
  • src/sugar/eggaccelerators.c

    diff --git a/src/sugar/eggaccelerators.c b/src/sugar/eggaccelerators.c
    index 0a39d51..0487db0 100644
    a b is_keycode (const gchar *string) 
    205205 * can represent various keyboard keys (numlock, meta, hyper, etc.),
    206206 * the virtual modifier represents the keyboard key, the concrete
    207207 * modifier the actual Mod2-Mod5 bits in the key press event.
    208  * 
     208 *
    209209 * Returns: %TRUE on success.
    210210 */
    211211gboolean
    egg_accelerator_parse_virtual (const gchar *accelerator, 
    218218  GdkModifierType mods;
    219219  gint len;
    220220  gboolean bad_keyval;
    221  
     221
    222222  if (accelerator_key)
    223223    *accelerator_key = 0;
    224224  if (accelerator_mods)
    egg_accelerator_parse_virtual (const gchar *accelerator, 
    229229  g_return_val_if_fail (accelerator != NULL, FALSE);
    230230
    231231  bad_keyval = FALSE;
    232  
     232
    233233  keyval = 0;
    234234  mods = 0;
    235235  len = strlen (accelerator);
    egg_accelerator_parse_virtual (const gchar *accelerator, 
    312312          else
    313313            {
    314314              gchar last_ch;
    315              
     315
    316316              last_ch = *accelerator;
    317317              while (last_ch && last_ch != '>')
    318318                {
    egg_accelerator_parse_virtual (const gchar *accelerator, 
    359359          len -= len;
    360360        }
    361361    }
    362  
     362
    363363  if (accelerator_key)
    364364    *accelerator_key = gdk_keyval_to_lower (keyval);
    365365  if (accelerator_mods)
    egg_accelerator_parse_virtual (const gchar *accelerator, 
    374374 * @accelerator_key:  accelerator keyval
    375375 * @accelerator_mods: accelerator modifier mask
    376376 * @returns:          a newly-allocated accelerator name
    377  * 
     377 *
    378378 * Converts an accelerator keyval and modifier mask
    379379 * into a string parseable by egg_accelerator_parse_virtual().
    380380 * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK,
    egg_virtual_accelerator_name (guint accelerator_key, 
    499499      strcpy (accelerator + l, text_super);
    500500      l += sizeof (text_super) - 1;
    501501    }
    502  
     502
    503503  strcpy (accelerator + l, keyval_name);
    504504
    505505  return accelerator;
    egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, 
    516516
    517517  g_return_if_fail (GDK_IS_KEYMAP (keymap));
    518518  g_return_if_fail (concrete_mods != NULL);
    519  
     519
    520520  modmap = egg_keymap_get_modmap (keymap);
    521  
     521
    522522  /* Not so sure about this algorithm. */
    523  
     523
    524524  concrete = 0;
    525525  i = 0;
    526526  while (i < EGG_MODMAP_ENTRY_LAST)
    egg_keymap_virtualize_modifiers (GdkKeymap *keymap, 
    542542  GdkModifierType virtual;
    543543  int i;
    544544  const EggModmap *modmap;
    545  
     545
    546546  g_return_if_fail (GDK_IS_KEYMAP (keymap));
    547547  g_return_if_fail (virtual_mods != NULL);
    548548
    549549  modmap = egg_keymap_get_modmap (keymap);
    550  
     550
    551551  /* Not so sure about this algorithm. */
    552  
     552
    553553  virtual = 0;
    554554  i = 0;
    555555  while (i < EGG_MODMAP_ENTRY_LAST)
    egg_keymap_virtualize_modifiers (GdkKeymap *keymap, 
    557557      if ((1 << i) & concrete_mods)
    558558        {
    559559          EggVirtualModifierType cleaned;
    560          
     560
    561561          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
    562562                                           EGG_VIRTUAL_MOD3_MASK |
    563563                                           EGG_VIRTUAL_MOD4_MASK |
    564564                                           EGG_VIRTUAL_MOD5_MASK);
    565          
     565
    566566          if (cleaned != 0)
    567567            {
    568568              virtual |= cleaned;
    egg_keymap_virtualize_modifiers (GdkKeymap *keymap, 
    575575              virtual |= modmap->mapping[i];
    576576            }
    577577        }
    578      
     578
    579579      ++i;
    580580    }
    581  
     581
    582582  *virtual_mods = virtual;
    583583}
    584584
    reload_modmap (GdkKeymap *keymap, 
    594594  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
    595595
    596596  memset (modmap->mapping, 0, sizeof (modmap->mapping));
    597  
     597
    598598  /* there are 8 modifiers, and the first 3 are shift, shift lock,
    599599   * and control
    600600   */
    reload_modmap (GdkKeymap *keymap, 
    611611      int n_entries;
    612612      int j;
    613613      EggVirtualModifierType mask;
    614      
     614
    615615      keys = NULL;
    616616      keyvals = NULL;
    617617      n_entries = 0;
    reload_modmap (GdkKeymap *keymap, 
    619619      gdk_keymap_get_entries_for_keycode (keymap,
    620620                                          keycode,
    621621                                          &keys, &keyvals, &n_entries);
    622      
     622
    623623      mask = 0;
    624624      j = 0;
    625625      while (j < n_entries)
    626         {         
     626        {
    627627          if (keyvals[j] == GDK_Num_Lock)
    628628            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
    629629          else if (keyvals[j] == GDK_Scroll_Lock)
    reload_modmap (GdkKeymap *keymap, 
    639639            mask |= EGG_VIRTUAL_SUPER_MASK;
    640640          else if (keyvals[j] == GDK_Mode_switch)
    641641            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
    642          
     642
    643643          ++j;
    644644        }
    645645
    646646      /* Mod1Mask is 1 << 3 for example, i.e. the
    647647       * fourth modifier, i / keyspermod is the modifier
    648648       * index
    649        */     
     649       */
    650650      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
    651      
     651
    652652      g_free (keyvals);
    653       g_free (keys);     
    654      
     653      g_free (keys);
     654
    655655      ++i;
    656656    }
    657657
    reload_modmap (GdkKeymap *keymap, 
    664664  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
    665665  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
    666666  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
    667  
     667
    668668  XFreeModifiermap (xmodmap);
    669669}
    670670
    egg_keymap_get_modmap (GdkKeymap *keymap) 
    676676  /* This is all a hack, much simpler when we can just
    677677   * modify GDK directly.
    678678   */
    679  
     679
    680680  modmap = g_object_get_data (G_OBJECT (keymap),
    681681                              "egg-modmap");
    682682
    egg_keymap_get_modmap (GdkKeymap *keymap) 
    687687      /* FIXME modify keymap change events with an event filter
    688688       * and force a reload if we get one
    689689       */
    690      
     690
    691691      reload_modmap (keymap, modmap);
    692      
     692
    693693      g_object_set_data_full (G_OBJECT (keymap),
    694694                              "egg-modmap",
    695695                              modmap,
    egg_keymap_get_modmap (GdkKeymap *keymap) 
    697697    }
    698698
    699699  g_assert (modmap != NULL);
    700  
     700
    701701  return modmap;
    702702}
  • src/sugar/eggaccelerators.h

    diff --git a/src/sugar/eggaccelerators.h b/src/sugar/eggaccelerators.h
    index d2276d2..96d5390 100644
    a b typedef enum 
    3636  EGG_VIRTUAL_CONTROL_MASK  = 1 << 2,
    3737
    3838  EGG_VIRTUAL_ALT_MASK      = 1 << 3, /* fixed as Mod1 */
    39  
     39
    4040  EGG_VIRTUAL_MOD2_MASK     = 1 << 4,
    4141  EGG_VIRTUAL_MOD3_MASK     = 1 << 5,
    4242  EGG_VIRTUAL_MOD4_MASK     = 1 << 6,
    typedef enum 
    5050  GDK_BUTTON5_MASK  = 1 << 12,
    5151  /* 13, 14 are used by Xkb for the keyboard group */
    5252#endif
    53  
     53
    5454  EGG_VIRTUAL_META_MASK = 1 << 24,
    5555  EGG_VIRTUAL_SUPER_MASK = 1 << 25,
    5656  EGG_VIRTUAL_HYPER_MASK = 1 << 26,
    57   EGG_VIRTUAL_MODE_SWITCH_MASK = 1 << 27, 
     57  EGG_VIRTUAL_MODE_SWITCH_MASK = 1 << 27,
    5858  EGG_VIRTUAL_NUM_LOCK_MASK = 1 << 28,
    5959  EGG_VIRTUAL_SCROLL_LOCK_MASK = 1 << 29,
    6060
    typedef enum 
    6363
    6464  /*     28-31 24-27 20-23 16-19 12-15 8-11 4-7 0-3
    6565   *       7     f     0     0     0    0    f   f
    66    */ 
     66   */
    6767  EGG_VIRTUAL_MODIFIER_MASK = 0x7f0000ff
    6868
    6969} EggVirtualModifierType;
  • src/sugar/eggdesktopfile.c

    diff --git a/src/sugar/eggdesktopfile.c b/src/sugar/eggdesktopfile.c
    index eb28b9d..d095a2f 100644
    a b egg_desktop_file_new_from_key_file (GKeyFile *key_file, 
    155155          g_key_file_free (key_file);
    156156          return NULL;
    157157        }
    158       else 
     158      else
    159159      g_free (version);
    160160    }
    161161
    egg_desktop_file_launch (EggDesktopFile *desktop_file, 
    13341334                       EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
    13351335                       _("Can't pass document URIs to a 'Type=Link' desktop entry"));
    13361336          return FALSE;
    1337         }         
     1337        }
    13381338
    13391339      if (!parse_link (desktop_file, &app_desktop_file, &documents, error))
    13401340        return FALSE;
    egg_set_desktop_file (const char *desktop_file_path) 
    14181418
    14191419/**
    14201420 * egg_get_desktop_file:
    1421  * 
     1421 *
    14221422 * Gets the application's #EggDesktopFile, as set by
    14231423 * egg_set_desktop_file().
    1424  * 
     1424 *
    14251425 * Return value: the #EggDesktopFile, or %NULL if it hasn't been set.
    14261426 **/
    14271427EggDesktopFile *
  • src/sugar/eggsmclient-xsmp.c

    diff --git a/src/sugar/eggsmclient-xsmp.c b/src/sugar/eggsmclient-xsmp.c
    index 13eb5d5..2a9532a 100644
    a b sm_client_xsmp_connect (gpointer user_data) 
    281281
    282282      if (xsmp->restart_style == SmRestartIfRunning)
    283283        {
    284           if (egg_desktop_file_get_boolean (desktop_file, 
     284          if (egg_desktop_file_get_boolean (desktop_file,
    285285                                            "X-GNOME-AutoRestart", NULL))
    286286            xsmp->restart_style = SmRestartImmediately;
    287287        }
    delete_properties (EggSMClientXSMP *xsmp, ...) 
    11201120 * until you're done with the SmProp.
    11211121 */
    11221122static SmProp *
    1123 array_prop (const char *name, ...) 
     1123array_prop (const char *name, ...)
    11241124{
    11251125  SmProp *prop;
    11261126  SmPropValue pv;
    ice_error_handler (IceConn ice_conn, 
    13381338                   IcePointer    values)
    13391339{
    13401340  /* Do nothing */
    1341 } 
     1341}
    13421342
    13431343static void
    13441344ice_io_error_handler (IceConn ice_conn)
    13451345{
    13461346  /* Do nothing */
    1347 } 
     1347}
    13481348
    13491349static void
    13501350smc_error_handler (SmcConn       smc_conn,
  • src/sugar/eggsmclient.c

    diff --git a/src/sugar/eggsmclient.c b/src/sugar/eggsmclient.c
    index 86036f9..a59cea0 100644
    a b egg_sm_client_class_init (EggSMClientClass *klass) 
    114114   * handling this signal; if the user has requested that the session
    115115   * be saved when logging out, then ::save_state will be emitted
    116116   * separately.
    117    * 
     117   *
    118118   * If the application agrees to quit, it should then wait for either
    119119   * the ::quit_cancelled or ::quit signals to be emitted.
    120120   **/
  • src/sugar/graphics/alert.py

    diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py
    index 2c3c4ca..b108d9d 100644
    a b import gtk 
    5050import gobject
    5151import hippo
    5252import math
    53        
     53
    5454from sugar.graphics import style
    5555from sugar.graphics.icon import Icon
    5656
    class Alert(gtk.EventBox): 
    111111        self._msg_label.set_alignment(0, 0.5)
    112112        self._msg_box.pack_start(self._msg_label, False)
    113113        self._hbox.pack_start(self._msg_box, False)
    114        
     114
    115115        self._buttons_box = gtk.HButtonBox()
    116116        self._buttons_box.set_layout(gtk.BUTTONBOX_END)
    117117        self._buttons_box.set_spacing(style.DEFAULT_SPACING)
    118118        self._hbox.pack_start(self._buttons_box)
    119        
     119
    120120        gobject.GObject.__init__(self, **kwargs)
    121121
    122         self.set_visible_window(True)       
    123         self.add(self._hbox)       
     122        self.set_visible_window(True)
     123        self.add(self._hbox)
    124124        self._title_label.show()
    125125        self._msg_label.show()
    126126        self._buttons_box.show()
    127127        self._msg_box.show()
    128128        self._hbox.show()
    129129        self.show()
    130        
    131     def do_set_property(self, pspec, value):       
     130
     131    def do_set_property(self, pspec, value):
    132132        """
    133133        Set alert property
    134134
    class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem): 
    299299
    300300    def __init__(self, **kwargs):
    301301        hippo.CanvasText.__init__(self, **kwargs)
    302        
     302
    303303        self.props.orientation = hippo.ORIENTATION_HORIZONTAL
    304304        self.props.border_left = style.DEFAULT_SPACING
    305305        self.props.border_right = style.DEFAULT_SPACING
    306            
     306
    307307    def do_paint_background(self, cr, damaged_box):
    308308        [width, height] = self.get_allocation()
    309        
     309
    310310        xval = width * 0.5
    311311        yval = height * 0.5
    312         radius = min(width * 0.5, height * 0.5)         
    313        
     312        radius = min(width * 0.5, height * 0.5)
     313
    314314        hippo.cairo_set_source_rgba32(cr, self.props.background_color)
    315         cr.arc(xval, yval, radius, 0, 2*math.pi)       
    316         cr.fill_preserve()   
     315        cr.arc(xval, yval, radius, 0, 2*math.pi)
     316        cr.fill_preserve()
    317317
    318318
    319319class TimeoutAlert(Alert):
    class TimeoutAlert(Alert): 
    362362        Alert.__init__(self, **kwargs)
    363363
    364364        self._timeout = timeout
    365        
     365
    366366        icon = Icon(icon_name='dialog-cancel')
    367367        self.add_button(gtk.RESPONSE_CANCEL, _('Cancel'), icon)
    368368        icon.show()
    369        
     369
    370370        self._timeout_text = _TimeoutIcon(
    371371            text=self._timeout,
    372372            color=style.COLOR_BUTTON_GREY.get_int(),
    373             background_color=style.COLOR_WHITE.get_int())   
     373            background_color=style.COLOR_WHITE.get_int())
    374374        canvas = hippo.Canvas()
    375375        canvas.set_root(self._timeout_text)
    376         canvas.show()                       
     376        canvas.show()
    377377        self.add_button(gtk.RESPONSE_OK, _('Continue'), canvas)
    378378
    379379        gobject.timeout_add_seconds(1, self.__timeout)
    380        
     380
    381381    def __timeout(self):
    382382        self._timeout -= 1
    383383        self._timeout_text.props.text = self._timeout
  • src/sugar/graphics/animator.py

    diff --git a/src/sugar/graphics/animator.py b/src/sugar/graphics/animator.py
    index 5d5b355..51c8ac3 100644
    a b class Animator(gobject.GObject): 
    3131        'completed': (gobject.SIGNAL_RUN_FIRST,
    3232                      gobject.TYPE_NONE, ([])),
    3333    }
    34    
     34
    3535    def __init__(self, duration, fps=20, easing=EASE_OUT_EXPO):
    3636        gobject.GObject.__init__(self)
    3737        self._animations = []
  • src/sugar/graphics/canvastextview.py

    diff --git a/src/sugar/graphics/canvastextview.py b/src/sugar/graphics/canvastextview.py
    index 481248d..4a2aaa4 100644
    a b class CanvasTextView(hippo.CanvasWidget): 
    2929        self.text_view_widget.props.right_margin = style.DEFAULT_SPACING
    3030        self.text_view_widget.props.wrap_mode = gtk.WRAP_WORD
    3131        self.text_view_widget.show()
    32        
     32
    3333        # TODO: These fields should expand vertically instead of scrolling
    3434        scrolled_window = gtk.ScrolledWindow()
    3535        scrolled_window.set_shadow_type(gtk.SHADOW_OUT)
    3636        scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
    3737        scrolled_window.add(self.text_view_widget)
    38        
     38
    3939        self.props.widget = scrolled_window
  • src/sugar/graphics/colorbutton.py

    diff --git a/src/sugar/graphics/colorbutton.py b/src/sugar/graphics/colorbutton.py
    index a5c7f0a..f69691c 100644
    a b from sugar.graphics.palette import Palette, ToolInvoker, WidgetInvoker 
    2929_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
    3030
    3131def get_svg_color_string(color):
    32     return '#%.2X%.2X%.2X' % (color.red / 257, color.green / 257, 
     32    return '#%.2X%.2X%.2X' % (color.red / 257, color.green / 257,
    3333                              color.blue / 257)
    3434
    3535class _ColorButton(gtk.Button):
    class _ColorButton(gtk.Button): 
    4040    As a preview an sugar.graphics.Icon is used. The fill color will be set to
    4141    the current color, and the stroke color is set to the font color.
    4242    """
    43    
     43
    4444    __gtype_name__ = 'SugarColorButton'
    4545    __gsignals__ = { 'color-set' : (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
    4646                                     tuple())}
    47    
     47
    4848    def __init__(self, **kwargs):
    4949        self._title = _('Choose a color')
    5050        self._color = gtk.gdk.Color(0, 0, 0)
    class _ColorButton(gtk.Button): 
    9292
    9393    def __palette_color_set_cb(self, palette):
    9494        self.emit('color-set')
    95    
     95
    9696    def __palette_color_changed(self, palette, pspec):
    9797        self.color = self._palette.color
    98    
     98
    9999    def do_style_set(self, previous_style):
    100100        self._preview.stroke_color = \
    101101            get_svg_color_string(self.style.fg[gtk.STATE_NORMAL])
    class _ColorButton(gtk.Button): 
    111111
    112112    def set_color(self, color):
    113113        assert isinstance(color, gtk.gdk.Color)
    114        
     114
    115115        if self._color.red == color.red and \
    116116           self._color.green == color.green and \
    117117           self._color.blue == color.blue:
    118118            return
    119        
     119
    120120        self._color = gtk.gdk.Color(color.red, color.green, color.blue)
    121121        self._preview.fill_color = get_svg_color_string(self._color)
    122122        if self._palette:
    class _ColorButton(gtk.Button): 
    201201        red = self._color.red / 257
    202202        green = self._color.green / 257
    203203        blue = self._color.blue / 257
    204        
     204
    205205        pixbuf.fill(red << 24 + green << 16 + blue << 8 + 0xff)
    206        
     206
    207207        context.set_icon_pixbuf(pixbuf)
    208208
    209209    def __drag_data_get_cb(self, widget, context, selection_data, info, time):
    class _ColorPalette(Palette): 
    258258        self._picker_hbox.pack_start(self._swatch_tray)
    259259        self._picker_hbox.pack_start(gtk.VSeparator(),
    260260                                     padding=style.DEFAULT_SPACING)
    261        
     261
    262262        self._chooser_table = gtk.Table(3, 2)
    263263        self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)
    264264
    class _ColorPalette(Palette): 
    271271            self._create_color_scale(_('Blue'), self._BLUE, 2))
    272272
    273273        self._picker_hbox.add(self._chooser_table)
    274        
     274
    275275        self._picker_hbox.show_all()
    276276
    277277        self._build_swatches()
    class _ColorPalette(Palette): 
    300300
    301301        return scale
    302302
    303        
     303
    304304
    305305    def _build_swatches(self):
    306306        for child in self._swatch_tray.get_children():
    class _ColorPalette(Palette): 
    370370            return
    371371
    372372        self._color = color.copy()
    373        
     373
    374374        if self._scales:
    375375            self._scales[self._RED].set_value(self._color.red / 65535.0)
    376376            self._scales[self._GREEN].set_value(self._color.green / 65535.0)
    377377            self._scales[self._BLUE].set_value(self._color.blue / 65535.0)
    378        
     378
    379379        self.notify('color')
    380380
    381381    def get_color(self):
  • src/sugar/graphics/combobox.py

    diff --git a/src/sugar/graphics/combobox.py b/src/sugar/graphics/combobox.py
    index 4e094ab..fe18087 100644
    a b import gobject 
    2323import gtk
    2424
    2525class ComboBox(gtk.ComboBox):
    26     __gtype_name__ = 'SugarComboBox'   
     26    __gtype_name__ = 'SugarComboBox'
    2727
    2828    def __init__(self):
    2929        gtk.ComboBox.__init__(self)
    class ComboBox(gtk.ComboBox): 
    129129        None
    130130
    131131        """
    132         self._model.append([0, None, None, True])   
     132        self._model.append([0, None, None, True])
    133133
    134134    def get_active_item(self):
    135135        """
  • src/sugar/graphics/icon.py

    diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
    index 45f2de5..345d26d 100644
    a b class Icon(gtk.Image): 
    324324        if self._buffer.file_name != self.props.file:
    325325            self._buffer.file_name = self.props.file
    326326
    327         if self.props.pixel_size == -1:   
     327        if self.props.pixel_size == -1:
    328328            width, height = gtk.icon_size_lookup(self.props.icon_size)
    329329        else:
    330             width = height = self.props.pixel_size 
     330            width = height = self.props.pixel_size
    331331        if self._buffer.width != width or self._buffer.height != height:
    332332            self._buffer.width = width
    333333            self._buffer.height = height
    class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): 
    904904
    905905    def get_palette_invoker(self):
    906906        return self._palette_invoker
    907    
     907
    908908    def set_palette_invoker(self, palette_invoker):
    909909        self._palette_invoker.detach()
    910910        self._palette_invoker = palette_invoker
    class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): 
    916916        from sugar.graphics.palette import Palette
    917917
    918918        self.set_palette(Palette(text))
    919    
     919
    920920    palette = property(get_palette, set_palette)
    921921
    922922class CellRendererIcon(gtk.GenericCellRenderer):
  • src/sugar/graphics/notebook.py

    diff --git a/src/sugar/graphics/notebook.py b/src/sugar/graphics/notebook.py
    index 4965b24..65d3522 100644
    a b  
    1717
    1818"""Notebook class
    1919
    20 This class create a gtk.Notebook() widget supporting 
     20This class create a gtk.Notebook() widget supporting
    2121a close button in every tab when the 'can-close-tabs' gproperty
    2222is enabled (True)
    2323
    class Notebook(gtk.Notebook): 
    3838
    3939    def __init__(self, **kwargs):
    4040        # Initialise the Widget
    41         #
    42         #    Side effects: 
     41
     42        #    Side effects:
    4343        #        Set the 'can-close-tabs' property using **kwargs
    4444        #        Set True the scrollable notebook property
    45        
     45
    4646        gobject.GObject.__init__(self, **kwargs)
    4747
    4848        self._can_close_tabs = None
    class Notebook(gtk.Notebook): 
    108108
    109109        tab_box.show_all()
    110110        event_box.add(tab_box)
    111        
     111
    112112        return event_box
    113113
    114114    def add_page(self, text_label, widget):
    class Notebook(gtk.Notebook): 
    130130        # Add a new page to the notebook
    131131        if self._can_close_tabs:
    132132            eventbox = self._create_custom_tab(text_label, widget)
    133             self.append_page(widget, eventbox)         
     133            self.append_page(widget, eventbox)
    134134        else:
    135135            self.append_page(widget, gtk.Label(text_label))
    136            
     136
    137137        pages = self.get_n_pages()
    138138
    139139        # Set the new page
    140140        self.set_current_page(pages - 1)
    141141        self.show_all()
    142        
     142
    143143        return True
    144144
    145145    def _close_page(self, button, child):
  • src/sugar/graphics/objectchooser.py

    diff --git a/src/sugar/graphics/objectchooser.py b/src/sugar/graphics/objectchooser.py
    index fb3703d..6dd3243 100644
    a b class ObjectChooser(object): 
    5656        self._chooser_id = None
    5757        self._response_code = gtk.RESPONSE_NONE
    5858        self._what_filter = what_filter
    59        
     59
    6060    def run(self):
    6161        self._object_id = None
    6262
  • src/sugar/graphics/palette.py

    diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
    index 42d2beb..d022a04 100644
    a b class Palette(PaletteWindow): 
    4646
    4747    __gtype_name__ = 'SugarPalette'
    4848
    49     # DEPRECATED: label is passed with the primary-text property, accel_path 
     49    # DEPRECATED: label is passed with the primary-text property, accel_path
    5050    # is set via the invoker property, and menu_after_content is not used
    5151    def __init__(self, label=None, accel_path=None, menu_after_content=False,
    5252                 text_maxlen=60, **kwargs):
    class Palette(PaletteWindow): 
    6868        primary_box.pack_start(self._icon_box, expand=False)
    6969
    7070        labels_box = gtk.VBox()
    71         self._label_alignment = gtk.Alignment(xalign=0, yalign=0.5, 
     71        self._label_alignment = gtk.Alignment(xalign=0, yalign=0.5,
    7272                                              xscale=1, yscale=0.33)
    73         self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING, 
     73        self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
    7474                                          style.DEFAULT_SPACING)
    7575        self._label_alignment.add(labels_box)
    7676        self._label_alignment.show()
    class Palette(PaletteWindow): 
    184184
    185185        if self._invoker is not None:
    186186            self._update_full_request()
    187    
     187
    188188        PaletteWindow.popup(self, immediate)
    189189
    190190        if state is None:
    class Palette(PaletteWindow): 
    196196    def on_enter(self, event):
    197197        PaletteWindow.on_enter(self, event)
    198198        self._secondary_anim.start()
    199        
     199
    200200    def _add_menu(self):
    201201        self._menu_box = gtk.VBox()
    202202        self._secondary_box.pack_start(self._menu_box)
  • src/sugar/graphics/palettegroup.py

    diff --git a/src/sugar/graphics/palettegroup.py b/src/sugar/graphics/palettegroup.py
    index e95b5aa..d3bccb5 100644
    a b class Group(gobject.GObject): 
    7676
    7777    def popdown(self):
    7878        for palette in self._palettes:
    79             if palette.is_up(): 
     79            if palette.is_up():
    8080                palette.popdown(immediate=True)
    8181
    8282    def _palette_popup_cb(self, palette):
  • src/sugar/graphics/palettewindow.py

    diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py
    index 53b5f7c..b881de1 100644
    a b def _calculate_gap(a, b): 
    5050        gap_side = gtk.POS_TOP
    5151    else:
    5252        gap = False
    53    
     53
    5454    if gap:
    5555        if gap_side == gtk.POS_BOTTOM or gap_side == gtk.POS_TOP:
    5656            gap_start = min(a.width, max(0, b.x - a.x))
    class PaletteWindow(gtk.Window): 
    184184        self.set_group_id(None)
    185185
    186186    def set_invoker(self, invoker):
    187         for hid in self._invoker_hids[:]: 
     187        for hid in self._invoker_hids[:]:
    188188            self._invoker.disconnect(hid)
    189189            self._invoker_hids.remove(hid)
    190190
    class PaletteWindow(gtk.Window): 
    217217        immediate = False
    218218
    219219        if self.is_up():
    220             self._popdown_anim.stop() 
     220            self._popdown_anim.stop()
    221221            return
    222222
    223223        if self._group_id:
    class Invoker(gobject.GObject): 
    636636
    637637    def get_palette(self):
    638638        return self._palette
    639    
     639
    640640    def set_palette(self, palette):
    641641        if self._palette:
    642642            self._palette.props.invoker = None
    class CanvasInvoker(Invoker): 
    794794            return gtk.gdk.Rectangle(x, y, width, height)
    795795        else:
    796796            return gtk.gdk.Rectangle()
    797        
     797
    798798    def __motion_notify_event_cb(self, button, event):
    799799        if event.detail == hippo.MOTION_DETAIL_ENTER:
    800800            self.notify_mouse_enter()
  • src/sugar/graphics/radiotoolbutton.py

    diff --git a/src/sugar/graphics/radiotoolbutton.py b/src/sugar/graphics/radiotoolbutton.py
    index 11f962d..7264232 100644
    a b class RadioToolButton(gtk.RadioToolButton): 
    154154
    155155    def get_palette_invoker(self):
    156156        return self._palette_invoker
    157    
     157
    158158    def set_palette_invoker(self, palette_invoker):
    159159        self._palette_invoker.detach()
    160160        self._palette_invoker = palette_invoker
  • src/sugar/graphics/roundbox.py

    diff --git a/src/sugar/graphics/roundbox.py b/src/sugar/graphics/roundbox.py
    index 28644bc..b909c74 100644
    a b class CanvasRoundBox(hippo.CanvasBox, hippo.CanvasItem): 
    3535
    3636        # TODO: we should calculate radius depending on the height of the box.
    3737        self._radius = style.zoom(10)
    38        
     38
    3939        self.props.orientation = hippo.ORIENTATION_HORIZONTAL
    4040        self.props.border = self._BORDER_DEFAULT
    4141        self.props.border_left = self._radius
    4242        self.props.border_right = self._radius
    4343        self.props.border_color = style.COLOR_BLACK.get_int()
    44            
     44
    4545    def do_paint_background(self, cr, damaged_box):
    4646        [width, height] = self.get_allocation()
    4747
  • src/sugar/graphics/toggletoolbutton.py

    diff --git a/src/sugar/graphics/toggletoolbutton.py b/src/sugar/graphics/toggletoolbutton.py
    index 9bb2f58..0aeb59c 100644
    a b class ToggleToolButton(gtk.ToggleToolButton): 
    5959
    6060    def get_palette_invoker(self):
    6161        return self._palette_invoker
    62    
     62
    6363    def set_palette_invoker(self, palette_invoker):
    6464        self._palette_invoker.detach()
    6565        self._palette_invoker = palette_invoker
    class ToggleToolButton(gtk.ToggleToolButton): 
    6969
    7070    def set_tooltip(self, text):
    7171        self.set_palette(Palette(text))
    72    
     72
    7373    def do_expose_event(self, event):
    7474        allocation = self.get_allocation()
    7575        child = self.get_child()
    class ToggleToolButton(gtk.ToggleToolButton): 
    8585                                  allocation.width, allocation.height)
    8686
    8787        gtk.ToggleToolButton.do_expose_event(self, event)
    88    
     88
    8989    palette = property(get_palette, set_palette)
  • src/sugar/graphics/toolbox.py

    diff --git a/src/sugar/graphics/toolbox.py b/src/sugar/graphics/toolbox.py
    index 1cfbe93..47a311d 100644
    a b class Toolbox(gtk.VBox): 
    3636
    3737    def __init__(self):
    3838        gtk.VBox.__init__(self)
    39        
     39
    4040        self._notebook = gtk.Notebook()
    4141        self._notebook.set_tab_pos(gtk.POS_BOTTOM)
    4242        self._notebook.set_show_border(False)
    class Toolbox(gtk.VBox): 
    5555                    border_bottom=style.LINE_WIDTH)
    5656        self._separator.set_root(box)
    5757        self.pack_start(self._separator, False)
    58        
     58
    5959        self._notebook.connect('notify::page', self._notify_page_cb)
    6060
    6161    def _notify_page_cb(self, notebook, pspec):
    6262        self.emit('current-toolbar-changed', notebook.props.page)
    63        
     63
    6464    def add_toolbar(self, name, toolbar):
    6565        label = gtk.Label(name)
    6666        width, height_ = label.size_request()
    class Toolbox(gtk.VBox): 
    6868        label.set_alignment(0.0, 0.5)
    6969
    7070        event_box = gtk.EventBox()
    71        
     71
    7272        alignment = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
    7373        alignment.set_padding(0, 0, style.TOOLBOX_HORIZONTAL_PADDING,
    7474                              style.TOOLBOX_HORIZONTAL_PADDING)
    class Toolbox(gtk.VBox): 
    8383        if self._notebook.get_n_pages() > 1:
    8484            self._notebook.set_show_tabs(True)
    8585            self._separator.show()
    86                    
     86
    8787    def remove_toolbar(self, index):
    8888        self._notebook.remove_page(index)
    8989
    class Toolbox(gtk.VBox): 
    9696
    9797    def get_current_toolbar(self):
    9898        return self._notebook.get_current_page()
    99    
     99
    100100    current_toolbar = property(get_current_toolbar, set_current_toolbar)
    101101
  • src/sugar/graphics/toolbutton.py

    diff --git a/src/sugar/graphics/toolbutton.py b/src/sugar/graphics/toolbutton.py
    index 047df06..7def0ff 100644
    a b class ToolButton(gtk.ToolButton): 
    128128
    129129    def get_palette_invoker(self):
    130130        return self._palette_invoker
    131    
     131
    132132    def set_palette_invoker(self, palette_invoker):
    133133        self._palette_invoker.detach()
    134134        self._palette_invoker = palette_invoker
  • src/sugar/graphics/tray.py

    diff --git a/src/sugar/graphics/tray.py b/src/sugar/graphics/tray.py
    index 5df7170..8b0abe7 100644
    a b class _TrayViewport(gtk.Viewport): 
    6464            adj = self.get_vadjustment()
    6565        adj.connect('changed', self._adjustment_changed_cb)
    6666        adj.connect('value-changed', self._adjustment_changed_cb)
    67            
     67
    6868    def scroll(self, direction):
    6969        if direction == _PREVIOUS_PAGE:
    7070            self._scroll_previous()
    class TrayIcon(gtk.ToolItem): 
    447447
    448448    def get_palette_invoker(self):
    449449        return self._palette_invoker
    450    
     450
    451451    def set_palette_invoker(self, palette_invoker):
    452452        self._palette_invoker.detach()
    453453        self._palette_invoker = palette_invoker
  • src/sugar/graphics/window.py

    diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py
    index 0d53776..d81c083 100644
    a b class Window(gtk.Window): 
    8787        self.connect('realize', self.__window_realize_cb)
    8888        self.connect('window-state-event', self.__window_state_event_cb)
    8989        self.connect('key-press-event', self.__key_press_cb)
    90        
     90
    9191        self._toolbar_box = None
    9292        self._alerts = []
    9393        self._canvas = None
    9494        self.tray = None
    95        
     95
    9696        self._vbox = gtk.VBox()
    9797        self._hbox = gtk.HBox()
    9898        self._vbox.pack_start(self._hbox)
    class Window(gtk.Window): 
    120120
    121121        if canvas:
    122122            self._event_box.add(canvas)
    123        
     123
    124124        self._canvas = canvas
    125125
    126126    def get_canvas(self):
    class Window(gtk.Window): 
    144144
    145145    def set_tray(self, tray, position):
    146146        if self.tray:
    147             box = self.tray.get_parent() 
     147            box = self.tray.get_parent()
    148148            box.remove(self.tray)
    149                
     149
    150150        if position == gtk.POS_LEFT:
    151151            self._hbox.pack_start(tray, False)
    152152        elif position == gtk.POS_RIGHT:
    153153            self._hbox.pack_end(tray, False)
    154154        elif position == gtk.POS_BOTTOM:
    155155            self._vbox.pack_end(tray, False)
    156                    
     156
    157157        self.tray = tray
    158158
    159159    def add_alert(self, alert):
    class Window(gtk.Window): 
    162162            self._vbox.pack_start(alert, False)
    163163            if self._toolbar_box is not None:
    164164                self._vbox.reorder_child(alert, 1)
    165             else:   
     165            else:
    166166                self._vbox.reorder_child(alert, 0)
    167                
     167
    168168    def remove_alert(self, alert):
    169169        if alert in self._alerts:
    170170            self._alerts.remove(alert)
    171171            # if the alert is the visible one on top of the queue
    172             if alert.get_parent() is not None:                           
     172            if alert.get_parent() is not None:
    173173                self._vbox.remove(alert)
    174174                if len(self._alerts) >= 1:
    175175                    self._vbox.pack_start(self._alerts[0], False)
    class Window(gtk.Window): 
    177177                        self._vbox.reorder_child(self._alerts[0], 1)
    178178                    else:
    179179                        self._vbox.reorder_child(self._alert[0], 0)
    180                    
     180
    181181    def __window_realize_cb(self, window):
    182182        group = gtk.Window()
    183183        group.realize()
  • src/sugar/gsm-app.c

    diff --git a/src/sugar/gsm-app.c b/src/sugar/gsm-app.c
    index 3a63bac..96b65ce 100644
    a b gsm_app_provides (GsmApp *app, const char *service) 
    315315  return FALSE;
    316316}
    317317
    318 static void 
     318static void
    319319app_exited (GPid pid, gint status, gpointer data)
    320320{
    321321  if (WIFEXITED (status))
  • src/sugar/gsm-app.h

    diff --git a/src/sugar/gsm-app.h b/src/sugar/gsm-app.h
    index 32ee62d..038caee 100644
    a b pid_t gsm_app_launch (GsmApp *app, 
    6363void             gsm_app_set_client      (GsmApp     *app,
    6464                                          GsmClient  *client);
    6565
    66 void             gsm_app_registered      (GsmApp     *app);     
     66void             gsm_app_registered      (GsmApp     *app);
    6767
    6868G_END_DECLS
    6969
  • src/sugar/gsm-client-xsmp.c

    diff --git a/src/sugar/gsm-client-xsmp.c b/src/sugar/gsm-client-xsmp.c
    index 04c7de4..632dec9 100644
    a b register_client_callback (SmsConn conn, 
    192192  GsmClientXSMP *xsmp = manager_data;
    193193  char *id;
    194194
    195   g_debug ("Client '%s' received RegisterClient(%s)", 
     195  g_debug ("Client '%s' received RegisterClient(%s)",
    196196           xsmp->description,
    197197           previous_id ? previous_id : "NULL");
    198198
    save_yourself_request_callback (SmsConn conn, 
    319319  if (shutdown && global)
    320320    {
    321321      g_debug ("  initiating shutdown");
    322 /*      gsm_session_initiate_shutdown (global_session, 
    323                                      !fast, 
     322/*      gsm_session_initiate_shutdown (global_session,
     323                                     !fast,
    324324                                     GSM_SESSION_LOGOUT_TYPE_LOGOUT);
    325325*/
    326326    }
    save_yourself_request_callback (SmsConn conn, 
    333333    g_debug ("  ignoring");
    334334}
    335335
    336 static void 
     336static void
    337337xsmp_restart (GsmClient *client, GError **error)
    338338{
    339339  char *restart_cmd = gsm_client_get_restart_command (client);
    delete_property (GsmClientXSMP *client, const char *name) 
    555555
    556556  prop = find_property (client, name, &index);
    557557  if (!prop)
    558     return;     
     558    return;
    559559
    560560#if 0
    561561  /* This is wrong anyway; we can't unconditionally run the current
  • src/sugar/gsm-client.h

    diff --git a/src/sugar/gsm-client.h b/src/sugar/gsm-client.h
    index 3e4e751..4cfd7ed 100644
    a b struct _GsmClientClass 
    6666  char       * (*get_discard_command) (GsmClient *client);
    6767  gboolean     (*get_autorestart)     (GsmClient *client);
    6868
    69   void (*restart)              (GsmClient *client, 
     69  void (*restart)              (GsmClient *client,
    7070                                GError   **error);
    7171  void (*save_yourself)        (GsmClient *client,
    7272                                gboolean   save_state);
  • src/sugar/gsm-session.c

    diff --git a/src/sugar/gsm-session.c b/src/sugar/gsm-session.c
    index 0fe2fb5..fd3c52f 100644
    a b gsm_session_class_init (GsmSessionClass *klass) 
    120120
    121121/**
    122122 * gsm_session_set_name:
    123  * @session: session instance 
    124  * @name: name of the session 
     123 * @session: session instance
     124 * @name: name of the session
    125125 *
    126126 * Sets the name of a running session.
    127127 **/
    gsm_session_register_client (GsmSession *session, 
    231231                             const char *id)
    232232{
    233233  GSList *a;
    234   char *client_id = NULL; 
     234  char *client_id = NULL;
    235235
    236236  /* If we're shutting down, we don't accept any new session
    237237     clients. */
    gsm_session_register_client (GsmSession *session, 
    252252              return NULL;
    253253            }
    254254        }
    255      
     255
    256256      client_id = g_strdup (id);
    257257    }
    258258
    client_save_yourself_done (GsmClient *client, gpointer data) 
    438438  session->phase2_clients =
    439439    g_slist_remove (session->phase2_clients, client);
    440440
    441   if (session->phase == GSM_SESSION_PHASE_SHUTDOWN && 
     441  if (session->phase == GSM_SESSION_PHASE_SHUTDOWN &&
    442442      !session->shutdown_clients)
    443443    {
    444444      if (session->phase2_clients)
    client_disconnected (GsmClient *client, gpointer data) 
    471471      is_condition_client = TRUE;
    472472    }
    473473
    474   if (session->phase != GSM_SESSION_PHASE_SHUTDOWN && 
     474  if (session->phase != GSM_SESSION_PHASE_SHUTDOWN &&
    475475      gsm_client_get_autorestart (client) &&
    476476      !is_condition_client)
    477477    {
  • src/sugar/gsm-session.h

    diff --git a/src/sugar/gsm-session.h b/src/sugar/gsm-session.h
    index d4880a9..7b23b00 100644
    a b extern GsmSession *global_session; 
    3939typedef enum {
    4040  /* gsm's own startup/initialization phase */
    4141  GSM_SESSION_PHASE_STARTUP,
    42  
     42
    4343  /* xrandr setup, gnome-settings-daemon, etc */
    4444  GSM_SESSION_PHASE_INITIALIZATION,
    45  
     45
    4646  /* window/compositing managers */
    4747  GSM_SESSION_PHASE_WINDOW_MANAGER,
    48  
     48
    4949  /* apps that will create _NET_WM_WINDOW_TYPE_PANEL windows */
    5050  GSM_SESSION_PHASE_PANEL,
    51  
     51
    5252  /* apps that will create _NET_WM_WINDOW_TYPE_DESKTOP windows */
    5353  GSM_SESSION_PHASE_DESKTOP,
    54  
     54
    5555  /* everything else */
    5656  GSM_SESSION_PHASE_APPLICATION,
    57  
     57
    5858  /* done launching */
    5959  GSM_SESSION_PHASE_RUNNING,
    60  
     60
    6161  /* shutting down */
    6262  GSM_SESSION_PHASE_SHUTDOWN
    6363} GsmSessionPhase;
  • src/sugar/network.py

    diff --git a/src/sugar/network.py b/src/sugar/network.py
    index 0e25d73..d6599ff 100644
    a b class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): 
    124124            self.wfile.flush()
    125125        self.wfile.close()
    126126        self.rfile.close()
    127        
     127
    128128    def finish(self):
    129129        """Close the sockets when we're done, not before"""
    130130        pass
  • src/sugar/presence/__init__.py

    diff --git a/src/sugar/presence/__init__.py b/src/sugar/presence/__init__.py
    index 1136c19..9756612 100644
    a b  
    1919
    2020Provides a simplified API for accessing the dbus service
    2121which coordinates native network presence and sharing
    22 information.  This includes both "buddies" and "shared 
     22information.  This includes both "buddies" and "shared
    2323activities".
    2424"""
  • src/sugar/presence/activity.py

    diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py
    index 13abf5d..3102388 100644
    a b _logger = logging.getLogger('sugar.presence.activity') 
    3030
    3131class Activity(gobject.GObject):
    3232    """UI interface for an Activity in the presence service
    33    
     33
    3434    Activities in the presence service represent your and other user's
    3535    shared activities.
    36    
     36
    3737    Properties:
    38         id 
    39         color 
    40         name 
    41         type 
    42         joined 
     38        id
     39        color
     40        name
     41        type
     42        joined
    4343    """
    4444    __gsignals__ = {
    4545        'buddy-joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
    class Activity(gobject.GObject): 
    7474        self._ps_del_object = del_obj_cb
    7575        bobj = bus.get_object(self._PRESENCE_SERVICE, object_path)
    7676        self._activity = dbus.Interface(bobj, self._ACTIVITY_DBUS_INTERFACE)
    77         self._activity.connect_to_signal('BuddyHandleJoined', 
     77        self._activity.connect_to_signal('BuddyHandleJoined',
    7878                                         self._buddy_handle_joined_cb)
    7979        self._activity.connect_to_signal('BuddyLeft',
    8080                                         self._buddy_left_cb)
    class Activity(gobject.GObject): 
    211211
    212212    def _emit_buddy_left_signal(self, object_path):
    213213        """Generate buddy-left GObject signal with presence Buddy object
    214        
     214
    215215        XXX note use of _ps_new_object instead of _ps_del_object here
    216216        """
    217217        self.emit('buddy-left', self._ps_new_object(object_path))
    class Activity(gobject.GObject): 
    225225            self._handle_to_buddy_path.pop(handle, None)
    226226
    227227    def _emit_new_channel_signal(self, object_path):
    228         """Generate new-channel GObject signal with channel object path 
    229        
     228        """Generate new-channel GObject signal with channel object path
     229
    230230        New telepathy-python communications channel has been opened
    231231        """
    232232        self.emit('new-channel', object_path)
    class Activity(gobject.GObject): 
    255255
    256256    def get_buddy_by_handle(self, handle):
    257257        """Retrieve the Buddy object given a telepathy handle.
    258        
     258
    259259        buddy object paths are cached in self._handle_to_buddy_path,
    260260        so we can get the buddy without calling PS.
    261261        """
    class Activity(gobject.GObject): 
    378378    # GetChannels() wrapper
    379379
    380380    def get_channels(self):
    381         """Retrieve communications channel descriptions for the activity 
    382        
     381        """Retrieve communications channel descriptions for the activity
     382
    383383        Returns a tuple containing:
    384384            - the D-Bus well-known service name of the connection
    385385              (FIXME: this is redundant; in Telepathy it can be derived
  • src/sugar/presence/buddy.py

    diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py
    index 57cd710..a1155b2 100644
    a b import dbus 
    2626
    2727class Buddy(gobject.GObject):
    2828    """UI interface for a Buddy in the presence service
    29    
     29
    3030    Each buddy interface tracks a set of activities and properties
    31     that can be queried to provide UI controls for manipulating 
     31    that can be queried to provide UI controls for manipulating
    3232    the presence interface.
    33    
     33
    3434    Properties Dictionary:
    35         'key': public key, 
    36         'nick': nickname , 
    37         'color': color (XXX what format), 
    38         'current-activity': (XXX dbus path?), 
    39         'owner': (XXX dbus path?), 
     35        'key': public key,
     36        'nick': nickname ,
     37        'color': color (XXX what format),
     38        'current-activity': (XXX dbus path?),
     39        'owner': (XXX dbus path?),
    4040        'icon': (XXX pixel data for an icon?)
    4141    See __gproperties__
    4242    """
    class Buddy(gobject.GObject): 
    6767
    6868    def __init__(self, bus, new_obj_cb, del_obj_cb, object_path):
    6969        """Initialise the reference to the buddy
    70        
    71         bus -- dbus bus object 
    72         new_obj_cb -- callback to call when this buddy joins an activity 
    73         del_obj_cb -- callback to call when this buddy leaves an activity 
    74         object_path -- path to the buddy object 
     70
     71        bus -- dbus bus object
     72        new_obj_cb -- callback to call when this buddy joins an activity
     73        del_obj_cb -- callback to call when this buddy leaves an activity
     74        object_path -- path to the buddy object
    7575        """
    7676        gobject.GObject.__init__(self)
    7777        self._object_path = object_path
    class Buddy(gobject.GObject): 
    104104        self._joined_activity_signal.remove()
    105105        self._left_activity_signal.remove()
    106106        self._property_changed_signal.remove()
    107        
     107
    108108    def _get_properties_helper(self):
    109109        """Retrieve the Buddy's property dictionary from the service object
    110110        """
    class Buddy(gobject.GObject): 
    114114        return props
    115115
    116116    def do_get_property(self, pspec):
    117         """Retrieve a particular property from our property dictionary 
    118        
     117        """Retrieve a particular property from our property dictionary
     118
    119119        pspec -- XXX some sort of GTK specifier object with attributes
    120120            including 'name', 'active' and 'icon-name'
    121121        """
    class Buddy(gobject.GObject): 
    170170
    171171    def _joined_activity_cb(self, object_path):
    172172        """Handle dbus signal by emitting a GObject signal
    173        
     173
    174174        Stores the activity in activities dictionary as well
    175175        """
    176176        if not self._activities.has_key(object_path):
    class Buddy(gobject.GObject): 
    179179
    180180    def _emit_left_activity_signal(self, object_path):
    181181        """Emit activity left signal with Activity object
    182        
     182
    183183        XXX this calls self._ps_new_object instead of self._ps_del_object,
    184184            which would seem to be the incorrect callback?
    185185        """
    class Buddy(gobject.GObject): 
    188188
    189189    def _left_activity_cb(self, object_path):
    190190        """Handle dbus signal by emitting a GObject signal
    191        
     191
    192192        Also removes from the activities dictionary
    193193        """
    194194        if self._activities.has_key(object_path):
    class Buddy(gobject.GObject): 
    196196        gobject.idle_add(self._emit_left_activity_signal, object_path)
    197197
    198198    def _handle_property_changed_signal(self, prop_list):
    199         """Emit property-changed signal with property dictionary 
    200        
    201         Generates a property-changed signal with the results of 
     199        """Emit property-changed signal with property dictionary
     200
     201        Generates a property-changed signal with the results of
    202202        _get_properties_helper()
    203203        """
    204204        self._properties = self._get_properties_helper()
    class Buddy(gobject.GObject): 
    212212
    213213    def get_icon_pixbuf(self):
    214214        """Retrieve Buddy's icon as a GTK pixel buffer
    215        
     215
    216216        XXX Why aren't the icons coming in as SVG?
    217217        """
    218218        if self.props.icon and len(self.props.icon):
    class Buddy(gobject.GObject): 
    224224            return None
    225225
    226226    def get_joined_activities(self):
    227         """Retrieve the set of all activities which this buddy has joined 
    228        
    229         Uses the GetJoinedActivities method on the service 
    230         object to produce object paths, wraps each in an 
    231         Activity object. 
    232        
     227        """Retrieve the set of all activities which this buddy has joined
     228
     229        Uses the GetJoinedActivities method on the service
     230        object to produce object paths, wraps each in an
     231        Activity object.
     232
    233233        returns list of presence Activity objects
    234234        """
    235235        try:
  • src/sugar/presence/presenceservice.py

    diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
    index a7fd1a4..ddd4967 100644
    a b _logger = logging.getLogger('sugar.presence.presenceservice') 
    4040
    4141
    4242class PresenceService(gobject.GObject):
    43     """UI-side interface to the dbus presence service 
    44    
     43    """UI-side interface to the dbus presence service
     44
    4545    This class provides UI programmers with simplified access
    4646    to the dbus service of the same name.  It allows for observing
    4747    various events from the presence service as GObject events,
    class PresenceService(gobject.GObject): 
    6868
    6969    _PS_BUDDY_OP = DBUS_PATH + "/Buddies/"
    7070    _PS_ACTIVITY_OP = DBUS_PATH + "/Activities/"
    71    
     71
    7272
    7373    def __init__(self, allow_offline_iface=True):
    7474        """Initialise the service and attempt to connect to events
    class PresenceService(gobject.GObject): 
    9999
    100100    _ps_ = None
    101101    def _get_ps(self):
    102         """Retrieve dbus interface to PresenceService 
    103        
    104         Also registers for updates from various dbus events on the 
     102        """Retrieve dbus interface to PresenceService
     103
     104        Also registers for updates from various dbus events on the
    105105        interface.
    106        
    107         If unable to retrieve the interface, we will temporarily 
    108         return an _OfflineInterface object to allow the calling 
    109         code to continue functioning as though it had accessed a 
     106
     107        If unable to retrieve the interface, we will temporarily
     108        return an _OfflineInterface object to allow the calling
     109        code to continue functioning as though it had accessed a
    110110        real presence service.
    111        
    112         If successful, caches the presence service interface 
     111
     112        If successful, caches the presence service interface
    113113        for use by other methods and returns that interface
    114114        """
    115115        if not self._ps_:
    116116            try:
    117117                # NOTE: We need to follow_name_owner_changes here
    118                 #       because we can not connect to a signal unless 
     118                #       because we can not connect to a signal unless
    119119                #       we follow the changes or we start the service
    120120                #       before we connect.  Starting the service here
    121121                #       causes a major bottleneck during startup
    122122                ps = dbus.Interface(
    123123                    self._bus.get_object(DBUS_SERVICE,
    124124                                         DBUS_PATH,
    125                                          follow_name_owner_changes=True), 
     125                                         follow_name_owner_changes=True),
    126126                    DBUS_INTERFACE
    127127                )
    128128            except dbus.exceptions.DBusException, err:
    class PresenceService(gobject.GObject): 
    135135                    return _OfflineInterface()
    136136                raise RuntimeError("Failed to connect to the presence service.")
    137137            else:
    138                 self._ps_ = ps 
     138                self._ps_ = ps
    139139                ps.connect_to_signal('BuddyAppeared',
    140140                                     self._buddy_appeared_cb)
    141141                ps.connect_to_signal('BuddyDisappeared',
    class PresenceService(gobject.GObject): 
    149149                ps.connect_to_signal('PrivateInvitation',
    150150                                     self._private_invitation_cb)
    151151        return self._ps_
    152        
     152
    153153    _ps = property(
    154154        _get_ps, None, None,
    155155        """DBUS interface to the PresenceService
    class PresenceService(gobject.GObject): 
    158158
    159159    def _new_object(self, object_path):
    160160        """Turn new object path into (cached) Buddy/Activity instance
    161        
     161
    162162        object_path -- full dbus path of the new object, must be
    163163            prefixed with either of _PS_BUDDY_OP or _PS_ACTIVITY_OP
    164        
     164
    165165        Note that this method is called throughout the class whenever
    166         the representation of the object is required, it is not only 
     166        the representation of the object is required, it is not only
    167167        called when the object is first discovered.  The point is to only have
    168168        _one_ Python object for any D-Bus object represented by an object path,
    169169        effectively wrapping the D-Bus object in a single Python GObject.
    170        
     170
    171171        returns presence Buddy or Activity representation
    172172        """
    173173        obj = None
    class PresenceService(gobject.GObject): 
    225225            # we could use a LRU cache limited to some value.
    226226            del self._objcache[object_path]
    227227            obj.destroy()
    228            
     228
    229229        return False
    230230
    231231    def _buddy_disappeared_cb(self, object_path):
    class PresenceService(gobject.GObject): 
    282282
    283283    def get_activities(self):
    284284        """Retrieve set of all activities from service
    285        
     285
    286286        returns list of Activity objects for all object paths
    287287            the service reports exist (using GetActivities)
    288288        """
    class PresenceService(gobject.GObject): 
    317317            )
    318318
    319319    def get_activities_async(self, reply_handler=None, error_handler=None):
    320         """Retrieve set of all activities from service asyncronously 
     320        """Retrieve set of all activities from service asyncronously
    321321        """
    322322
    323323        if not reply_handler:
    324324            logging.error('Function get_activities_async called without' \
    325                           'a reply handler. Can not run.') 
     325                          'a reply handler. Can not run.')
    326326            return
    327327
    328328        self._ps.GetActivities(
    class PresenceService(gobject.GObject): 
    351351
    352352    def get_buddies(self):
    353353        """Retrieve set of all buddies from service
    354        
     354
    355355        returns list of Buddy objects for all object paths
    356356            the service reports exist (using GetBuddies)
    357357        """
    class PresenceService(gobject.GObject): 
    386386            )
    387387
    388388    def get_buddies_async(self, reply_handler=None, error_handler=None):
    389         """Retrieve set of all buddies from service asyncronously 
     389        """Retrieve set of all buddies from service asyncronously
    390390        """
    391391
    392392        if not reply_handler:
    393393            logging.error('Function get_buddies_async called without' \
    394                           'a reply handler. Can not run.') 
     394                          'a reply handler. Can not run.')
    395395            return
    396396
    397397        self._ps.GetBuddies(
    class PresenceService(gobject.GObject): 
    402402
    403403    def get_buddy(self, key):
    404404        """Retrieve single Buddy object for the given public key
    405        
     405
    406406        key -- buddy's public encryption key
    407        
    408         returns single Buddy object or None if the activity 
    409             is not found using GetBuddyByPublicKey on the 
     407
     408        returns single Buddy object or None if the activity
     409            is not found using GetBuddyByPublicKey on the
    410410            service
    411411        """
    412412        try:
    class PresenceService(gobject.GObject): 
    479479
    480480    def share_activity(self, activity, properties=None, private=True):
    481481        """Ask presence service to ask the activity to share itself publicly.
    482        
    483         Uses the AdvertiseActivity method on the service to ask for the 
    484         sharing of the given activity.  Arranges to emit activity-shared 
     482
     483        Uses the AdvertiseActivity method on the service to ask for the
     484        sharing of the given activity.  Arranges to emit activity-shared
    485485        event with:
    486        
     486
    487487            (success, Activity, err)
    488        
     488
    489489        on success/failure.
    490        
     490
    491491        returns None
    492492        """
    493493        actid = activity.get_id()
    class PresenceService(gobject.GObject): 
    528528
    529529class _OfflineInterface( object ):
    530530    """Offline-presence-service interface
    531    
     531
    532532    Used to mimic the behaviour of a real PresenceService sufficiently
    533533    to avoid crashing client code that expects the given interface.
    534    
    535     XXX we could likely return a "MockOwner" object reasonably 
     534
     535    XXX we could likely return a "MockOwner" object reasonably
    536536    easily, but would it be worth it?
    537537    """
    538538    def raiseException( self, *args, **named ):
    539539        """Raise dbus.exceptions.DBusException"""
    540         raise dbus.exceptions.DBusException( 
     540        raise dbus.exceptions.DBusException(
    541541            """PresenceService Interface not available"""
    542542        )
    543543    GetActivities = raiseException
    class _OfflineInterface( object ): 
    546546    GetBuddyByPublicKey = raiseException
    547547    GetOwner = raiseException
    548548    GetPreferredConnection = raiseException
    549     def ShareActivity( 
     549    def ShareActivity(
    550550        self, actid, atype, name, properties,
    551551        reply_handler, error_handler,
    552552    ):
    class _OfflineInterface( object ): 
    559559
    560560class _MockPresenceService(gobject.GObject):
    561561    """Test fixture allowing testing of items that use PresenceService
    562    
     562
    563563    See PresenceService for usage and purpose
    564564    """
    565565    __gsignals__ = {
  • src/sugar/profile.py

    diff --git a/src/sugar/profile.py b/src/sugar/profile.py
    index 6e5a1bf..6fbf5c2 100644
    a b _profile = None 
    3333
    3434class Profile(object):
    3535    """Local user's current options/profile information
    36    
    37     User settings were previously stored in an INI-style 
    38     configuration file. We moved to gconf now. The deprected 
     36
     37    User settings were previously stored in an INI-style
     38    configuration file. We moved to gconf now. The deprected
    3939    API is kept around to not break activities still using it.
    4040
    4141    The profile is also responsible for loading the user's
    4242    public and private ssh keys from disk.
    43    
     43
    4444    Attributes:
    45        
     45
    4646        pubkey -- public ssh key
    47         privkey_hash -- SHA has of the child's public key 
     47        privkey_hash -- SHA has of the child's public key
    4848    """
    4949    def __init__(self, path):
    5050        self._pubkey = None
    class Profile(object): 
    138138            client.set_string("/desktop/sugar/user/color", color)
    139139        if cp.has_option('Jabber', 'Server'):
    140140            server = cp.get('Jabber', 'Server')
    141             client.set_string("/desktop/sugar/collaboration/jabber_server", 
     141            client.set_string("/desktop/sugar/collaboration/jabber_server",
    142142                              server)
    143143        if cp.has_option('Date', 'Timezone'):
    144144            timezone = cp.get('Date', 'Timezone')
    class Profile(object): 
    165165                client.set_bool("/desktop/sugar/power/extreme", True)
    166166        if cp.has_option('Shell', 'FavoritesLayout'):
    167167            layout = cp.get('Shell', 'FavoritesLayout')
    168             client.set_string("/desktop/sugar/desktop/favorites_layout", 
     168            client.set_string("/desktop/sugar/desktop/favorites_layout",
    169169                              layout)
    170170        del cp
    171171        try:
    class Profile(object): 
    191191            '#export SUGAR_LOGGER_LEVEL=debug\n\n' \
    192192            '# Uncomment the following line to enable core dumps\n' \
    193193            '#ulimit -c unlimited\n'
    194         fd.write(text)       
     194        fd.write(text)
    195195        fd.close()
    196196
    197197def get_profile():
    def get_profile(): 
    205205
    206206def get_nick_name():
    207207    client = gconf.client_get_default()
    208     return client.get_string("/desktop/sugar/user/nick")   
     208    return client.get_string("/desktop/sugar/user/nick")
    209209
    210210def get_color():
    211211    client = gconf.client_get_default()
    212     color = client.get_string("/desktop/sugar/user/color")   
     212    color = client.get_string("/desktop/sugar/user/color")
    213213    return XoColor(color)
    214214
    215215def get_pubkey():
  • src/sugar/sugar-address-entry.c

    diff --git a/src/sugar/sugar-address-entry.c b/src/sugar/sugar-address-entry.c
    index c7555e0..0309880 100644
    a b gtk_entry_get_pixel_ranges (GtkEntry *entry, 
    8787      if (ranges)
    8888        {
    8989          gint *r = *ranges;
    90          
     90
    9191          for (i = 0; i < real_n_ranges; ++i)
    9292            {
    9393              r[2 * i + 1] = (r[2 * i + 1] - r[2 * i]) / PANGO_SCALE;
    9494              r[2 * i] = r[2 * i] / PANGO_SCALE;
    9595            }
    9696        }
    97      
     97
    9898      if (n_ranges)
    9999        *n_ranges = real_n_ranges;
    100100    }
    gtk_entry_get_cursor_locations (GtkEntry *entry, 
    117117    {
    118118      if (strong_x)
    119119        *strong_x = 0;
    120      
     120
    121121      if (weak_x)
    122122        *weak_x = 0;
    123123    }
    gtk_entry_get_cursor_locations (GtkEntry *entry, 
    128128      const gchar *text = pango_layout_get_text (layout);
    129129      PangoRectangle strong_pos, weak_pos;
    130130      gint index;
    131  
     131
    132132      if (type == CURSOR_STANDARD)
    133133        {
    134134          index = g_utf8_offset_to_pointer (text, entry->current_pos + entry->preedit_cursor) - text;
    gtk_entry_get_cursor_locations (GtkEntry *entry, 
    148148                }
    149149            }
    150150        }
    151      
     151
    152152      pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
    153      
     153
    154154      if (strong_x)
    155155        *strong_x = strong_pos.x / PANGO_SCALE;
    156      
     156
    157157      if (weak_x)
    158158        *weak_x = weak_pos.x / PANGO_SCALE;
    159159    }
    gtk_entry_draw_cursor (GtkEntry *entry, 
    165165{
    166166  GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (entry)));
    167167  PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
    168  
     168
    169169  if (GTK_WIDGET_DRAWABLE (entry))
    170170    {
    171171      GtkWidget *widget = GTK_WIDGET (entry);
    gtk_entry_draw_cursor (GtkEntry *entry, 
    186186      xoffset = inner_border.left - entry->scroll_offset;
    187187
    188188      gdk_drawable_get_size (entry->text_area, NULL, &text_area_height);
    189      
     189
    190190      gtk_entry_get_cursor_locations (entry, type, &strong_x, &weak_x);
    191191
    192192      g_object_get (gtk_widget_get_settings (widget),
    gtk_entry_draw_cursor (GtkEntry *entry, 
    194194                    NULL);
    195195
    196196      dir1 = entry->resolved_dir;
    197      
     197
    198198      if (split_cursor)
    199199        {
    200200          x1 = strong_x;
    gtk_entry_draw_cursor (GtkEntry *entry, 
    221221      draw_insertion_cursor (entry,
    222222                             &cursor_location, TRUE, dir1,
    223223                             dir2 != PANGO_DIRECTION_NEUTRAL);
    224      
     224
    225225      if (dir2 != PANGO_DIRECTION_NEUTRAL)
    226226        {
    227227          cursor_location.x = xoffset + x2;
    get_layout_position (GtkEntry *entry, 
    243243  GtkBorder inner_border;
    244244  gint y_pos;
    245245  PangoLayoutLine *line;
    246  
     246
    247247//  layout = gtk_entry_ensure_layout (entry, TRUE);
    248248  layout = gtk_entry_get_layout(entry);
    249249
    get_layout_position (GtkEntry *entry, 
    254254
    255255  line = pango_layout_get_lines (layout)->data;
    256256  pango_layout_line_get_extents (line, NULL, &logical_rect);
    257  
     257
    258258  /* Align primarily for locale's ascent/descent */
    259   y_pos = ((area_height - entry->ascent - entry->descent) / 2 + 
     259  y_pos = ((area_height - entry->ascent - entry->descent) / 2 +
    260260           entry->ascent + logical_rect.y);
    261  
     261
    262262  /* Now see if we need to adjust to fit in actual drawn string */
    263263  if (logical_rect.height > area_height)
    264264    y_pos = (area_height - logical_rect.height) / 2;
    get_layout_position (GtkEntry *entry, 
    266266    y_pos = 0;
    267267  else if (y_pos + logical_rect.height > area_height)
    268268    y_pos = area_height - logical_rect.height;
    269  
     269
    270270  y_pos = inner_border.top + y_pos / PANGO_SCALE;
    271271
    272272  if (x)
    static void 
    306306gtk_entry_draw_text (GtkEntry *entry)
    307307{
    308308  GtkWidget *widget;
    309  
     309
    310310  if (!entry->visible && entry->invisible_char == 0)
    311311    return;
    312  
     312
    313313  if (GTK_WIDGET_DRAWABLE (entry))
    314314    {
    315315      //PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
    gtk_entry_draw_text (GtkEntry *entry) 
    317317      cairo_t *cr;
    318318      gint x, y;
    319319      gint start_pos, end_pos;
    320      
     320
    321321      widget = GTK_WIDGET (entry);
    322      
     322
    323323      get_layout_position (entry, &x, &y);
    324324
    325325      cr = gdk_cairo_create (entry->text_area);
    gtk_entry_draw_text (GtkEntry *entry) 
    360360                             logical_rect.height);
    361361
    362362          cairo_clip (cr);
    363          
     363
    364364          gdk_cairo_set_source_color (cr, selection_color);
    365365          cairo_paint (cr);
    366366
    367367          cairo_move_to (cr, x, y);
    368368          gdk_cairo_set_source_color (cr, text_color);
    369369          pango_cairo_show_layout (cr, layout);
    370          
     370
    371371          g_free (ranges);
    372372        }
    373373
    get_text_area_size (GtkEntry *entry, 
    427427
    428428  if (y)
    429429    *y = yborder;
    430  
     430
    431431  if (width)
    432432    *width = GTK_WIDGET (entry)->allocation.width - xborder * 2;
    433433
    sugar_address_entry_expose(GtkWidget *widget, 
    471471                        cairo_fill(cr);
    472472                        cairo_destroy (cr);
    473473                }
    474        
     474
    475475
    476476      if ((entry->visible || entry->invisible_char != 0) &&
    477477          GTK_WIDGET_HAS_FOCUS (widget) &&
  • src/sugar/sugar-key-grabber.c

    diff --git a/src/sugar/sugar-key-grabber.c b/src/sugar/sugar-key-grabber.c
    index 8139ce1..8a00a80 100644
    a b sugar_key_grabber_init(SugarKeyGrabber *grabber) 
    153153        gdk_window_add_filter(grabber->root, filter_events, grabber);
    154154}
    155155
    156 /* grab_key and grab_key_real are from 
     156/* grab_key and grab_key_real are from
    157157 * gnome-control-center/gnome-settings-daemon/gnome-settings-multimedia-keys.c
    158158 */
    159159
    sugar_key_grabber_grab_keys(SugarKeyGrabber *grabber, const char **keys) 
    213213    while (*cur != NULL) {
    214214        key = *cur;
    215215        cur += 1;
    216        
     216
    217217        keyinfo = g_new0 (Key, 1);
    218218        keyinfo->key = g_strdup(key);
    219219
    sugar_key_grabber_is_modifier(SugarKeyGrabber *grabber, guint keycode, guint mas 
    279279                        break;
    280280                }
    281281        }
    282        
     282
    283283        XFreeModifiermap (modmap);
    284        
     284
    285285        return is_modifier;
    286286}
    287287
  • src/sugar/util.py

    diff --git a/src/sugar/util.py b/src/sugar/util.py
    index 26bbe83..d88f462 100644
    a b def sha_data(data): 
    4848
    4949def unique_id(data = ''):
    5050    """Generate a likely-unique ID for whatever purpose
    51    
     51
    5252    data -- suffix appended to working data before hashing
    53    
     53
    5454    Returns a 40-character string with hexidecimal digits
    55     representing an SHA hash of the time, a random digit 
     55    representing an SHA hash of the time, a random digit
    5656    within a constrained range and the data passed.
    57    
    58     Note: these are *not* crypotographically secure or 
    59         globally unique identifiers.  While they are likely 
    60         to be unique-enough, no attempt is made to make 
     57
     58    Note: these are *not* crypotographically secure or
     59        globally unique identifiers.  While they are likely
     60        to be unique-enough, no attempt is made to make
    6161        perfectly unique values.
    6262    """
    6363    data_string = "%s%s%s" % (time.time(), random.randint(10000, 100000), data)
    def is_hex(s): 
    7272    except ValueError:
    7373        return False
    7474
    75     return True 
     75    return True
    7676
    7777def validate_activity_id(actid):
    7878    """Validate an activity ID."""
    def set_proc_title(title): 
    9090       and only the first 15 characters will be shown.
    9191
    9292       title -- the title you wish to change the process
    93                 title to 
     93                title to
    9494
    9595       Returns True on success.  We don't raise exceptions
    9696       because if something goes wrong here it is not a big
    class TempFilePath(str): 
    284284    def __del__(self):
    285285        if _tracked_paths[self] == 1:
    286286            del _tracked_paths[self]
    287            
     287
    288288            if os.path.exists(self):
    289289                os.unlink(self)
    290290                logging.debug('TempFilePath deleted %r' % self)
  • src/sugar/wm.py

    diff --git a/src/sugar/wm.py b/src/sugar/wm.py
    index 4ec9a12..64505e8 100644
    a b  
    1616# Boston, MA 02111-1307, USA.
    1717
    1818"""
    19 UNSTABLE. Used only internally by Activity and jarabe. 
     19UNSTABLE. Used only internally by Activity and jarabe.
    2020"""
    2121
    2222import gtk
  • tests/graphics/iconwidget.py

    diff --git a/tests/graphics/iconwidget.py b/tests/graphics/iconwidget.py
    index cacf501..625306e 100644
    a b def create_icon_widgets(box, sensitive=True): 
    4545    icon.set_sensitive(sensitive)
    4646    icon.show()
    4747
    48     icon = Icon(icon_name='computer-xo', 
     48    icon = Icon(icon_name='computer-xo',
    4949                icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
    5050                xo_color=XoColor())
    5151    box.pack_start(icon)
  • tests/lib/test_mime.py

    diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py
    index 3df0ce6..9a9ad61 100644
    a b class TestMime(unittest.TestCase): 
    3333                ['text/plain', 'text/_moz_htmlcontext', 'text/unicode',
    3434                 'text/html', 'text/_moz_htmlinfo'])
    3535        self.assertEqual(mime_type, 'text/html')
    36        
     36
    3737        # Mozilla's text in c&v
    3838        mime_type = mime.choose_most_significant(
    3939                ['text/_moz_htmlcontext', 'STRING', 'text/html', 'text/_moz_htmlinfo',