Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Bert Freudenberg
On 11.06.2008, at 02:34, Eben Eliason wrote:

> I vote for:
> -
> Resume
> -
> Resume in  >
> -
>
> ...for instances, and...
>
> -
> Start
> -
> Open in>
> -
>
> The submenu can then contain:
>
> -
> Paint (default)
> -
> Other 1
> Other 2
> ...
> -
>
> Another option, assuming we have (or gain) the ability to apply labels
> to menu dividers, is to add a "resume with" or "open with" label to
> the divider, and then simply group the available activities below
> that.  (This amounts to what we have now, but with the added
> indication that the action taken with respect to the activities in the
> list is eg. "resume with".


I'm late to this thread so forgive me if I missed some semantic  
discussion, but ...

Isn't "resume with" an oxymoron? "Resuming" an activity means we  
continue to do what we were doing. Instances of activities are the  
verbs of our interface language, and documents/people/other objects  
are the nouns. Using a different activity to continue to work on an  
object cannot be called "resuming" because it is a different verb even  
though the noun stays the same. It doesn't even work grammatically,  
"resume with " is not proper English, is it?

Ideally we'd have actual verbs in the menu, which would make helpers  
like "start", "open", "resume" unnecessary. Or would this be taking  
the metaphor too far?

- Bert -


___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] review: Guillaume's 'activity' branch of Gadget

2008-06-11 Thread Guillaume Desmottes
Le mardi 10 juin 2008 à 14:42 +0100, Dafydd Harries a écrit : 
> > diff --git a/gadget/component.py b/gadget/component.py
> > index b5fc702..dd85a03 100644
> > --- a/gadget/component.py
> > +++ b/gadget/component.py
> > @@ -92,8 +92,9 @@ class Room(object):
> >  def __init__(self, own_nick):
> >  self.own_nick = own_nick
> >  self.membership = None
> > -self.members = {}
> > +self.members = set()
> >  self.properties = {}
> > +self.id = None
> >  
> 
> Would it be possible to just have a Room.activity property and use that to
> store members/id?
> 

I'll remove the Room object and move membership management to Activity
as we discussed yesterday.


> >  class GadgetService(component.Service):
> >  debug = False
> > @@ -333,7 +334,7 @@ class GadgetService(component.Service):
> >  def message(self, stanza):
> >  type = stanza.getAttribute('type', 'normal')
> >  
> > -if type in ('chat', 'groupchat'):
> > +if type in ('chat'):
> >  return
> 
> This doesn't do quite what you want. "()" doesn't create a tuple, "," does, so
> this is the same as "type in 'chat'", which will be true if type is a
> substring of "chat". Better to just say "==".
> 

Right. Forgot about that, good catch. Fixed.

> >  
> >  if type == 'normal':
> > @@ -343,12 +344,17 @@ class GadgetService(component.Service):
> >  return
> >  elif (elem.uri == ns.ACTIVITY_PROP and
> >elem.name == 'properties'):
> > -self.message_activity_properties(stanza, elem)
> > +self.message_pre_invite_activity_properties(stanza, 
> > elem)
> >  return
> >  elif elem.uri == ns.PUBSUB_EVENT and elem.name == 'event':
> >  self.message_pubsub_notification(stanza, elem)
> >  return
> >  
> > +elif type == 'groupchat':
> > +for elem in stanza.elements():
> > +if elem.uri == ns.ACTIVITY_PROP and elem.name == 
> > 'properties':
> > +self.message_activity_properties(stanza, elem)
> 
> You should return here. Perhaps we should dispatch messages more like we
> dispatch IQs, i.e. using a dict.
> 

fixed. I added a FIXME suggestion a better dispatch system.

> > +
> >  # FIXME: handle close query stanza
> >  log.msg('got unhandled ')
> >  
> > @@ -357,7 +363,7 @@ class GadgetService(component.Service):
> >  if elem.uri == ns.MUC_USER and elem.name == 'invite':
> >  self.message_muc_invite(stanza, elem)
> >  
> > -def create_room(self, jid, properties):
> > +def create_room(self, jid, properties, id):
> 
> Hmm, can we put the id before the properties? I think it's more aesthetically
> pleasing that way.
> 

done.

> >  if jid in self.mucs:
> >  # We already have a room by this name.
> >  return
> > @@ -366,9 +372,10 @@ class GadgetService(component.Service):
> >  # join it.
> >  room = Room('inspector')
> >  room.properties = properties
> > +room.id = id
> >  self.mucs[jid] = room
> >  
> > -def message_activity_properties(self, stanza, properties_elem):
> > +def message_pre_invite_activity_properties(self, stanza, 
> > properties_elem):
> >  # XXX Restrictions on from address?
> >  
> >  try:
> > @@ -384,7 +391,7 @@ class GadgetService(component.Service):
> >  if not (properties and activity and room_jid):
> >  return
> >  
> > -self.create_room(room_jid, properties)
> > +self.create_room(room_jid, properties, activity)
> 
> Perhaps we should rename 'activity' to 'activity_id' for clarity.
> 

done.

> >  def message_muc_invite(self, stanza, invite):
> >  to = stanza.getAttribute('to')
> > @@ -502,17 +509,54 @@ class GadgetService(component.Service):
> >  # Presence for our in-room self; we've finished joining the
> >  # room.
> >  room.membership = 'joined'
> > +
> > +# activities are created and added to the model when the
> > +# inspector actually joined the muc.
> 
> English nitpicks: Your tenses don't agree here. "are created" ... "joined".
> s/joined/join/. If you use a full stop, you should also capitalise the first
> letter.
> 

fixed.

> > +# If we'll do it before, we won't be able to properly track
> > +# activity's properties and members.
> 
> I don't understand this comment.
> 

Humm me neither actually :) Removed.

> > +activity = self.model.activity_add(room.id, room_jid,
> > +room.properties)
> > +
> > +# Activity and Room now share the same set() object
> > +activity.members = room.members
> >  return
> >  
> > +item = xpath_query('/p

Re: [sugar] [PATCH] to Browse activity; trac #6250

2008-06-11 Thread Simon Schampijer
Hi Erik,

thanks for the patch! Can you describe the steps involved to reproduce what the 
patch is going to fix?
For me these steps work without the patch applied: 
http://dev.laptop.org/ticket/6250#comment:5 (accessing local files and online 
mode 
when the link is present again)
Not saying that the patch is not worth it just want to understand.

And please follow the review guidelines 
http://wiki.sugarlabs.org/go/DevelopmentTeam/CodeReview next time (not push 
before 
the review).

Thanks,
Simon

Erik Garrison wrote:
> The following patch resolves trac #6250 (and #6999).
> 
> I have tested and pushed the patch into the web-activity git repo.
> 
> 
>>From 9e3c4d01dc2b368ef0636cce598dd655446fb883 Mon Sep 17 00:00:00 2001
> From: Erik Garrison <[EMAIL PROTECTED]>
> Date: Tue, 10 Jun 2008 14:29:17 -0400
> Subject: [PATCH] To resolve trac 6250, we disable browser detection of 
> offline mode using xpcom.
> 
> ---
>  browser.py |5 +
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/browser.py b/browser.py
> index f57bafa..208ff93 100644
> --- a/browser.py
> +++ b/browser.py
> @@ -83,6 +83,11 @@ class Browser(WebView):
>  "@mozilla.org/network/io-service;1"]
>  io_service = io_service_class.getService(interfaces.nsIIOService)
>  
> +# Use xpcom to turn off "offline mode" detection, which disables
> +# access to localhost for no good reason.  (Trac #6250.)
> +io_service2 = io_service_class.getService(interfaces.nsIIOService2)
> +io_service2.manageOfflineStatus = False
> +
>  cls = 
> components.classes['@mozilla.org/content/style-sheet-service;1']
>  style_sheet_service = cls.getService(interfaces.nsIStyleSheetService)
>  
> 
> 
> 
> 
> ___
> Sugar mailing list
> Sugar@lists.laptop.org
> http://lists.laptop.org/listinfo/sugar

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Michael Stone
On Wed, Jun 11, 2008 at 10:58:54AM +0200, Bert Freudenberg wrote:
> Isn't "resume with" an oxymoron? 

