Re: [sugar] Preparing for the feature freeze

2008-06-04 Thread Guillaume Desmottes
Le mardi 03 juin 2008 à 14:33 -0400, Polychronis Ypodimatopoulos a
écrit :
 Guillaume Desmottes wrote:
  Search queries will return a {Buddy,Activity}View object. This object
  will have a Get{Buddies,Activities} method to retrieve the result of the
  search, a Changed (or Added/Removed) signal to track changes and a
  Closed method when user is not interested anymore by the result of the
  search.
 
  Does it make sense to you? Suggestions are welcome.
  I'll update http://wiki.laptop.org/go/Presence_Service_D-Bus_API with my
  changes.

 I would suggest not returning objects on any of the dbus calls; this 
 makes it harder to go through and debug the code both in the presence 
 service and telepathy. We should try to keep it as simple as possible 
 wrt the messages that are exchanged between the presence service and 
 telepathy. The presence service currently offers a nice abstraction of 
 how telepathy works, but this abstraction is hindered by the fact the 
 the presence service returns telepathy objects.

PS won't return Telepathy objects but buddies and activities as it
always did. The {Buddy,Activity}Views returned in Telepathy won't be the
same as the one returned by PS. In the TP case, views contains handles,
in the PS case they contains buddy and activity objects (as when
GetBuddies or GetActivities methods are called on PS).



G.

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


Re: [sugar] Preparing for the feature freeze

2008-06-04 Thread Tomeu Vizoso
On Tue, Jun 3, 2008 at 7:19 PM, Erik Garrison [EMAIL PROTECTED] wrote:
 On Tue, Jun 03, 2008 at 01:53:37PM +0200, Tomeu Vizoso wrote:
 On Tue, Jun 3, 2008 at 1:50 PM, Walter Bender [EMAIL PROTECTED] wrote:
  Alas, two more open bugs that should be considered by someone:
 
  (1) Record has been broken in Joyride for quite some time: ever since
  the introduction of compositing? (#6850)

 I am looking into this.

Awesome.


 Joyride has no composite enabled, so this seems to be something different.


 According to xdpyinfo the Composite extension is enabled on joyride
 1998.  So if this is different it is different in a way that xdpyinfo
 does not know.

xdpyinfo reports that the composite extension is present, and I think
that this has been like this since always. The difference between
joyride and faster is that in the latter the window manager includes a
composition manager that creates offscreen pixmaps for every window.
Look for XCompositeRedirectSubwindows for more details in:

http://ktown.kde.org/~fredrik/composite_howto.html
http://svn.o-hand.com/view/matchbox/trunk/matchbox-window-manager/src/composite-engine.c?rev=1084view=markup

 On 1998 I get the following messages to the virtual terminal (I assume
 they are delivered via printk):

  cafe1000-ccic :00:0c.2: Frame overrun on 1, frames lost
  ... 59 printk messages suppressed ...

No idea about this :/

Thanks,

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


Re: [sugar] Preparing for the feature freeze

2008-06-04 Thread Tomeu Vizoso
On Wed, Jun 4, 2008 at 12:29 AM, Walter Bender [EMAIL PROTECTED] wrote:
 So I was probably wrong to bring up the Record bug in this thread.
 However, the Browse bugs seem to be related to unsupported features in
 the browser--e.g., the need for some daughter windows to appear.
 Feature or bug--not obvious.

I would call it a bug since affects the basic behavior of what people
expect from a browser.

Regards,

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


Re: [sugar] Preparing for the feature freeze

2008-06-04 Thread Marco Pesenti Gritti
On Wed, Jun 4, 2008 at 10:31 AM, Tomeu Vizoso [EMAIL PROTECTED] wrote:
 On Wed, Jun 4, 2008 at 12:29 AM, Walter Bender [EMAIL PROTECTED] wrote:
 So I was probably wrong to bring up the Record bug in this thread.
 However, the Browse bugs seem to be related to unsupported features in
 the browser--e.g., the need for some daughter windows to appear.
 Feature or bug--not obvious.

 I would call it a bug since affects the basic behavior of what people
 expect from a browser.

By the same criteria you could probably call missing auto completion a
bug too. We should probably try to come up with a better definition of
the feature freeze at some point... The session work for example is
totally a feature from the code point of view, but a bug from the user
point of view.

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


Re: [sugar] control panel review

2008-06-04 Thread Tomeu Vizoso
On Tue, Jun 3, 2008 at 11:42 PM, Simon Schampijer [EMAIL PROTECTED] wrote:
 Hi Tomeu,

 thanks very much for your detailed review - it was very useful! I am fine
 with most of your comments and changed the code accordingly. I made inline
 comments for the items.

 So I would re-base my changes on latest HEAD now and push if you are ok?

Ok with me. In the future, I hope we can land things like this in
small pieces, I think it plays better with the review process. A few
remaining comments:

for module in modules:
method = getattr(module, 'set_' + key, None)
if method:
print method.__doc__
sys.exit()
print _(sugar-control-panel: key=%s not an available option
% key)
 What if different modules have the same method?

 Do we really have this issue? I think/hope we don't have more than one
 module which
 has for example the method set_color.

Yes, I agree that the model structure requires that modules don't have
duplicated methods, but what will happen when someone codes a new
module and strange things happen? Can we make this error more clear?
Maybe keep iterating and displaying a warning if there's another
method with the same name in other module?

{'optionname': {'view', 'model', 'button', 'keywords', 'icon'}
 }
 In python, would be {'optionname': ['view', 'model', 'button',
 'keywords', 'icon'] }

 It is a dictionary options with the keys 'optionname' which has the keys
 'view',
 'model'...

You meant the values 'view', 'model', ...?

 {'optionname': {'view', 'model', 'button', 'keywords', 'icon'} }
  File stdin, line 1
{'optionname': {'view', 'model', 'button', 'keywords', 'icon'} }
  ^
SyntaxError: invalid syntax

if tmp in self._options:
 This means we cannot have one section just with command line support?

 Oh we can have one section just with command line support. You do so by
 providing
 only the module and not the view class.

But _get_options() will only setup in self._options options that are
present on a view module, right? Btw, if the function is called
_get_something, it should probably return an array instead of setting
a private member variable.

 view/aboutme.py

 class EventIcon(gtk.EventBox):
 What's the reason of existence of this class?

 I could have used a hippo.CanvasIcon but I thought we wanted to get rid of
 hippo code where possible. Maybe we should move it to the toolkit so it can
 be used in other places as well?

What has CanvasIcon to do here? Icon is not enough?

Thanks,

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


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

2008-06-04 Thread Simon Schampijer
Hi,

after a few weeks of absence of the sugar meeting we want to get back into 
track 
again. Next meeting will be Thursday June 05 2008 at 17.00 UTC.

Please note the new place: irc.freenode.net, #sugar-meeting.

We want to make a meeting about the sugar review process. To make it even more 
effective. Thoughts can be added here:

http://wiki.sugarlabs.org/go/DevelopmentTeam/Meetings#Thursday_June_05_2008_-_17.00_.28UTC.29

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


Re: [sugar] [PATCH] adding a bad device to the frame shouldn't crash sugar

2008-06-04 Thread Martin Dengler
On Wed, Jun 04, 2008 at 11:44:09AM +0200, Tomeu Vizoso wrote:
 Looks good to me. Small comments inline:
 
  +import logging
  +logger = logging.getLogger('DevicesTray')
 
 What about moving the import along with the others and declaring the
 logger at the module level as in activitiesring.py?

Sure.  I saw that code after I thought of the patch, but figured
someone might want the patch changes to be all in one place in the
file (just so you know why I did it that way).  Changed as you
suggested.

  +logger.warn(Not able to add icon for device [%s], because of 
  +an error (%s). Continuing. % (device, message))
 
 May be better to print the __repr__ of the device, with %r instead of
 %s. In some classes, __str__ won't be as good a description of the
 instance as __repr__.

Sure.

 Thanks,
 
 Tomeu

Martin


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


Re: [sugar] [PATCH] Refactor invites for 1-1 Chat (#6298)

2008-06-04 Thread Guillaume Desmottes
Le mercredi 04 juin 2008 à 17:08 +0200, Morgan Collett a écrit :
 The main code to review is at:
 http://dev.laptop.org/git?p=users/morgan/sugar;a=shortlog;h=6298 (3
 most recent patches).

As bundle_id is passed to both constructor, you could move it to
BaseInvite.__init__


Didn't read code carefully but InviteButton and InvitePalette still
contain lot of:

if shared:
  ...
else:
  # private


Maybe it would be worth to abstract these 2 classes too if possible?



G.

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


[sugar] Jun 5, Sucrose 0.81.2 Tarballs Due

2008-06-04 Thread Marco Pesenti Gritti
Hello!

Here are the modules which are included in the release:

Glucose: http://wiki.sugarlabs.org/go/Roadmap#Glucose_Modules
Fructose: http://wiki.sugarlabs.org/go/Roadmap#Fructose_Modules

Please provide source code tarballs and announce them as explained here:

http://wiki.sugarlabs.org/go/Release#Module_release

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


Re: [sugar] Moving to metacity with composition (was: Preparing for the feature freeze)

2008-06-04 Thread Sayamindu Dasgupta
On Tue, Jun 3, 2008 at 5:09 PM, Martin Dengler [EMAIL PROTECTED] wrote:
 As an aside...

 On Tue, Jun 03, 2008 at 12:16:27PM +0200, Tomeu Vizoso wrote:
 Sayamindu, you say you got OOM problems after activating composition,
 can you check where that memory is going? Or might be the X server
 crashing instead?

 Even on my C2 yum search yummemoryimprovesinf9 causes significant
 memory pressure[1].  Sugar/Glucose/Sweetness becomes unresponsive,
 though oom-killer doesn't get involved. I'm surprised that it's even
 feasible to run yum on a B4 with sugar running.  I've been using
 compcache[2,3] to help with this pressure.

 Cheers,

 Tomeu

 Martin

 1. As in, free in vmstat goes down to 0, from 40.  Yeah, this is
 imprecise.  cache is still fine at 80.  joyride-1998. That's not
 downloading any updates, no activities running.
 2. http://dev.laptop.org/ticket/28
 3. http://www.xades.com/ , compcache on the XO


I tried your ps_mem.py based tests, as outlined at
http://lists.laptop.org/pipermail/sugar/2008-March/004718.html (well,
not an exact replica, but close to it). I was running os16 from
http://pilgrim.laptop.org/~pilgrim/olpc/streams/olpc3/build16/, and
was unable to run most activities on it (eg: Web, Write, etc). The
before part of the test was done with matchbox (the stock one which
came with the os), and the after part with metacity, with compositor
enabled. The results are as follows:


-
before:  2.5 MiB + 459.0 KiB =   2.9 MiBmatchbox-window-manager
-
after.:  1.8 MiB + 552.5 KiB =   2.3 MiBmetacity
-
-
before: 73.3 MiB +   5.3 MiB =  78.6 MiBpython (12)
after.: 73.7 MiB +   5.6 MiB =  79.3 MiBpython (12)
-
before: 13.1 MiB +   1.9 MiB =  14.9 MiBTerminal 17c20
after.: 13.1 MiB +   1.8 MiB =  14.9 MiBTerminal b9662
-
-
before: 26.4 MiB +   3.5 MiB =  29.9 MiBMeasure 5f0940
after.: 26.4 MiB +   3.4 MiB =  29.9 MiBMeasure ff6038
-
before: 11.9 MiB +   2.0 MiB =  14.0 MiBJournal 01f5e1
after.: 13.0 MiB +   2.0 MiB =  15.0 MiBJournal 8828b9
-
before:  6.2 MiB + 514.0 KiB =   6.7 MiBXorg
after.: 20.7 MiB + 466.0 KiB =  21.2 MiBXorg


Cheers,
Sayamindu

-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] Jun 5, Sucrose 0.81.2 Tarballs Due

2008-06-04 Thread Marco Pesenti Gritti
Oooops thanks!

Marco

On Wed, Jun 4, 2008 at 6:00 PM, Bert Freudenberg [EMAIL PROTECTED] wrote:

 On 04.06.2008, at 17:52, Marco Pesenti Gritti wrote:

 Hello!

 Here are the modules which are included in the release:

 Glucose: http://wiki.sugarlabs.org/go/Roadmap#Glucose_Modules
 Fructose: http://wiki.sugarlabs.org/go/Roadmap#Fructose_Modules

 This is now

 http://wiki.sugarlabs.org/go/ReleaseTeam/Roadmap#Glucose_Modules
 http://wiki.sugarlabs.org/go/ReleaseTeam/Roadmap#Fructose_Modules

 Please provide source code tarballs and announce them as explained
 here:

 http://wiki.sugarlabs.org/go/Release#Module_release

 http://wiki.sugarlabs.org/go/ReleaseTeam#Module_release

 - Bert -


 ___
 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] Preparing for the feature freeze

2008-06-04 Thread Erik Garrison
On Wed, Jun 04, 2008 at 10:28:25AM +0200, Tomeu Vizoso wrote:
 On Tue, Jun 3, 2008 at 7:19 PM, Erik Garrison [EMAIL PROTECTED] wrote:
  On Tue, Jun 03, 2008 at 01:53:37PM +0200, Tomeu Vizoso wrote:
  On Tue, Jun 3, 2008 at 1:50 PM, Walter Bender [EMAIL PROTECTED] wrote:
   Alas, two more open bugs that should be considered by someone:
  
   (1) Record has been broken in Joyride for quite some time: ever since
   the introduction of compositing? (#6850)
 
  I am looking into this.
 
 Awesome.
 

I currently believe that I've narrowed the bug down to something
involving the colorspace conversion filter used in gstreamer
(ffmpegcolorspace).  See the ticket (http://dev.laptop.org/ticket/6850)
for more details.

 
  Joyride has no composite enabled, so this seems to be something different.
 
 
  According to xdpyinfo the Composite extension is enabled on joyride
  1998.  So if this is different it is different in a way that xdpyinfo
  does not know.
 
 xdpyinfo reports that the composite extension is present, and I think
 that this has been like this since always. The difference between
 joyride and faster is that in the latter the window manager includes a
 composition manager that creates offscreen pixmaps for every window.
 Look for XCompositeRedirectSubwindows for more details in:
 
 http://ktown.kde.org/~fredrik/composite_howto.html
 http://svn.o-hand.com/view/matchbox/trunk/matchbox-window-manager/src/composite-engine.c?rev=1084view=markup
 

Thanks.  This makes sense to me.

  On 1998 I get the following messages to the virtual terminal (I assume
  they are delivered via printk):
 
   cafe1000-ccic :00:0c.2: Frame overrun on 1, frames lost
   ... 59 printk messages suppressed ...
 
 No idea about this :/
 

What it means is that userspace software isn't processing buffers from
the cafe chip fast enough.  So they get thrown away.  Does not appear to
be a problem with the cafe1000-ccic driver.

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


Re: [sugar] [PATCH] Fixing timestamp issue on wnck.Window.activate()

2008-06-04 Thread Marco Pesenti Gritti
 def present(self):
-# wnck.Window.activate() expects a timestamp, but we don't
-# always have one, and libwnck will complain if we pass 0,
-# and matchbox doesn't look at the timestamp anyway. So we
-# just always pass 1.
-self._window.activate(1)
+self._window.activate(gtk.get_current_event_time())

Since you can't be sure of where present() will be called from (an
event or not), I'd rather pass in a timestamp to method.

-previous_activity.get_window().activate(1)
+
previous_activity.get_window().activate(gtk.get_current_event_time())

Same as above, and you are exceeding 80 cols.

 def activate_next_activity(self):
 home_model = self._model.get_home()
 next_activity = home_model.get_next_activity()
 if next_activity:
 self.take_activity_screenshot()
-next_activity.get_window().activate(1)
+next_activity.get_window().activate(gtk.get_current_event_time())

Same as above.

+# This is being called in response to a user generated click,
+# so I guess gtk.get_current_event_time() is OK here.
+# See libwnck/test-wnck.c for an example
+home_activity.get_window().activate(gtk.get_current_event_time())

I think the comment is not necessary.

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


Re: [sugar] [PATCH] Fixing timestamp issue on wnck.Window.activate()

2008-06-04 Thread Sayamindu Dasgupta
On Wed, Jun 4, 2008 at 10:38 PM, Marco Pesenti Gritti
[EMAIL PROTECTED] wrote:
 def present(self):
 -# wnck.Window.activate() expects a timestamp, but we don't
 -# always have one, and libwnck will complain if we pass 0,
 -# and matchbox doesn't look at the timestamp anyway. So we
 -# just always pass 1.
 -self._window.activate(1)
 +self._window.activate(gtk.get_current_event_time())

 Since you can't be sure of where present() will be called from (an
 event or not), I'd rather pass in a timestamp to method.

Hmm - but passing 1 does not seem to work in case of Metacity, The
documentation for gtk.get_current_event_time() suggests that 0L is
returned if there is no current event.


 -previous_activity.get_window().activate(1)
 +
 previous_activity.get_window().activate(gtk.get_current_event_time())

 Same as above, and you are exceeding 80 cols.


Oops - sorry about the 80 columns :-P.

Cheers,
Sayamindu


-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Fixing timestamp issue on wnck.Window.activate()

2008-06-04 Thread Marco Pesenti Gritti
On Wed, Jun 4, 2008 at 7:37 PM, Sayamindu Dasgupta [EMAIL PROTECTED] wrote:
 On Wed, Jun 4, 2008 at 10:38 PM, Marco Pesenti Gritti
 [EMAIL PROTECTED] wrote:
 def present(self):
 -# wnck.Window.activate() expects a timestamp, but we don't
 -# always have one, and libwnck will complain if we pass 0,
 -# and matchbox doesn't look at the timestamp anyway. So we
 -# just always pass 1.
 -self._window.activate(1)
 +self._window.activate(gtk.get_current_event_time())

 Since you can't be sure of where present() will be called from (an
 event or not), I'd rather pass in a timestamp to method.

 Hmm - but passing 1 does not seem to work in case of Metacity, The
 documentation for gtk.get_current_event_time() suggests that 0L is
 returned if there is no current event.

Sorry I was not clear enough... I was proposing to change the method
to present(self, timestamp).

Though I just looked at how gtk handles it and they seem to default to
current time, providing a different method for the special cases
(present_with_time).

So in summary I think your patch is good except for the 80 line
nitpick. Please fix that and check it in...

Thanks!!

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


Re: [sugar] [PATCH] Fixing timestamp issue on wnck.Window.activate()

2008-06-04 Thread Sayamindu Dasgupta
On Wed, Jun 4, 2008 at 11:19 PM, Marco Pesenti Gritti
[EMAIL PROTECTED] wrote:
 On Wed, Jun 4, 2008 at 7:37 PM, Sayamindu Dasgupta [EMAIL PROTECTED] wrote:
 On Wed, Jun 4, 2008 at 10:38 PM, Marco Pesenti Gritti
 [EMAIL PROTECTED] wrote:
 def present(self):
 -# wnck.Window.activate() expects a timestamp, but we don't
 -# always have one, and libwnck will complain if we pass 0,
 -# and matchbox doesn't look at the timestamp anyway. So we
 -# just always pass 1.
 -self._window.activate(1)
 +self._window.activate(gtk.get_current_event_time())

 Since you can't be sure of where present() will be called from (an
 event or not), I'd rather pass in a timestamp to method.

 Hmm - but passing 1 does not seem to work in case of Metacity, The
 documentation for gtk.get_current_event_time() suggests that 0L is
 returned if there is no current event.

 Sorry I was not clear enough... I was proposing to change the method
 to present(self, timestamp).

 Though I just looked at how gtk handles it and they seem to default to
 current time, providing a different method for the special cases
 (present_with_time).

 So in summary I think your patch is good except for the 80 line
 nitpick. Please fix that and check it in...


Fixed, committed and pushed to d.l.o.
Thanks,
Sayamindu


-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] documentation effort for sugar api

2008-06-04 Thread Faisal Anwar
Hello All,

I'm currently working on creating documentation for the api of several basic
sugar packages. I've started putting some of this work online at
http://wiki.laptop.org/go/Sugar-api-doc. I'm sure that many of you have a
lot of knowledge and experience with different modules in sugar and would
appreciate any help in developing content and ensuring its accuracy. In
particular:

- if there are any specific tasks associated with a class or package that
aren't documented yet, please feel free to update the wiki yourself or send
me code fragments with clear descriptions.

- if there is any feedback you have on the organization of the wiki pages as
I've set up or if there is some major package I really need to make sure to
document, please let me know.

- If there are any issues of accuracy with anything that is on the wiki,
please let me know.

I've made a point to write and test all sample code that goes up on the
wiki, so it should work with the latest builds of sugar. But, if things do
change with the underlying code or if there are style issues, please do let
me know asap. Also, I found some really good conceptual documentation at
http://wiki.laptop.org/go/OLPC_Human_Interface_Guidelines. There are links
to more detailed api documentation pages, but these seem to be empty and in
need of completion. I think it will be good to link the parts of this wiki
that refer to api's to the documentation that I'm helping to set up above.
If you have helped write some of the existing documentation, please do get
in touch!

Right now, I'm specifically working on documenting the datastore features of
sugar and would especially appreciate an opportunity to talk with someone
with experience with the journal. In addition to email, I should often be on
#sugar and #olpc in IRC under the name fanwar.

Thanks!


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


[sugar] [PATCH] Change tabbing to show a preview by opening the frame

2008-06-04 Thread Benjamin Berg
Hello,

Some patches that implement nicer tabbing will follow. With the patches
applied, pressing Alt+Tab will show the frame. The activity that will
be selected as soon as Alt is released again is shown by popping up
its palette.


Unfortunately there are a couple of issues with palettes.

One issue is that that at first only the primary palette is shown, but
after a while the secondary palette will pop up (as the timeout is
started automatically).

Then I am accessing the _update_position function of the Palette
directly, to handle disappearing activities properly.

The third thing I noticed is that there is a race condition in the
Palette (which I think is my fault ...). I'll need to have a look at how
to fix this.
(The reason for the race is the code that delays the popup signal
until the window has been mapped. IIRC that was needed so the gab
drawing would work properly.)


Benjamin


signature.asc
Description: This is a digitally signed message part
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH 1/5] Add an unobscured property that is set when the frame is fully visible.

2008-06-04 Thread Benjamin Berg
This commit switches the Frame to be a GObject. By doing this the gobject
property system can be used to notify interested parties when the frame
becomes fully visible. This is needed, so that the ActivitiesTray can
show the palette of an activity as soon as the frame is fully visible.
---
 src/view/frame/frame.py |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/view/frame/frame.py b/src/view/frame/frame.py
index 6009e7f..9e5af71 100644
--- a/src/view/frame/frame.py
+++ b/src/view/frame/frame.py
@@ -89,12 +89,19 @@ class _KeyListener(object):
 else:
 self._frame.show(Frame.MODE_KEYBOARD)
 
-class Frame(object):
+class Frame(gobject.GObject):
 MODE_MOUSE= 0
 MODE_KEYBOARD = 1
 MODE_NON_INTERACTIVE = 2
+__gtype_name__ = SugarFrame
+__gproperties__ = {
+'unobscured' : (bool, None, None, False,
+gobject.PARAM_READABLE),
+}
 
 def __init__(self):
+gobject.GObject.__init__(self)
+
 self.mode = None
 
 self._palette_group = palettegroup.get_group('frame')
@@ -106,6 +113,7 @@ class Frame(object):
 self._bottom_panel = None
 
 self.current_position = 0.0
+self._unobscured = False
 self._animator = None
 
 self._event_area = EventArea()
@@ -248,6 +256,11 @@ class Frame(object):
 self._move_panel(self._right_panel, self.current_position,
  screen_w, 0, screen_w - self._right_panel.size, 0)
 
+unobscured = (self.current_position == 1.0)
+if unobscured != self._unobscured:
+self._unobscured = unobscured
+self.notify('unobscured')
+
 def _size_changed_cb(self, screen):
 self._update_position()
 
@@ -274,7 +287,11 @@ class Frame(object):
 
 def _enter_corner_cb(self, event_area):
 self._mouse_listener.mouse_enter()
-
+
+def do_get_property(self, pspec):
+if pspec.name == 'unobscured':
+return self._unobscured
+
 def notify_key_press(self):
 self._key_listener.key_press()
 
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH 2/5] Add functionallity for tabbing trough activities.

2008-06-04 Thread Benjamin Berg
This commits adds some functions and properties to keep track of the
activities when the user is tabbing.
---
 src/model/homemodel.py |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/src/model/homemodel.py b/src/model/homemodel.py
index 5538f84..032f019 100644
--- a/src/model/homemodel.py
+++ b/src/model/homemodel.py
@@ -53,6 +53,9 @@ class HomeModel(gobject.GObject):
([gobject.TYPE_PYOBJECT])),
 'pending-activity-changed': (gobject.SIGNAL_RUN_FIRST,
  gobject.TYPE_NONE,
+ ([gobject.TYPE_PYOBJECT])),
+'tabbing-activity-changed': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
  ([gobject.TYPE_PYOBJECT]))
 }
 
@@ -62,6 +65,7 @@ class HomeModel(gobject.GObject):
 self._activities = []
 self._active_activity = None
 self._pending_activity = None
+self._tabbing_activity = None
 
 screen = wnck.screen_get_default()
 screen.connect('window-opened', self._window_opened_cb)
@@ -126,6 +130,42 @@ class HomeModel(gobject.GObject):
 
 return self._active_activity
 
+def tabbing_previous_activity(self):
+activities = self._get_activities_with_window()
+if len(activities) == 0:
+return
+
+activity = self._tabbing_activity
+if activity is None:
+activity = self._pending_activity
+
+i = activities.index(activity)
+if i - 1 = 0:
+self._set_tabbing_activity(activities[i - 1])
+else:
+self._set_tabbing_activity(activities[len(activities) - 1])
+
+def tabbing_next_activity(self):
+activities = self._get_activities_with_window()
+if len(activities) == 0:
+return
+
+activity = self._tabbing_activity
+if activity is None:
+activity = self._pending_activity
+
+i = activities.index(activity)
+if i + 1  len(activities):
+self._set_tabbing_activity(activities[i + 1])
+else:
+self._set_tabbing_activity(activities[0])
+
+def tabbing_cancel(self):
+self._set_tabbing_activity(None)
+
+def get_tabbing_activity(self):
+return self._tabbing_activity
+
 def _set_active_activity(self, home_activity):
 if self._active_activity == home_activity:
 return
@@ -146,6 +186,13 @@ class HomeModel(gobject.GObject):
 self._active_activity = home_activity
 self.emit('active-activity-changed', self._active_activity)
 
+def _set_tabbing_activity(self, tabbing_activity):
+if self._tabbing_activity == tabbing_activity:
+return
+
+self._tabbing_activity = tabbing_activity
+self.emit('tabbing-activity-changed', self._tabbing_activity)
+
 def __iter__(self): 
 return iter(self._activities)
 
@@ -243,6 +290,20 @@ class HomeModel(gobject.GObject):
 logging.error('No activities are running')
 self._set_pending_activity(None)
 
+if home_activity == self._tabbing_activity:
+# Find a new tabbing activity
+activities = self._get_activities_with_window()
+if len(activities) = 1:
+# There is no other activity to tab to ...
+self._set_tabbing_activity(None)
+
+i = activities.index(self._tabbing_activity)
+if i + 1  len(activities):
+self._set_tabbing_activity(activities[i + 1])
+else:
+# Do not wrap, but instead select the last activity again
+self._set_tabbing_activity(activities[i - 1])
+
 self.emit('activity-removed', home_activity)
 self._activities.remove(home_activity)
 
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH 4/5] Handle the key events for tabbing.

2008-06-04 Thread Benjamin Berg
This adds the neccessary keyboard handling, grabbing the input, switching to
the new activity, or canceling the operation. It is also responsible for
showing the frame during the tabbing operation.
---
 src/view/keyhandler.py |   96 +++-
 1 files changed, 94 insertions(+), 2 deletions(-)
diff --git a/src/view/keyhandler.py b/src/view/keyhandler.py
index 306bb21..8dee50c 100644
--- a/src/view/keyhandler.py
+++ b/src/view/keyhandler.py
@@ -32,6 +32,10 @@ _BRIGHTNESS_STEP = 2
 _VOLUME_STEP = 10
 _BRIGHTNESS_MAX = 15
 _VOLUME_MAX = 100
+# The modifier used for tabbing. Should the shortcuts ever be made user
+# configurable, then some code to figure out the apropriate modifier is
+# needed instead of hardcoding it.
+_TABBING_MODIFIER = gtk.gdk.MOD1_MASK
 
 _actions_table = {
 'F1' : 'zoom_mesh',
@@ -77,10 +81,13 @@ class KeyHandler(object):
 self._keycode_pressed = 0
 self._keystate_pressed = 0
 self._speech_proxy = None
+self._tabbing_windows = False
 
 self._key_grabber = KeyGrabber()
 self._key_grabber.connect('key-pressed',
   self._key_pressed_cb)
+self._key_grabber.connect('key-released',
+  self._key_released_cb)
 
 for key in _actions_table.keys():
 self._key_grabber.grab(key)
@@ -131,15 +138,75 @@ class KeyHandler(object):
 self._get_speech_proxy().SayText(text, reply_handler=lambda: None, \
 error_handler=self._on_speech_err)
 
+def _window_tabbing(self, direction):
+if not self._tabbing_windows:
+logging.debug('Grabing the input.')
+
+screen = gtk.gdk.screen_get_default()
+window = screen.get_root_window() 
+keyboard_grab_result = gtk.gdk.keyboard_grab(window)
+pointer_grab_result = gtk.gdk.pointer_grab(window)
+
+self._tabbing_windows = (keyboard_grab_result == gtk.gdk.GRAB_SUCCESS and
+ pointer_grab_result == gtk.gdk.GRAB_SUCCESS)
+
+# Now test that the modifier is still active to prevent race
+# conditions. We also test if one of the grabs failed.
+mask = window.get_pointer()[2]
+if not self._tabbing_windows or not (mask  _TABBING_MODIFIER):
+logging.debug('Releasing grabs again.')
+
+if keyboard_grab_result != gtk.gdk.GRAB_SUCCESS:
+gtk.gdk.keyboard_ungrab()
+if pointer_grab_result != gtk.gdk.GRAB_SUCCESS:
+gtk.gdk.pointer_ungrab()
+self._tabbing_windows = False
+
+if self._tabbing_windows:
+# We have the grab, so show the frame.
+shell = view.Shell.get_instance()
+frame = shell.get_frame()
+frame.show(frame.MODE_NON_INTERACTIVE)
+
+if direction == 1:
+shell.tabbing_next_activity()
+else:
+shell.tabbing_previous_activity()
+
+return self._tabbing_windows
+
+def _stop_window_tabbing(self, cancel=True):
+# Some useless key was pressed, or Alt released.
+if not self._tabbing_windows:
+return
+
+logging.debug('Releasing grabs again.')
+gtk.gdk.keyboard_ungrab()
+gtk.gdk.pointer_ungrab()
+
+shell = view.Shell.get_instance()
+frame = shell.get_frame()
+
+if not cancel:
+shell.tabbing_activate_current()
+else:
+shell.tabbing_cancel()
+
+frame.hide()
+
+self._tabbing_windows = False
+
 def handle_say_text(self):
 clipboard = gtk.clipboard_get(selection=PRIMARY)
 clipboard.request_text(self._primary_selection_cb)
 
 def handle_previous_window(self):
-view.Shell.get_instance().activate_previous_activity()
+if not self._window_tabbing(-1):
+view.Shell.get_instance().activate_previous_activity()
 
 def handle_next_window(self):
-view.Shell.get_instance().activate_next_activity()
+if not self._window_tabbing(1):
+view.Shell.get_instance().activate_next_activity()
 
 def handle_close_window(self):
 view.Shell.get_instance().close_current_activity()
@@ -218,9 +285,34 @@ class KeyHandler(object):
 self._keystate_pressed = state
 
 action = _actions_table[key]
+if self._tabbing_windows:
+# Only accept window tabbing events, everything else
+# cancels the tabbing operation.
+if not action in [next_window, previous_window]:
+self._stop_window_tabbing(True)
+return True
+
 method = getattr(self, 'handle_' + action)
 method()
 
 return True
+else:
+# If this is not a registered 

Re: [sugar] Moving to metacity with composition (was: Preparing for the feature freeze)

2008-06-04 Thread Martin Dengler
On Wed, Jun 04, 2008 at 09:28:40PM +0530, Sayamindu Dasgupta wrote:
 I tried your ps_mem.py based tests [...]

Cool -- looks like just moving to os16 + metacity saved at least 14
MiB[1] (not counting any python savings) and Xorg grew by 15 MiB.

 Cheers,
 Sayamindu

Martin

1. 2 + 6 + 6 MiB: matchbox - metacity, Terminal, and Journal MiB
savings.  These are obviously not numbers to rely on, but they're
probably a decent in-kind test (as I saw net memory usage grow, and so
did you, but the growths are on the same order of magnitude. As it
looks like many other things might have got a lot better, this still
seems pretty promising to me.


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


Re: [sugar] Preparing for the feature freeze

2008-06-04 Thread Michael Stone
On Tue, Jun 03, 2008 at 11:03:44AM +0200, Marco Pesenti Gritti wrote:
 * Browser bookmarks and autocompletion. - priority 3

I'd really like to see some progress on #542/#5534 (deal with
non-standard SSL certificate authorities). This is going to become a
bigger and bigger stumbling block the longer we wait. Surely we could
manage some sort of 'accept this cert' button? (Keep in mind the
possibility of another G1G1 coming our way in the foreseeable future.)

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