本文整理匯總了Python中sugar3.bundle.activitybundle.ActivityBundle.install_mime_type方法的典型用法代碼示例。如果您正苦於以下問題:Python ActivityBundle.install_mime_type方法的具體用法?Python ActivityBundle.install_mime_type怎麽用?Python ActivityBundle.install_mime_type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sugar3.bundle.activitybundle.ActivityBundle
的用法示例。
在下文中一共展示了ActivityBundle.install_mime_type方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _add_bundle
# 需要導入模塊: from sugar3.bundle.activitybundle import ActivityBundle [as 別名]
# 或者: from sugar3.bundle.activitybundle.ActivityBundle import install_mime_type [as 別名]
def _add_bundle(self, bundle_path, install_mime_type=False):
logging.debug('STARTUP: Adding bundle %r', bundle_path)
try:
bundle = ActivityBundle(bundle_path)
if install_mime_type:
bundle.install_mime_type(bundle_path)
except MalformedBundleException:
logging.exception('Error loading bundle %r', bundle_path)
return None
bundle_id = bundle.get_bundle_id()
installed = self.get_bundle(bundle_id)
if installed is not None:
if NormalizedVersion(installed.get_activity_version()) >= \
NormalizedVersion(bundle.get_activity_version()):
logging.debug('Skip old version for %s', bundle_id)
return None
else:
logging.debug('Upgrade %s', bundle_id)
self.remove_bundle(installed.get_path())
self._bundles.append(bundle)
return bundle