From 22cf90c7a23fdf1687b6c4a75c64aa9c95d7c8a3 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Mon, 27 Jul 2009 04:05:14 +0000 Subject: Fix .xoj support #1098 --- (limited to 'src') diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py index 4ca751c..bc0ba14 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -288,6 +288,7 @@ class JournalActivity(Window): if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: model.delete(object_id) + return metadata['bundle_id'] = bundle.get_bundle_id() model.write(metadata) diff --git a/src/jarabe/journal/journalentrybundle.py b/src/jarabe/journal/journalentrybundle.py index 5d4086c..ebe7ec3 100644 --- a/src/jarabe/journal/journalentrybundle.py +++ b/src/jarabe/journal/journalentrybundle.py @@ -40,7 +40,7 @@ class JournalEntryBundle(Bundle): def __init__(self, path): Bundle.__init__(self, path) - def install(self): + def install(self, install_path): if os.environ.has_key('SUGAR_ACTIVITY_ROOT'): install_dir = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'], 'data') @@ -62,6 +62,9 @@ class JournalEntryBundle(Bundle): finally: shutil.rmtree(bundle_dir, ignore_errors=True) + def get_bundle_id(self): + return None + def _read_metadata(self, bundle_dir): metadata_path = os.path.join(bundle_dir, '_metadata.json') if not os.path.exists(metadata_path): diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index 42d39b0..351459b 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -26,6 +26,7 @@ import cjson from sugar.bundle.activitybundle import ActivityBundle from sugar.bundle.contentbundle import ContentBundle +from jarabe.journal.journalentrybundle import JournalEntryBundle from sugar.bundle.bundle import MalformedBundleException, \ AlreadyInstalledException, RegistrationException from sugar import env @@ -309,7 +310,8 @@ class BundleRegistry(gobject.GObject): def is_installed(self, bundle): # TODO treat ContentBundle in special way # needs rethinking while fixing ContentBundle support - if isinstance(bundle, ContentBundle): + if isinstance(bundle, ContentBundle) or \ + isinstance(bundle, JournalEntryBundle): return bundle.is_installed() for installed_bundle in self._bundles: @@ -338,7 +340,8 @@ class BundleRegistry(gobject.GObject): # TODO treat ContentBundle in special way # needs rethinking while fixing ContentBundle support - if isinstance(bundle, ContentBundle): + if isinstance(bundle, ContentBundle) or \ + isinstance(bundle, JournalEntryBundle): pass elif not self.add_bundle(install_path): raise RegistrationException @@ -346,7 +349,8 @@ class BundleRegistry(gobject.GObject): def uninstall(self, bundle, force=False): # TODO treat ContentBundle in special way # needs rethinking while fixing ContentBundle support - if isinstance(bundle, ContentBundle): + if isinstance(bundle, ContentBundle) or \ + isinstance(bundle, JournalEntryBundle): if bundle.is_installed(): bundle.uninstall() else: -- cgit v0.9.1