From 14da529ec77941a93ed3066ed02a10113ffe31d5 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Sat, 21 May 2011 12:12:10 +0000 Subject: fix PEP8 whitespace issues Signed-off-by: Sascha Silbe --- diff --git a/browser.py b/browser.py index 7b0ec1d..8b0994b 100644 --- a/browser.py +++ b/browser.py @@ -218,7 +218,7 @@ class TabLabel(gtk.HBox): __gsignals__ = { 'tab-close': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([object])) + ([object])), } def __init__(self, browser): @@ -263,8 +263,8 @@ class Browser(WebView): __gsignals__ = { 'is-setup': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])) + gobject.TYPE_NONE, + ([])), } def __init__(self): @@ -295,7 +295,6 @@ class Browser(WebView): self.emit('is-setup') - def get_url_from_nsiuri(self, uri): """ get a nsIURI object and return a string with the url diff --git a/downloadmanager.py b/downloadmanager.py index 90d22a5..a71f16e 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -166,7 +166,8 @@ class Download: _active_downloads.append(self) elif state_flags & interfaces.nsIWebProgressListener.STATE_STOP: - if NS_FAILED(status): # download cancelled + if NS_FAILED(status): + # download cancelled return self._stop_alert = Alert() @@ -237,6 +238,7 @@ class Download: gtk.gdk.INTERP_BILINEAR) preview_data = [] + def save_func(buf, data): data.append(buf) @@ -287,7 +289,7 @@ class Download: def onProgressChange64(self, web_progress, request, cur_self_progress, max_self_progress, cur_total_progress, max_total_progress): - percent = (cur_self_progress * 100) / max_self_progress + percent = (cur_self_progress * 100) / max_self_progress if (time.time() - self._last_update_time) < _MIN_TIME_UPDATE and \ (percent - self._last_update_percent) < _MIN_PERCENT_UPDATE: @@ -343,7 +345,7 @@ class Download: global _active_downloads if self in _active_downloads: # TODO: Use NS_BINDING_ABORTED instead of NS_ERROR_FAILURE. - self.cancelable.cancel(NS_ERROR_FAILURE) #NS_BINDING_ABORTED) + self.cancelable.cancel(NS_ERROR_FAILURE) _active_downloads.remove(self) @@ -442,4 +444,4 @@ class _SaveLinkProgressListener(object): def onDataAvailable(self, request, context, inputStream, offset, count): self._external_listener.onDataAvailable(request, context, inputStream, - offset, count); + offset, count) diff --git a/linkbutton.py b/linkbutton.py index 3247c7b..4a0a18f 100644 --- a/linkbutton.py +++ b/linkbutton.py @@ -32,7 +32,7 @@ class LinkButton(TrayButton, gobject.GObject): __gtype_name__ = 'LinkButton' __gsignals__ = { 'remove_link': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([str])) + gobject.TYPE_NONE, ([str])), } def __init__(self, url, buf, color, title, owner, index, hash): @@ -40,7 +40,7 @@ class LinkButton(TrayButton, gobject.GObject): self.set_image(buf, color.split(',')[1], color.split(',')[0]) self.hash = hash - info = title +'\n'+ owner + info = title + '\n' + owner self.setup_rollover_options(info) def set_image(self, buf, fill='#0000ff', stroke='#4d4c4f'): diff --git a/messenger.py b/messenger.py index a1aacda..5114511 100644 --- a/messenger.py +++ b/messenger.py @@ -73,7 +73,7 @@ class Messenger(ExportedGObject): self.tube.get_object(member, PATH).sync_with_members( self.model.get_links_ids(), dbus_interface=IFACE, reply_handler=self.reply_sync, error_handler=lambda - e:self.error_sync(e, 'transfering file')) + e: self.error_sync(e, 'transfering file')) self.entered = True diff --git a/model.py b/model.py index 65e5647..852e8e8 100644 --- a/model.py +++ b/model.py @@ -28,7 +28,7 @@ class Model(gobject.GObject): ''' __gsignals__ = { 'add_link': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([int])) + gobject.TYPE_NONE, ([int])), } def __init__(self): @@ -45,12 +45,12 @@ class Model(gobject.GObject): break self.data['shared_links'].insert(index, - {'hash':sha.new(str(url)).hexdigest(), - 'url':str(url), 'title':str(title), - 'thumb':base64.b64encode(thumb), - 'owner':str(owner), - 'color':str(color), - 'timestamp':float(timestamp)}) + {'hash': sha.new(str(url)).hexdigest(), + 'url': str(url), 'title': str(title), + 'thumb': base64.b64encode(thumb), + 'owner': str(owner), + 'color': str(color), + 'timestamp': float(timestamp)}) self.emit('add_link', index) def remove_link(self, hash): diff --git a/palettes.py b/palettes.py index 0d4023a..9695db1 100644 --- a/palettes.py +++ b/palettes.py @@ -41,7 +41,7 @@ class MouseOutListener(gobject.GObject): __gsignals__ = { 'mouse-out': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([])) + ([])), } def __init__(self, target): @@ -247,7 +247,7 @@ class ImagePalette(Palette): cls = components.classes[ \ '@mozilla.org/embedding/browser/nsWebBrowserPersist;1'] persist = cls.createInstance(interfaces.nsIWebBrowserPersist) - persist.persistFlags = 1 # PERSIST_FLAGS_FROM_CACHE + persist.persistFlags = 1 # PERSIST_FLAGS_FROM_CACHE listener = xpcom.server.WrapObject(_ImageProgressListener(temp_file), interfaces.nsIWebProgressListener) persist.progressListener = listener diff --git a/sessionhistory.py b/sessionhistory.py index 2211551..8a5aef0 100644 --- a/sessionhistory.py +++ b/sessionhistory.py @@ -29,7 +29,7 @@ class HistoryListener(gobject.GObject): gobject.TYPE_NONE, ([int])), 'session-link-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([str])) + ([str])), } def __init__(self): diff --git a/webactivity.py b/webactivity.py index d744ab1..480ea9a 100644 --- a/webactivity.py +++ b/webactivity.py @@ -114,13 +114,13 @@ def _seed_xs_cookie(): _logger.debug('seed_xs_cookie: Cookie exists already') return - expire = int(time.time()) + 10*365*24*60*60 + expire = int(time.time()) + 10 * 365 * 24 * 60 * 60 c.execute('''INSERT INTO moz_cookies (name, value, host, path, expiry, lastAccessed, isSecure, isHttpOnly) VALUES(?,?,?,?,?,?,?,?)''', ('xoid', cjson.encode(cookie_data), jabber_server, - '/', expire, 0, 0, 0 )) + '/', expire, 0, 0, 0)) cookies_db.commit() cookies_db.close() except sqlite3.Error, e: @@ -147,7 +147,7 @@ def _set_accept_languages(): lang = lang.split('_') # e.g. es-uy, es - pref = lang[0] + "-" + lang[1].lower() + ", " + lang[0] + pref = lang[0] + "-" + lang[1].lower() + ", " + lang[0] cls = components.classes["@mozilla.org/preferences-service;1"] prefService = cls.getService(components.interfaces.nsIPrefService) branch = prefService.getBranch('') @@ -369,7 +369,7 @@ class WebActivity(activity.Activity): self.tube_conn = TubeConnection(self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], - identifier, group_iface = self.text_chan[ + identifier, group_iface=self.text_chan[ telepathy.CHANNEL_INTERFACE_GROUP]) _logger.debug('Tube created') @@ -547,7 +547,8 @@ class WebActivity(activity.Activity): item = LinkButton(url, buf, color, title, owner, index, hash) item.connect('clicked', self._link_clicked_cb, url) item.connect('remove_link', self._link_removed_cb) - self._tray.add_item(item, index) # use index to add to the tray + # use index to add to the tray + self._tray.add_item(item, index) item.show() if self._tray.props.visible is False: self._tray.show() diff --git a/webtoolbar.py b/webtoolbar.py index a5e2c6e..1ae8cd9 100644 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -37,6 +37,7 @@ import places _MAX_HISTORY_ENTRIES = 15 + class WebEntry(AddressEntry): _COL_ADDRESS = 0 _COL_TITLE = 1 @@ -216,6 +217,7 @@ class WebEntry(AddressEntry): else: self._search_popup() + class PrimaryToolbar(ToolbarBox): __gtype_name__ = 'PrimaryToolbar' @@ -228,7 +230,7 @@ class PrimaryToolbar(ToolbarBox): ([])), 'go-home': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([])) + ([])), } def __init__(self, tabbed_view, act, disable_multiple_tabs): -- cgit v0.9.1