Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pippy_app.py
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2007-12-19 23:11:34 (GMT)
committer C. Scott Ananian <cscott@laptop.org>2007-12-19 23:23:30 (GMT)
commit4d4c6604b932b8d7be477a0151f651944e739c30 (patch)
tree4e46f1c795e0d1364850b46dc83dca6a7158dad7 /pippy_app.py
parentb0b4bac7d787b71b34bb65cecc5dd7584977d92a (diff)
Add new p_a_extra_info magic; install activity.py helper when we run.
Some activities want to put crazy custom stuff into their activity.info file; the new pippy_activity_extra_info() method gives them the backdoor they need to do this. I also renamed pippy_activity_extrafiles to pippy_activity_extra_files for consistency. Also, Pippy and Chat (and other activities that subclass ViewSourceActivity) want to have the stock pippy activity.py file available when they run, so that the imports work properly. Put it there when you click 'run'.
Diffstat (limited to 'pippy_app.py')
-rw-r--r--pippy_app.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/pippy_app.py b/pippy_app.py
index 7fdc1ff..1e7bc56 100644
--- a/pippy_app.py
+++ b/pippy_app.py
@@ -249,6 +249,7 @@ class PippyActivity(ViewSourceActivity):
self._vte.feed("\x1B[H\x1B[J\x1B[0;39m")
def gobutton_cb(self, button):
+ from shutil import copy2
self.stopbutton_cb(button) # try stopping old code first.
self._reset_vte()
@@ -257,6 +258,9 @@ class PippyActivity(ViewSourceActivity):
pippy_app_name = '%s/tmp/pippy_app.py' % self.get_activity_root()
self._write_text_buffer(pippy_app_name)
+ # write activity.py here too, to support pippy-based activities.
+ copy2('%s/activity.py' % get_bundle_path(),
+ '%s/tmp/activity.py' % self.get_activity_root())
self._pid = self._vte.fork_command \
(command="/bin/sh",
@@ -597,6 +601,7 @@ icon = activity-icon
activity_version = %(version)d
mime_types = %(mime_types)s
show_launcher = yes
+%(extra_info)s
"""
PIPPY_ICON = \
@@ -632,7 +637,7 @@ PIPPY_DEFAULT_ICON = \
def pippy_activity_version():
"""Returns the version number of the generated activity bundle."""
return 14
-def pippy_activity_extrafiles():
+def pippy_activity_extra_files():
"""Returns a map of 'extra' files which should be included in the
generated activity bundle."""
# Cheat here and generate the map from the fs contents.
@@ -695,12 +700,13 @@ def main():
# things we look for:
bundle_info = {
'version': 1,
- 'extrafiles': {},
+ 'extra_files': {},
'news': 'No news.',
'icon': PIPPY_DEFAULT_ICON,
'class': 'activity.VteActivity',
'bundle_id': ('org.laptop.pippy.%s' % pytitle),
'mime_types': '',
+ 'extra_info': '',
}
# are any of these things in the module?
try_import = False
@@ -730,13 +736,13 @@ def main():
bundle_info['title'] = title
bundle_info['pytitle'] = pytitle
# put 'extra' files in place.
- extrafiles = {
+ extra_files = {
'activity/activity.info': ACTIVITY_INFO_TEMPLATE % bundle_info,
'activity/activity-icon.svg': bundle_info['icon'],
'NEWS': bundle_info['news'],
}
- extrafiles.update(bundle_info['extrafiles'])
- for path, contents in extrafiles.items():
+ extra_files.update(bundle_info['extra_files'])
+ for path, contents in extra_files.items():
# safety first!
assert '..' not in path
dirname, filename = os.path.split(path)