Yes. I refer you to the grammar discussion we had a few weeks ago:

  
http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_2#Grammar_and_Criticism

(also see the diagram at the top of 

  http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_1
)

Michael
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Eben Eliason
On Wed, Jun 11, 2008 at 9:52 AM, Michael Stone <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 11, 2008 at 10:58:54AM +0200, Bert Freudenberg wrote:
>> Isn't "resume with" an oxymoron?

Nearly so, yes.  I admit openly that this is bad grammar, but have yet
to discover better terminology. "Open with", "Resume in", "Resume
with", "Resume as"; they are all bad.  Maybe something like "Convert
to" or "Translate to" is more appropriate, but still pretty terrible.
The heart of the matter, as the dialogue Michael linked to reveals, is
that instances are like closures where the metadata serves as the
bound variables.  The activity is part of this context, and so
swapping out this or that variable in the closure feels wrong.  In
fact, it might /be/ wrong.  What we might really mean to say, with the
action/object split, is "take a specific object from within this
closure and act on it within some other activity."  This is something
that could be done easily from the object view, since there we look
only at the objects themselves, and not at the actions/instances.
This also makes it trivial to choose the specific object desired
directly.  It might also open up the possibility, via the palette of
an object inside an action/instance, to perform "modify in place" type
operations. (But let's table that discussion entirely for now!)

The question to ask ourselves here is if this split can be made
intuitive to kids.  It might be the answer to the question, really.
Once we have the new designs of the Journal in place, every action can
be expanded to reveal its associated objects.  If we drop the "primary
object" notion discussed before, and instead /always/ show /every/
associated object /in addition to/ the instance itself (where the
instance is represented by the colored activity icon, and the object
is represented as distinct from that...I have new mockups to reveal
this idea), then it would be relatively trivial to resume the instance
by clicking it (the activity icon), act on the object with the default
activity by clicking it (the object icon), or act on the object with
some other activity by selecting from its palette.  Actually, writing
this, it almost makes too much sense to do things this way, as it
always associates the activity icon with a specific activity (You
can't right click on a paint activity icon and morph it into a draw
activity).  We can attach the "open with" type functionality to the
objects themselves, instead of the instance, and solve the issue
rather painlessly.  It's not too much of a discoverability/usability
issue because  the ability to expand actions/instances reveals the
objects contained within in the same view. What does everyone think?

- Eben

PS. I know there was resistance to the notion of a "primary object"
before as well, and Bert was among those speaking against it.  I
apologize that I was blind to the benefits of your perspective!



> Yes. I refer you to the grammar discussion we had a few weeks ago:
>
>  
> http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_2#Grammar_and_Criticism
>
> (also see the diagram at the top of
>
>  http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_1
> )
>
> Michael
>
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Jameson "Chema" Quinn
re "open with", etc.

In English, I think the best construction is "  this",
where  is usually but not always the activity name, and preposition is
activity-specific. Paint on this, rewrite this, read this, browse from this,
etc. With the icon as an extra clue to meaning. In general, the phrase will
not be able to just use the activity name - to begin with, verbs in other
languages need conjugation whereas the activity name will be infinitive. So
I think that this should be another line in activity.info, and there should
be no %s for munging in the "this" (in some languages, this could change
depending on the surrounding words, like a/an in English). If the
activity-specific string is missing from activity.info, Glucose should
default to ("%s with this" % activityname).
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] to Browse activity; trac #6250

2008-06-11 Thread Erik Garrison
This test follows from my discussion with Chris Ball.

On 703:

1) Connect to an AP.
2) Run browse
3) Suspend the laptop (causing NM to go offline).
4) Un-suspend the laptop.
5) Note that the browser is now in offline mode, but there is no way to
access the menu to put it back in online mode.

Apply patch.  Note that offline mode no longer occurs.

Please tell me if this is not reproducible.

Erik


On Wed, Jun 11, 2008 at 01:33:47PM +0200, Simon Schampijer wrote:
> Hi Erik,
>
> thanks for the patch! Can you describe the steps involved to reproduce 
> what the patch is going to fix?
> For me these steps work without the patch applied:  
> http://dev.laptop.org/ticket/6250#comment:5 (accessing local files and 
> online mode when the link is present again)
> Not saying that the patch is not worth it just want to understand.
>
> And please follow the review guidelines  
> http://wiki.sugarlabs.org/go/DevelopmentTeam/CodeReview next time (not 
> push before the review).
>
> Thanks,
>Simon
>
> Erik Garrison wrote:
>> The following patch resolves trac #6250 (and #6999).
>>
>> I have tested and pushed the patch into the web-activity git repo.
>>
>>
>>> From 9e3c4d01dc2b368ef0636cce598dd655446fb883 Mon Sep 17 00:00:00 2001
>> From: Erik Garrison <[EMAIL PROTECTED]>
>> Date: Tue, 10 Jun 2008 14:29:17 -0400
>> Subject: [PATCH] To resolve trac 6250, we disable browser detection of 
>> offline mode using xpcom.
>>
>> ---
>>  browser.py |5 +
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/browser.py b/browser.py
>> index f57bafa..208ff93 100644
>> --- a/browser.py
>> +++ b/browser.py
>> @@ -83,6 +83,11 @@ class Browser(WebView):
>>  "@mozilla.org/network/io-service;1"]
>>  io_service = io_service_class.getService(interfaces.nsIIOService)
>>  +# Use xpcom to turn off "offline mode" detection, which 
>> disables
>> +# access to localhost for no good reason.  (Trac #6250.)
>> +io_service2 = io_service_class.getService(interfaces.nsIIOService2)
>> +io_service2.manageOfflineStatus = False
>> +
>>  cls = 
>> components.classes['@mozilla.org/content/style-sheet-service;1']
>>  style_sheet_service = 
>> cls.getService(interfaces.nsIStyleSheetService)
>>  
>>
>>
>> 
>>
>> ___
>> Sugar mailing list
>> Sugar@lists.laptop.org
>> http://lists.laptop.org/listinfo/sugar
>
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Benjamin M. Schwartz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have a proposal for how to manage objects in the datastore, to resolve
the various issues we have discussed.  I call it the "Objects and
Translators" model.  The fundamental idea is this: the datastore is a
flat, non-hierarchical listing of objects (versioned, but that does not
come into play here).  The datastore provides these objects for use by
Activities.  However, the datastore (or perhaps the Journal) also contains
a new element: Translators.

A Translator is a non-interactive object processing machine that takes an
object as input and returns a set of objects as output.  Each Translator
has a specified set of input types on which it can act.  The user, having
selected a particular object, should be provided with a list of all
compatible Translators.  Clicking on a Translator should show the list of
output objects that Translator would generate for this input object, and
the user may repeat this process on each of those objects as well.

This model allows us to reproduce the usual sorts of directory
hierarchies, simply by using a group object (I think of it as a .tar file)
and an untar Translator.  To the user, this looks very much like a
directory hierarchy.  However, because each "directory" is in fact a
first-class object, it can also be associated with Activity instances, or
passed from one XO to another over the network, etc.

The Translator system is appealing to me because it can provide far more
than a simple storage hierarchy.  For example, I have often had to extract
a particular image from a PDF file, in order to include it in a class
project.  I, and most people, have done this by blowing up the image and
performing "Print Screen", or perhaps opening the PDF in the GIMP, which
rasterizes it.  However, there is a much better solution, provided by
xpdf's command-line utils, which allows one to split a PDF into its
component images and text, losslessly.

Almost nobody uses these tools, because they are command-line only, and
obscure.  It would be trivial to wrap them up into a Translator, though,
and then every PDF, in addition to showing options for viewing in Read,
would show an option for splitting into it components, for further
editing.  Nothing could be more in keeping with our goal of creating an
editable world.

You can easily think of many other interesting Translators.  For example,
one could also provide a PDF->PNG rasterizer, a ODT->PDF renderer, or a
Theora->JPG frames decompressor.  The APIs should be designed so that
Translators can be lazy, computing the contents of output objects only
when necessary.

Translators provide tremendously powerful object management, with a simple
path to implementation.

