Re: [Sugar-devel] Adding committers on gitorious (was: Re: [PATCH] Remove nbsp chars from the html string before parsing)

2010-08-05 Thread Tomeu Vizoso
On Wed, Aug 4, 2010 at 21:41, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Tomeu Vizoso's message of Wed Aug 04 20:03:50 +0200 2010:

 Don't have permissions to push to sugar-tools, gitorious should grow
 a better way to add committers.
 erikos (owner of both the sugar-tools project and its mainline repository)
 should be able to add you as a committer by using the Add committer
 link [1] on the sugar-tools/mainline repository page [2]. Didn't that
 work? Or what else is wrong with it? Please be more specific.

The problem with this is that often the owner is not around when
needed. If gitorious doesn't have more sofisticated rights management
I propose creating a group account and sharing the password between
several people.

Regards,

Tomeu

 Sascha

 [1] 
 http://git.sugarlabs.org/projects/sugar-tools/repos/mainline/committers/new
 [2] http://git.sugarlabs.org/projects/sugar-tools/repos/mainline
 --
 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] Adding committers on gitorious (was: Re: [PATCH] Remove nbsp chars from the html string before parsing)

2010-08-05 Thread Tomeu Vizoso
On Thu, Aug 5, 2010 at 09:04, Tomeu Vizoso to...@sugarlabs.org wrote:
 On Wed, Aug 4, 2010 at 21:41, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Tomeu Vizoso's message of Wed Aug 04 20:03:50 +0200 2010:

 Don't have permissions to push to sugar-tools, gitorious should grow
 a better way to add committers.
 erikos (owner of both the sugar-tools project and its mainline repository)
 should be able to add you as a committer by using the Add committer
 link [1] on the sugar-tools/mainline repository page [2]. Didn't that
 work? Or what else is wrong with it? Please be more specific.

 The problem with this is that often the owner is not around when
 needed. If gitorious doesn't have more sofisticated rights management
 I propose creating a group account and sharing the password between
 several people.

Another option is having some script that adds committers to all sugar
core modules in one go, that would be similar to what GNOME does.

Regards,

Tomeu

 Regards,

 Tomeu

 Sascha

 [1] 
 http://git.sugarlabs.org/projects/sugar-tools/repos/mainline/committers/new
 [2] http://git.sugarlabs.org/projects/sugar-tools/repos/mainline
 --
 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] CIA bot disabled

2010-08-05 Thread Tomeu Vizoso
On Fri, Jul 16, 2010 at 10:52, Tomeu Vizoso to...@tomeuvizoso.net wrote:
 Hi,

 have disabled again the CIA bot because it's reporting old commits
 when people merge.

 Please only activate it once uninteresting commits are filtered out.

Disabled it again because was sending multiple times the same commit.

Regards,

Tomeu

 Regards,

 Tomeu

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


Re: [Sugar-devel] [ANNOUNCE] Sucrose 0.89.2 Tarballs Due

2010-08-05 Thread Simon Schampijer
On 08/03/2010 09:14 PM, Anish Mangal wrote:
 Hi,

 Sorry for the noob query, but,

 I released the Pippy-37 source tarball a few days ago on sugar-devel
 [1]. Do I need to send that email again (in response to your
 ANNOUNCE), or will the latest tarball be picked up automatically?

 --
 Anish

 [1] http://lists.sugarlabs.org/archive/sugar-devel/2010-July/025728.html

Thanks for letting me know. I do filter the emails for the [RELEASE] 
tag, so I catch those mails. Of course, feel free to ping me if I 
oversee something or if in doubt.

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


[Sugar-devel] [PATCH 1/2] new color selector for control panel

2010-08-05 Thread Walter Bender
As per feedback on my patches for ticket #1592, I've refactored my
code. I think this time it may be set to go.

From 5a031a488d2c51440297a9ec8cd4c67c7fcd7175 Mon Sep 17 00:00:00 2001
From: Walter Bender wal...@sugarlabs.org
Date: Thu, 5 Aug 2010 07:37:36 -0400
Subject: [PATCH] added prev next fill and stroke color to selector

---
 extensions/cpsection/aboutme/view.py |  184 ++
 1 files changed, 118 insertions(+), 66 deletions(-)

diff --git a/extensions/cpsection/aboutme/view.py
b/extensions/cpsection/aboutme/view.py
index cabd66a..5c8e65d 100644
--- a/extensions/cpsection/aboutme/view.py
+++ b/extensions/cpsection/aboutme/view.py
@@ -1,4 +1,5 @@
 # Copyright (C) 2008, OLPC
+# Copyright (C) 2010, Sugar Labs
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,18 +21,27 @@ from gettext import gettext as _

 from sugar.graphics.icon import Icon
 from sugar.graphics import style
-from sugar.graphics.xocolor import XoColor
+from sugar.graphics.xocolor import XoColor, get_next_stroke_color, \
+get_prev_stroke_color, get_next_fill_color, get_prev_fill_color

 from jarabe.controlpanel.sectionview import SectionView
 from jarabe.controlpanel.inlinealert import InlineAlert

+_PREV_FILL_COLOR = 0
+_NEXT_FILL_COLOR = 1
+_CURRENT_COLOR = 2
+_NEXT_STROKE_COLOR = 3
+_PREV_STROKE_COLOR = 4
+
+
 class EventIcon(gtk.EventBox):
-__gtype_name__ = SugarEventIcon
-def __init__(self, **kwargs):
+__gtype_name__ = SugarEventIcon
+
+def __init__(self, **kwargs):
 gtk.EventBox.__init__(self)

-self.icon = Icon(pixel_size = style.XLARGE_ICON_SIZE, **kwargs)
-
+self.icon = Icon(pixel_size=style.XLARGE_ICON_SIZE, **kwargs)
+
 self.set_visible_window(False)
 self.set_app_paintable(True)
 self.set_events(gtk.gdk.BUTTON_PRESS_MASK)
@@ -39,28 +49,45 @@ class EventIcon(gtk.EventBox):
 self.add(self.icon)
 self.icon.show()

+
 class ColorPicker(EventIcon):
 __gsignals__ = {
 'color-changed': (gobject.SIGNAL_RUN_FIRST,
   gobject.TYPE_NONE,
-  ([str]))
-}
-def __init__(self, xocolor=None):
+  ([object]))
+}
+
+def __init__(self, picker):
 EventIcon.__init__(self)
-self.icon.props.xo_color = xocolor
+
 self.icon.props.icon_name = 'computer-xo'
+self._picker = picker
+self._color = None
+
 self.icon.props.pixel_size = style.XLARGE_ICON_SIZE
-self.connect('button_press_event', self.__pressed_cb)

-def __pressed_cb(self, button, event):
-self._set_random_colors()
+self.connect('button_press_event', self.__pressed_cb, picker)
+
+def update(self, color):
+if self._picker == _PREV_FILL_COLOR:
+self._color = XoColor(get_prev_fill_color(color))
+elif self._picker == _PREV_STROKE_COLOR:
+self._color = XoColor(get_prev_stroke_color(color))
+elif self._picker == _NEXT_FILL_COLOR:
+self._color = XoColor(get_next_fill_color(color))
+elif self._picker == _NEXT_STROKE_COLOR:
+self._color = XoColor(get_next_stroke_color(color))
+else:
+self._color = color
+self.icon.props.xo_color = self._color
+
+def __pressed_cb(self, button, event, picker):
+if picker != _CURRENT_COLOR:
+self.emit('color-changed', self._color)

-def _set_random_colors(self):
-xocolor = XoColor()
-self.icon.props.xo_color = xocolor
-self.emit('color-changed', xocolor.to_string())

 class AboutMe(SectionView):
+
 def __init__(self, model, alerts):
 SectionView.__init__(self)

@@ -69,44 +96,45 @@ class AboutMe(SectionView):
 self._nick_sid = 0
 self._color_valid = True
 self._nick_valid = True
-self._color_change_handler = None
-self._nick_change_handler = None
+self._handlers = []

 self.set_border_width(style.DEFAULT_SPACING * 2)
 self.set_spacing(style.DEFAULT_SPACING)
 self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

+self._color_label = gtk.HBox(spacing=style.DEFAULT_SPACING)
+self._color_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
+self._color_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
+self._color_alert = None
+
+self._pickers = {
+_PREV_FILL_COLOR: ColorPicker(_PREV_FILL_COLOR),
+_NEXT_FILL_COLOR: ColorPicker(_NEXT_FILL_COLOR),
+_CURRENT_COLOR: ColorPicker(_CURRENT_COLOR),
+_NEXT_STROKE_COLOR: ColorPicker(_NEXT_STROKE_COLOR),
+_PREV_STROKE_COLOR: ColorPicker(_PREV_STROKE_COLOR)
+}
+
+self._setup_color()
+initial_color = XoColor(self._model.get_color_xo())
+

[Sugar-devel] [PATCH 2/2] new color selector for control panel

2010-08-05 Thread Walter Bender
Part 2 of the patch for #1592

From 44564b8d20094d61f06b99f25726bdf5cd0829ff Mon Sep 17 00:00:00 2001
From: Walter Bender wal...@sugarlabs.org
Date: Thu, 5 Aug 2010 07:34:03 -0400
Subject: [PATCH] added get_next and get_prev fill and stroke colors

---
 src/sugar/graphics/xocolor.py |  109 ++---
 1 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/src/sugar/graphics/xocolor.py b/src/sugar/graphics/xocolor.py
index fd329cb..9d1d80a 100644
--- a/src/sugar/graphics/xocolor.py
+++ b/src/sugar/graphics/xocolor.py
@@ -1,4 +1,5 @@
 # Copyright (C) 2006-2007 Red Hat, Inc.
+# Copyright (C) 2008-2010 Sugar Labs
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -24,6 +25,9 @@ import logging

 import gconf

+_STROKE_COLOR = 0
+_FILL_COLOR = 1
+
 colors = [
 ['#B20008', '#FF2B34'], \
 ['#FF2B34', '#B20008'], \
@@ -216,7 +220,7 @@ def _parse_string(color_string):

 splitted = color_string.split(',')
 if len(splitted) == 2:
-return [splitted[0], splitted[1]]
+return [splitted[_STROKE_COLOR], splitted[_FILL_COLOR]]
 else:
 return None

@@ -225,14 +229,99 @@ def is_valid(color_string):
 return (_parse_string(color_string) != None)


+def get_random_color():
+ Return a random color from the default colors-pair list. 
+color_index = int(random.random() * (len(colors) - 1))
+return %s,%s % (colors[color_index][_STROKE_COLOR],
+  colors[color_index][_FILL_COLOR])
+
+
+def get_next_stroke_color(color):
+ Return the next color pair in the list that shares the same fill
+as color. 
+current_index = _get_index(color)
+if current_index == -1:
+return %s,%s % (color.stroke, color.fill)
+next_index = _next_index(current_index)
+while(colors[next_index][_FILL_COLOR] != \
+  colors[current_index][_FILL_COLOR]):
+next_index = _next_index(next_index)
+return %s,%s % (colors[next_index][_STROKE_COLOR],
+  colors[next_index][_FILL_COLOR])
+
+
+def get_prev_stroke_color(color):
+ Return the prev color pair in the list that shares the same fill
+as color. 
+current_index = _get_index(color)
+if current_index == -1:
+return %s,%s % (color.stroke, color.fill)
+prev_index = _prev_index(current_index)
+while (colors[prev_index][_FILL_COLOR] != \
+   colors[current_index][_FILL_COLOR]):
+prev_index = _prev_index(prev_index)
+return %s,%s % (colors[prev_index][_STROKE_COLOR],
+  colors[prev_index][_FILL_COLOR])
+
+
+def get_next_fill_color(color):
+ Return the next color pair in the list that shares the same stroke
+as color. 
+current_index = _get_index(color)
+if current_index == -1:
+return %s,%s % (color.stroke, color.fill)
+next_index = _next_index(current_index)
+while (colors[next_index][_STROKE_COLOR] != \
+   colors[current_index][_STROKE_COLOR]):
+next_index = _next_index(next_index)
+return %s,%s % (colors[next_index][_STROKE_COLOR],
+  colors[next_index][_FILL_COLOR])
+
+
+def get_prev_fill_color(color):
+ Return the prev color pair in the list that shares the same stroke
+as color. 
+current_index = _get_index(color)
+if current_index == -1:
+return %s,%s % (color.stroke, color.fill)
+prev_index = _prev_index(current_index)
+while (colors[prev_index][_STROKE_COLOR] != \
+   colors[current_index][_STROKE_COLOR]):
+prev_index = _prev_index(prev_index)
+return %s,%s % (colors[prev_index][_STROKE_COLOR],
+  colors[prev_index][_FILL_COLOR])
+
+
+def _next_index(current_index):
+next_index = current_index + 1
+if next_index == len(colors):
+next_index = 0
+return next_index
+
+
+def _prev_index(current_index):
+prev_index = current_index - 1
+if prev_index  0:
+prev_index = len(colors)-1
+return prev_index
+
+
+def _get_index(color):
+for index in range(0, len(colors)):
+if colors[index] == [color.stroke, color.fill]:
+return index
+return -1
+
+
 class XoColor:

 def __init__(self, color_string=None):
 if color_string == None:
 randomize = True
 elif not is_valid(color_string):
-logging.debug('Color string is not valid: %s, '
-  'fallback to default', color_string)
+logging.error(
+'Color string is not valid: %s; fallback to default',
+color_string)
 client = gconf.client_get_default()
 color_string = client.get_string('/desktop/sugar/user/color')
 randomize = False
@@ -240,10 +329,8 @@ class XoColor:
 randomize = False

 if randomize:
-n = int(random.random() * (len(colors) - 1))

[Sugar-devel] [RELEASE] Browse-117

2010-08-05 Thread Lucian Branescu Mihaila
Bugfix release, adds a missing tab icon.

Please test this and report back any issues with tabs, from functionality to 
design.
Note: tabs will disable themselves if you have a version of cairo that would 
crash Browse.

== Source ==

http://download.sugarlabs.org/sources/sucrose/fructose/Browse/Browse-117.tar.bz2
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] CIA bot disabled

2010-08-05 Thread Sascha Silbe
Excerpts from Tomeu Vizoso's message of Thu Aug 05 11:11:00 +0200 2010:

  have disabled again the CIA bot because it's reporting old commits
  when people merge.
 
  Please only activate it once uninteresting commits are filtered out.
 
 Disabled it again because was sending multiple times the same commit.
D'oh, I assumed it's still deactivated. Sorry for the spam.
I've now configured the bot to ignore commits from my repository (the
changes I did the last time went missing :-/) and re-enabled it.

Sascha

--
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] [ANNOUNCE] Sucrose 0.89.2 Development Release

2010-08-05 Thread Simon Schampijer
Dear Sugar Community,

This is our second release in the 0.90 development cycle [1].

There have been many great fixes already helping to make Sugar even more 
stable. From a user point of view we want to highlight the addition of 
the keybindings for accessing the Journal (F5) and the Frame (F6). 
Daniel Drake has as well changed the appearance of the mesh device to be 
only present when the mesh is active (this is the same behavior than 
that of the wired device).

On the activity side many fixes have been going into Pippy version 37, 
especially on fixing layout issues on different resolutions. Thanks to 
the Pippy team for all your hard work!

The new Browse maintainers have not waited long with a new release. 
Shortcuts for back/forward/reload, support for CAcerts and user visible 
support for tabs. The Browse team would like to have feedback especially 
on the latter. Thanks again to Lucian and Sascha for taking on this 
valuable task.

There is also a new bundle from the Calculate team around Gary and 
Reinier. The activity does use the new activity toolbar introduced in 
0.86 now. From a first glance the interface has improved a lot, please 
report back what you think about it.

The full release notes with the tarballs can be found at [2].

We encourage people to start doing testing. The sooner the developers 
get feedback about their changes the better. The Fedora team is doing 
nightly builds which contains the Soas images [3]. And as the Fedora 
packager team is doing a fantastic job at packaging the latest tarballs 
the release should be packaged up soon. I will do another announcement 
once they are available. By now you can already test the 0.89.1 release 
if you grab the latest image from [3].

Thanks everyone for your great contributions!

In behalf of the sugar community,
Your Release Team

[1] Schedule: http://wiki.sugarlabs.org/go/0.90/Roadmap
[2] Release notes: http://wiki.sugarlabs.org/go/0.90/0.89.2_Notes
[3] http://alt.fedoraproject.org/pub/alt/nightly-composes/soas/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] gadget extension to ejabberd

2010-08-05 Thread Tomeu Vizoso
Hi,

is anybody aware of any production usage of gadget?

We are considering removing the client code from telepathy-gabble.

Thanks,

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


Re: [Sugar-devel] gadget extension to ejabberd

2010-08-05 Thread Thomas Gilliard

Tomeu;

daveb used it for a while on the default -jabber.sugarlabs.org  server.
I do not think it is being used now.

Tom Gilliard
satellit

Tomeu Vizoso wrote:
 Hi,

 is anybody aware of any production usage of gadget?

 We are considering removing the client code from telepathy-gabble.

 Thanks,

 Tomeu
 ___
 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] gadget extension to ejabberd

2010-08-05 Thread Dave Bauer
On Thu, Aug 5, 2010 at 11:47 AM, Tomeu Vizoso to...@sugarlabs.org wrote:

 Hi,

 is anybody aware of any production usage of gadget?

 We are considering removing the client code from telepathy-gabble.


One reason it isn't used, I imagine, if that it doesn't do anything actually
useful at the moment. Serving a random subset of users isn't really helpful
to any use case I am aware of.

Dave



 Thanks,

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




-- 
Dave Bauer
d...@solutiongrove.com
http://www.solutiongrove.com
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] No sugar-base or sugar-presence-service releases for 0.90 branch?

2010-08-05 Thread Jonas Smedegaard

On Thu, Aug 05, 2010 at 02:11:38PM +0200, Simon Schampijer wrote:

On 07/21/2010 12:14 PM, Jonas Smedegaard wrote:
I am currently releasing the 0.90 (a.k.a. 0.89.x) branch of Sugar for 
Debian.


The parts sugar, sugar-artwork and sugar-toolkit have Git tags and 
tarballs in the 0.89.x series, but not sugar-base or 
sugar-presence-service.


there have been no changes to those modules yet. I was wondering about 
doing a release today - just to bump the version number, but was not 
sure what is more convenient. You as a packager, what would you prefer?


Yes, for base parts (the subset of Sucrose which all activities depend 
on) it makes best sense for me as distributor that each branch has a 
complete set of tarballs.


Alternatively there ought to be a single, obvious to find canonical 
place which declared which parts officially span which multiple 
branches.  But really I prefer the (in my opinion) simpler approach of 
simply rereleasing with bumped version number, even if nothing has 
changed.



This *only* relates to core parts.  Activities we have no problems in 
Debian handling even if they span multiple branches.  Or actually, we do 
have problems with it currently, but that is due to bugs in the CDBS 
plugin that I developed for it, not a problem with your releases. :-)



 - Jonas

--
 * Jonas Smedegaard - idealist  Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private


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


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

2010-08-05 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 |   36 
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 0e2ecc5..1b1503c 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -61,13 +61,15 @@ import dbus.service
 import cjson
 
 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
@@ -331,6 +333,8 @@ class Activity(Window, gtk.Container):
 else:
 logging.debug('Unknown share scope %r', share_scope)
 
+client = gconf.client_get_default()
+icon_color = client.get_string('/desktop/sugar/user/color')
 if handle.object_id is None and create_jobject:
 logging.debug('Creating a jobject.')
 self._jobject = datastore.create()
@@ -345,9 +349,6 @@ class Activity(Window, gtk.Container):
 self._jobject.metadata['share-scope'] = SCOPE_PRIVATE
 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')
 self._jobject.metadata['icon-color'] = icon_color
 
 self._jobject.file_path = ''
@@ -355,6 +356,33 @@ class Activity(Window, gtk.Container):
 # https://dev.laptop.org/ticket/3071
 datastore.write(self._jobject)
 
+icon_pixbuf = self._get_icon_pixbuf(icon_color)
+gtk.window_set_default_icon(icon_pixbuf)
+self.set_icon(icon_pixbuf)
+
+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: (29aa609..) 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] [sugar-toolkit PATCH] set window icon

2010-08-05 Thread James Cameron
On Thu, Aug 05, 2010 at 09:26:04PM +, Sascha Silbe wrote:
 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

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] Adding committers on gitorious (was: Re: [PATCH] Remove nbsp chars from the html string before parsing)

2010-08-05 Thread Tim McNamara
On 6 August 2010 11:20, James Cameron qu...@laptop.org wrote:

 On Thu, Aug 05, 2010 at 09:06:03AM +0200, Tomeu Vizoso wrote:
  Another option is having some script that adds committers to all sugar
  core modules in one go, that would be similar to what GNOME does.

 There are too many core modules, in my opinion (and Michael Stone's).  I
 see no good reason why there isn't just one git repository for the
 whole of Sugar.


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


Re: [Sugar-devel] Adding committers on gitorious (was: Re: [PATCH] Remove nbsp chars from the html string before parsing)

2010-08-05 Thread Marco Pesenti Gritti
On 6 Aug 2010, at 00:20, James Cameron qu...@laptop.org wrote:

 On Thu, Aug 05, 2010 at 09:06:03AM +0200, Tomeu Vizoso wrote:
 Another option is having some script that adds committers to all sugar
 core modules in one go, that would be similar to what GNOME does.
 
 There are too many core modules, in my opinion (and Michael Stone's).  I
 see no good reason why there isn't just one git repository for the
 whole of Sugar.

Yeah, I think we need to look into merging core in a single repository. Not 
even so much because of the maintenance burden, but because we really need to 
get to the point where building Sugar on a recent distribution is just cloning 
one git repository and running ./configure; make install.

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


[Sugar-devel] PATCH #1106 Browse: No preview in Journal for downloaded image

2010-08-05 Thread Gonzalo Odiard
This patch resolves the problem in browser.
I don't know if may be a good idea do the preview in the datastore instead.

Gonzalo

[gonz...@aronax Browse.activity]$ diff -u downloadmanager.py.ori
downloadmanager.py
--- downloadmanager.py.ori2010-07-05 20:27:06.0 -0300
+++ downloadmanager.py2010-08-06 02:17:23.095272320 -0300
@@ -36,8 +36,10 @@
 from sugar import mime
 from sugar.graphics.alert import Alert, TimeoutAlert
 from sugar.graphics.icon import Icon
+from sugar.graphics import style
 from sugar.activity import activity

+
 # #3903 - this constant can be removed and assumed to be 1 when dbus-python
 # 0.82.3 is the only version used
 import dbus
@@ -192,12 +194,47 @@
 sniffed_mime_type =
mime.get_for_file(self._target_file.path)
 self.dl_jobject.metadata['mime_type'] = sniffed_mime_type

+if self._mime_type in
('image/bmp','image/gif','image/jpeg','image/png','image/tiff'):
+
+self.dl_jobject.metadata['preview'] =
self.__get_preview_image()
+else:
+self.dl_jobject.metadata['preview'] = ''
+
 datastore.write(self.dl_jobject,
 transfer_ownership=True,
 reply_handler=self._internal_save_cb,
 error_handler=self._internal_save_error_cb,
 timeout=360 *
DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND)

+def __get_preview_image(self):
+pixbuf = gtk.gdk.pixbuf_new_from_file(self._target_file.path)
+width, height = pixbuf.get_width(), pixbuf.get_height()
+
+preview_width = style.zoom(300)
+preview_height =  style.zoom(225)
+
+if (width  preview_width) or (height  preview_height):
+scale_x = float(width) / preview_width
+scale_y = float(height) / preview_height
+scale = max(scale_x,scale_y)
+
+pixbuf = pixbuf.scale_simple(float(width) / scale, height /
scale,
+ gtk.gdk.INTERP_BILINEAR)
+pixbuf2 =
gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,pixbuf.get_has_alpha(),8,preview_width,preview_height)
+pixbuf2.fill(0x)
+margin_x = (preview_width - pixbuf.get_width()) / 2
+margin_y = (preview_height - pixbuf.get_height()) / 2
+
+
pixbuf.copy_area(0,0,pixbuf.get_width(),pixbuf.get_height(),pixbuf2,margin_x,margin_y)
+
+preview_data = []
+def save_func(buf, data):
+data.append(buf)
+
+pixbuf2.save_to_callback(save_func, 'png', user_data=preview_data)
+preview_data = ''.join(preview_data)
+return dbus.ByteArray(preview_data)
+
 def __start_response_cb(self, alert, response_id):
 global _active_downloads
 if response_id is gtk.RESPONSE_CANCEL:
@@ -273,10 +310,10 @@
 self.dl_jobject.metadata['progress'] = '0'
 self.dl_jobject.metadata['keep'] = '0'
 self.dl_jobject.metadata['buddies'] = ''
-self.dl_jobject.metadata['preview'] = ''
 self.dl_jobject.metadata['icon-color'] = \
 profile.get_color().to_string()
 self.dl_jobject.metadata['mime_type'] = self._mime_type
+self.dl_jobject.metadata['preview'] = ''
 self.dl_jobject.file_path = ''
 datastore.write(self.dl_jobject)
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel