From 52c8b44fd8e32f0748acfbf3871f86a143d769d3 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Tue, 21 Jun 2011 19:47:08 +0000 Subject: Fix merge --- diff --git a/activity.py b/activity.py index 40bde74..40bde74 100644..100755 --- a/activity.py +++ b/activity.py diff --git a/char.py b/char.py index 131c14d..176e4ee 100644 --- a/char.py +++ b/char.py @@ -31,6 +31,7 @@ def load(): [i for i in set(Document.tape) if not i.empty() and i.custom()]): custom.frames[i] = f + class Frame: def __init__(self, id): self.id = id @@ -59,7 +60,8 @@ class Frame: return self._orig def select(self): - return True; + return True + class PreinstalledFrame(Frame): def __init__(self, filename): @@ -74,6 +76,7 @@ class PreinstalledFrame(Frame): self._orig = theme.pixbuf(self._filename) return self._orig + class EmptyFrame(Frame): def __init__(self): Frame.__init__(self, None) @@ -84,13 +87,15 @@ class EmptyFrame(Frame): return False def empty(self): - return True + return True; + class RestoredFrame(Frame): def __init__(self, id, data): Frame.__init__(self, id) self._orig = pixbuf.from_str(data) + class CustomFrame(Frame): def __init__(self): Frame.__init__(self, None) @@ -114,6 +119,7 @@ class CustomFrame(Frame): else: return False + class Char: def __init__(self, name, thumbfile, dir): self.name = name @@ -126,7 +132,7 @@ class Char: self._thumb = theme.pixbuf(thumbfile, theme.THUMB_SIZE) self._custom = False else: - for i in range(0, theme.FRAME_ROWS*theme.FRAME_COLS): + for i in range(0, theme.FRAME_ROWS * theme.FRAME_COLS): self.frames.append(CustomFrame()) self._thumb = theme.CUSTOM_FRAME_THUMB self._custom = True diff --git a/document.py b/document.py index 99f1a04..a7d9e91 100644 --- a/document.py +++ b/document.py @@ -37,17 +37,19 @@ class Document: for i in range(theme.TAPE_COUNT): tape.append(EmptyFrame()) + def clean(index): from char import Frame Document.tape[index] = EmptyFrame() + def save(filepath): tar = Tarball(filepath, 'w') - cfg = { 'ground': {}, - 'sound' : {}, + cfg = {'ground': {}, + 'sound': {}, 'frames': {}, - 'tape' : [] } + 'tape': []} def _save(node, arcname, value): if value.custom(): @@ -79,6 +81,7 @@ def save(filepath): tar.write('MANIFEST', json.dumps(cfg)) tar.close() + def load(filepath): try: tar = Tarball(filepath) diff --git a/ground.py b/ground.py index 25139fe..f1cd069 100644 --- a/ground.py +++ b/ground.py @@ -28,6 +28,7 @@ def load(): if Document.ground and Document.ground.custom(): THEMES.append(Document.ground) + class Ground: def __init__(self, name, id): self.name = name @@ -51,6 +52,7 @@ class Ground: def select(self): return self + class PreinstalledGround(Ground): def __init__(self, name, filename): Ground.__init__(self, name, filename) @@ -59,6 +61,7 @@ class PreinstalledGround(Ground): def custom(self): return False + class CustomGround(Ground): def __init__(self, name, filename): Ground.__init__(self, name, None) @@ -71,11 +74,13 @@ class CustomGround(Ground): except: return None + class RestoredGround(Ground): def __init__(self, name, id, data): Ground.__init__(self, name, id) self._orig = pixbuf.from_str(data) + class JournalGround(Ground): def __init__(self, jobject): Ground.__init__(self, jobject.metadata['title'], jobject.object_id) diff --git a/lessons.py b/lessons.py index 35a6922..e5ece14 100644 --- a/lessons.py +++ b/lessons.py @@ -22,6 +22,7 @@ import theme THEMES = [] + class Lesson: def __init__(self, index, filename): self.index = index @@ -32,6 +33,7 @@ class Lesson: def change(self): View.notebook.set_current_page(self.index) + class View(gtk.EventBox): notebook = None diff --git a/messenger.py b/messenger.py index c03005e..57f6df3 100644 --- a/messenger.py +++ b/messenger.py @@ -31,6 +31,7 @@ SERVICE = 'org.sugarlabs.CartoonBuilder' IFACE = SERVICE PATH = '/org/sugarlabs/CartoonBuilder' + class Slot: def __init__(self, sender=None, raw=None): if sender: @@ -46,7 +47,8 @@ class Slot: def serialize(self): return json.dumps({ 'seqno': self.seqno, - 'oid' : self.oid}) + 'oid': self.oid}) + class Messenger(ExportedGObject): def __init__(self, tube, initiator, view): @@ -87,7 +89,6 @@ class Messenger(ExportedGObject): sender_keyword='sender') self._ping() - self._tube.add_signal_receiver(self._notify_cb, '_notify', IFACE, path=PATH, sender_keyword='sender') self._entered = True @@ -215,14 +216,16 @@ class Messenger(ExportedGObject): def _sound_changed_cb(self, sender, sound): self._send(SOUND, sound.id) -FRAME = 'frame' + +FRAME = 'frame' GROUND = 'ground' -SOUND = 'sound' +SOUND = 'sound' OBJECTS = { - FRAME : char.THEMES[-1].frames, - GROUND : ground.THEMES, - SOUND : sound.THEMES } + FRAME: char.THEMES[-1].frames, + GROUND: ground.THEMES, + SOUND: sound.THEMES} + def object_find(type, oid): if type.startswith(FRAME): @@ -238,6 +241,7 @@ def object_find(type, oid): return i return None + def object_new(type, oid, name, raw): logger.debug('add new object type=%s oid=%s' % (type, oid)) @@ -257,6 +261,7 @@ def object_new(type, oid, name, raw): OBJECTS[type.split(':')[0]].append(object) + def object_serialize(type, oid): object = object_find(type, oid) @@ -267,6 +272,7 @@ def object_serialize(type, oid): % (type, oid)) return ('', '') + def object_select(view, type, oid): if oid: object = object_find(type, oid) diff --git a/theme.py b/theme.py index e29d0af..1591be8 100644 --- a/theme.py +++ b/theme.py @@ -16,7 +16,6 @@ import os import gtk import shutil from math import ceil -from gettext import gettext as _ from sugar.activity.activity import get_bundle_path, get_activity_root from sugar.graphics import style diff --git a/utils.py b/utils.py index fdf7e95..cb5b53f 100644 --- a/utils.py +++ b/utils.py @@ -22,13 +22,14 @@ from sugar.graphics.combobox import ComboBox as _ComboBox from theme import * + class ComboBox(_ComboBox): def __init__(self): _ComboBox.__init__(self) self.set_name('we-really-need-it-to-use-custom-combobox-colors') - def append_item(self, action_id, text = None, icon_name = None, size = None, - pixbuf = None, position = None): + def append_item(self, action_id, text=None, icon_name=None, size=None, + pixbuf=None, position=None): if not self._icon_renderer and (icon_name or pixbuf): self._icon_renderer = gtk.CellRendererPixbuf() -- cgit v0.9.1