- --Ben
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhP8SkACgkQUJT6e6HFtqRQrACfcd5ntZ1ZXovZtTVI5k4LEG96
oDwAnjswhuiV1uKJ5cWhVV9N6uFNgT6E
=x7ie
-END PGP SIGNATURE-
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH] Persist position of favorite icons

2008-06-11 Thread Tomeu Vizoso
Hi,

these two patches are the continuation of the work to implement a new
favorites screen in the home view.

Thanks,

Tomeu
From 40bdb87d43d0644edf62e1e727b6e936ccf7b00d Mon Sep 17 00:00:00 2001
From: Tomeu Vizoso <[EMAIL PROTECTED](none)>
Date: Wed, 11 Jun 2008 17:38:17 +0200
Subject: [PATCH] Persist position of favorite icons

---
 service/activityregistryservice.py |   12 -
 service/bundleregistry.py  |  106 ++--
 src/view/home/activitiesring.py|   36 ++---
 3 files changed, 117 insertions(+), 37 deletions(-)

diff --git a/service/activityregistryservice.py b/service/activityregistryservice.py
index bf98ef9..a42eae0 100644
--- a/service/activityregistryservice.py
+++ b/service/activityregistryservice.py
@@ -109,6 +109,12 @@ class ActivityRegistry(dbus.service.Object):
 registry = bundleregistry.get_registry()
 registry.set_bundle_favorite(bundle_id, version, favorite)
 
+@dbus.service.method(_ACTIVITY_REGISTRY_IFACE,
+ in_signature='siii', out_signature='')
+def SetActivityPosition(self, bundle_id, version, x, y):
+registry = bundleregistry.get_registry()
+registry.set_bundle_position(bundle_id, version, x, y)
+
 @dbus.service.signal(_ACTIVITY_REGISTRY_IFACE, signature='a{sv}')
 def ActivityAdded(self, activity_info):
 pass
@@ -125,6 +131,8 @@ class ActivityRegistry(dbus.service.Object):
 registry = bundleregistry.get_registry()
 favorite = registry.is_bundle_favorite(bundle.get_bundle_id(),
bundle.get_activity_version())
+x, y = registry.get_bundle_position(bundle.get_bundle_id(),
+bundle.get_activity_version())
 return {'name': bundle.get_name(),
 'icon': bundle.get_icon(),
 'bundle_id': bundle.get_bundle_id(),
@@ -133,7 +141,9 @@ class ActivityRegistry(dbus.service.Object):
 'command': bundle.get_command(),
 'show_launcher': bundle.get_show_launcher(),
 'favorite': favorite,
-'installation_time': bundle.get_installation_time()}
+'installation_time': bundle.get_installation_time(),
+'position_x': x,
+'position_y': y}
 
 def _bundle_added_cb(self, bundle_registry, bundle):
 self.ActivityAdded(self._bundle_to_dict(bundle))
diff --git a/service/bundleregistry.py b/service/bundleregistry.py
index 8b7f09b..e7c30a8 100644
--- a/service/bundleregistry.py
+++ b/service/bundleregistry.py
@@ -16,6 +16,7 @@
 
 import os
 import logging
+import traceback
 
 import gobject
 import simplejson
@@ -48,7 +49,14 @@ class BundleRegistry(gobject.GObject):
 self._scan_directory(activity_dir)
 
 self._last_defaults_mtime = -1
-self._favorite_bundles = self._load_favorites()
+self._favorite_bundles = {}
+
+try:
+self._load_favorites()
+except Exception, e:
+logging.error('Error while loading favorite_activities\n%s.' \
+% traceback.format_exc())
+
 self._merge_default_favorites()
 
 def _get_activity_directories(self):
@@ -74,24 +82,34 @@ class BundleRegistry(gobject.GObject):
 
 return defaults
 
+def _get_favorite_key(self, bundle_id, version):
+"""We use a string as a composite key for the favorites dictionary
+because JSON doesn't support tuples and python won't accept a list
+as a dictionary key.
+"""
+if ' ' in bundle_id:
+raise ValueError('bundle_id cannot contain spaces')
+return '%s %s' % (bundle_id, version)
+
 def _load_favorites(self):
