Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorLincoln Quirk <lincoln@techhouse.org>2007-08-28 21:31:59 (GMT)
committer Chris Ball <cjb@pullcord.laptop.org>2007-08-28 21:31:59 (GMT)
commit4d3670ccd35eabbd3084ed932a3dffb0c23ff064 (patch)
tree6db9b2651fc9d4d92f8b332fbc883641409641be /activity.py
parent08eac8285af137297469962bf8e94297c3554002 (diff)
Add load/save to journal. (flawed)
You can resume from the Journal, but if you load an example, your work is lost.
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/activity.py b/activity.py
index 451f222..165f8c2 100644
--- a/activity.py
+++ b/activity.py
@@ -205,6 +205,17 @@ class PippyActivity(Activity):
file.close()
pid = self._vte.fork_command("/bin/sh", ["/bin/sh", "-c", "python /tmp/pippy.py; sleep 1"])
+
+ def write_file(self, file_path):
+ self.metadata['mime_type'] = 'text/x-python'
+ start, end = self.text_buffer.get_bounds()
+ text = self.text_buffer.get_text(start, end)
+ file = open(file_path, 'w')
+ file.write(text)
+
+ def read_file(self, file_path):
+ text = open(file_path).read()
+ self.text_buffer.set_text(text)
def _shared_cb(self, activity):
self._logger.debug('My activity was shared')