diff options
Diffstat (limited to 'src/jarabe/journal')
-rw-r--r-- | src/jarabe/journal/expandedentry.py | 4 | ||||
-rw-r--r-- | src/jarabe/journal/journalactivity.py | 9 | ||||
-rw-r--r-- | src/jarabe/journal/journaltoolbox.py | 2 | ||||
-rw-r--r-- | src/jarabe/journal/listmodel.py | 2 | ||||
-rw-r--r-- | src/jarabe/journal/listview.py | 4 | ||||
-rw-r--r-- | src/jarabe/journal/misc.py | 12 | ||||
-rw-r--r-- | src/jarabe/journal/model.py | 28 | ||||
-rw-r--r-- | src/jarabe/journal/objectchooser.py | 4 | ||||
-rw-r--r-- | src/jarabe/journal/palettes.py | 2 | ||||
-rw-r--r-- | src/jarabe/journal/volumestoolbar.py | 6 |
10 files changed, 35 insertions, 38 deletions
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 6ef531b..88c0b41 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -187,8 +187,8 @@ class ExpandedEntry(hippo.CanvasBox): try: surface = cairo.ImageSurface.create_from_png(png_file) has_preview = True - except Exception, e: - logging.error('Error while loading the preview: %r' % e) + except Exception: + logging.exception('Error while loading the preview') has_preview = False else: has_preview = False diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py index 80204a1..08a5a0f 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -236,7 +236,7 @@ class JournalActivity(Window): return True def __volume_changed_cb(self, volume_toolbar, mount_point): - logging.debug('Selected volume: %r.' % mount_point) + logging.debug('Selected volume: %r.', mount_point) self._main_toolbox.search_toolbar.set_mount_point(mount_point) self._main_toolbox.set_current_toolbar(0) @@ -281,8 +281,7 @@ class JournalActivity(Window): try: registry.install(bundle) except (ZipExtractException, RegistrationException): - logging.warning('Could not install bundle %s:\n%s' % \ - (bundle.get_path(), traceback.format_exc())) + logging.exception('Could not install bundle %s', bundle.get_path()) return if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: @@ -297,14 +296,14 @@ class JournalActivity(Window): search_toolbar.give_entry_focus() def __window_state_event_cb(self, window, event): - logging.debug('window_state_event_cb %r' % self) + logging.debug('window_state_event_cb %r', self) if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: state = event.new_window_state visible = not state & gtk.gdk.WINDOW_STATE_ICONIFIED self._list_view.set_is_visible(visible) def __visibility_notify_event_cb(self, window, event): - logging.debug('visibility_notify_event_cb %r' % self) + logging.debug('visibility_notify_event_cb %r', self) visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED self._list_view.set_is_visible(visible) diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py index af6e20e..201bf76 100644 --- a/src/jarabe/journal/journaltoolbox.py +++ b/src/jarabe/journal/journaltoolbox.py @@ -258,7 +258,7 @@ class SearchToolbar(gtk.Toolbar): break if what_filter_index == -1: - logging.warning('what_filter %r not known' % what_filter) + logging.warning('what_filter %r not known', what_filter) else: self._what_search_combo.set_active(what_filter_index) diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py index a5586b7..917fbb1 100644 --- a/src/jarabe/journal/listmodel.py +++ b/src/jarabe/journal/listmodel.py @@ -193,7 +193,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource): if selection.target == 'text/uri-list': # Get hold of a reference so the temp file doesn't get deleted self._temp_drag_file_path = model.get_file(uid) - logging.debug('putting %r in selection' % self._temp_drag_file_path) + logging.debug('putting %r in selection', self._temp_drag_file_path) selection.set(selection.target, 8, self._temp_drag_file_path) return True elif selection.target == 'journal-object-id': diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py index 332edc9..251388d 100644 --- a/src/jarabe/journal/listview.py +++ b/src/jarabe/journal/listview.py @@ -277,7 +277,7 @@ class BaseListView(gtk.Bin): self.refresh() def refresh(self): - logging.debug('ListView.refresh query %r' % self._query) + logging.debug('ListView.refresh query %r', self._query) self._stop_progress_bar() self._start_progress_bar() @@ -411,7 +411,7 @@ class BaseListView(gtk.Bin): self.refresh() def set_is_visible(self, visible): - logging.debug('canvas_visibility_notify_event_cb %r' % visible) + logging.debug('canvas_visibility_notify_event_cb %r', visible) if visible: self._fully_obscured = False if self._dirty: diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py index 5a9feb0..e6e5abf 100644 --- a/src/jarabe/journal/misc.py +++ b/src/jarabe/journal/misc.py @@ -44,7 +44,7 @@ def _get_icon_for_mime(mime_type): return file_name icons = gio.content_type_get_icon(mime_type) - logging.debug('icons for this file: %r' % icons.props.names) + logging.debug('icons for this file: %r', icons.props.names) for icon_name in icons.props.names: file_name = get_icon_file_name(icon_name) if file_name is not None: @@ -96,27 +96,27 @@ def get_bundle(metadata): if is_activity_bundle(metadata): file_path = util.TempFilePath(model.get_file(metadata['uid'])) if not os.path.exists(file_path): - logging.warning('Invalid path: %r' % file_path) + logging.warning('Invalid path: %r', file_path) return None return ActivityBundle(file_path) elif is_content_bundle(metadata): file_path = util.TempFilePath(model.get_file(metadata['uid'])) if not os.path.exists(file_path): - logging.warning('Invalid path: %r' % file_path) + logging.warning('Invalid path: %r', file_path) return None return ContentBundle(file_path) elif is_journal_bundle(metadata): file_path = util.TempFilePath(model.get_file(metadata['uid'])) if not os.path.exists(file_path): - logging.warning('Invalid path: %r' % file_path) + logging.warning('Invalid path: %r', file_path) return None return JournalEntryBundle(file_path) else: return None except MalformedBundleException, e: - logging.warning('Incorrect bundle: %r' % e) + logging.warning('Incorrect bundle: %r', e) return None def _get_activities_for_mime(mime_type): @@ -196,7 +196,7 @@ def resume(metadata, bundle_id=None): if bundle_id is None: activities = get_activities(metadata) if not activities: - logging.warning('No activity can open this object, %s.' % + logging.warning('No activity can open this object, %s.', metadata.get('mime_type', None)) return bundle_id = activities[0].get_bundle_id() diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py index e710464..15259bb 100644 --- a/src/jarabe/journal/model.py +++ b/src/jarabe/journal/model.py @@ -20,7 +20,6 @@ from datetime import datetime import time import shutil from stat import S_IFMT, S_IFDIR, S_IFREG -import traceback import re import gobject @@ -119,7 +118,7 @@ class BaseResultSet(object): self._position = position def read(self): - logging.debug('ResultSet.read position: %r' % self._position) + logging.debug('ResultSet.read position: %r', self._position) if self._position == -1: self.seek(0) @@ -142,8 +141,8 @@ class BaseResultSet(object): # Total cache miss: remake it limit = self._page_size * MIN_PAGES_TO_CACHE offset = max(0, self._position - limit / 2) - logging.debug('remaking cache, offset: %r limit: %r' % \ - (offset, limit)) + logging.debug('remaking cache, offset: %r limit: %r', offset, + limit) query = self._query.copy() query['limit'] = limit query['offset'] = offset @@ -156,8 +155,8 @@ class BaseResultSet(object): elif remaining_forward_entries <= 0 and remaining_backwards_entries > 0: # Add one page to the end of cache - logging.debug('appending one more page, offset: %r' % \ - last_cached_entry) + logging.debug('appending one more page, offset: %r', + last_cached_entry) query = self._query.copy() query['limit'] = self._page_size query['offset'] = last_cached_entry @@ -180,8 +179,8 @@ class BaseResultSet(object): limit = min(self._offset, self._page_size) self._offset = max(0, self._offset - limit) - logging.debug('prepending one more page, offset: %r limit: %r' % - (self._offset, limit)) + logging.debug('prepending one more page, offset: %r limit: %r', + self._offset, limit) query = self._query.copy() query['limit'] = self._page_size query['offset'] = self._offset @@ -289,7 +288,7 @@ class InplaceResultSet(BaseResultSet): metadata['mountpoint'] = self._mount_point entries.append(metadata) - logging.debug('InplaceResultSet.find took %f s.' % (time.time() - t)) + logging.debug('InplaceResultSet.find took %f s.', time.time() - t) return entries, total_count @@ -331,8 +330,7 @@ class InplaceResultSet(BaseResultSet): self.progress.send(self) except Exception: - logging.error('Error reading file %r: %s' % \ - (full_path, traceback.format_exc())) + logging.exception('Error reading file %r', full_path) if self._pending_directories == 0: self.setup_ready() @@ -412,10 +410,10 @@ def get_file(object_id): """Returns the file for an object """ if os.path.exists(object_id): - logging.debug('get_file asked for file with path %r' % object_id) + logging.debug('get_file asked for file with path %r', object_id) return object_id else: - logging.debug('get_file asked for entry with id %r' % object_id) + logging.debug('get_file asked for entry with id %r', object_id) file_path = _get_datastore().get_filename(object_id) if file_path: return util.TempFilePath(file_path) @@ -450,8 +448,8 @@ def copy(metadata, mount_point): def write(metadata, file_path='', update_mtime=True): """Creates or updates an entry for that id """ - logging.debug('model.write %r %r %r' % (metadata.get('uid', ''), file_path, - update_mtime)) + logging.debug('model.write %r %r %r', metadata.get('uid', ''), file_path, + update_mtime) if update_mtime: metadata['mtime'] = datetime.now().isoformat() metadata['timestamp'] = int(time.time()) diff --git a/src/jarabe/journal/objectchooser.py b/src/jarabe/journal/objectchooser.py index 32bfbb3..31bdba8 100644 --- a/src/jarabe/journal/objectchooser.py +++ b/src/jarabe/journal/objectchooser.py @@ -128,11 +128,11 @@ class ObjectChooser(gtk.Window): self._list_view.update_with_query(query) def __volume_changed_cb(self, volume_toolbar, mount_point): - logging.debug('Selected volume: %r.' % mount_point) + logging.debug('Selected volume: %r.', mount_point) self._toolbar.set_mount_point(mount_point) def __visibility_notify_event_cb(self, window, event): - logging.debug('visibility_notify_event_cb %r' % self) + logging.debug('visibility_notify_event_cb %r', self) visible = event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED self._list_view.set_is_visible(visible) diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 341a09f..49cc676 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -126,7 +126,7 @@ class ObjectPalette(Palette): def __clipboard_get_func_cb(self, clipboard, selection_data, info, data): # Get hold of a reference so the temp file doesn't get deleted self._temp_file_path = model.get_file(self._metadata['uid']) - logging.debug('__clipboard_get_func_cb %r' % self._temp_file_path) + logging.debug('__clipboard_get_func_cb %r', self._temp_file_path) selection_data.set_uris(['file://' + self._temp_file_path]) def __clipboard_clear_func_cb(self, clipboard, data): diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py index b21832e..6cb3f8d 100644 --- a/src/jarabe/journal/volumestoolbar.py +++ b/src/jarabe/journal/volumestoolbar.py @@ -76,7 +76,7 @@ class VolumesToolbar(gtk.Toolbar): self._remove_button(mount) def _add_button(self, mount): - logging.debug('VolumeToolbar._add_button: %r' % mount.get_name()) + logging.debug('VolumeToolbar._add_button: %r', mount.get_name()) button = VolumeButton(mount) button.props.group = self._volume_buttons[0] @@ -99,14 +99,14 @@ class VolumesToolbar(gtk.Toolbar): mount.unmount(self.__unmount_cb) def __unmount_cb(self, source, result): - logging.debug('__unmount_cb %r %r' % (source, result)) + logging.debug('__unmount_cb %r %r', source, result) def _get_button_for_mount(self, mount): mount_point = mount.get_root().get_path() for button in self.get_children(): if button.mount_point == mount_point: return button - logging.error('Couldnt find button with mount_point %r' % mount_point) + logging.error('Couldnt find button with mount_point %r', mount_point) return None def _remove_button(self, mount): |