Re: [sugar] Sugar API documentation

2008-05-06 Thread Bert Freudenberg
On 06.05.2008, at 11:14, Edward Cherlin wrote:
 I often do what I call Defensive Documentation. I write the manual I
 wanted to have in the first place.

Nice term, Defensive Documentation :) That describes exactly why I  
made the low-level Sugar API documentation. It's not so much about  
the low level functions but rather about what is actually going on and  
required of an activity, independent of what language is being used. I  
wish I had had that kind of documentation when I started, because for  
me it's about understanding a system, not just using it.

  Occasionally I can get paid to do this, although usually I get  
 decent source docs from engineers.

Well, I'm just an engineer, and it shows in my style ;) Fortunately,  
Viewpoints Research pays me to work on the Sugar Etoys port, and they  
don't mind me doing occasional peripheral work, too. I did get help  
on IRC when I asked, although mostly I was just reverse-engineering  
the source code ...

- Bert -


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


Re: [sugar] [PATCH] make width/text of battery palette look nicer

2008-05-06 Thread Tomeu Vizoso
r+

Thanks!

Tomeu

On 5/2/08, Martin Dengler [EMAIL PROTECTED] wrote:
 ---
  src/view/devices/battery.py |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/src/view/devices/battery.py b/src/view/devices/battery.py
 index a97d014..e4d82d3 100644
 --- a/src/view/devices/battery.py
 +++ b/src/view/devices/battery.py
 @@ -84,6 +84,8 @@ class BatteryPalette(Palette):

 self._level = 0
 self._progress_bar = gtk.ProgressBar()
 +self._progress_bar.set_size_request(
 +style.zoom(style.GRID_CELL_SIZE * 4), -1)
 self._progress_bar.show()
 self._status_label = gtk.Label()
 self._status_label.show()
 @@ -120,7 +122,6 @@ class BatteryPalette(Palette):
'min': remaining_minpart})
 else:
 secondary_text = _('Charged')
 -status_text = ''

 self.props.secondary_text = secondary_text
 self._status_label.set_text(status_text)
 --
 1.5.4.1
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Add speaker device and icon by default

2008-05-06 Thread Martin Dengler
On Tue, May 06, 2008 at 04:39:30PM +0200, Tomeu Vizoso wrote:
 On 5/4/08, Martin Dengler [EMAIL PROTECTED] wrote:
  On Tue, Apr 29, 2008 at 02:12:58PM +0200, Tomeu Vizoso wrote:
   I think that Michael has spotted here a wonderful opportunity for
   making Sugar more robust, thanks to your patch.
...
  I haven't forgotten this thread, just been unable to work on it.
  After an hour of messing about with some ideas/code today, my current
  approach is a bit more involved than just a try/except but nothing too
  dramatic (just a small yak to shave):
 
  - refactor sugar/model/devices/device{,smodel}.py to make
   adding/removing device.Device subclasses safe
 
  ... this begs one to do the next step or be left with many many
   try/excepts and very ugly code (or just one try/except around
   speaker.py, which kind of doesn't improve matters that much - though
   it's very simple code and I'm happy to move on to other things if
   people would accept that :) )
 
  - refactor sugar/model/devices/device{,semodel}.py to make discovering
   device python files safe using metaclasses (see
   http://blogs.gnome.org/jamesh/2008/02/12/python-metaclasses/ ); I
   have considered the objections and alternatives including martian,
   Zope's plugin framework design, and settled on this approach because
   it's very simple, meets the very simple needs we have, and is very
   little code
 
  ...this requires one to remove the networkmanager- and
  halmanager-specific logic in devicesmodel.py:
 
  - create a new networkmanager model class that will add_device() and
   remove_device() using the same logic that used to be in
   devicesmodel.py
 
  - create a new halmanager model class in the same way
 
  ...and then we only need to:
 
  - trivially update battery.py and speaker.py
 
  - pretty trivially update network/mesh.py, wired.py, wireless.py;
   these are only slightly more than trivial because devicesmodel.py
   used to define some very network-specific variables that (IMO)
   should be exposed by the networkmanager model (above) instead
 
  This explanation is long-winded only because I wanted to allow people
  to poke holes in the approach, not because it's a lot of work.
 
 If it's not much work, can you provide a patch that gives an idea of
 what you plan to do? No need to be the final patch right now.
 
 Your ideas look interesting but I'm having a bit of difficulty in
 visualizing how you would refactor things.

This is not a patch because I think it's easier to read due to the
volume of refactoring, and it's very very much incomplete and
unpolished (as I said it's an hour's work), but if you look at them in
order you'll get an idea of what I'm trying, hopefully:

http://pastebin.be/11020 - devicesmodel.py - note this is refactored
to be much simpler, and the major *new* feature is simply the
metaclass usage (I still have to make it import everything in the
model.devices subtree, but you see where it's going)

http://pastebin.be/11021 - device.py - again, much simpler now and the
main changes are 1) register with the metaclass; and 2) subclassers
shoudl implement realize() rather than __init__() to do the real work

http://pastebin.be/11022 - battery.py - example of the changes; they
are basically trivial (superclass, move __init__() to realize(), call
super in realize())

http://pastebin.be/11023 - networkmanagermodel.py - this is where a
lot of devicesmodel.py has gone, because this is really a meta
device that creates new devices.Device subclasses as NM tells us
about device appearance/disappearance.  This is completely in flux and
definitely doesn't work, but at least the comments might show you
where I'm going (this is my bullet point #3 above)

 Thanks,
 
 Tomeu

Martin


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


[sugar] New Design - problem with Circle of Activities

2008-05-06 Thread Mikus Grinbergs
On my G1G1, I've installed (primary+alternate) both Joyride and 
Update.1.  Since Update.1 now comes without Activities, I have 
populated /home/olpc/Activities with what I want for Update.1
But Joyride comes with Activities in /usr/share/activities -- so 
I've ended up with some duplicates between the two locations.

The 'list' view of Activity Management is o.k. -- it shows the 
/usr/share Activities entries before the /home/olpc/Activities 
entries, so I can distinguish between them (if I want to).

But the 'ring' view of Activity Management does not populate the way 
I would like it to.  If I star a /home/olpc/Activities Activity, its 
icon gets put in the ring.  But if that same Activity exists in 
/usr/share/activities and I restart Sugar, I get TWO icons for that 
Activity in the circle of activities.  If I then click on 'Remove 
from ring' on one of them, it vanishes (it should).  But when I 
restart Sugar, the remaining one vanishes as well (it shouldn't).

The 'ring' view in Activity Management needs fixing -- when MULTIPLE 
Activity instances with the same name exist in the system, each 
instance should be treated (and shown) independently.

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