Do not use the translated summary to get the value from gettext in the bundle builder
This patch is a rebased push from pull request #31 Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
This commit is contained in:
parent
1f5e39f3a8
commit
58bab9cf6a
@ -82,9 +82,10 @@ class Config(object):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.bundle = bundle = ActivityBundle(self.source_dir)
|
self.bundle = bundle = ActivityBundle(self.source_dir,
|
||||||
|
translated=False)
|
||||||
self.version = bundle.get_activity_version()
|
self.version = bundle.get_activity_version()
|
||||||
self.activity_name = bundle.get_bundle_name()
|
self.activity_name = bundle.get_name()
|
||||||
self.bundle_id = bundle.get_bundle_id()
|
self.bundle_id = bundle.get_bundle_id()
|
||||||
self.summary = bundle.get_summary()
|
self.summary = bundle.get_summary()
|
||||||
self.bundle_name = reduce(operator.add, self.activity_name.split())
|
self.bundle_name = reduce(operator.add, self.activity_name.split())
|
||||||
|
@ -92,13 +92,12 @@ class ActivityBundle(Bundle):
|
|||||||
_unzipped_extension = '.activity'
|
_unzipped_extension = '.activity'
|
||||||
_infodir = 'activity'
|
_infodir = 'activity'
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path, translated=True):
|
||||||
Bundle.__init__(self, path)
|
Bundle.__init__(self, path)
|
||||||
self.activity_class = None
|
self.activity_class = None
|
||||||
self.bundle_exec = None
|
self.bundle_exec = None
|
||||||
|
|
||||||
self._name = None
|
self._name = None
|
||||||
self._local_name = None
|
|
||||||
self._icon = None
|
self._icon = None
|
||||||
self._bundle_id = None
|
self._bundle_id = None
|
||||||
self._mime_types = None
|
self._mime_types = None
|
||||||
@ -107,23 +106,17 @@ class ActivityBundle(Bundle):
|
|||||||
self._activity_version = '0'
|
self._activity_version = '0'
|
||||||
self._installation_time = os.stat(path).st_mtime
|
self._installation_time = os.stat(path).st_mtime
|
||||||
self._summary = None
|
self._summary = None
|
||||||
self._local_summary = None
|
|
||||||
|
|
||||||
info_file = self.get_file('activity/activity.info')
|
info_file = self.get_file('activity/activity.info')
|
||||||
if info_file is None:
|
if info_file is None:
|
||||||
raise MalformedBundleException('No activity.info file')
|
raise MalformedBundleException('No activity.info file')
|
||||||
self._parse_info(info_file)
|
self._parse_info(info_file)
|
||||||
|
|
||||||
|
if translated:
|
||||||
linfo_file = self._get_linfo_file()
|
linfo_file = self._get_linfo_file()
|
||||||
if linfo_file:
|
if linfo_file:
|
||||||
self._parse_linfo(linfo_file)
|
self._parse_linfo(linfo_file)
|
||||||
|
|
||||||
if self._local_name == None:
|
|
||||||
self._local_name = self._name
|
|
||||||
|
|
||||||
if self._local_summary == None:
|
|
||||||
self._local_summary = self._summary
|
|
||||||
|
|
||||||
def _parse_info(self, info_file):
|
def _parse_info(self, info_file):
|
||||||
cp = ConfigParser()
|
cp = ConfigParser()
|
||||||
cp.readfp(info_file)
|
cp.readfp(info_file)
|
||||||
@ -209,10 +202,10 @@ class ActivityBundle(Bundle):
|
|||||||
section = 'Activity'
|
section = 'Activity'
|
||||||
|
|
||||||
if cp.has_option(section, 'name'):
|
if cp.has_option(section, 'name'):
|
||||||
self._local_name = cp.get(section, 'name')
|
self._name = cp.get(section, 'name')
|
||||||
|
|
||||||
if cp.has_option(section, 'summary'):
|
if cp.has_option(section, 'summary'):
|
||||||
self._local_summary = cp.get(section, 'summary')
|
self._summary = cp.get(section, 'summary')
|
||||||
|
|
||||||
if cp.has_option(section, 'tags'):
|
if cp.has_option(section, 'tags'):
|
||||||
tag_list = cp.get(section, 'tags').strip(';')
|
tag_list = cp.get(section, 'tags').strip(';')
|
||||||
@ -236,10 +229,6 @@ class ActivityBundle(Bundle):
|
|||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
"""Get the activity user-visible name."""
|
"""Get the activity user-visible name."""
|
||||||
return self._local_name
|
|
||||||
|
|
||||||
def get_bundle_name(self):
|
|
||||||
"""Get the activity bundle name."""
|
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
def get_installation_time(self):
|
def get_installation_time(self):
|
||||||
@ -289,7 +278,7 @@ class ActivityBundle(Bundle):
|
|||||||
|
|
||||||
def get_summary(self):
|
def get_summary(self):
|
||||||
"""Get the summary that describe the activity"""
|
"""Get the summary that describe the activity"""
|
||||||
return self._local_summary
|
return self._summary
|
||||||
|
|
||||||
def get_show_launcher(self):
|
def get_show_launcher(self):
|
||||||
"""Get whether there should be a visible launcher for the activity"""
|
"""Get whether there should be a visible launcher for the activity"""
|
||||||
|
Loading…
Reference in New Issue
Block a user