From 2905360178115993d9bff62eccaf6b36b47b1075 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 21 Jul 2008 17:20:31 +0000 Subject: Merge branch 'master' of git://dev.laptop.org/sugar-toolkit --- diff --git a/po/ja.po b/po/ja.po index 93a56e3..945d15c 100644 --- a/po/ja.po +++ b/po/ja.po @@ -2,23 +2,22 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-06-24 00:07+0530\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2008-07-21 08:22-0400\n" +"Last-Translator: korakurider \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Translate Toolkit 1.1.1rc4\n" +"X-Generator: Pootle 1.1.0rc2\n" #: ../src/sugar/activity/activity.py:120 msgid "Share with:" -msgstr "" +msgstr "次の人と共有:" #: ../src/sugar/activity/activity.py:122 msgid "Private" @@ -26,40 +25,40 @@ msgstr "" #: ../src/sugar/activity/activity.py:123 msgid "My Neighborhood" -msgstr "" +msgstr "私のお隣さん" #: ../src/sugar/activity/activity.py:130 msgid "Keep" -msgstr "" +msgstr "残しておく" #: ../src/sugar/activity/activity.py:136 msgid "Stop" -msgstr "" +msgstr "停止" #: ../src/sugar/activity/activity.py:251 msgid "Undo" -msgstr "" +msgstr "元に戻す" #: ../src/sugar/activity/activity.py:256 msgid "Redo" -msgstr "" +msgstr "やり直し" #: ../src/sugar/activity/activity.py:266 msgid "Copy" -msgstr "" +msgstr "コピー" #: ../src/sugar/activity/activity.py:271 msgid "Paste" -msgstr "" +msgstr "貼り付け" #: ../src/sugar/activity/activity.py:297 msgid "Activity" -msgstr "" +msgstr "アクティビティ" #: ../src/sugar/activity/activity.py:469 #, python-format msgid "%s Activity" -msgstr "" +msgstr "%s アクティビティ" #: ../src/sugar/activity/activity.py:856 msgid "Keep error" @@ -79,15 +78,15 @@ msgstr "" #: ../src/sugar/graphics/alert.py:166 ../src/sugar/graphics/alert.py:209 msgid "Cancel" -msgstr "" +msgstr "中止" #: ../src/sugar/graphics/alert.py:170 ../src/sugar/graphics/alert.py:247 msgid "Ok" -msgstr "" +msgstr "了解" #: ../src/sugar/graphics/alert.py:219 msgid "Continue" -msgstr "" +msgstr "続ける" #: ../src/sugar/util.py:181 msgid " and " @@ -100,7 +99,7 @@ msgstr "" #. TRANS: Indicating something that just happened, eg. "just now", "moments ago" #: ../src/sugar/util.py:185 msgid "Seconds ago" -msgstr "" +msgstr "ちょっと前" #. TRANS: Indicating time passed, eg. "[10 day, 5 hours] ago", #. "[2 minutes] in the past", or "[3 years, 1 month] earlier" @@ -114,40 +113,34 @@ msgstr "" #, python-format msgid "%d year" msgid_plural "%d years" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 年" #: ../src/sugar/util.py:203 #, python-format msgid "%d month" msgid_plural "%d months" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 月" #: ../src/sugar/util.py:204 #, python-format msgid "%d week" msgid_plural "%d weeks" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 週" #: ../src/sugar/util.py:205 #, python-format msgid "%d day" msgid_plural "%d days" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 日" #: ../src/sugar/util.py:206 #, python-format msgid "%d hour" msgid_plural "%d hours" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 時間" #: ../src/sugar/util.py:207 #, python-format msgid "%d minute" msgid_plural "%d minutes" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "%d 分" diff --git a/src/sugar/bundle/contentbundle.py b/src/sugar/bundle/contentbundle.py index 38d4e51..32f38e3 100644 --- a/src/sugar/bundle/contentbundle.py +++ b/src/sugar/bundle/contentbundle.py @@ -19,6 +19,7 @@ from ConfigParser import ConfigParser import os +import urllib from sugar import env from sugar.bundle.bundle import Bundle, NotInstalledException, \ @@ -140,6 +141,11 @@ class ContentBundle(Bundle): else: self._bundle_class = None + if cp.has_option(section, 'activity_start'): + self._activity_start = cp.get(section, 'activity_start') + else: + self._activity_start = 'index.html' + def get_name(self): return self._name @@ -167,6 +173,9 @@ class ContentBundle(Bundle): def get_bundle_class(self): return self._bundle_class + def get_activity_start(self): + return self._activity_start + def _run_indexer(self): xdg_data_dirs = os.getenv('XDG_DATA_DIRS', '/usr/local/share/:/usr/share/') @@ -175,11 +184,19 @@ class ContentBundle(Bundle): if os.path.exists(indexer): os.spawnlp(os.P_WAIT, 'python', 'python', indexer) + def get_root_dir(self): + return os.path.join(env.get_user_library_path(), self._zip_root_dir) + + def get_start_path(self): + return os.path.join(self.get_root_dir(), self._activity_start) + + def get_start_uri(self): + return "file://" + urllib.pathname2url(self.get_start_path()) + def is_installed(self): if self._unpacked: return True - elif os.path.isdir(os.path.join(env.get_user_library_path(), - self._zip_root_dir)): + elif os.path.isdir(self.get_root_dir()): return True else: return False @@ -194,7 +211,6 @@ class ContentBundle(Bundle): raise NotInstalledException install_dir = self._path else: - install_dir = os.path.join(env.get_user_library_path(), - self._zip_root_dir) + install_dir = os.path.join(self.get_root_dir()) self._uninstall(install_dir) self._run_indexer() diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py index b7792f4..b88a877 100644 --- a/src/sugar/datastore/datastore.py +++ b/src/sugar/datastore/datastore.py @@ -169,6 +169,24 @@ class DSObject(object): logging.debug('activityfactory.creating bundle with id %r', bundle.get_bundle_id()) activityfactory.create(bundle.get_bundle_id()) + + elif self.is_content_bundle() and not bundle_id: + + logging.debug('Creating content bundle') + bundle = ContentBundle(self.file_path) + if not bundle.is_installed(): + logging.debug('Installing content bundle') + bundle.install() + + activities = self._get_activities_for_mime('text/html') + if len(activities) == 0: + logging.warning('No activity can open HTML content bundles') + return + + uri = bundle.get_start_uri() + logging.debug('activityfactory.creating with uri %s', uri) + activityfactory.create_with_uri(activities[0].bundle_id, + bundle.get_start_uri()) else: if not self.get_activities() and bundle_id is None: logging.warning('No activity can open this object, %s.' % -- cgit v0.9.1