From 4d3670ccd35eabbd3084ed932a3dffb0c23ff064 Mon Sep 17 00:00:00 2001 From: Lincoln Quirk Date: Tue, 28 Aug 2007 21:31:59 +0000 Subject: Add load/save to journal. (flawed) You can resume from the Journal, but if you load an example, your work is lost. --- (limited to 'activity.py') 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') -- cgit v0.9.1