-favorite_bundles = []
 favorites_path = env.get_profile_path('favorite_activities')
 if os.path.exists(favorites_path):
-try:
-favorites_data = simplejson.load(open(favorites_path))
-except ValueError, e:
-logging.error('Error while loading favorite_activities: %r.' %
-  e)
-else:
-# Old structure used to be a list, instead of a dictionary.
-if isinstance(favorites_data, list):
-favorite_bundles = favorites_data
-else:
-favorite_bundles = favorites_data['favorites']
-self._last_defaults_mtime = favorites_data['defaults-mtime']
+favorites_data = simplejson.load(open(favorites_path))
+
+favorite_bundles = favorites_data['favorites']
+if not isinstance(favorite_bundles, dict):
+raise ValueError('Invalid format in %s.' % favorites_path)
+if favorite_bundles:
+first_key = favorite_bundles.keys()[0]
+if not isinstance(first_key, basestring):
+raise ValueErro

Re: [sugar] [PATCH] to Browse activity; trac #6250

2008-06-11 Thread Simon Schampijer
Erik Garrison wrote:
> This test follows from my discussion with Chris Ball.
> 
> On 703:
> 
> 1) Connect to an AP.
> 2) Run browse
> 3) Suspend the laptop (causing NM to go offline).
> 4) Un-suspend the laptop.
> 5) Note that the browser is now in offline mode, but there is no way to
> access the menu to put it back in online mode.

Did you try to enter a new url or hit reload when you are connected again? This 
works fine for me. And I can access local pages fine as well.

Best,
Simon

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Make the favorite activity icons draggable

2008-06-11 Thread Simon Schampijer
The patch looks good to me r+.

Simon

Tomeu Vizoso wrote:
> Hi,
> 
> this patch adds the ability to drag activity icons out from the ring.
> 
> Thanks,
> 
> Tomeu
> 
> 
> 
> 
> ___
> Sugar mailing list
> Sugar@lists.laptop.org
> http://lists.laptop.org/listinfo/sugar

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Michael Stone
On Wed, Jun 11, 2008 at 11:37:13AM -0400, Benjamin M. Schwartz wrote:

Cute. Incidental thought: is performing a translation an action? (If so,
then when new versions of the source objects become available, it might
be straightforward to "replay" the action on the new version of the
sources.) Secondary thought: if translating is an action, then have we
simply produced transient or instantaneous activities which have no GUI?

To me, the interesting claim is that these "transient activities" (or
translators, if you think they're different) should be able to advertise
that they can turn types A into (potentially) B, C, and D.) (If we
expect the activities to be able to read the user's data in order to
state make this determination, then we have even greater incentive to
implement the Bitfrost P_DOCUMENT_RO and P_NETWORK protections - they
seem to be ideally suited to this use case.)

 (Jill: "But Jack, what about Translators that require network access to
 function?"
  Jack: "I'm so glad you asked, Jill! In fact, ...")

Michael
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] bundles and parts (was Re: [PATCH] Journal able to use "open with" for activity bundles)

2008-06-11 Thread Jameson "Chema" Quinn
The "objects and translators" model, as described, does not have any easy
way to retar a bundle; nor is it easy to figure out how to assign different
mime types to different "kinds" of tar files (this one is a web page, that
one is an activity bundle). Note that the "rebundle" problem is not so
trivial - what do you do with the metadata on the subfiles?

Let me try to sketch out the problem of bundles, with everything a good
solution should enable.

1. In journal, the "most default" view shows only bundles, is not cluttered
with all subfiles.
2. Bundles have their own metadata, and a mime-type that reflects their
holistic nature (a set of photos, a web page, an activity)
3. Subfiles inherit (some?) bundle metadata, but can also have their own
metadata.
4. Some subfiles, which make no sense on their own, are hidden by default
(dotted files)
5. Possible to grab a piece of a bundle and start treating it as a separate
top-level object.
6. Possible to edit a piece of a bundle as if it were a top-level object,
yet keep it as part of the bundle. This creates a new version of the whole
bundle, with the edited file.
7. Possible to take a top-level object and add it to a bundle.
8. Possible to remove (delete) an object from a bundle.
9. Possible to import/ export bundles as single files (zip/tar) to external
media/over the net
10. Possible to import/export bundles as directories to external media.
11. For easier porting of legacy apps: ability to open a subfile in context,
with the directory structure of the bundle extracted, so that relative paths
work.

...

I think it is clear from the above list that moving back and forth from
bundle to file view should be as transparent as possible. Internal storage
could be as separate files or as zipped/tarred groups; either way, there
would need to be a storage of stubs/pointers to stand in for the other
model.

Here's one proposal to kick things off:
External format:
metadata for a traditional file is represented on external media by an
invisible file in the same directory, with a related name, which contains
json.
bundles are represented on external media by a zip, which politely extracts
itself to a subdirectory.
metadata for bundles is represented by an invisible file next to the zip.
This file is a zip which extracts to the same subdirectory, putting global
metadata in an invisible file in the root, and subfile metadata in dotfiles
as above.

Internal format:
Same as external format. Glucose knows how to unpack and repack the bundles.
There is no pretense that Glucose maintains any integrity/signatures for the
bundles. When editing as in option 6 above, the bundle is extracted (see
option 11 above) and then repacked on *each save* of the subfile. Each
non-hidden subfile is also represented by a metadata-only datastore pointer
into the bundle, for journal searches.

Note: this proposal is less than ideal in some ways. For one instance: small
changes to large files inside a zip are not good for delta-based storage.
For another, zip has no way to include empty directories, which might be
important for directory structure in some legacy cases. It assumes
relatively large atomic saves in any subfile.

Jameson

On Wed, Jun 11, 2008 at 9:37 AM, Benjamin M. Schwartz <
[EMAIL PROTECTED]> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I have a proposal for how to manage objects in the datastore, to resolve
> the various issues we have discussed.  I call it the "Objects and
> Translators" model.  The fundamental idea is this: the datastore is a
> flat, non-hierarchical listing of objects (versioned, but that does not
> come into play here).  The datastore provides these objects for use by
> Activities.  However, the datastore (or perhaps the Journal) also contains
> a new element: Translators.
>
> A Translator is a non-interactive object processing machine that takes an
> object as input and returns a set of objects as output.  Each Translator
> has a specified set of input types on which it can act.  The user, having
> selected a particular object, should be provided with a list of all
> compatible Translators.  Clicking on a Translator should show the list of
> output objects that Translator would generate for this input object, and
> the user may repeat this process on each of those objects as well.
>
> This model allows us to reproduce the usual sorts of directory
> hierarchies, simply by using a group object (I think of it as a .tar file)
> and an untar Translator.  To the user, this looks very much like a
> directory hierarchy.  However, because each "directory" is in fact a
> first-class object, it can also be associated with Activity instances, or
> passed from one XO to another over the network, etc.
>
> The Translator system is appealing to me because it can provide far more
> than a simple storage hierarchy.  For example, I have often had to extract
> a particular image from a PDF file, in order to include it in a class
> project.  I, and most people, hav

Re: [sugar] [PATCH] Journal able to use "open with" for activity bundles

2008-06-11 Thread Benjamin M. Schwartz
On Wed, 2008-06-11 at 12:11 -0400, Michael Stone wrote:
> On Wed, Jun 11, 2008 at 11:37:13AM -0400, Benjamin M. Schwartz wrote:
> 
> Cute. Incidental thought: is performing a translation an action?

Thank you.  No, I don't see it as an action, especially because I
imagine that the translation is performed lazily.  Translators provide a
menu of potential new objects, but an object is actually created only
when some other action (like opening a frame of video in Paint, or
sending it to a friend) demands it.

> Secondary thought: if translating is an action, then have we
> simply produced transient or instantaneous activities which have no GUI?

I very much think of these as "passive translators", in opposition to
"Activities".  I imagine that they are non-interactive, and their nature
is infrastructural, not creative.  If an Activity is something fun and
productive to do, a Translator is something so basic, like viewing the
contents of a directory, that one does not even notice that one is doing
it.

Ultimately, the key difference between these forms of computation is how
they are presented in the interface.

