-
From 58354e387d616f505a3e4749c26cac0f2ee1c44c Mon Sep 17 00:00:00 2001
From: Sascha Silbe <sascha@silbe.org>
Date: Wed, 19 Aug 2009 19:37:40 +0200
Subject: [PATCH] let the logger do the formatting
---
extensions/cpsection/aboutcomputer/model.py | 2 +-
extensions/cpsection/updater/backends/aslo.py | 3 +-
extensions/cpsection/updater/model.py | 4 +-
extensions/deviceicon/battery.py | 8 +++---
extensions/deviceicon/volume.py | 2 +-
src/jarabe/controlpanel/gui.py | 2 +-
src/jarabe/desktop/favoriteslayout.py | 6 ++--
src/jarabe/desktop/favoritesview.py | 6 ++--
src/jarabe/desktop/homebox.py | 4 +-
src/jarabe/desktop/meshbox.py | 2 +-
src/jarabe/desktop/schoolserver.py | 6 ++--
src/jarabe/frame/activitiestray.py | 26 ++++++++++----------
src/jarabe/frame/clipboard.py | 2 +-
src/jarabe/frame/clipboardicon.py | 2 +-
src/jarabe/frame/clipboardmenu.py | 4 +-
src/jarabe/frame/clipboardobject.py | 2 +-
src/jarabe/frame/clipboardpanelwindow.py | 6 ++--
src/jarabe/frame/clipboardtray.py | 14 +++++-----
src/jarabe/frame/frame.py | 4 +-
src/jarabe/frame/zoomtoolbar.py | 2 +-
src/jarabe/intro/window.py | 2 +-
src/jarabe/journal/expandedentry.py | 4 +-
src/jarabe/journal/journalactivity.py | 9 +++----
src/jarabe/journal/journaltoolbox.py | 2 +-
src/jarabe/journal/listmodel.py | 2 +-
src/jarabe/journal/listview.py | 4 +-
src/jarabe/journal/misc.py | 12 +++++-----
src/jarabe/journal/model.py | 28 ++++++++++------------
src/jarabe/journal/objectchooser.py | 4 +-
src/jarabe/journal/palettes.py | 2 +-
src/jarabe/journal/volumestoolbar.py | 6 ++--
src/jarabe/model/bundleregistry.py | 10 +++-----
src/jarabe/model/filetransfer.py | 20 ++++++++--------
src/jarabe/model/friends.py | 8 +++---
src/jarabe/model/neighborhood.py | 10 ++++----
src/jarabe/model/network.py | 30 ++++++++++++------------
src/jarabe/model/notifications.py | 4 +-
src/jarabe/model/shell.py | 22 +++++++++---------
src/jarabe/view/keyhandler.py | 8 +++---
src/jarabe/view/launcher.py | 2 +-
src/jarabe/view/palettes.py | 2 +-
src/jarabe/view/viewsource.py | 12 +++++-----
42 files changed, 152 insertions(+), 158 deletions(-)
diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py
index 6cddb4c..898d79c 100644
a
|
b
|
def _read_file(path): |
111 | 111 | value = value.strip('\n') |
112 | 112 | return value |
113 | 113 | else: |
114 | | _logger.debug('No information in file or directory: %s' % path) |
| 114 | _logger.debug('No information in file or directory: %s', path) |
115 | 115 | return None |
116 | 116 | |
117 | 117 | def get_license(): |
-
diff --git a/extensions/cpsection/updater/backends/aslo.py b/extensions/cpsection/updater/backends/aslo.py
index 8c01ec2..443fd1c 100644
a
|
b
|
class _UpdateFetcher(object): |
116 | 116 | |
117 | 117 | if document.find(_FIND_DESCRIPTION) is None: |
118 | 118 | logging.debug('Bundle %s not available in the server for the ' |
119 | | 'version %s' % (self._bundle.get_bundle_id(), |
120 | | config.version)) |
| 119 | 'version %s', self._bundle.get_bundle_id(), config.version) |
121 | 120 | version = None |
122 | 121 | link = None |
123 | 122 | size = None |
-
diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
index 489cfa5..102edea 100755
a
|
b
|
class UpdateModel(gobject.GObject): |
119 | 119 | self._downloader.connect('error', self.__downloader_error_cb) |
120 | 120 | |
121 | 121 | def __downloader_progress_cb(self, downloader, progress): |
122 | | logging.debug('__downloader_progress_cb %r' % progress) |
| 122 | logging.debug('__downloader_progress_cb %r', progress) |
123 | 123 | total = self._total_bundles_to_update * 2 |
124 | 124 | current = total - len(self._bundles_to_update) * 2 - 2 + progress |
125 | 125 | |
… |
… |
class UpdateModel(gobject.GObject): |
133 | 133 | self._downloader = None |
134 | 134 | |
135 | 135 | def __downloader_error_cb(self, downloader, error_message): |
136 | | logging.error('Error downloading update:\n%s' % error_message) |
| 136 | logging.error('Error downloading update:\n%s', error_message) |
137 | 137 | |
138 | 138 | total = self._total_bundles_to_update * 2 |
139 | 139 | current = total - len(self._bundles_to_update) * 2 |
-
diff --git a/extensions/deviceicon/battery.py b/extensions/deviceicon/battery.py
index 76b1565..edfcce4 100644
a
|
b
|
class DeviceModel(gobject.GObject): |
189 | 189 | try: |
190 | 190 | return self._battery.GetProperty(_LEVEL_PROP) |
191 | 191 | except dbus.DBusException: |
192 | | logging.error('Cannot access %s' % _LEVEL_PROP) |
| 192 | logging.error('Cannot access %s', _LEVEL_PROP) |
193 | 193 | return 0 |
194 | 194 | |
195 | 195 | def _get_charging(self): |
196 | 196 | try: |
197 | 197 | return self._battery.GetProperty(_CHARGING_PROP) |
198 | 198 | except dbus.DBusException: |
199 | | logging.error('Cannot access %s' % _CHARGING_PROP) |
| 199 | logging.error('Cannot access %s', _CHARGING_PROP) |
200 | 200 | return False |
201 | 201 | |
202 | 202 | def _get_discharging(self): |
203 | 203 | try: |
204 | 204 | return self._battery.GetProperty(_DISCHARGING_PROP) |
205 | 205 | except dbus.DBusException: |
206 | | logging.error('Cannot access %s' % _DISCHARGING_PROP) |
| 206 | logging.error('Cannot access %s', _DISCHARGING_PROP) |
207 | 207 | return False |
208 | 208 | |
209 | 209 | def _get_present(self): |
210 | 210 | try: |
211 | 211 | return self._battery.GetProperty(_PRESENT_PROP) |
212 | 212 | except dbus.DBusException: |
213 | | logging.error('Cannot access %s' % _PRESENT_PROP) |
| 213 | logging.error('Cannot access %s', _PRESENT_PROP) |
214 | 214 | return False |
215 | 215 | |
216 | 216 | def do_get_property(self, pspec): |
-
diff --git a/extensions/deviceicon/volume.py b/extensions/deviceicon/volume.py
index 5c4c49e..4ccae7a 100644
a
|
b
|
def _mount(volume, tray): |
97 | 97 | volume.mount(gtk.MountOperation(tray.get_toplevel()), _mount_cb) |
98 | 98 | |
99 | 99 | def _mount_cb(volume, result): |
100 | | logging.debug('_mount_cb %r %r' % (volume, result)) |
| 100 | logging.debug('_mount_cb %r %r', volume, result) |
101 | 101 | volume.mount_finish(result) |
102 | 102 | |
103 | 103 | def _mount_added_cb(volume_monitor, mount, tray): |
-
diff --git a/src/jarabe/controlpanel/gui.py b/src/jarabe/controlpanel/gui.py
index 3d226fa..7384a0d 100644
a
|
b
|
class ModelWrapper(object): |
352 | 352 | try: |
353 | 353 | method(self._options[key]) |
354 | 354 | except Exception, detail: |
355 | | _logger.debug('Error undo option: %s' % detail) |
| 355 | _logger.debug('Error undo option: %s', detail) |
356 | 356 | |
357 | 357 | class _SectionIcon(gtk.EventBox): |
358 | 358 | __gtype_name__ = "SugarSectionIcon" |
-
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index 506446f..3ff0ba8 100644
a
|
b
|
class FavoritesLayout(gobject.GObject, hippo.CanvasLayout): |
57 | 57 | |
58 | 58 | def append(self, icon, locked=False): |
59 | 59 | if not hasattr(type(icon), 'fixed_position'): |
60 | | logging.debug('Icon without fixed_position: %r' % icon) |
| 60 | logging.debug('Icon without fixed_position: %r', icon) |
61 | 61 | return |
62 | 62 | |
63 | 63 | icon.props.size = max(icon.props.size, style.STANDARD_ICON_SIZE) |
64 | 64 | |
65 | 65 | relative_x, relative_y = icon.fixed_position |
66 | 66 | if relative_x < 0 or relative_y < 0: |
67 | | logging.debug('Icon out of bounds: %r' % icon) |
| 67 | logging.debug('Icon out of bounds: %r', icon) |
68 | 68 | return |
69 | 69 | |
70 | 70 | min_width_, width = self.box.get_width_request() |
… |
… |
class FavoritesLayout(gobject.GObject, hippo.CanvasLayout): |
82 | 82 | raise ValueError('Child not in box.') |
83 | 83 | |
84 | 84 | if not(hasattr(icon, 'get_bundle_id') and hasattr(icon, 'get_version')): |
85 | | logging.debug('Not an activity icon %r' % icon) |
| 85 | logging.debug('Not an activity icon %r', icon) |
86 | 86 | return |
87 | 87 | |
88 | 88 | min_width_, width = self.box.get_width_request() |
-
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 6ca8732..236ba2b 100644
a
|
b
|
class ActivityIcon(CanvasIcon): |
431 | 431 | |
432 | 432 | def __get_last_activity_async_cb(self, entries, error=None): |
433 | 433 | if error is not None: |
434 | | logging.error('Error retrieving most recent activities: %r' % error) |
| 434 | logging.error('Error retrieving most recent activities: %r', error) |
435 | 435 | return |
436 | 436 | |
437 | 437 | # If there's a problem with the DS index, we may get entries not related |
… |
… |
class FavoritesSetting(object): |
678 | 678 | def __init__(self): |
679 | 679 | client = gconf.client_get_default() |
680 | 680 | self._layout = client.get_string(self._FAVORITES_KEY) |
681 | | logging.debug('FavoritesSetting layout %r' % (self._layout)) |
| 681 | logging.debug('FavoritesSetting layout %r', self._layout) |
682 | 682 | |
683 | 683 | self._mode = None |
684 | 684 | |
… |
… |
class FavoritesSetting(object): |
688 | 688 | return self._layout |
689 | 689 | |
690 | 690 | def set_layout(self, layout): |
691 | | logging.debug('set_layout %r %r' % (layout, self._layout)) |
| 691 | logging.debug('set_layout %r %r', layout, self._layout) |
692 | 692 | if layout != self._layout: |
693 | 693 | self._layout = layout |
694 | 694 | |
-
diff --git a/src/jarabe/desktop/homebox.py b/src/jarabe/desktop/homebox.py
index 88da9d2..0be1d05 100644
a
|
b
|
class HomeBox(gtk.VBox): |
89 | 89 | try: |
90 | 90 | os.unlink(update_trigger_file) |
91 | 91 | except OSError: |
92 | | logging.error('Software-update: Can not remove file %s' % |
93 | | update_trigger_file) |
| 92 | logging.error('Software-update: Can not remove file %s', |
| 93 | update_trigger_file) |
94 | 94 | |
95 | 95 | if response_id == gtk.RESPONSE_OK: |
96 | 96 | from jarabe.controlpanel.gui import ControlPanel |
-
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index c37bba1..ba9c103 100644
a
|
b
|
class MeshBox(gtk.VBox): |
876 | 876 | self._layout.remove(icon) |
877 | 877 | del self.access_points[ap_o] |
878 | 878 | else: |
879 | | logging.error('Can not remove access point %s' % ap_o) |
| 879 | logging.error('Can not remove access point %s', ap_o) |
880 | 880 | |
881 | 881 | def suspend(self): |
882 | 882 | if not self._suspended: |
-
diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py
index 1dd9edc..2df2a40 100644
a
|
b
|
def register_laptop(url=REGISTER_URL): |
46 | 46 | server = ServerProxy(url) |
47 | 47 | try: |
48 | 48 | data = server.register(sn, nick, uuid, profile.pubkey) |
49 | | except (Error, socket.error), e: |
50 | | logging.error('Registration: cannot connect to server: %s' % e) |
| 49 | except (Error, socket.error): |
| 50 | logging.exception('Registration: cannot connect to server') |
51 | 51 | raise RegisterError(_('Cannot connect to the server.')) |
52 | 52 | |
53 | 53 | if data['success'] != 'OK': |
54 | | logging.error('Registration: server could not complete request: %s' % |
| 54 | logging.error('Registration: server could not complete request: %s', |
55 | 55 | data['error']) |
56 | 56 | raise RegisterError(_('The server could not complete the request.')) |
57 | 57 | |
-
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 0025403..390cf88 100644
a
|
b
|
class ActivitiesTray(HTray): |
335 | 335 | filetransfer.new_file_transfer.connect(self.__new_file_transfer_cb) |
336 | 336 | |
337 | 337 | def __activity_added_cb(self, home_model, home_activity): |
338 | | logging.debug('__activity_added_cb: %r' % home_activity) |
| 338 | logging.debug('__activity_added_cb: %r', home_activity) |
339 | 339 | if self.get_children(): |
340 | 340 | group = self.get_children()[0] |
341 | 341 | else: |
… |
… |
class ActivitiesTray(HTray): |
348 | 348 | button.show() |
349 | 349 | |
350 | 350 | def __activity_removed_cb(self, home_model, home_activity): |
351 | | logging.debug('__activity_removed_cb: %r' % home_activity) |
| 351 | logging.debug('__activity_removed_cb: %r', home_activity) |
352 | 352 | button = self._buttons[home_activity.get_activity_id()] |
353 | 353 | self.remove_item(button) |
354 | 354 | del self._buttons[home_activity.get_activity_id()] |
… |
… |
class ActivitiesTray(HTray): |
366 | 366 | self.window.process_updates(True) |
367 | 367 | |
368 | 368 | def __activity_changed_cb(self, home_model, home_activity): |
369 | | logging.debug('__activity_changed_cb: %r' % home_activity) |
| 369 | logging.debug('__activity_changed_cb: %r', home_activity) |
370 | 370 | |
371 | 371 | # Only select the new activity, if there is no tabbing activity. |
372 | 372 | if home_model.get_tabbing_activity() is None: |
373 | 373 | self._activate_activity(home_activity) |
374 | 374 | |
375 | 375 | def __tabbing_activity_changed_cb(self, home_model, home_activity): |
376 | | logging.debug('__tabbing_activity_changed_cb: %r' % home_activity) |
| 376 | logging.debug('__tabbing_activity_changed_cb: %r', home_activity) |
377 | 377 | # If the tabbing_activity is set to None just do nothing. |
378 | 378 | # The active activity will be updated a bit later (and it will |
379 | 379 | # be set to the activity that is currently selected). |
… |
… |
class ActivitiesTray(HTray): |
424 | 424 | |
425 | 425 | def __new_file_transfer_cb(self, **kwargs): |
426 | 426 | file_transfer = kwargs['file_transfer'] |
427 | | logging.debug('__new_file_transfer_cb %r' % file_transfer) |
| 427 | logging.debug('__new_file_transfer_cb %r', file_transfer) |
428 | 428 | |
429 | 429 | if isinstance(file_transfer, filetransfer.IncomingFileTransfer): |
430 | 430 | button = IncomingTransferButton(file_transfer) |
… |
… |
class BaseTransferButton(ToolButton): |
463 | 463 | self.props.parent.remove(self) |
464 | 464 | |
465 | 465 | def __notify_state_cb(self, file_transfer, pspec): |
466 | | logging.debug('_update state: %r %r' % (file_transfer.props.state, |
467 | | file_transfer.reason_last_change)) |
| 466 | logging.debug('_update state: %r %r', file_transfer.props.state, |
| 467 | file_transfer.reason_last_change) |
468 | 468 | if file_transfer.props.state == filetransfer.FT_STATE_CANCELLED: |
469 | 469 | if file_transfer.reason_last_change == \ |
470 | 470 | filetransfer.FT_REASON_LOCAL_STOPPED: |
… |
… |
class IncomingTransferButton(BaseTransferButton): |
565 | 565 | return dbus.Interface(remote_object, DS_DBUS_INTERFACE) |
566 | 566 | |
567 | 567 | def __reply_handler_cb(self): |
568 | | logging.debug('__reply_handler_cb %r' % self._object_id) |
| 568 | logging.debug('__reply_handler_cb %r', self._object_id) |
569 | 569 | |
570 | 570 | def __error_handler_cb(self, error): |
571 | | logging.debug('__error_handler_cb %r %s' % (self._object_id, error)) |
| 571 | logging.debug('__error_handler_cb %r %s', self._object_id, error) |
572 | 572 | |
573 | 573 | def __dismiss_clicked_cb(self, palette): |
574 | 574 | self.remove() |
… |
… |
class BaseTransferPalette(Palette): |
654 | 654 | return _('%dMB') % (size / 1048576) |
655 | 655 | |
656 | 656 | def update_progress(self): |
657 | | logging.debug('update_progress: %r' % |
| 657 | logging.debug('update_progress: %r', |
658 | 658 | self.file_transfer.props.transferred_bytes) |
659 | 659 | |
660 | 660 | if self.progress_bar is None: |
… |
… |
class BaseTransferPalette(Palette): |
663 | 663 | self.progress_bar.props.fraction = \ |
664 | 664 | self.file_transfer.props.transferred_bytes / \ |
665 | 665 | float(self.file_transfer.file_size) |
666 | | logging.debug('update_progress: %r' % self.progress_bar.props.fraction) |
| 666 | logging.debug('update_progress: %r', self.progress_bar.props.fraction) |
667 | 667 | |
668 | 668 | transferred = self._format_size( |
669 | 669 | self.file_transfer.props.transferred_bytes) |
… |
… |
class IncomingTransferPalette(BaseTransferPalette): |
688 | 688 | self._update() |
689 | 689 | |
690 | 690 | def _update(self): |
691 | | logging.debug('_update state: %r' % self.file_transfer.props.state) |
| 691 | logging.debug('_update state: %r', self.file_transfer.props.state) |
692 | 692 | if self.file_transfer.props.state == filetransfer.FT_STATE_PENDING: |
693 | 693 | menu_item = MenuItem(_('Accept'), icon_name='dialog-ok') |
694 | 694 | menu_item.connect('activate', self.__accept_activate_cb) |
… |
… |
class OutgoingTransferPalette(BaseTransferPalette): |
816 | 816 | |
817 | 817 | def _update(self): |
818 | 818 | new_state = self.file_transfer.props.state |
819 | | logging.debug('_update state: %r' % new_state) |
| 819 | logging.debug('_update state: %r', new_state) |
820 | 820 | if new_state == filetransfer.FT_STATE_PENDING: |
821 | 821 | |
822 | 822 | menu_item = MenuItem(_('Cancel'), icon_name='dialog-cancel') |
-
diff --git a/src/jarabe/frame/clipboard.py b/src/jarabe/frame/clipboard.py
index d18dd44..1cefcc1 100644
a
|
b
|
class Clipboard(gobject.GObject): |
77 | 77 | cb_object = self._objects.pop(object_id) |
78 | 78 | cb_object.destroy() |
79 | 79 | self.emit('object-deleted', object_id) |
80 | | logging.debug('Deleted object with object_id %r' % object_id) |
| 80 | logging.debug('Deleted object with object_id %r', object_id) |
81 | 81 | |
82 | 82 | def set_object_percent(self, object_id, percent): |
83 | 83 | cb_object = self._objects[object_id] |
-
diff --git a/src/jarabe/frame/clipboardicon.py b/src/jarabe/frame/clipboardicon.py
index ff63ad9..93a177e 100644
a
|
b
|
class ClipboardIcon(RadioToolButton): |
96 | 96 | def _clipboard_data_get_cb(self, x_clipboard, selection, info, targets): |
97 | 97 | if not selection.target in [target[0] for target in targets]: |
98 | 98 | logging.warning('ClipboardIcon._clipboard_data_get_cb: asked %s' \ |
99 | | ' but only have %r.' % (selection.target, targets)) |
| 99 | ' but only have %r.', selection.target, targets) |
100 | 100 | return |
101 | 101 | data = self._cb_object.get_formats()[selection.target].get_data() |
102 | 102 | selection.set(selection.target, 8, data) |
-
diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py
index 8a8ba11..e2eba68 100644
a
|
b
|
class ClipboardMenu(Palette): |
74 | 74 | |
75 | 75 | def _update_open_submenu(self): |
76 | 76 | activities = self._get_activities() |
77 | | logging.debug('_update_open_submenu: %r' % activities) |
| 77 | logging.debug('_update_open_submenu: %r', activities) |
78 | 78 | child = self._open_item.get_child() |
79 | 79 | if activities is None or len(activities) <= 1: |
80 | 80 | child.set_text(_('Open')) |
… |
… |
class ClipboardMenu(Palette): |
97 | 97 | activity_info = registry.get_bundle(service_name) |
98 | 98 | |
99 | 99 | if not activity_info: |
100 | | logging.warning('Activity %s is unknown.' % service_name) |
| 100 | logging.warning('Activity %s is unknown.', service_name) |
101 | 101 | |
102 | 102 | item = gtk.MenuItem(activity_info.get_name()) |
103 | 103 | item.connect('activate', self._open_submenu_item_activate_cb, |
-
diff --git a/src/jarabe/frame/clipboardobject.py b/src/jarabe/frame/clipboardobject.py
index 91fa1e6..d6a55db 100644
a
|
b
|
class ClipboardObject(object): |
110 | 110 | format_ = mime.get_for_file(uri.path) |
111 | 111 | else: |
112 | 112 | format_ = mime.get_from_file_name(uri.path) |
113 | | logging.debug('Choosed %r!' % format_) |
| 113 | logging.debug('Chose %r!', format_) |
114 | 114 | |
115 | 115 | return format_ |
116 | 116 | |
-
diff --git a/src/jarabe/frame/clipboardpanelwindow.py b/src/jarabe/frame/clipboardpanelwindow.py
index 7093199..7d08d32 100644
a
|
b
|
class ClipboardPanelWindow(FrameWindow): |
63 | 63 | for target in targets: |
64 | 64 | if target not in ('TIMESTAMP', 'TARGETS', |
65 | 65 | 'MULTIPLE', 'SAVE_TARGETS'): |
66 | | logging.debug('Asking for target %s.' % target) |
| 66 | logging.debug('Asking for target %s.', target) |
67 | 67 | selection = x_clipboard.wait_for_contents(target) |
68 | 68 | if not selection: |
69 | | logging.warning('no data for selection target %s.' % target) |
| 69 | logging.warning('no data for selection target %s.', target) |
70 | 70 | continue |
71 | 71 | self._add_selection(key, selection) |
72 | 72 | |
… |
… |
class ClipboardPanelWindow(FrameWindow): |
74 | 74 | |
75 | 75 | def _add_selection(self, key, selection): |
76 | 76 | if not selection.data: |
77 | | logging.warning('no data for selection target %s.' % selection.type) |
| 77 | logging.warning('no data for selection target %s.', selection.type) |
78 | 78 | return |
79 | 79 | |
80 | 80 | logging.debug('adding type ' + selection.type + '.') |
-
diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index a387328..75c1ecf 100644
a
|
b
|
class ClipboardTray(tray.VTray): |
79 | 79 | if not selection.data: |
80 | 80 | return |
81 | 81 | |
82 | | logging.debug('ClipboardTray: adding type %r' % selection.type) |
| 82 | logging.debug('ClipboardTray: adding type %r', selection.type) |
83 | 83 | |
84 | 84 | cb_service = clipboard.get_instance() |
85 | 85 | if selection.type == 'text/uri-list': |
… |
… |
class ClipboardTray(tray.VTray): |
115 | 115 | cb_service = clipboard.get_instance() |
116 | 116 | cb_service.delete_object(icon.get_object_id()) |
117 | 117 | |
118 | | logging.debug('ClipboardTray: %r was added' % cb_object.get_id()) |
| 118 | logging.debug('ClipboardTray: %r was added', cb_object.get_id()) |
119 | 119 | |
120 | 120 | def _object_deleted_cb(self, cb_service, object_id): |
121 | 121 | icon = self._icons[object_id] |
122 | 122 | self.remove_item(icon) |
123 | 123 | del self._icons[object_id] |
124 | | logging.debug('ClipboardTray: %r was deleted' % object_id) |
| 124 | logging.debug('ClipboardTray: %r was deleted', object_id) |
125 | 125 | |
126 | 126 | def drag_motion_cb(self, widget, context, x, y, time): |
127 | 127 | logging.debug('ClipboardTray._drag_motion_cb') |
… |
… |
class ClipboardTray(tray.VTray): |
180 | 180 | |
181 | 181 | def drag_data_received_cb(self, widget, context, x, y, selection, |
182 | 182 | targetType, time): |
183 | | logging.debug('ClipboardTray: got data for target %r' |
184 | | % selection.target) |
| 183 | logging.debug('ClipboardTray: got data for target %r', |
| 184 | selection.target) |
185 | 185 | |
186 | 186 | object_id = self._context_map.get_object_id(context) |
187 | 187 | try: |
188 | 188 | if selection is None: |
189 | | logging.warn('ClipboardTray: empty selection for target %s' |
190 | | % selection.target) |
| 189 | logging.warn('ClipboardTray: empty selection for target %s', |
| 190 | selection.target) |
191 | 191 | elif selection.target == 'XdndDirectSave0': |
192 | 192 | if selection.data == 'S': |
193 | 193 | window = context.source_window |
-
diff --git a/src/jarabe/frame/frame.py b/src/jarabe/frame/frame.py
index 0bb8d92..1e02fc8 100644
a
|
b
|
class Frame(object): |
318 | 318 | |
319 | 319 | def remove_notification(self, icon): |
320 | 320 | if icon not in self._notif_by_icon: |
321 | | logging.debug('icon %r not in list of notifications.' % icon) |
| 321 | logging.debug('icon %r not in list of notifications.', icon) |
322 | 322 | return |
323 | 323 | |
324 | 324 | window = self._notif_by_icon[icon] |
… |
… |
class Frame(object): |
326 | 326 | del self._notif_by_icon[icon] |
327 | 327 | |
328 | 328 | def __notification_received_cb(self, **kwargs): |
329 | | logging.debug('__notification_received_cb %r' % kwargs) |
| 329 | logging.debug('__notification_received_cb %r', kwargs) |
330 | 330 | icon = NotificationIcon() |
331 | 331 | |
332 | 332 | hints = kwargs['hints'] |
-
diff --git a/src/jarabe/frame/zoomtoolbar.py b/src/jarabe/frame/zoomtoolbar.py
index 43cc358..22b443e 100644
a
|
b
|
class ZoomToolbar(gtk.Toolbar): |
73 | 73 | self._set_zoom_level(kwargs['new_level']) |
74 | 74 | |
75 | 75 | def _set_zoom_level(self, new_level): |
76 | | logging.debug('new zoom level: %r' % new_level) |
| 76 | logging.debug('new zoom level: %r', new_level) |
77 | 77 | if new_level == shell.ShellModel.ZOOM_MESH: |
78 | 78 | self._mesh_button.props.active = True |
79 | 79 | elif new_level == shell.ShellModel.ZOOM_GROUP: |
-
diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
index 0e0cbb3..94c6782 100644
a
|
b
|
def create_profile(name, color=None, pixbuf=None): |
55 | 55 | cmd = "ssh-keygen -q -t dsa -f %s -C '' -N ''" % keypath |
56 | 56 | (s, o) = commands.getstatusoutput(cmd) |
57 | 57 | if s != 0: |
58 | | logging.error("Could not generate key pair: %d %s" % (s, o)) |
| 58 | logging.error("Could not generate key pair: %d %s", s, o) |
59 | 59 | else: |
60 | 60 | logging.error("Keypair exists, skip generation.") |
61 | 61 | |
-
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 6ef531b..88c0b41 100644
a
|
b
|
class ExpandedEntry(hippo.CanvasBox): |
187 | 187 | try: |
188 | 188 | surface = cairo.ImageSurface.create_from_png(png_file) |
189 | 189 | has_preview = True |
190 | | except Exception, e: |
191 | | logging.error('Error while loading the preview: %r' % e) |
| 190 | except Exception: |
| 191 | logging.exception('Error while loading the preview') |
192 | 192 | has_preview = False |
193 | 193 | else: |
194 | 194 | has_preview = False |
-
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index 80204a1..08a5a0f 100644
a
|
b
|
class JournalActivity(Window): |
236 | 236 | return True |
237 | 237 | |
238 | 238 | def __volume_changed_cb(self, volume_toolbar, mount_point): |
239 | | logging.debug('Selected volume: %r.' % mount_point) |
| 239 | logging.debug('Selected volume: %r.', mount_point) |
240 | 240 | self._main_toolbox.search_toolbar.set_mount_point(mount_point) |
241 | 241 | self._main_toolbox.set_current_toolbar(0) |
242 | 242 | |
… |
… |
class JournalActivity(Window): |
281 | 281 | try: |
282 | 282 | registry.install(bundle) |
283 | 283 | except (ZipExtractException, RegistrationException): |
284 | | logging.warning('Could not install bundle %s:\n%s' % \ |
285 | | (bundle.get_path(), traceback.format_exc())) |
| 284 | logging.exception('Could not install bundle %s', bundle.get_path()) |
286 | 285 | return |
287 | 286 | |
288 | 287 | if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: |
… |
… |
class JournalActivity(Window): |
297 | 296 | search_toolbar.give_entry_focus() |
298 | 297 | |
299 | 298 | def __window_state_event_cb(self, window, event): |
300 | | logging.debug('window_state_event_cb %r' % self) |
| 299 | logging.debug('window_state_event_cb %r', self) |
301 | 300 | if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: |
302 | 301 | state = event.new_window_state |
303 | 302 | visible = not state & gtk.gdk.WINDOW_STATE_ICONIFIED |
304 | 303 | self._list_view.set_is_visible(visible) |
305 | 304 | |
306 | 305 | def __visibility_notify_event_cb(self, window, event): |
307 | | logging.debug('visibility_notify_event_cb %r' % self) |
| 306 | logging.debug('visibility_notify_event_cb %r', self) |
308 | 307 | visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED |
309 | 308 | self._list_view.set_is_visible(visible) |
310 | 309 | |
-
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index af6e20e..201bf76 100644
a
|
b
|
class SearchToolbar(gtk.Toolbar): |
258 | 258 | break |
259 | 259 | |
260 | 260 | if what_filter_index == -1: |
261 | | logging.warning('what_filter %r not known' % what_filter) |
| 261 | logging.warning('what_filter %r not known', what_filter) |
262 | 262 | else: |
263 | 263 | self._what_search_combo.set_active(what_filter_index) |
264 | 264 | |
-
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index a5586b7..917fbb1 100644
a
|
b
|
class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource): |
193 | 193 | if selection.target == 'text/uri-list': |
194 | 194 | # Get hold of a reference so the temp file doesn't get deleted |
195 | 195 | self._temp_drag_file_path = model.get_file(uid) |
196 | | logging.debug('putting %r in selection' % self._temp_drag_file_path) |
| 196 | logging.debug('putting %r in selection', self._temp_drag_file_path) |
197 | 197 | selection.set(selection.target, 8, self._temp_drag_file_path) |
198 | 198 | return True |
199 | 199 | 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
|
b
|
class BaseListView(gtk.Bin): |
277 | 277 | self.refresh() |
278 | 278 | |
279 | 279 | def refresh(self): |
280 | | logging.debug('ListView.refresh query %r' % self._query) |
| 280 | logging.debug('ListView.refresh query %r', self._query) |
281 | 281 | self._stop_progress_bar() |
282 | 282 | self._start_progress_bar() |
283 | 283 | |
… |
… |
class BaseListView(gtk.Bin): |
411 | 411 | self.refresh() |
412 | 412 | |
413 | 413 | def set_is_visible(self, visible): |
414 | | logging.debug('canvas_visibility_notify_event_cb %r' % visible) |
| 414 | logging.debug('canvas_visibility_notify_event_cb %r', visible) |
415 | 415 | if visible: |
416 | 416 | self._fully_obscured = False |
417 | 417 | if self._dirty: |
-
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 5a9feb0..e6e5abf 100644
a
|
b
|
def _get_icon_for_mime(mime_type): |
44 | 44 | return file_name |
45 | 45 | |
46 | 46 | icons = gio.content_type_get_icon(mime_type) |
47 | | logging.debug('icons for this file: %r' % icons.props.names) |
| 47 | logging.debug('icons for this file: %r', icons.props.names) |
48 | 48 | for icon_name in icons.props.names: |
49 | 49 | file_name = get_icon_file_name(icon_name) |
50 | 50 | if file_name is not None: |
… |
… |
def get_bundle(metadata): |
96 | 96 | if is_activity_bundle(metadata): |
97 | 97 | file_path = util.TempFilePath(model.get_file(metadata['uid'])) |
98 | 98 | if not os.path.exists(file_path): |
99 | | logging.warning('Invalid path: %r' % file_path) |
| 99 | logging.warning('Invalid path: %r', file_path) |
100 | 100 | return None |
101 | 101 | return ActivityBundle(file_path) |
102 | 102 | |
103 | 103 | elif is_content_bundle(metadata): |
104 | 104 | file_path = util.TempFilePath(model.get_file(metadata['uid'])) |
105 | 105 | if not os.path.exists(file_path): |
106 | | logging.warning('Invalid path: %r' % file_path) |
| 106 | logging.warning('Invalid path: %r', file_path) |
107 | 107 | return None |
108 | 108 | return ContentBundle(file_path) |
109 | 109 | |
110 | 110 | elif is_journal_bundle(metadata): |
111 | 111 | file_path = util.TempFilePath(model.get_file(metadata['uid'])) |
112 | 112 | if not os.path.exists(file_path): |
113 | | logging.warning('Invalid path: %r' % file_path) |
| 113 | logging.warning('Invalid path: %r', file_path) |
114 | 114 | return None |
115 | 115 | return JournalEntryBundle(file_path) |
116 | 116 | else: |
117 | 117 | return None |
118 | 118 | except MalformedBundleException, e: |
119 | | logging.warning('Incorrect bundle: %r' % e) |
| 119 | logging.warning('Incorrect bundle: %r', e) |
120 | 120 | return None |
121 | 121 | |
122 | 122 | def _get_activities_for_mime(mime_type): |
… |
… |
def resume(metadata, bundle_id=None): |
196 | 196 | if bundle_id is None: |
197 | 197 | activities = get_activities(metadata) |
198 | 198 | if not activities: |
199 | | logging.warning('No activity can open this object, %s.' % |
| 199 | logging.warning('No activity can open this object, %s.', |
200 | 200 | metadata.get('mime_type', None)) |
201 | 201 | return |
202 | 202 | 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
|
b
|
from datetime import datetime |
20 | 20 | import time |
21 | 21 | import shutil |
22 | 22 | from stat import S_IFMT, S_IFDIR, S_IFREG |
23 | | import traceback |
24 | 23 | import re |
25 | 24 | |
26 | 25 | import gobject |
… |
… |
class BaseResultSet(object): |
119 | 118 | self._position = position |
120 | 119 | |
121 | 120 | def read(self): |
122 | | logging.debug('ResultSet.read position: %r' % self._position) |
| 121 | logging.debug('ResultSet.read position: %r', self._position) |
123 | 122 | |
124 | 123 | if self._position == -1: |
125 | 124 | self.seek(0) |
… |
… |
class BaseResultSet(object): |
142 | 141 | # Total cache miss: remake it |
143 | 142 | limit = self._page_size * MIN_PAGES_TO_CACHE |
144 | 143 | offset = max(0, self._position - limit / 2) |
145 | | logging.debug('remaking cache, offset: %r limit: %r' % \ |
146 | | (offset, limit)) |
| 144 | logging.debug('remaking cache, offset: %r limit: %r', offset, |
| 145 | limit) |
147 | 146 | query = self._query.copy() |
148 | 147 | query['limit'] = limit |
149 | 148 | query['offset'] = offset |
… |
… |
class BaseResultSet(object): |
156 | 155 | elif remaining_forward_entries <= 0 and remaining_backwards_entries > 0: |
157 | 156 | |
158 | 157 | # Add one page to the end of cache |
159 | | logging.debug('appending one more page, offset: %r' % \ |
160 | | last_cached_entry) |
| 158 | logging.debug('appending one more page, offset: %r', |
| 159 | last_cached_entry) |
161 | 160 | query = self._query.copy() |
162 | 161 | query['limit'] = self._page_size |
163 | 162 | query['offset'] = last_cached_entry |
… |
… |
class BaseResultSet(object): |
180 | 179 | limit = min(self._offset, self._page_size) |
181 | 180 | self._offset = max(0, self._offset - limit) |
182 | 181 | |
183 | | logging.debug('prepending one more page, offset: %r limit: %r' % |
184 | | (self._offset, limit)) |
| 182 | logging.debug('prepending one more page, offset: %r limit: %r', |
| 183 | self._offset, limit) |
185 | 184 | query = self._query.copy() |
186 | 185 | query['limit'] = self._page_size |
187 | 186 | query['offset'] = self._offset |
… |
… |
class InplaceResultSet(BaseResultSet): |
289 | 288 | metadata['mountpoint'] = self._mount_point |
290 | 289 | entries.append(metadata) |
291 | 290 | |
292 | | logging.debug('InplaceResultSet.find took %f s.' % (time.time() - t)) |
| 291 | logging.debug('InplaceResultSet.find took %f s.', time.time() - t) |
293 | 292 | |
294 | 293 | return entries, total_count |
295 | 294 | |
… |
… |
class InplaceResultSet(BaseResultSet): |
331 | 330 | self.progress.send(self) |
332 | 331 | |
333 | 332 | except Exception: |
334 | | logging.error('Error reading file %r: %s' % \ |
335 | | (full_path, traceback.format_exc())) |
| 333 | logging.exception('Error reading file %r', full_path) |
336 | 334 | |
337 | 335 | if self._pending_directories == 0: |
338 | 336 | self.setup_ready() |
… |
… |
def get_file(object_id): |
412 | 410 | """Returns the file for an object |
413 | 411 | """ |
414 | 412 | if os.path.exists(object_id): |
415 | | logging.debug('get_file asked for file with path %r' % object_id) |
| 413 | logging.debug('get_file asked for file with path %r', object_id) |
416 | 414 | return object_id |
417 | 415 | else: |
418 | | logging.debug('get_file asked for entry with id %r' % object_id) |
| 416 | logging.debug('get_file asked for entry with id %r', object_id) |
419 | 417 | file_path = _get_datastore().get_filename(object_id) |
420 | 418 | if file_path: |
421 | 419 | return util.TempFilePath(file_path) |
… |
… |
def copy(metadata, mount_point): |
450 | 448 | def write(metadata, file_path='', update_mtime=True): |
451 | 449 | """Creates or updates an entry for that id |
452 | 450 | """ |
453 | | logging.debug('model.write %r %r %r' % (metadata.get('uid', ''), file_path, |
454 | | update_mtime)) |
| 451 | logging.debug('model.write %r %r %r', metadata.get('uid', ''), file_path, |
| 452 | update_mtime) |
455 | 453 | if update_mtime: |
456 | 454 | metadata['mtime'] = datetime.now().isoformat() |
457 | 455 | metadata['timestamp'] = int(time.time()) |
-
diff --git a/src/jarabe/journal/objectchooser.py b/src/jarabe/journal/objectchooser.py
index 32bfbb3..31bdba8 100644
a
|
b
|
class ObjectChooser(gtk.Window): |
128 | 128 | self._list_view.update_with_query(query) |
129 | 129 | |
130 | 130 | def __volume_changed_cb(self, volume_toolbar, mount_point): |
131 | | logging.debug('Selected volume: %r.' % mount_point) |
| 131 | logging.debug('Selected volume: %r.', mount_point) |
132 | 132 | self._toolbar.set_mount_point(mount_point) |
133 | 133 | |
134 | 134 | def __visibility_notify_event_cb(self, window, event): |
135 | | logging.debug('visibility_notify_event_cb %r' % self) |
| 135 | logging.debug('visibility_notify_event_cb %r', self) |
136 | 136 | visible = event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED |
137 | 137 | self._list_view.set_is_visible(visible) |
138 | 138 | |
-
diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py
index 341a09f..49cc676 100644
a
|
b
|
class ObjectPalette(Palette): |
126 | 126 | def __clipboard_get_func_cb(self, clipboard, selection_data, info, data): |
127 | 127 | # Get hold of a reference so the temp file doesn't get deleted |
128 | 128 | self._temp_file_path = model.get_file(self._metadata['uid']) |
129 | | logging.debug('__clipboard_get_func_cb %r' % self._temp_file_path) |
| 129 | logging.debug('__clipboard_get_func_cb %r', self._temp_file_path) |
130 | 130 | selection_data.set_uris(['file://' + self._temp_file_path]) |
131 | 131 | |
132 | 132 | 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
|
b
|
class VolumesToolbar(gtk.Toolbar): |
76 | 76 | self._remove_button(mount) |
77 | 77 | |
78 | 78 | def _add_button(self, mount): |
79 | | logging.debug('VolumeToolbar._add_button: %r' % mount.get_name()) |
| 79 | logging.debug('VolumeToolbar._add_button: %r', mount.get_name()) |
80 | 80 | |
81 | 81 | button = VolumeButton(mount) |
82 | 82 | button.props.group = self._volume_buttons[0] |
… |
… |
class VolumesToolbar(gtk.Toolbar): |
99 | 99 | mount.unmount(self.__unmount_cb) |
100 | 100 | |
101 | 101 | def __unmount_cb(self, source, result): |
102 | | logging.debug('__unmount_cb %r %r' % (source, result)) |
| 102 | logging.debug('__unmount_cb %r %r', source, result) |
103 | 103 | |
104 | 104 | def _get_button_for_mount(self, mount): |
105 | 105 | mount_point = mount.get_root().get_path() |
106 | 106 | for button in self.get_children(): |
107 | 107 | if button.mount_point == mount_point: |
108 | 108 | return button |
109 | | logging.error('Couldnt find button with mount_point %r' % mount_point) |
| 109 | logging.error('Couldnt find button with mount_point %r', mount_point) |
110 | 110 | return None |
111 | 111 | |
112 | 112 | def _remove_button(self, mount): |
-
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 3e5e586..1d23f0c 100644
a
|
b
|
class BundleRegistry(gobject.GObject): |
68 | 68 | try: |
69 | 69 | self._load_favorites() |
70 | 70 | except Exception: |
71 | | logging.error('Error while loading favorite_activities\n%s.' \ |
72 | | % traceback.format_exc()) |
| 71 | logging.exception('Error while loading favorite_activities.') |
73 | 72 | |
74 | 73 | self._merge_default_favorites() |
75 | 74 | |
… |
… |
class BundleRegistry(gobject.GObject): |
154 | 153 | if max_version > -1 and key not in self._favorite_bundles: |
155 | 154 | self._favorite_bundles[key] = None |
156 | 155 | |
157 | | logging.debug('After merging: %r' % self._favorite_bundles) |
| 156 | logging.debug('After merging: %r', self._favorite_bundles) |
158 | 157 | |
159 | 158 | self._write_favorites_file() |
160 | 159 | |
… |
… |
class BundleRegistry(gobject.GObject): |
211 | 210 | return False |
212 | 211 | |
213 | 212 | def _add_bundle(self, bundle_path, install_mime_type=False): |
214 | | logging.debug('STARTUP: Adding bundle %r' % bundle_path) |
| 213 | logging.debug('STARTUP: Adding bundle %r', bundle_path) |
215 | 214 | try: |
216 | 215 | bundle = ActivityBundle(bundle_path) |
217 | 216 | if install_mime_type: |
218 | 217 | bundle.install_mime_type(bundle_path) |
219 | 218 | except MalformedBundleException: |
220 | | logging.error('Error loading bundle %r:\n%s' % (bundle_path, |
221 | | traceback.format_exc())) |
| 219 | logging.exception('Error loading bundle %r', bundle_path) |
222 | 220 | return None |
223 | 221 | |
224 | 222 | if self.get_bundle(bundle.get_bundle_id()): |
-
diff --git a/src/jarabe/model/filetransfer.py b/src/jarabe/model/filetransfer.py
index d0d28fa..3c188ff 100644
a
|
b
|
class BaseFileTransfer(gobject.GObject): |
147 | 147 | handle) |
148 | 148 | |
149 | 149 | def __transferred_bytes_changed_cb(self, transferred_bytes): |
150 | | logging.debug('__transferred_bytes_changed_cb %r' % transferred_bytes) |
| 150 | logging.debug('__transferred_bytes_changed_cb %r', transferred_bytes) |
151 | 151 | self.props.transferred_bytes = transferred_bytes |
152 | 152 | |
153 | 153 | def _set_transferred_bytes(self, transferred_bytes): |
… |
… |
class BaseFileTransfer(gobject.GObject): |
160 | 160 | getter=_get_transferred_bytes, setter=_set_transferred_bytes) |
161 | 161 | |
162 | 162 | def __initial_offset_defined_cb(self, offset): |
163 | | logging.debug('__initial_offset_defined_cb %r' % offset) |
| 163 | logging.debug('__initial_offset_defined_cb %r', offset) |
164 | 164 | self.initial_offset = offset |
165 | 165 | |
166 | 166 | def __state_changed_cb(self, state, reason): |
167 | | logging.debug('__state_changed_cb %r %r' % (state, reason)) |
| 167 | logging.debug('__state_changed_cb %r %r', state, reason) |
168 | 168 | self.reason_last_change = reason |
169 | 169 | self.props.state = state |
170 | 170 | |
… |
… |
class IncomingFileTransfer(BaseFileTransfer): |
205 | 205 | SOCKET_ACCESS_CONTROL_LOCALHOST, '', 0, byte_arrays=True) |
206 | 206 | |
207 | 207 | def __notify_state_cb(self, file_transfer, pspec): |
208 | | logging.debug('__notify_state_cb %r' % self.props.state) |
| 208 | logging.debug('__notify_state_cb %r', self.props.state) |
209 | 209 | if self.props.state == FT_STATE_OPEN: |
210 | 210 | # Need to hold a reference to the socket so that python doesn't |
211 | 211 | # close the fd when it goes out of scope |
… |
… |
class OutgoingFileTransfer(BaseFileTransfer): |
276 | 276 | 'org.laptop.Sugar.Presence.Buddy') |
277 | 277 | |
278 | 278 | handles = ps_buddy.GetTelepathyHandles() |
279 | | logging.debug('_get_buddy_handle %r' % handles) |
| 279 | logging.debug('_get_buddy_handle %r', handles) |
280 | 280 | |
281 | 281 | bus_name, object_path, handle = handles[0] |
282 | 282 | |
283 | 283 | return handle |
284 | 284 | |
285 | 285 | def __notify_state_cb(self, file_transfer, pspec): |
286 | | logging.debug('__notify_state_cb %r' % self.props.state) |
| 286 | logging.debug('__notify_state_cb %r', self.props.state) |
287 | 287 | if self.props.state == FT_STATE_OPEN: |
288 | 288 | # Need to hold a reference to the socket so that python doesn't |
289 | 289 | # closes the fd when it goes out of scope |
… |
… |
class OutgoingFileTransfer(BaseFileTransfer): |
291 | 291 | self._socket.connect(self._socket_address) |
292 | 292 | output_stream = gio.unix.OutputStream(self._socket.fileno(), True) |
293 | 293 | |
294 | | logging.debug('opening %s for reading' % self._file_name) |
| 294 | logging.debug('opening %s for reading', self._file_name) |
295 | 295 | input_stream = gio.File(self._file_name).read() |
296 | 296 | if self.initial_offset > 0: |
297 | 297 | input_stream.skip(self.initial_offset) |
… |
… |
def _new_channels_cb(connection, channels): |
308 | 308 | if props[CHANNEL + '.ChannelType'] == CHANNEL_TYPE_FILE_TRANSFER and \ |
309 | 309 | not props[CHANNEL + '.Requested']: |
310 | 310 | |
311 | | logging.debug('__new_channels_cb %r' % object_path) |
| 311 | logging.debug('__new_channels_cb %r', object_path) |
312 | 312 | |
313 | 313 | incoming_file_transfer = IncomingFileTransfer(connection, |
314 | 314 | object_path, props) |
315 | 315 | new_file_transfer.send(None, file_transfer=incoming_file_transfer) |
316 | 316 | |
317 | 317 | def _monitor_connection(connection): |
318 | | logging.debug('connection added %r' % connection) |
| 318 | logging.debug('connection added %r', connection) |
319 | 319 | connection[CONNECTION_INTERFACE_REQUESTS].connect_to_signal('NewChannels', |
320 | 320 | lambda channels: _new_channels_cb(connection, channels)) |
321 | 321 | |
… |
… |
def _connection_addded_cb(conn_watcher, connection): |
323 | 323 | _monitor_connection(connection) |
324 | 324 | |
325 | 325 | def _connection_removed_cb(conn_watcher, connection): |
326 | | logging.debug('connection removed %r' % connection) |
| 326 | logging.debug('connection removed %r', connection) |
327 | 327 | |
328 | 328 | _conn_watcher = None |
329 | 329 | |
-
diff --git a/src/jarabe/model/friends.py b/src/jarabe/model/friends.py
index 27a11dd..b7bf7f1 100644
a
|
b
|
class Friends(gobject.GObject): |
72 | 72 | continue |
73 | 73 | buddy = BuddyModel(key=key, nick=cp.get(key, 'nick')) |
74 | 74 | self.add_friend(buddy) |
75 | | except Exception, exc: |
76 | | logging.error("Error parsing friends file: %s" % exc) |
| 75 | except Exception: |
| 76 | logging.exception('Error parsing friends file') |
77 | 77 | |
78 | 78 | def save(self): |
79 | 79 | cp = ConfigParser() |
… |
… |
class Friends(gobject.GObject): |
98 | 98 | pass |
99 | 99 | |
100 | 100 | def friends_synced_error(e): |
101 | | logging.error("Error asking presence service to sync friends: %s" |
102 | | % e) |
| 101 | logging.error('Error asking presence service to sync friends: %s', |
| 102 | e) |
103 | 103 | |
104 | 104 | keys = [] |
105 | 105 | for friend in self: |
-
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index f4ef9ac..2b223e4 100644
a
|
b
|
class Neighborhood(gobject.GObject): |
122 | 122 | gconf_client = gconf.client_get_default() |
123 | 123 | key = '/desktop/sugar/collaboration/publish_gadget' |
124 | 124 | publish = gconf_client.get_bool(key) |
125 | | logging.debug("Gadget discovered on connection %s." |
126 | | " Publish our status: %r" % |
127 | | (conn.service_name.split('.')[-1], publish)) |
| 125 | logging.debug('Gadget discovered on connection %s.' |
| 126 | ' Publish our status: %r', conn.service_name.split('.')[-1], |
| 127 | publish) |
128 | 128 | conn[CONN_INTERFACE_GADGET].Publish(publish) |
129 | 129 | |
130 | 130 | self._request_random_buddies(conn, NB_RANDOM_BUDDIES) |
131 | 131 | self._request_random_activities(conn, NB_RANDOM_ACTIVITIES) |
132 | 132 | |
133 | 133 | def _request_random_buddies(self, conn, nb): |
134 | | logging.debug("Request %d random buddies" % nb) |
| 134 | logging.debug('Request %d random buddies', nb) |
135 | 135 | |
136 | 136 | path, props_ = conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel( |
137 | 137 | { 'org.freedesktop.Telepathy.Channel.ChannelType': |
… |
… |
class Neighborhood(gobject.GObject): |
145 | 145 | lambda: self._request_random_buddies(conn, nb))) |
146 | 146 | |
147 | 147 | def _request_random_activities(self, conn, nb): |
148 | | logging.debug("Request %d random activities" % nb) |
| 148 | logging.debug('Request %d random activities', nb) |
149 | 149 | |
150 | 150 | path, props_ = conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel( |
151 | 151 | { 'org.freedesktop.Telepathy.Channel.ChannelType': |
-
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 2607005..4dbc309 100644
a
|
b
|
class NMSettingsConnection(dbus.service.Object): |
254 | 254 | if not config.read(config_path): |
255 | 255 | logging.error('Error reading the nm config file') |
256 | 256 | return |
257 | | except ConfigParser.ParsingError, e: |
258 | | logging.error('Error reading the nm config file: %s' % e) |
| 257 | except ConfigParser.ParsingError: |
| 258 | logging.exception('Error reading the nm config file') |
259 | 259 | return |
260 | 260 | identifier = self._settings.connection.id |
261 | 261 | |
… |
… |
class NMSettingsConnection(dbus.service.Object): |
292 | 292 | elif self._settings.wireless_security.key_mgmt == 'wpa-psk': |
293 | 293 | config.set(identifier, 'key', self._secrets.psk) |
294 | 294 | except ConfigParser.Error, e: |
295 | | logging.error('Error constructing %s: %s' % (identifier, e)) |
| 295 | logging.exception('Error constructing %s', identifier) |
296 | 296 | else: |
297 | 297 | f = open(config_path, 'w') |
298 | 298 | try: |
299 | 299 | config.write(f) |
300 | | except ConfigParser.Error, e: |
301 | | logging.error('Can not write %s error: %s' % (config_path, e)) |
| 300 | except ConfigParser.Error: |
| 301 | logging.exception('Can not write %s', config_path) |
302 | 302 | f.close() |
303 | 303 | |
304 | 304 | @dbus.service.method(dbus_interface=NM_CONNECTION_IFACE, |
… |
… |
class NMSettingsConnection(dbus.service.Object): |
310 | 310 | async_callbacks=('reply', 'error'), |
311 | 311 | in_signature='sasb', out_signature='a{sa{sv}}') |
312 | 312 | def GetSecrets(self, setting_name, hints, request_new, reply, error): |
313 | | logging.debug('Secrets requested for connection %s request_new=%s' |
314 | | % (self.path, request_new)) |
| 313 | logging.debug('Secrets requested for connection %s request_new=%s', |
| 314 | self.path, request_new) |
315 | 315 | |
316 | 316 | if request_new or self._secrets is None: |
317 | 317 | # request_new is for example the case when the pw on the AP changes |
318 | 318 | response = SecretsResponse(self, reply, error) |
319 | 319 | try: |
320 | 320 | self.secrets_request.send(self, response=response) |
321 | | except Exception, e: |
322 | | logging.error('Error requesting the secrets via dialog: %s' % e) |
| 321 | except Exception: |
| 322 | logging.exception('Error requesting the secrets via dialog') |
323 | 323 | else: |
324 | 324 | reply(self._secrets.get_dict()) |
325 | 325 | |
… |
… |
def get_settings(): |
328 | 328 | if _nm_settings is None: |
329 | 329 | try: |
330 | 330 | _nm_settings = NMSettings() |
331 | | except dbus.DBusException, e: |
332 | | logging.error('Cannot create the UserSettings service %s.', e) |
| 331 | except dbus.DBusException: |
| 332 | logging.exception('Cannot create the UserSettings service.') |
333 | 333 | load_connections() |
334 | 334 | return _nm_settings |
335 | 335 | |
… |
… |
def load_connections(): |
367 | 367 | if not config.read(config_path): |
368 | 368 | logging.error('Error reading the nm config file') |
369 | 369 | return |
370 | | except ConfigParser.ParsingError, e: |
371 | | logging.error('Error reading the nm config file: %s' % e) |
| 370 | except ConfigParser.ParsingError: |
| 371 | logging.exception('Error reading the nm config file') |
372 | 372 | return |
373 | 373 | |
374 | 374 | for section in config.sections(): |
… |
… |
def load_connections(): |
412 | 412 | if config.has_option(section, 'pairwise'): |
413 | 413 | value = config.get(section, 'pairwise') |
414 | 414 | settings.wireless_security.pairwise = value |
415 | | except ConfigParser.Error, e: |
416 | | logging.error('Error reading section: %s' % e) |
| 415 | except ConfigParser.Error: |
| 416 | logging.exception('Error reading section') |
417 | 417 | else: |
418 | 418 | add_connection(ssid, settings, secrets) |
-
diff --git a/src/jarabe/model/notifications.py b/src/jarabe/model/notifications.py
index da5c590..a2345f7 100644
a
|
b
|
class NotificationService(dbus.service.Object): |
42 | 42 | def Notify(self, app_name, replaces_id, app_icon, summary, body, actions, |
43 | 43 | hints, expire_timeout): |
44 | 44 | |
45 | | logging.debug('Received notification: %r' % ([app_name, replaces_id, |
46 | | app_icon, summary, body, actions, hints, expire_timeout])) |
| 45 | logging.debug('Received notification: %r', [app_name, replaces_id, |
| 46 | app_icon, summary, body, actions, hints, expire_timeout]) |
47 | 47 | |
48 | 48 | if replaces_id > 0: |
49 | 49 | notification_id = replaces_id |
-
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index d7810ba..ec315ca 100644
a
|
b
|
class Activity(gobject.GObject): |
269 | 269 | pass |
270 | 270 | |
271 | 271 | def _set_active_error(self, err): |
272 | | logging.error("set_active() failed: %s" % err) |
| 272 | logging.error("set_active() failed: %s", err) |
273 | 273 | |
274 | 274 | class ShellModel(gobject.GObject): |
275 | 275 | """Model of the shell (activity management) |
… |
… |
class ShellModel(gobject.GObject): |
474 | 474 | self.emit('launch-completed', home_activity) |
475 | 475 | |
476 | 476 | startup_time = time.time() - home_activity.get_launch_time() |
477 | | logging.debug('%s launched in %f seconds.' % |
478 | | (home_activity.get_type(), startup_time)) |
| 477 | logging.debug('%s launched in %f seconds.', |
| 478 | home_activity.get_type(), startup_time) |
479 | 479 | |
480 | 480 | if self._active_activity is None: |
481 | 481 | self._set_active_activity(home_activity) |
… |
… |
class ShellModel(gobject.GObject): |
537 | 537 | if home_activity: |
538 | 538 | self._remove_activity(home_activity) |
539 | 539 | else: |
540 | | logging.error('Model for window %d does not exist.' % xid) |
| 540 | logging.error('Model for window %d does not exist.', xid) |
541 | 541 | |
542 | 542 | def notify_launch(self, activity_id, service_name): |
543 | 543 | registry = get_registry() |
… |
… |
class ShellModel(gobject.GObject): |
562 | 562 | def notify_launch_failed(self, activity_id): |
563 | 563 | home_activity = self.get_activity_by_id(activity_id) |
564 | 564 | if home_activity: |
565 | | logging.debug("Activity %s (%s) launch failed" % \ |
566 | | (activity_id, home_activity.get_type())) |
| 565 | logging.debug("Activity %s (%s) launch failed", activity_id, |
| 566 | home_activity.get_type()) |
567 | 567 | home_activity.props.launching = False |
568 | 568 | self._remove_activity(home_activity) |
569 | 569 | else: |
570 | | logging.error('Model for activity id %s does not exist.' |
571 | | % activity_id) |
| 570 | logging.error('Model for activity id %s does not exist.', |
| 571 | activity_id) |
572 | 572 | |
573 | 573 | self.emit('launch-failed', home_activity) |
574 | 574 | |
… |
… |
class ShellModel(gobject.GObject): |
576 | 576 | home_activity = self.get_activity_by_id(activity_id) |
577 | 577 | |
578 | 578 | if not home_activity: |
579 | | logging.debug('Activity %s has been closed already.' % activity_id) |
| 579 | logging.debug('Activity %s has been closed already.', activity_id) |
580 | 580 | return False |
581 | 581 | |
582 | 582 | if home_activity.props.launching: |
583 | | logging.debug('Activity %s still launching, assuming it failed...' |
584 | | % activity_id) |
| 583 | logging.debug('Activity %s still launching, assuming it failed.', |
| 584 | activity_id) |
585 | 585 | self.notify_launch_failed(activity_id) |
586 | 586 | return False |
587 | 587 | |
-
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
index 0505c52..f81d24b 100644
a
|
b
|
class KeyHandler(object): |
91 | 91 | if f.endswith('.py') and not f.startswith('__'): |
92 | 92 | module_name = f[:-3] |
93 | 93 | try: |
94 | | logging.debug('Loading module %r' % module_name) |
| 94 | logging.debug('Loading module %r', module_name) |
95 | 95 | module = __import__('globalkey.' + module_name, globals(), |
96 | 96 | locals(), [module_name]) |
97 | 97 | for key in module.BOUND_KEYS: |
… |
… |
class KeyHandler(object): |
134 | 134 | return self._speech_proxy |
135 | 135 | |
136 | 136 | def _on_speech_err(self, ex): |
137 | | logging.error("An error occurred with the ESpeak service: %r" % (ex, )) |
| 137 | logging.error('An error occurred with the ESpeak service: %r', ex) |
138 | 138 | |
139 | 139 | def _primary_selection_cb(self, clipboard, text, user_data): |
140 | | logging.debug('KeyHandler._primary_selection_cb: %r' % text) |
| 140 | logging.debug('KeyHandler._primary_selection_cb: %r', text) |
141 | 141 | if text: |
142 | 142 | self._get_speech_proxy().SayText(text, reply_handler=lambda: None, \ |
143 | 143 | error_handler=self._on_speech_err) |
… |
… |
class KeyHandler(object): |
200 | 200 | |
201 | 201 | def _key_pressed_cb(self, grabber, keycode, state, event_time): |
202 | 202 | key = grabber.get_key(keycode, state) |
203 | | logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state, key)) |
| 203 | logging.debug('_key_pressed_cb: %i %i %s', keycode, state, key) |
204 | 204 | if key: |
205 | 205 | self._key_pressed = key |
206 | 206 | self._keycode_pressed = keycode |
-
diff --git a/src/jarabe/view/launcher.py b/src/jarabe/view/launcher.py
index 83a141a..643baee 100644
a
|
b
|
def _destroy_launcher(home_activity): |
157 | 157 | _launchers[activity_id].destroy() |
158 | 158 | del _launchers[activity_id] |
159 | 159 | else: |
160 | | logging.error('Launcher for %s is missing' % activity_id) |
| 160 | logging.error('Launcher for %s is missing', activity_id) |
-
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py
index 317a15f..7bdd3d2 100644
a
|
b
|
class VolumePalette(Palette): |
227 | 227 | self._mount.unmount(self.__unmount_cb) |
228 | 228 | |
229 | 229 | def __unmount_cb(self, mount, result): |
230 | | logging.debug('__unmount_cb %r %r' % (mount, result)) |
| 230 | logging.debug('__unmount_cb %r %r', mount, result) |
231 | 231 | mount.unmount_finish(result) |
232 | 232 | |
233 | 233 | def __popup_cb(self, palette): |
-
diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
index 870b176..43f668a 100644
a
|
b
|
def setup_view_source(activity): |
64 | 64 | bundle_path = activity.get_bundle_path() |
65 | 65 | |
66 | 66 | if window_xid in map_activity_to_window: |
67 | | _logger.debug('Viewsource window already open for %s %s' % \ |
68 | | (window_xid, bundle_path)) |
| 67 | _logger.debug('Viewsource window already open for %s %s', window_xid, |
| 68 | bundle_path) |
69 | 69 | return |
70 | 70 | |
71 | 71 | document_path = None |
… |
… |
class ViewSource(gtk.Window): |
95 | 95 | def __init__(self, window_xid, bundle_path, document_path, title): |
96 | 96 | gtk.Window.__init__(self) |
97 | 97 | |
98 | | logging.debug('ViewSource paths: %r %r' % (bundle_path, document_path)) |
| 98 | logging.debug('ViewSource paths: %r %r', bundle_path, document_path) |
99 | 99 | |
100 | 100 | self.set_decorated(False) |
101 | 101 | self.set_position(gtk.WIN_POS_CENTER_ALWAYS) |
… |
… |
class DocumentButton(RadioToolButton): |
248 | 248 | self._jobject.destroy() |
249 | 249 | |
250 | 250 | def __internal_save_error_cb(self, err): |
251 | | logging.debug("Error saving Source object to datastore: %s" % err) |
| 251 | logging.debug('Error saving Source object to datastore: %s', err) |
252 | 252 | self._jobject.destroy() |
253 | 253 | |
254 | 254 | class Toolbar(gtk.Toolbar): |
… |
… |
class SourceDisplay(gtk.ScrolledWindow): |
439 | 439 | return |
440 | 440 | |
441 | 441 | mime_type = mime.get_for_file(self._file_path) |
442 | | logging.debug('Detected mime type: %r' % mime_type) |
| 442 | logging.debug('Detected mime type: %r', mime_type) |
443 | 443 | |
444 | 444 | language_manager = gtksourceview2.language_manager_get_default() |
445 | 445 | detected_language = None |
… |
… |
class SourceDisplay(gtk.ScrolledWindow): |
450 | 450 | break |
451 | 451 | |
452 | 452 | if detected_language is not None: |
453 | | logging.debug('Detected language: %r' % \ |
| 453 | logging.debug('Detected language: %r', |
454 | 454 | detected_language.get_name()) |
455 | 455 | |
456 | 456 | self._buffer.set_language(detected_language) |