From 51d0563b974f4daa7150410f66d1816c42780212 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 22 May 2013 18:59:51 +0000 Subject: pep8 and pyflakes cleanup --- (limited to 'gnome_plugins') diff --git a/gnome_plugins/collaboration_plugin.py b/gnome_plugins/collaboration_plugin.py index 4ba98a5..83b35f8 100644 --- a/gnome_plugins/collaboration_plugin.py +++ b/gnome_plugins/collaboration_plugin.py @@ -35,19 +35,17 @@ from util.menubuilder import MenuBuilder from util.configfile import ConfigFile from util.configwizard import ConfigWizard -import telepathy from collaboration.neighborhood import get_neighborhood from collaboration.connectionmanager import get_connection_manager from collaboration.activity import Activity from collaboration import telepathyclient -from collaboration.tubeconn import TubeConnection from TurtleArt.tacollaboration import Collaboration import traceback CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = \ - 'org.laptop.Telepathy.ActivityProperties' + 'org.laptop.Telepathy.ActivityProperties' class Collaboration_plugin(Plugin): @@ -56,8 +54,7 @@ class Collaboration_plugin(Plugin): 'joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), 'shared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ()), - } + ()), } def __init__(self, parent): Plugin.__init__(self) @@ -82,8 +79,7 @@ class Collaboration_plugin(Plugin): 'server': {'type': 'text'}, 'port': {'type': 'integer'}, 'register': {'type': 'boolean'}, - 'colors': {'type': 'text'} - } + 'colors': {'type': 'text'}} def _connect_cb(self, button): """ Enable connection """ @@ -181,7 +177,7 @@ class Collaboration_plugin(Plugin): dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) self._client_handler = telepathyclient.get_instance() - if self._client_handler == None: + if self._client_handler is None: raise RuntimeError('Telepathy client unavailable') self._neighborhood = get_neighborhood(params) self._neighborhood.connect('activity-added', self._activity_added_cb) @@ -263,7 +259,8 @@ class Collaboration_plugin(Plugin): properties['private'] = True try: - room_handle = connection.GetActivity(activity.activity_id, + room_handle = connection.GetActivity( + activity.activity_id, dbus_interface=CONNECTION_INTERFACE_ACTIVITY_PROPERTIES) print('room_handle = %s' % str(room_handle)) self._joined_activity = Activity( @@ -277,7 +274,7 @@ class Collaboration_plugin(Plugin): raise RuntimeError('Activity %s is already shared.' % activity.activity_id) - _join_id = self._joined_activity.connect('joined', self.__joined_cb) + self._joined_activity.connect('joined', self.__joined_cb) self._joined_activity.join() def __joined_cb(self, activity, success, err): @@ -302,8 +299,7 @@ class Collaboration_plugin(Plugin): {'item_label': _('Register'), 'item_type': 'boolean', 'item_name': 'register'}, {'item_label': _('Colors'), 'item_type': 'text', - 'item_name': 'colors'} - ] + 'item_name': 'colors'}] config_w.set_config_items(config_items) config_w.set_config_file_obj(self._collaboration_config_values) config_w.show() @@ -328,8 +324,8 @@ class Collaboration_plugin(Plugin): try: self._parent._shared_activity = Activity(account_path, - connection, - properties=properties) + connection, + properties=properties) # FIXME: this should be unified, no need to keep 2 references self._shared_activity = self._parent._shared_activity except: @@ -340,7 +336,7 @@ class Collaboration_plugin(Plugin): self._parent._get_activity_id()) self._parent._shared_parent.share(self.__share_activity_cb, - self.__share_activity_error_cb) + self.__share_activity_error_cb) def __share_activity_cb(self, activity): """Finish sharing the activity""" diff --git a/gnome_plugins/fb_plugin.py b/gnome_plugins/fb_plugin.py index 54fa9d2..0f5fc15 100644 --- a/gnome_plugins/fb_plugin.py +++ b/gnome_plugins/fb_plugin.py @@ -32,7 +32,6 @@ import pycurl -import sys import urlparse import gtk @@ -45,6 +44,7 @@ from plugin import Plugin from util.menubuilder import MenuBuilder, MENUBAR from gettext import gettext as _ + class FbUploader(): UPLOAD_URL = "https://graph.facebook.com/me/photos?access_token=%s" @@ -142,7 +142,7 @@ class Fb_plugin(Plugin): if uri: url_o = urlparse.urlparse(uri) params = urlparse.parse_qs(url_o.fragment) - if params.has_key('access_token'): + if 'access_token' in params: self._access_token = params['access_token'][0] self._auth_win.hide() self._post_to_fb() diff --git a/gnome_plugins/uploader_plugin.py b/gnome_plugins/uploader_plugin.py index 3d3e04f..b9d7810 100644 --- a/gnome_plugins/uploader_plugin.py +++ b/gnome_plugins/uploader_plugin.py @@ -193,7 +193,7 @@ http://turtleartsite.sugarlabs.org to upload your project.')) ('title', title), ('description', description), ('upload_key', key), ('_formname', - 'image_create')]) + 'image_create')]) c.perform() error_code = c.getinfo(c.HTTP_CODE) c.close @@ -207,7 +207,7 @@ http://turtleartsite.sugarlabs.org to upload your project.')) if __name__ == "__main__": # TODO: create test data... - u = Uploader(None) + u = Uploader_plugin(None) if u.enabled(): print "Uploader is enabled... trying to upload" u.do_upload_to_web() -- cgit v0.9.1