From d2bac711f96ff10cd40201bdfe7810f0fe0f872e Mon Sep 17 00:00:00 2001
From: Sascha Silbe <sascha@silbe.org>
Date: Tue, 18 Aug 2009 15:25:13 +0200
Subject: [PATCH] compatible changes to prepare for version support
---
src/sugar/activity/activity.py | 6 +++---
src/sugar/activity/activityfactory.py | 2 +-
src/sugar/activity/activityhandle.py | 2 --
src/sugar/datastore/__init__.py | 29 +++++++++++++++++++++++++++++
src/sugar/graphics/objectchooser.py | 2 +-
5 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index f20d402..1c2e06a 100644
a
|
b
|
class Activity(Window, gtk.Container): |
470 | 470 | """ |
471 | 471 | raise NotImplementedError |
472 | 472 | |
473 | | def __save_cb(self): |
| 473 | def __save_cb(self, object_id=None): |
474 | 474 | logging.debug('Activity.__save_cb') |
475 | 475 | self._updating_jobject = False |
476 | 476 | if self._quit_requested: |
… |
… |
class Activity(Window, gtk.Container): |
550 | 550 | logging.debug('Cannot save, no journal object.') |
551 | 551 | return |
552 | 552 | |
553 | | logging.debug('Activity.save: %r' % self._jobject.object_id) |
| 553 | logging.debug('Activity.save: %r', self._jobject.object_id) |
554 | 554 | |
555 | 555 | if self._updating_jobject: |
556 | 556 | logging.info('Activity.save: still processing a previous request.') |
… |
… |
class Activity(Window, gtk.Container): |
594 | 594 | Activities should not override this method. Instead, like save() do any |
595 | 595 | copy work that needs to be done in write_file() |
596 | 596 | """ |
597 | | logging.debug('Activity.copy: %r' % self._jobject.object_id) |
| 597 | logging.debug('Activity.copy: %r', self._jobject.object_id) |
598 | 598 | self.save() |
599 | 599 | self._jobject.object_id = None |
600 | 600 | |
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
index 462a0f9..3d790c7 100644
a
|
b
|
class ActivityCreationHandler(gobject.GObject): |
319 | 319 | def _find_object_reply_handler(self, jobjects, count): |
320 | 320 | if count > 0: |
321 | 321 | if count > 1: |
322 | | logging.debug("Multiple objects has the same activity_id.") |
| 322 | logging.debug("Multiple objects have the same activity_id.") |
323 | 323 | self._handle.object_id = jobjects[0]['uid'] |
324 | 324 | self._launch_activity() |
325 | 325 | |
diff --git a/src/sugar/activity/activityhandle.py b/src/sugar/activity/activityhandle.py
index f255fd5..c4e16a8 100644
a
|
b
|
class ActivityHandle(object): |
38 | 38 | since new activities does not have an |
39 | 39 | associated object (yet). |
40 | 40 | |
41 | | XXX Not clear how this relates to the activity |
42 | | id yet, i.e. not sure we really need both. TBF |
43 | 41 | uri -- URI associated with the activity. Used when |
44 | 42 | opening an external file or resource in the |
45 | 43 | activity, rather than a journal object |
diff --git a/src/sugar/datastore/__init__.py b/src/sugar/datastore/__init__.py
index bdb658b..ece8f20 100644
a
|
b
|
|
14 | 14 | # License along with this library; if not, write to the |
15 | 15 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | 16 | # Boston, MA 02111-1307, USA. |
| 17 | |
| 18 | |
| 19 | class NoSpaceLeftError(Exception): |
| 20 | """There is not enough space left on disk to safely store data and/or |
| 21 | metadata. |
| 22 | |
| 23 | Operation aborted, everything still at the previous state. |
| 24 | """ |
| 25 | |
| 26 | class InvalidArgumentError(Exception): |
| 27 | """One or several of the passed parameters were invalid. |
| 28 | |
| 29 | See formatted string for details. This should only happen if the caller |
| 30 | is doing something wrong, not during normal operation. |
| 31 | """ |
| 32 | |
| 33 | class CorruptionError(Exception): |
| 34 | """The internal data structures of the data store or one of its backends |
| 35 | are corrupted. |
| 36 | |
| 37 | Should only happen in case of hardware defects or OS bugs. |
| 38 | """ |
| 39 | |
| 40 | class BusyError(Exception): |
| 41 | """Data store is busy recovering from a crash. |
| 42 | |
| 43 | Please wait for Ready() before starting to issue any API call (except |
| 44 | check_ready()). |
| 45 | """ |
diff --git a/src/sugar/graphics/objectchooser.py b/src/sugar/graphics/objectchooser.py
index fb3703d..ef4e728 100644
a
|
b
|
class ObjectChooser(object): |
110 | 110 | def __chooser_response_cb(self, chooser_id, object_id): |
111 | 111 | if chooser_id != self._chooser_id: |
112 | 112 | return |
113 | | logging.debug('ObjectChooser.__chooser_response_cb: %r' % object_id) |
| 113 | logging.debug('ObjectChooser.__chooser_response_cb: %r', object_id) |
114 | 114 | self._response_code = gtk.RESPONSE_ACCEPT |
115 | 115 | self._object_id = object_id |
116 | 116 | self._cleanup() |