From 2937c3bd6347ee8e916a05bb18ef9bef914ed8bd Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Sat, 21 May 2011 12:20:28 +0000 Subject: Fix overlong lines Signed-off-by: Sascha Silbe --- diff --git a/browser.py b/browser.py index 8b0994b..b9c1f69 100644 --- a/browser.py +++ b/browser.py @@ -53,8 +53,8 @@ class GetSourceListener(object): self._async_err_cb = async_err_cb def onStateChange(self, webProgress, request, stateFlags, status): - if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_REQUEST and \ - stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: + if (stateFlags & interfaces.nsIWebProgressListener.STATE_IS_REQUEST and + stateFlags & interfaces.nsIWebProgressListener.STATE_STOP): self._async_cb(self._file_path) def onProgressChange(self, progress, request, curSelfProgress, @@ -127,8 +127,8 @@ class TabbedView(gtk.Notebook): interfaces.nsIStyleSheetService.AGENT_SHEET) if os.path.exists(TabbedView.USER_SHEET): - user_sheet_uri = io_service.newURI('file:///' + TabbedView.USER_SHEET, - None, None) + url = 'file:///' + TabbedView.USER_SHEET + user_sheet_uri = io_service.newURI(url, None, None) style_sheet_service.loadAndRegisterSheet(user_sheet_uri, interfaces.nsIStyleSheetService.USER_SHEET) @@ -181,7 +181,8 @@ class TabbedView(gtk.Notebook): def _get_current_browser(self): return self.get_nth_page(self.get_current_page()) - current_browser = gobject.property(type=object, getter=_get_current_browser) + current_browser = gobject.property(type=object, + getter=_get_current_browser) def get_session(self): tab_sessions = [] @@ -248,11 +249,13 @@ class TabLabel(gtk.HBox): self.emit('tab-close', self._browser) def __browser_is_setup_cb(self, browser): - browser.progress.connect('notify::location', self.__location_changed_cb) + browser.progress.connect('notify::location', + self.__location_changed_cb) browser.connect('notify::title', self.__title_changed_cb) def __location_changed_cb(self, progress_listener, pspec): - self._label.set_text(self._browser.get_url_from_nsiuri(progress_listener.location)) + url = self._browser.get_url_from_nsiuri(progress_listener.location) + self._label.set_text(url) def __title_changed_cb(self, browser, pspec): self._label.set_text(browser.props.title) diff --git a/downloadmanager.py b/downloadmanager.py index ec18973..934693f 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -96,12 +96,14 @@ class HelperAppLauncherDialog: temp_path = os.path.join(activity.get_activity_root(), 'instance') if not os.path.exists(temp_path): os.makedirs(temp_path) - fd, file_path = tempfile.mkstemp(dir=temp_path, prefix=base_name, suffix=extension) + fd, file_path = tempfile.mkstemp(dir=temp_path, prefix=base_name, + suffix=extension) os.close(fd) os.chmod(file_path, 0644) dest_file.initWithPath(file_path) - requestor = window_context.queryInterface(interfaces.nsIInterfaceRequestor) + interface_id = interfaces.nsIInterfaceRequestor + requestor = window_context.queryInterface(interface_id) dom_window = requestor.getInterface(interfaces.nsIDOMWindow) _dest_to_window[file_path] = dom_window @@ -428,9 +430,10 @@ class _SaveLinkProgressListener(object): logging.error("Error downloading link") return - cls = components.classes[ - "@mozilla.org/uriloader/external-helper-app-service;1"] - external_helper = cls.getService(interfaces.nsIExternalHelperAppService) + class_name = '@mozilla.org/uriloader/external-helper-app-service;1' + cls = components.classes[class_name] + interface_id = interfaces.nsIExternalHelperAppService + external_helper = cls.getService(interface_id) channel = request.QueryInterface(interfaces.nsIChannel) diff --git a/edittoolbar.py b/edittoolbar.py index 4658683..f238647 100644 --- a/edittoolbar.py +++ b/edittoolbar.py @@ -121,7 +121,8 @@ class EditToolbar(activity.EditToolbar): def _get_command_manager(self): tabbed_view = self._activity.get_canvas() web_browser = tabbed_view.props.current_browser.browser - requestor = web_browser.queryInterface(interfaces.nsIInterfaceRequestor) + interface_id = interfaces.nsIInterfaceRequestor + requestor = web_browser.queryInterface(interface_id) return requestor.getInterface(interfaces.nsICommandManager) def __search_entry_activate_cb(self, entry): diff --git a/model.py b/model.py index 852e8e8..504b84e 100644 --- a/model.py +++ b/model.py @@ -44,13 +44,11 @@ class Model(gobject.GObject): index = self.data['shared_links'].index(item) 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)}) + info = {'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.data['shared_links'].insert(index, info) self.emit('add_link', index) def remove_link(self, hash): diff --git a/palettes.py b/palettes.py index 9695db1..9fbc370 100644 --- a/palettes.py +++ b/palettes.py @@ -97,7 +97,8 @@ class ContentInvoker(Invoker): else: title = os.path.basename(urlparse.urlparse(target.src).path) - self.palette = ImagePalette(title, target.src, target.ownerDocument) + self.palette = ImagePalette(title, target.src, + target.ownerDocument) self.notify_right_click() else: return @@ -277,8 +278,8 @@ class _ImageProgressListener(object): pass def onStateChange(self, webProgress, request, stateFlags, status): - if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_REQUEST and \ - stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: + if (stateFlags & interfaces.nsIWebProgressListener.STATE_IS_REQUEST and + stateFlags & interfaces.nsIWebProgressListener.STATE_STOP): clipboard = gtk.Clipboard() clipboard.set_with_data([('text/uri-list', 0, 0)], _clipboard_get_func_cb, diff --git a/places.py b/places.py index 38fa7b2..d44d747 100644 --- a/places.py +++ b/places.py @@ -92,7 +92,7 @@ class SqliteStore(object): cursor = self._connection.cursor() try: - cursor.execute('select uri, title, bookmark, gecko_flags,visits, ' \ + cursor.execute('select uri, title, bookmark, gecko_flags,visits, ' 'last_visit from places where uri=?', (uri,)) row = cursor.fetchone() diff --git a/promptservice.py b/promptservice.py index bab2417..8cdcff9 100644 --- a/promptservice.py +++ b/promptservice.py @@ -63,7 +63,8 @@ class PromptService: logging.debug('nsIPromptService.select()') -#components.registrar.registerFactory(PromptService.cid, -# PromptService.description, -# '@mozilla.org/embedcomp/prompt-service;1', -# Factory(PromptService)) +#components.registrar.registerFactory( +# PromptService.cid, +# PromptService.description, +# '@mozilla.org/embedcomp/prompt-service;1', +# Factory(PromptService)) diff --git a/webactivity.py b/webactivity.py index 8415df2..b444861 100644 --- a/webactivity.py +++ b/webactivity.py @@ -1,5 +1,6 @@ # Copyright (C) 2006, Red Hat, Inc. -# Copyright (C) 2009 Martin Langhoff, Simon Schampijer, Daniel Drake, Tomeu Vizoso +# Copyright (C) 2009 Martin Langhoff, Simon Schampijer, Daniel Drake, +# Tomeu Vizoso # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -200,7 +201,7 @@ class WebActivity(activity.Activity): # isn't exactly known. Thus, disable the multiple tabs feature # if we come across cairo versions >= 1.08.10 # More information can be found here: - # [1] http://lists.sugarlabs.org/archive/sugar-devel/2010-July/025187.html + # http://lists.sugarlabs.org/archive/sugar-devel/2010-July/025187.html self._disable_multiple_tabs = cairo.cairo_version() >= 10810 if self._disable_multiple_tabs: logging.warning('Not enabling the multiple tabs feature due' @@ -286,7 +287,8 @@ class WebActivity(activity.Activity): self._setup() _logger.debug('This is my activity: making a tube...') - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube(SERVICE, {}) + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube(SERVICE, + {}) def _setup(self): if self._shared_activity is None: @@ -310,10 +312,12 @@ class WebActivity(activity.Activity): room = handle ctype = channel.GetChannelType() if ctype == telepathy.CHANNEL_TYPE_TUBES: - _logger.debug('Found our Tubes channel at %s', channel_path) + _logger.debug('Found our Tubes channel at %s', + channel_path) tubes_chan = channel elif ctype == telepathy.CHANNEL_TYPE_TEXT: - _logger.debug('Found our Text channel at %s', channel_path) + _logger.debug('Found our Text channel at %s', + channel_path) text_chan = channel if room is None: @@ -326,9 +330,9 @@ class WebActivity(activity.Activity): # Make sure we have a Tubes channel - PS doesn't yet provide one if tubes_chan is None: _logger.debug("Didn't find our Tubes channel, requesting one...") - tubes_chan = self.conn.request_channel(telepathy.CHANNEL_TYPE_TUBES, - telepathy.HANDLE_TYPE_ROOM, - room, True) + tubes_chan = self.conn.request_channel( + telepathy.CHANNEL_TYPE_TUBES, telepathy.HANDLE_TYPE_ROOM, + room, True) self.tubes_chan = tubes_chan self.text_chan = text_chan @@ -357,7 +361,8 @@ class WebActivity(activity.Activity): reply_handler=self._list_tubes_reply_cb, error_handler=self._list_tubes_error_cb) - def _new_tube_cb(self, identifier, initiator, type, service, params, state): + def _new_tube_cb(self, identifier, initiator, type, service, params, + state): _logger.debug('New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', identifier, initiator, type, service, params, state) @@ -453,14 +458,17 @@ class WebActivity(activity.Activity): self.metadata['title'] = browser.props.title self.model.data['history'] = self._tabbed_view.get_session() - self.model.data['current_tab'] = self._tabbed_view.get_current_page() + current_tab = self._tabbed_view.get_current_page() + self.model.data['current_tab'] = current_tab self.model.data['currents'] = [] for n in range(0, self._tabbed_view.get_n_pages()): n_browser = self._tabbed_view.get_nth_page(n) if n_browser != None: - ui_uri = browser.get_url_from_nsiuri(browser.progress.location) - self.model.data['currents'].append({'title':browser.props.title,'url':ui_uri}) + nsiuri = browser.progress.location + ui_uri = browser.get_url_from_nsiuri(nsiuri) + info = {'title': browser.props.title, 'url': ui_uri} + self.model.data['currents'].append(info) f = open(file_path, 'w') try: -- cgit v0.9.1