> To me, the interesting claim is that these "transient activities" (or
> translators, if you think they're different) should be able to advertise
> that they can turn types A into (potentially) B, C, and D.)

I imagine translators as being integrated tightly into the Journal,
rather than being independent programs.  Also, I'm not sure that they
need to advertise output types in advance. Instead, I think they should
advertise input types, and when invoked, provide a list of potential
output objects, including types.

>  (If we
> expect the activities to be able to read the user's data in order to
> state make this determination, then we have even greater incentive to
> implement the Bitfrost P_DOCUMENT_RO and P_NETWORK protections - they
> seem to be ideally suited to this use case.)

There is certainly a resemblance here.  I imagined that translators
would have no network access, and could only read the single object in
question.  They would not have write access until an output is
requested, at which time they may write a single object to a particular
location.

However, for a first pass, I am not concerned about allowing untrusted,
user-generated translators.  I am happy to simply leave them as part of
Glucose, running as trusted code.  Once we have the next-gen datastore
working, then we may worry about better exposing its parts.

--Ben

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] Sugar mtg reminder, 12th June 2008 --- 17.00 UTC --- irc.freenode.net, #sugar-meeting

2008-06-11 Thread Simon Schampijer
This weeks dev meeting has the following topics:

* 5.1.3 Topics
o 5.1.3.1 Update on the status of the ongoing features
o 5.1.3.2 How to announce a new release of an activity best? (moved from 
last week)
o 5.1.3.3 Providing test plans along releases
o 5.1.3.4 Documentation efforts for Sugar API and creating sugar activities

See you there,
Simon
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH] get_icon_name(): add step kwarg

2008-06-11 Thread Martin Dengler
---
 src/sugar/graphics/icon.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
index d22b412..65f194b 100644
--- a/src/sugar/graphics/icon.py
+++ b/src/sugar/graphics/icon.py
@@ -580,8 +580,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
 
 palette = property(get_palette, set_palette)
 
-def get_icon_state(base_name, perc):
-step = 5
+def get_icon_state(base_name, perc, step=5):
+assert step > 0, 'get_icon_state(): step must be positive'
 strength = round(perc / step) * step
 icon_theme = gtk.icon_theme_get_default()
 
-- 
1.5.3.3

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH] 7248.1: speaker-icon chosen correctly

2008-06-11 Thread Martin Dengler
speaker icon now chosen correctly; requires patch to sugar-toolkit
---
 src/view/devices/speaker.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/view/devices/speaker.py b/src/view/devices/speaker.py
index 5db16b5..a7efb26 100644
--- a/src/view/devices/speaker.py
+++ b/src/view/devices/speaker.py
@@ -57,7 +57,7 @@ class DeviceView(TrayIcon):
 xo_color = XoColor('%s,%s' % (style.COLOR_WHITE.get_svg(),
   style.COLOR_WHITE.get_svg()))
 
-self.icon.props.icon_name = get_icon_state(name, current_level)
+self.icon.props.icon_name = get_icon_state(name, current_level, step=1)
 self.icon.props.xo_color = xo_color
 
 def __speaker_status_changed_cb(self, pspec, param):
-- 
1.5.3.3

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] get_icon_name(): add step kwarg

2008-06-11 Thread Martin Dengler
On Thu, Jun 12, 2008 at 01:15:03AM +0100, Martin Dengler wrote:
> [1-line patch to sugar/graphics/icon.py]

A more performant approach to get_icon_name(), which I think is called
a fair bit, would be to cache the list of available files to avoid
exercising the file systme a billion times as the wireles signal
changes (ooh, imagine the stat()s when showing the mesh view and there
are loads of APs around changing signal strength all the time).

A related idea is to change this function to really do what it seems
to be meaning to do which is quantize the input range 0-100 into the
output range (defined by the number of different icon files).  However
consider that this would affect icon file names if the current user
experience is to be preserved.

As the number of files deceases the ratio of files to step size grows
and starts to dominate the time cost of calculating the output range.
And of course my previous suggestion could reduce this cost to
constant time.

Martin


pgpjll6FKLtdT.pgp
Description: PGP signature
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar