Re: [Sugar-devel] http://bugs.sugarlabs.org/ticket/1742

2010-09-19 Thread Aleksey Lim
On Sat, Sep 18, 2010 at 11:57:59PM +0530, Ishan Bansal wrote:
 hi
 
 I am working on the bug http://bugs.sugarlabs.org/ticket/1742.
 
 The check to see if the person is a friend in buddymeny.py is working fine
 for friends view but it still shows Make Friend when we right click in
 neighborhood view even if the person is a friend.
 
 I have been trying to find the difference between the codes for the above
 files but havent been able to do so.
 
 Please provide me some pointers on the above issue.

You can follow regular way like - add debug output in all critical
places.

For example, after logging from place where palette is being filled with items
'Remove friend' and 'Make friend' and opening in sugar palette before
adding new friend and after, I got that logging happens only once - in
1st case. Thus, after adding a friend palette contains outdated items.

 
 regards
 
 ishan

-- 
Aleksey
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v2 sugar] Frame: show application-set icon for non-Sugar windows

2010-09-19 Thread Sascha Silbe
Display the _NET_WM_ICON content instead of a generic icon for non-Sugar
applications.

Because the sugar.graphics.Icon API is based on file names, we need to create
a temporary file to store the icon.
A future patch could either enhance sugar.graphics.Icon to accept
pixbufs or rework ActivityButton to use something different to show the icon.

Tested on XO-1.5 running Debian Squeeze. Updating the icon took  0.1s
(0.018s, 0.005s and 0.026s) with /tmp on tmpfs.

Signed-off-by: Sascha Silbe sascha-...@silbe.org

---
 src/jarabe/frame/activitiestray.py |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)

v1-v2: fix race condition causing application-set icon not to be shown
on fast systems

diff --git a/src/jarabe/frame/activitiestray.py 
b/src/jarabe/frame/activitiestray.py
index 6bd2a1b..6508953 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -37,6 +37,7 @@ from sugar.graphics.menuitem import MenuItem
 from sugar.datastore import datastore
 from sugar import mime
 from sugar import env
+from sugar import util

 from jarabe.model import shell
 from jarabe.model import invites
@@ -67,6 +68,12 @@ class ActivityButton(RadioToolButton):
 self._icon.props.file = home_activity.get_icon_path()
 else:
 self._icon.props.icon_name = 'image-missing'
+window = home_activity.get_window()
+if window is not None:
+window.connect('icon-changed', self._icon_changed_cb)
+if window.get_icon():
+self._update_icon(window)
+
 self.set_icon_widget(self._icon)
 self._icon.show()

@@ -97,6 +104,22 @@ class ActivityButton(RadioToolButton):
 else:
 self._icon.props.pulsing = False

+def _icon_changed_cb(self, window):
+gobject.idle_add(self._update_icon, window)
+
+def _update_icon(self, window):
+logging.debug('_update_icon: start')
+pixbuf = window.get_icon()
+if pixbuf is None:
+return
+
+fd, path = tempfile.mkstemp(suffix='.png')
+os.close(fd)
+pixbuf.save(path, 'png')
+self._icon.props.icon_name = None
+self._icon.props.file = util.TempFilePath(path)
+logging.debug('_update_icon: updated icon')
+


 class InviteButton(ToolButton):
--
tg: (7fc14a7..) t/frame-show-legacy-icons (depends on: upstream/master)
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v2 sugar-toolkit] set window icon

2010-09-19 Thread Sascha Silbe
Set the window icon to the activity icon for improved look-and-feel when
using non-Sugar ways of switching windows (e.g. by enabling the metacity key
bindings).

Tested on XO-1.5 running Debian Squeeze. Setting the icon takes  0.1s
(0.058s, 0.026s, 0.021s).

Signed-off-by: Sascha Silbe sascha-...@silbe.org

---
 src/sugar/activity/activity.py |   47 ---
 1 files changed, 38 insertions(+), 9 deletions(-)

v1 was Reviewed-by: James Cameron qu...@laptop.org
v1-v2: Rebased on current mainline/master

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 0bda2ea..238716f 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -70,13 +70,15 @@ from telepathy.interfaces import CHANNEL, \
 from telepathy.constants import CONNECTION_HANDLE_TYPE_CONTACT

 from sugar import util
+from sugar.bundle.activitybundle import ActivityBundle
 from sugar.presence import presenceservice
 from sugar.activity.activityservice import ActivityService
 from sugar.activity.namingalert import NamingAlert
 from sugar.graphics import style
 from sugar.graphics.window import Window
 from sugar.graphics.alert import Alert
-from sugar.graphics.icon import Icon
+from sugar.graphics.icon import Icon, get_surface
+from sugar.graphics.xocolor import XoColor
 from sugar.datastore import datastore
 from sugar.session import XSMPClient
 from sugar import wm
@@ -327,20 +329,24 @@ class Activity(Window, gtk.Container):
   warn_if_none=False)
 self._set_up_sharing(mesh_instance, share_scope)

-if handle.object_id is None and create_jobject:
-logging.debug('Creating a jobject.')
-self._jobject = self._initialize_journal_object()
-self.set_title(self._jobject.metadata['title'])
-
-def _initialize_journal_object(self):
-title = _('%s Activity') % get_bundle_name()
-
 if self.shared_activity is not None:
 icon_color = self.shared_activity.props.color
 else:
 client = gconf.client_get_default()
 icon_color = client.get_string('/desktop/sugar/user/color')

+icon_pixbuf = self._get_icon_pixbuf(icon_color)
+gtk.window_set_default_icon(icon_pixbuf)
+self.set_icon(icon_pixbuf)
+
+if handle.object_id is None and create_jobject:
+logging.debug('Creating a jobject.')
+self._jobject = self._initialize_journal_object(icon_color)
+self.set_title(self._jobject.metadata['title'])
+
+def _initialize_journal_object(self, icon_color):
+title = _('%s Activity') % get_bundle_name()
+
 jobject = datastore.create()
 jobject.metadata['title'] = title
 jobject.metadata['title_set_by_user'] = '0'
@@ -402,6 +408,29 @@ class Activity(Window, gtk.Container):
 self._set_up_sharing(mesh_instance, SCOPE_PRIVATE)
 wait_loop.quit()

+def _get_icon_pixbuf(self, icon_color):
+Return colored activity icon as a Pixbuf.
+bundle = ActivityBundle(get_bundle_path())
+xo_color = XoColor(icon_color)
+# FIXME: without background_color there's garbage in the output
+surface = get_surface(file_name=bundle.get_icon(),
+fill_color=xo_color.get_fill_color(),
+stroke_color=xo_color.get_stroke_color(),
+background_color=style.COLOR_WHITE.get_gdk_color())
+width, height = surface.get_width(), surface.get_height()
+colormap = gtk.gdk.colormap_get_system()
+pixmap = gtk.gdk.Pixmap(self.window, width, height,
+colormap.get_visual().depth)
+pixmap.set_colormap(colormap)
+cr = pixmap.cairo_create()
+cr.set_source_surface(surface, 0, 0)
+cr.paint()
+pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True,
+colormap.get_visual().bits_per_rgb, width, height)
+pixbuf = pixbuf.get_from_drawable(pixmap, colormap, 0, 0, 0, 0,
+width, height)
+return pixbuf
+
 def get_active(self):
 return self._active

--
tg: (a2b8518..) t/set-window-icon (depends on: upstream/master)
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Bug tracking Vs Patch review

2010-09-19 Thread Sascha Silbe
Excerpts from Marco Pesenti Gritti's message of Thu Sep 02 00:43:14 +0200 2010:

 I'm pretty confident we can setup and improve patchwork to help us tracking 
 patch status reliably. I don't have a lot of time but I will commit to help 
 out with both infrastructure and the reviews themselves.

I have added a patchwork component on Trac and will file a few RFEs.
You can get a list of all tickets against patchwork on [1].
Thanks for helping out!

Sascha

[1] 
https://bugs.sugarlabs.org/query?component=patchworkstatus=acceptedstatus=assignedstatus=newstatus=reopened
--
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Shutdown and Logout menu items should activate the buzzy cursor (SL#2151)

2010-09-19 Thread Anurag Chowdhury
Shutdown (and Logout) menu items should activate the buzzy cursor (or provide 
some other visual feedback, perhaps dimming/locking the UI from use).

---
 buddymenu.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/buddymenu.py b/buddymenu.py
index 0ba6cc1..aaaf608 100644
--- a/buddymenu.py
+++ b/buddymenu.py
@@ -98,14 +98,17 @@ class BuddyMenu(Palette):
 item.show()
 
 def __logout_activate_cb(self, menu_item):
+self.window.get_window(set_cursor (gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.logout()
 
 def __reboot_activate_cb(self, menu_item):
+self.window.get_window(set_cursor (gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.reboot()
 
 def __shutdown_activate_cb(self, menu_item):
+self.window.get_window(set_cursor (gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.shutdown()
 
-- 
1.7.2.2

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] [PATCH] Shutdown and Logout menu items should activate the buzzy cursor (SL#2151)

2010-09-19 Thread Anurag Chowdhury
Shutdown (and Logout) menu items should activate the buzzy cursor (or provide 
some other visual feedback, perhaps dimming/locking the UI from use).
---
 src/jarabe/view/buddymenu.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py
index 0ba6cc1..6a60c71 100644
--- a/src/jarabe/view/buddymenu.py
+++ b/src/jarabe/view/buddymenu.py
@@ -98,14 +98,17 @@ class BuddyMenu(Palette):
 item.show()
 
 def __logout_activate_cb(self, menu_item):
+self.window.get_window(set_cursor( gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.logout()
 
 def __reboot_activate_cb(self, menu_item):
+self.window.get_window(set_cursor( gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.reboot()
 
 def __shutdown_activate_cb(self, menu_item):
+self.window.get_window(set_cursor( gtk.gdk.Cursor(gtk.gdk.WATCH)))
 session_manager = get_session_manager()
 session_manager.shutdown()
 
-- 
1.7.2.2

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Time out on registration process to prevent indefinite UI hang (SL#2289)

2010-09-19 Thread Dipankar Patro
Registration with the school server is currently done synchronously.
To prevent the UI from hanging indefinitely, if the school server is reachable
but unresponsive, we add an explicit timeout.

Reviewed-By: Sascha Silbe sascha-...@silbe.org
---
 src/jarabe/desktop/schoolserver.py |   27 ---
 1 files changed, 24 insertions(+), 3 deletions(-)

v2 was Reviewed by: Sascha Silbe sascha-...@silbe.org
v2-v3: Rebased on current mainline/master

diff --git a/src/jarabe/desktop/schoolserver.py 
b/src/jarabe/desktop/schoolserver.py
index a05f56c..a1c8c26 100644
--- a/src/jarabe/desktop/schoolserver.py
+++ b/src/jarabe/desktop/schoolserver.py
@@ -16,8 +16,9 @@
 
 import logging
 from gettext import gettext as _
-from xmlrpclib import ServerProxy, Error
+import xmlrpclib
 import socket
+import httplib
 import os
 from string import ascii_uppercase
 import random
@@ -30,6 +31,7 @@ from sugar import env
 from sugar.profile import get_profile
 
 REGISTER_URL = 'http://schoolserver:8080/'
+REGISTER_TIMEOUT = 8
 
 def generate_serial_number():
   Generates a serial number based on 3 random uppercase letters
@@ -76,6 +78,25 @@ def store_identifiers(serial_number, uuid, backup_url):
 class RegisterError(Exception):
 pass
 
+
+class TimeoutHTTP(httplib.HTTP):
+
+def __init__(self, host='', port=None, strict=None, timeout=None):
+if port == 0:
+port = None
+# FIXME: Depending on undocumented internals that can break between
+# Python releases.
+self._setup(self._connection_class(host,
+ port, strict, timeout=REGISTER_TIMEOUT))
+
+
+class TimeoutTransport(xmlrpclib.Transport):
+
+def make_connection(self, host):
+host, extra_headers, x509 = self.get_host_info(host)
+return TimeoutHTTP(host, timeout=REGISTER_TIMEOUT)
+
+
 def register_laptop(url=REGISTER_URL):
 
 profile = get_profile()
@@ -96,10 +117,10 @@ def register_laptop(url=REGISTER_URL):
 
 nick = client.get_string('/desktop/sugar/user/nick')
 
-server = ServerProxy(url)
+server = xmlrpclib.ServerProxy(url, TimeoutTransport())
 try:
 data = server.register(sn, nick, uuid_, profile.pubkey)
-except (Error, TypeError, socket.error):
+except (xmlrpclib.Error, TypeError, socket.error):
 logging.exception('Registration: cannot connect to server')
 raise RegisterError(_('Cannot connect to the server.'))
 
-- 
1.7.0.4
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] [PATCH] Shutdown and Logout menu items should activate the buzzy cursor (SL#2151)

2010-09-19 Thread Gary Martin
On 19 Sep 2010, at 20:36, Sascha Silbe sascha-ml-reply-to-201...@silbe.org 
wrote:

 Excerpts from Anurag Chowdhury's message of Sun Sep 19 19:51:02 +0200 2010:
 
 Shutdown (and Logout) menu items should activate the buzzy cursor (or 
 provide some other visual feedback, perhaps dimming/locking the UI from use).
 
 It's called a busy cursor [1] because it indicates that the computer
 is currently busy, not because it buzzes around. ;)

Sorry that was my fault in the original ticket report, I'm going to blame the 
iPad and auto correction ;)

--Gary

 Please wrap lines in the patch description so they are no longer that 80
 characters ([2] hints at it in section 15).
 The subject is fine in general (except for the double [PATCH] and buzzy
 vs. busy), though I would express it in a more active way: Use busy
 cursor during shutdown and logout.
 
 +self.window.get_window(set_cursor( gtk.gdk.Cursor(gtk.gdk.WATCH)))
 
 Please run pep8 [3] and fix anything you introduced.
 
 Sascha
 
 [1] http://www.freedesktop.org/wiki/Specifications/cursor-spec
 [2] https://www.kernel.org/doc/Documentation/SubmittingPatches
 [3] https://wiki.sugarlabs.org/go/Development_Team/Code_guidelines#Tools
 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [IAEP] Text to Speech in other Activities (was Re: FW: [Olpc-uruguay] MiguelEstudia (Version 1))

2010-09-19 Thread Tim McNamara
On 17 September 2010 02:19, James Simmons nices...@gmail.com wrote:

 Tim,

 Do I have documentation?  Surely your jest!

 http://en.flossmanuals.net/ActivitiesGuideSugar/TextToSpeech

 This is a chapter of Make Your Own Sugar Activities!, a FLOSS Manual
 I wrote (with much help from the folks on the Sugar-Devel mailing
 list).  There's a Spanish version in progress, and we hope to have
 printed versions available from Lulu in time for Christmas.


James,

Thanks for this! I was sure that I had read through the guide all the way
through. This book is an amazing resource. Thank you.

Tim
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Time out on registration process to prevent indefinite UI hang (SL#2289)

2010-09-19 Thread James Cameron
Reviewed-by: James Cameron qu...@laptop.org

(I agree with Sascha, there are minor whitespace issues that should be
fixed ... whitespace consistency greatly aids comprehension by humans
who have learned the patterns).

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Setting logging level of message Gsm connection not set... to warning from exception (SL #2247)

2010-09-19 Thread James Cameron
Reviewed-by: James Cameron qu...@laptop.org

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v2 sugar] Frame: show application-set icon for non-Sugar windows

2010-09-19 Thread James Cameron
On Sun, Sep 19, 2010 at 02:43:01PM +0200, Sascha Silbe wrote:
 Display the _NET_WM_ICON content instead of a generic icon for non-Sugar
 applications.

Nice.

 [...] 
 --- a/src/jarabe/frame/activitiestray.py
 +++ b/src/jarabe/frame/activitiestray.py
 @@ -97,6 +104,22 @@ class ActivityButton(RadioToolButton):
  else:
  self._icon.props.pulsing = False
 
 +def _icon_changed_cb(self, window):
 +gobject.idle_add(self._update_icon, window)

I'm puzzled.  Why defer the update to an idle task?  If it is because of
a race, I'm worried this won't fix it.

 +def _update_icon(self, window):
 +logging.debug('_update_icon: start')
 +pixbuf = window.get_icon()
 +if pixbuf is None:
 +return

When a function is an idle task, the return value has significance, so
I'm not sure if a bare return is the right thing here.

 +
 +fd, path = tempfile.mkstemp(suffix='.png')
 +os.close(fd)
 +pixbuf.save(path, 'png')
 +self._icon.props.icon_name = None
 +self._icon.props.file = util.TempFilePath(path)
 +logging.debug('_update_icon: updated icon')

When are these files cleaned up?

I've seen some applications that change their icon quite frequently.

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RELEASE] Etoys 4.1.2387

2010-09-19 Thread Bert Freudenberg
== Sources ==

http://download.sugarlabs.org/sources/sucrose/glucose/etoys/etoys-4.1.2387.tar.gz

== Changes since 4.1.2386 (rc1) ==

* fix Journal saving fails in Sugar 0.82
* updated translations: de, ja, ta
* fix error when adding variable named 'val'
* fix tile help balloons not being translated
* add button to reset saved preferences
* make soundReverb a preference

== Changes since 4.1.2384 (beta) ==
* do not hard-code squeak vm path
* replace == with = in shell tests
* fix paintbox in event theatre
* fix SuppliesPlayersTool guide
* remove MenuMakeNewFlap guide from index
* pop-up arrows now enabled by default
* new DrGeo examples project (see gallery)
* new home project (green border more visible)
* Demon Castle renamed to Etoys Castle and fixed
* revised guides for English and Spanish
* DrGeoII translations for de,es,fr,ja
* updated German and Japanese translations
* do not ship languages with too few translations (ar_SY, en_GB, km, pap, pl, 
zh_TW)
* hide distracting/not-functional preference panel buttons
* allow negative timer values
* shared flaps are not destroyed anymore when switching projects
* various smaller fixes

== Changes since 4.1.2382 (alpha 2) ==

* no save on stop under Sugar, must use keep button (enable sugarAutoSave to 
revert to old behavior)
* easier to make flap (see supplies)
* GSoC addition: scriptable speech bubbles
* translatability of Text object must be enabled explicitly
* minor fixes
* updated translations from Pootle
* added languages zh_CN, ca, sk, pap, pl, km, en_GB, ar_SY
* revised Italian, Portuguese, and German QuickGuides

== Changes since 4.1.2381 (alpha 1) ==

* fix DBus service methods
* fix NavBar not showing Sugar buttons
* fix 'length' and 'width' being read-only
* flip commands renamed to 'flip left right' and 'flip up down'
* fix QuickGuides showing up twice

== Changes since 4.0 (previous stable) ==

* switched to etoys.squeak.org/svn repo
* translations broken up in smaller files
* activity version will not track etoys version anymore
* QuickGuides translated to Spanish, Portuguese, German, Italian, and (some) 
French
* added DrGeo for exploring geometry
* sketches support flipping
* geometry tiles for the world
* timer tile (world and other playfields)
* can store preferences
* plus bug fixes

- Bert - (for the Etoys team)

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Activity Installation Problem - help!

2010-09-19 Thread Peter Hewitt
Hi,

I successfully installed my first activity on my soas box but it took a lot 
of trial and error! I thought I wrote down all the steps but when I tried 
my second activity it failed. I spent a lot of time with alsroot - the app 
worked fine for him - could I have an soas issue here?

Thanks ... Peter

test.py
===

import pygame,sys
def main():
 pygame.init()
 screen=pygame.display.set_mode()
 gwidth,gheight=screen.get_size()
 print gwidth
 print gheight
 pygame.display.quit()
 pygame.quit()
 sys.exit()

if __name__==__main__:
 main()

steps:
=
cd ~/peter/OLPCGames-1.6/skeleton
python buildskel.py –n test -t test -m test:main
cd test.activity
python setup.py dev
restart sugar
try hammer icon - fails - error log:
'module' object has no attribute 'main'

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel