Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/labyrinthactivity.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-04-15 12:35:16 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-04-15 12:35:16 (GMT)
commit0e069dcc5a4a416e679dc5c1a15fd468246bc0f5 (patch)
treee3a0c3f1c055207990bf0f278f66bda421113548 /labyrinthactivity.py
parenta4c97e5c60d93cf7ce42ccf6b191dc376df383d1 (diff)
Back switch to old jobject format
Diffstat (limited to 'labyrinthactivity.py')
-rw-r--r--labyrinthactivity.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/labyrinthactivity.py b/labyrinthactivity.py
index e90450e..16da036 100644
--- a/labyrinthactivity.py
+++ b/labyrinthactivity.py
@@ -32,6 +32,7 @@ from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.radiotoolbutton import RadioToolButton
from sugar.graphics.toggletoolbutton import ToggleToolButton
from sugar.graphics.menuitem import MenuItem
+from port.tarball import Tarball
# labyrinth sources are shipped inside the 'src' subdirectory
sys.path.append(os.path.join(activity.get_bundle_path(), 'src'))
@@ -284,16 +285,16 @@ class LabyrinthActivity(activity.Activity):
self._main_area.grab_focus ()
def read_file(self, file_path):
- zip = ZipFile(file_path, 'r')
+ tar = Tarball(file_path)
- doc = dom.parseString (zip.read('MANIFEST'))
+ doc = dom.parseString (tar.read(tar.getnames()[0]))
top_element = doc.documentElement
self.set_title(top_element.getAttribute ("title"))
self._mode = int (top_element.getAttribute ("mode"))
self._main_area.set_mode (self._mode)
- self._main_area.load_thyself (top_element, doc, zip)
+ self._main_area.load_thyself (top_element, doc, tar)
if top_element.hasAttribute("scale_factor"):
self._main_area.scale_fac = float (top_element.getAttribute ("scale_factor"))
if top_element.hasAttribute("translation"):
@@ -303,19 +304,20 @@ class LabyrinthActivity(activity.Activity):
self.mods[self._mode].set_active(True)
- zip.close()
+ tar.close()
def write_file(self, file_path):
logging.debug('write_file')
- zip = ZipFile(file_path, 'w')
+ tar = Tarball(file_path, 'w')
- self._main_area.update_save(zip)
+ self._main_area.update_save()
manifest = self.serialize_to_xml(self._main_area.save,
self._main_area.element)
- zip.writestr('MANIFEST', manifest)
+ tar.write('MANIFEST', manifest)
+ self._main_area.save_thyself(tar)
- zip.close()
+ tar.close()
def serialize_to_xml(self, doc, top_element):
top_element.setAttribute ("title", self.props.title)