[Sugar-devel] GSoC Update: SharedTextDemo-3

Benjamin M. Schwartz bmschwar at fas.harvard.edu
Mon Jun 22 22:56:38 EDT 2009

Hash: SHA1

SharedTextDemo-3 is available at

This version introduces saving to and loading from the Journal.  The
contents of the textbox are saved to the Journal, and loaded back in when
you relaunch the program.  This may not sound like a very impressive
feature, but consider the source code of the activity (in its entirety):

from groupthink import sugar_tools, gtk_tools
import sugar

class SharedTextDemoActivity(sugar_tools.GroupActivity):
    def initialize_display(self):
        self.cloud.textview = gtk_tools.SharedTextView()
        return self.cloud.textview

The self.cloud object takes care not only of sharing the TextView over the
network, live, but also of serializing it to disk on save, and
deserializing it on load.  At 6 lines of code, this system is finally
approaching a level of boilerplate I would consider acceptable for users
to build their own activities.*

In addition to working Journal persistence, this version also adds (very
simple) wait screens.  With wait screens, the user is not left at the
pulsing activity icon during slow actions, like loading a large journal
entry or joining a shared session.  Instead, the activity displays a
message informing the user of its current status as soon as possible after
launch.  Naturally, both automatic load/save and wait screens are
available to any activity using Groupthink, not just SharedTextDemo.

- --Ben

*: There is admittedly a tradeoff here between flexibility and magic.
self.cloud, providing magic load/save and sharing, will only accept
objects of appropriate type, drawn from the groupthink library.  This
means that users must code with an understanding of the types of the
objects they are using.
Version: GnuPG v2.0.11 (GNU/Linux)


More information about the Sugar-devel mailing list