Re: [Sugar-devel] [PATCH 3/5] sl#2816: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 01/23/2012 06:01 PM, Sascha Silbe wrote:

Excerpts from Ajay Garg's message of 2012-01-19 22:36:08 +0100:

Like mentioned for the first patch in the series (BTW, please post
series as a thread (git send-email --thread; this option is enabled by
default so you seem to have explicitly deactivated it), please provide a
better description than just Localization fixes).


[data/sugar.schemas.in]

@@ -218,7 +218,7 @@
typebool/type
defaultfalse/default
locale name=C
-shortPower Automatic/short
+shortPower Automatic./short
  longPower Automatic./long
/locale
  /schema
@@ -229,7 +229,7 @@
typebool/type
defaultfalse/default
locale name=C
-shortPower Extreme/short
+shortPower Extreme./short
  longPower Extreme./long
/locale
  /schema


I wouldn't mind us accepting this patch to make the lives of our
translators easier, but the existing descriptions are rather poor and
should be fixed. We could take the strings from
extensions/cpsection/power/view.py:

Automatic power management (increases battery life)

Extreme power management (disables wireless radio, increases battery life)

Reusing those strings as-is would achieve the goal of SL#2816 and at
the same time improve the gconf descriptions.

Sascha


Good Idea, I would do then:

diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index e048c37..763aa38 100644
--- a/data/sugar.schemas.in
+++ b/data/sugar.schemas.in
@@ -152,7 +152,7 @@
   defaultfalse/default
   locale name=C
 shortPower Automatic/short
-longPower Automatic./long
+longAutomatic power management (increases battery life)/long
   /locale
 /schema
 schema
@@ -163,7 +163,7 @@
   defaultfalse/default
   locale name=C
 shortPower Extreme/short
-longPower Extreme. /long
+longExtreme power management (disables wireless radio, 
increases battery life)/long

   /locale
 /schema

@Chris: Looks like we need to cleanup the po files then after those 
changes. An extract from the german po.


#~ msgid Power Automatic.
#~ msgstr Automatische Energieverwaltung.

# (Markus S.) war 'Extreme Energieverwaltung'
#~ msgid Power Extreme.
#~ msgstr Extremes Energiesparen.

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


Re: [Sugar-devel] [PATCH 3/5] sl#2816: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 02/09/2012 09:02 AM, Simon Schampijer wrote:

On 01/23/2012 06:01 PM, Sascha Silbe wrote:

Excerpts from Ajay Garg's message of 2012-01-19 22:36:08 +0100:

Like mentioned for the first patch in the series (BTW, please post
series as a thread (git send-email --thread; this option is enabled by
default so you seem to have explicitly deactivated it), please provide a
better description than just Localization fixes).


[data/sugar.schemas.in]

@@ -218,7 +218,7 @@
typebool/type
defaultfalse/default
locale name=C
-shortPower Automatic/short
+shortPower Automatic./short
longPower Automatic./long
/locale
/schema
@@ -229,7 +229,7 @@
typebool/type
defaultfalse/default
locale name=C
-shortPower Extreme/short
+shortPower Extreme./short
longPower Extreme./long
/locale
/schema


I wouldn't mind us accepting this patch to make the lives of our
translators easier, but the existing descriptions are rather poor and
should be fixed. We could take the strings from
extensions/cpsection/power/view.py:

Automatic power management (increases battery life)

Extreme power management (disables wireless radio, increases battery
life)

Reusing those strings as-is would achieve the goal of SL#2816 and at
the same time improve the gconf descriptions.

Sascha


Good Idea, I would do then:

diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index e048c37..763aa38 100644
--- a/data/sugar.schemas.in
+++ b/data/sugar.schemas.in
@@ -152,7 +152,7 @@
defaultfalse/default
locale name=C
shortPower Automatic/short
- longPower Automatic./long
+ longAutomatic power management (increases battery life)/long
/locale
/schema
schema
@@ -163,7 +163,7 @@
defaultfalse/default
locale name=C
shortPower Extreme/short
- longPower Extreme. /long
+ longExtreme power management (disables wireless radio, increases
battery life)/long
/locale
/schema

@Chris: Looks like we need to cleanup the po files then after those
changes. An extract from the german po.

#~ msgid Power Automatic.
#~ msgstr Automatische Energieverwaltung.

# (Markus S.) war 'Extreme Energieverwaltung'
#~ msgid Power Extreme.
#~ msgstr Extremes Energiesparen.

Regards,
Simon


Pushed that one now, to not get it stale: 
72a7278f2803c5f13d55226af82ada1a8f8e714d


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


Re: [Sugar-devel] [PATCH] sl#2815: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 02/01/2012 03:35 PM, Chris Leonard wrote:

On Tue, Jan 31, 2012 at 7:38 AM, Sascha Silbesi...@activitycentral.com  wrote:

Excerpts from David Mason's message of 2012-01-31 03:16:14 +0100:


David, I'm assuming you replied in private accidentally, so I'm bringing
the thread back on-list.


Similar to your previous patch [1], gettext already flags this as a
format string. As this particular example is a bit more complicated,
I'm less averse to accepting the patch, but I'd still prefer a solution
that tells translators how to properly handle them without requiring us to
mention that for each and every format string in the code.


We've just implemented a validator in zanata's translation editor that will 
warn translators when there is any change in printf style variables. I based it 
on the validator in translation toolkit, and I believe a similar validator is 
also available in pootle. Having translators performing translations through 
Zanata (www.zanata.org) or Pootle, or use translation toolkit or running 
msgmerge with appropriate options, could make handling of variables in 
translations a lot cleaner.


Sugar Labs already uses a Pootle instance [1], which Chris (who
requested the changes discussed in this thread) maintains.

Chris, what are the exact cases where format strings are troublesome? Is
it with translators using translation tools outside of Pootle (which
tools exactly?) or when translating inside Pootle?



The particular string in question was

%(hour)d:%(min).2d remaining

The tools handle this properly, however, it had been my observation
that translators had a tendency to translate the variable names (hour
and minutes) on this particular string, so I felt it was worth asking
for the translator's comment.  It is as simple as that.


I think the TRANS string does handle this case fine. I have pushed the 
change.


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


Re: [Sugar-devel] [PATCH 4/5] sl#3029: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 01/23/2012 06:12 PM, Sascha Silbe wrote:

Excerpts from Ajay Garg's message of 2012-01-19 22:36:26 +0100:


Signed-off-by: Ajay Garga...@activitycentral.com


How about:

Capitalise Sugar in strings marked for translation (fixes SL#3029)

The patch itself looks good.

Sascha


Adjusted message, pushed as:

4fe56b6bd11abcff9be9b46e31906649b5083107

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


Re: [Sugar-devel] [PATCH] sl#3149: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 01/23/2012 02:48 PM, Ajay Garg wrote:

---

Removed unncessary gettext notations; plus added TRANS labels for not
translating format-specifier tokens.

Thanks Chris Leonard.

  extensions/cpsection/aboutcomputer/model.py |2 +-
  src/jarabe/desktop/favoritesview.py |2 +-
  src/jarabe/frame/activitiestray.py  |7 +--
  3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/extensions/cpsection/aboutcomputer/model.py 
b/extensions/cpsection/aboutcomputer/model.py
index 431c9c0..86d2e3f 100644
--- a/extensions/cpsection/aboutcomputer/model.py
+++ b/extensions/cpsection/aboutcomputer/model.py
@@ -180,7 +180,7 @@ def get_wireless_firmware():
  if len(firmware_info) == 1:
  return firmware_info.values()[0]

-return ', '.join([_('%(interface)s: %(version)s') %
+return ', '.join(['%(interface)s: %(version)s' %
{'interface': interface, 'version': version}
for interface, version in firmware_info.items()])


This one looks good.


diff --git a/src/jarabe/desktop/favoritesview.py 
b/src/jarabe/desktop/favoritesview.py
index 132d14f..5c76cdc 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -336,7 +336,7 @@ class FavoritesView(hippo.Canvas):
  schoolserver.register_laptop()
  except RegisterError, e:
  alert.props.title = _('Registration Failed')
-alert.props.msg = _('%s') % e
+alert.props.msg = '%s' % e
  else:
  alert.props.title = _('Registration Successful')
  alert.props.msg = _('You are now registered ' \


This one looks good as well.


diff --git a/src/jarabe/frame/activitiestray.py 
b/src/jarabe/frame/activitiestray.py
index 941b174..2b8b7c6 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -541,6 +541,7 @@ class BaseTransferPalette(Palette):
  transferred = self._format_size(
  self.file_transfer.props.transferred_bytes)
  total = self._format_size(self.file_transfer.file_size)
+# TRANS: do not translate the two %s.
  self.progress_label.props.label = _('%s of %s') % (transferred, total)


If I would add a comment here I would be verbose about the context. For 
example:


# TRANS: file transfer, bytes transferred, e.g. 128 of 1024


@@ -555,6 +556,7 @@ class IncomingTransferPalette(BaseTransferPalette):
  self.file_transfer.connect('notify::state', self.__notify_state_cb)

  nick = str(self.file_transfer.buddy.props.nick)
+# TRANS: do not translate the token %s.
  label = glib.markup_escape_text(_('Transfer from %s') % (nick,))
  self.props.secondary_text = label


No need to add an extra trans information here. I think translators know 
how to deal with this one.



@@ -589,7 +591,7 @@ class IncomingTransferPalette(BaseTransferPalette):
  type_description = mime.get_mime_description(mime_type)

  size = self._format_size(self.file_transfer.file_size)
-label = gtk.Label(_('%s (%s)') % (size, type_description))
+label = gtk.Label('%s (%s)' % (size, type_description))
  vbox.add(label)
  label.show()


This one looks good.


@@ -688,6 +690,7 @@ class OutgoingTransferPalette(BaseTransferPalette):
  self.file_transfer.connect('notify::state', self.__notify_state_cb)

  nick = str(file_transfer.buddy.props.nick)
+# TRANS: do not translate %s.
  label = glib.markup_escape_text(_('Transfer to %s') % (nick,))
  self.props.secondary_text = label


Same as above: No need to add an extra trans information here. I think 
translators know how to deal with this one.



@@ -719,7 +722,7 @@ class OutgoingTransferPalette(BaseTransferPalette):
  type_description = mime.get_mime_description(mime_type)

  size = self._format_size(self.file_transfer.file_size)
-label = gtk.Label(_('%s (%s)') % (size, type_description))
+label = gtk.Label('%s (%s)' % (size, type_description))
  vbox.add(label)
  label.show()


This one looks good.

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


[Sugar-devel] Easy Hacks in activities

2012-02-09 Thread Gonzalo Odiard
I have received questions from volunteers about easy tasks to start hacking
in Sugar.
Of course, start with activities is easier than core Sugar, then I reviewed
the open ticket
in the activities and added a easy-hack tag to tickets I think can be
solved by a newbie hacker.

The list is here:
http://bugs.sugarlabs.org/query?status=acceptedstatus=assignedstatus=newstatus=reopenedgroup=componentorder=prioritycol=idcol=summarycol=statuscol=ownercol=typecol=prioritycol=milestonekeywords=~easy-hack

We used to have another similar tag sugar-love, but I found the tickets
no so easy to solve,
and the list not maintained. If anybody will maintain/use the sugar-love
tag, we can keep it,
if not may be is a good idea remove the tag.

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


Re: [Sugar-devel] Easy Hacks in activities

2012-02-09 Thread Thomas C Gilliard

Fully sugarize firefox-6.xo?[1]

It starts and runs fine in most versions of sugar [2];  but has greyed 
circle and  firefox icons in the frame while it runs and exits with a 
(failed to start)  pop-up.


[1] http://download.sugarlabs.org/activities/4262/firefox-6.xo
[2]http://wiki.sugarlabs.org/go/Sugar_Creation_Kit/sck/Activity_Matrix

Tom Gilliard
satellit_ on #sugar

On 02/09/2012 06:19 AM, Gonzalo Odiard wrote:
I have received questions from volunteers about easy tasks to start 
hacking in Sugar.
Of course, start with activities is easier than core Sugar, then I 
reviewed the open ticket
in the activities and added a easy-hack tag to tickets I think can 
be solved by a newbie hacker.


The list is here: 
http://bugs.sugarlabs.org/query?status=acceptedstatus=assignedstatus=newstatus=reopenedgroup=componentorder=prioritycol=idcol=summarycol=statuscol=ownercol=typecol=prioritycol=milestonekeywords=~easy-hack 
http://bugs.sugarlabs.org/query?status=acceptedstatus=assignedstatus=newstatus=reopenedgroup=componentorder=prioritycol=idcol=summarycol=statuscol=ownercol=typecol=prioritycol=milestonekeywords=%7Eeasy-hack


We used to have another similar tag sugar-love, but I found the 
tickets no so easy to solve,
and the list not maintained. If anybody will maintain/use the 
sugar-love tag, we can keep it,

if not may be is a good idea remove the tag.

Gonzalo


___
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] Easy Hacks in activities

2012-02-09 Thread Gonzalo Odiard
I think we should try to avoid Sugarized activities.
Can be a fast solution, but never are really well integrated,
nor designed for our users.
And if there are binaries is very difficult support multiple architectures
too.

Gonzalo

On Thu, Feb 9, 2012 at 11:43 AM, Thomas C Gilliard 
satel...@bendbroadband.com wrote:

 **
 Fully sugarize firefox-6.xo?[1]

 It starts and runs fine in most versions of sugar [2];  but has greyed
 circle and  firefox icons in the frame while it runs and exits with a
 (failed to start)  pop-up.

 [1] http://download.sugarlabs.org/activities/4262/firefox-6.xo
 [2]http://wiki.sugarlabs.org/go/Sugar_Creation_Kit/sck/Activity_Matrix

 Tom Gilliard
 satellit_ on #sugar


 On 02/09/2012 06:19 AM, Gonzalo Odiard wrote:

 I have received questions from volunteers about easy tasks to start
 hacking in Sugar.
 Of course, start with activities is easier than core Sugar, then I
 reviewed the open ticket
 in the activities and added a easy-hack tag to tickets I think can be
 solved by a newbie hacker.

 The list is here:
 http://bugs.sugarlabs.org/query?status=acceptedstatus=assignedstatus=newstatus=reopenedgroup=componentorder=prioritycol=idcol=summarycol=statuscol=ownercol=typecol=prioritycol=milestonekeywords=~easy-hack

 We used to have another similar tag sugar-love, but I found the tickets
 no so easy to solve,
 and the list not maintained. If anybody will maintain/use the sugar-love
 tag, we can keep it,
 if not may be is a good idea remove the tag.

 Gonzalo


 ___
 Sugar-devel mailing 
 listSugar-devel@lists.sugarlabs.orghttp://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] [PATCH] sl#3149: Localization fixes.

2012-02-09 Thread Chris Leonard
I agree with all of Simon's comments.

cjl

On Thu, Feb 9, 2012 at 4:18 AM, Simon Schampijer si...@schampijer.dewrote:

 On 01/23/2012 02:48 PM, Ajay Garg wrote:

 ---

 Removed unncessary gettext notations; plus added TRANS labels for not
 translating format-specifier tokens.

 Thanks Chris Leonard.

  extensions/cpsection/**aboutcomputer/model.py |2 +-
  src/jarabe/desktop/**favoritesview.py |2 +-
  src/jarabe/frame/**activitiestray.py  |7 +--
  3 files changed, 7 insertions(+), 4 deletions(-)

 diff --git a/extensions/cpsection/**aboutcomputer/model.py
 b/extensions/cpsection/**aboutcomputer/model.py
 index 431c9c0..86d2e3f 100644
 --- a/extensions/cpsection/**aboutcomputer/model.py
 +++ b/extensions/cpsection/**aboutcomputer/model.py
 @@ -180,7 +180,7 @@ def get_wireless_firmware():
  if len(firmware_info) == 1:
  return firmware_info.values()[0]

 -return ', '.join([_('%(interface)s: %(version)s') %
 +return ', '.join(['%(interface)s: %(version)s' %
{'interface': interface, 'version': version}
for interface, version in firmware_info.items()])


 This one looks good.


  diff --git a/src/jarabe/desktop/**favoritesview.py b/src/jarabe/desktop/*
 *favoritesview.py
 index 132d14f..5c76cdc 100644
 --- a/src/jarabe/desktop/**favoritesview.py
 +++ b/src/jarabe/desktop/**favoritesview.py
 @@ -336,7 +336,7 @@ class FavoritesView(hippo.Canvas):
  schoolserver.register_laptop()
  except RegisterError, e:
  alert.props.title = _('Registration Failed')
 -alert.props.msg = _('%s') % e
 +alert.props.msg = '%s' % e
  else:
  alert.props.title = _('Registration Successful')
  alert.props.msg = _('You are now registered ' \


 This one looks good as well.


  diff --git a/src/jarabe/frame/**activitiestray.py b/src/jarabe/frame/**
 activitiestray.py
 index 941b174..2b8b7c6 100644
 --- a/src/jarabe/frame/**activitiestray.py
 +++ b/src/jarabe/frame/**activitiestray.py
 @@ -541,6 +541,7 @@ class BaseTransferPalette(Palette):
  transferred = self._format_size(
  self.file_transfer.props.**transferred_bytes)
  total = self._format_size(self.file_**transfer.file_size)
 +# TRANS: do not translate the two %s.
  self.progress_label.props.**label = _('%s of %s') %
 (transferred, total)


 If I would add a comment here I would be verbose about the context. For
 example:

 # TRANS: file transfer, bytes transferred, e.g. 128 of 1024


  @@ -555,6 +556,7 @@ class IncomingTransferPalette(**BaseTransferPalette):
  self.file_transfer.connect('**notify::state',
 self.__notify_state_cb)

  nick = str(self.file_transfer.buddy.**props.nick)
 +# TRANS: do not translate the token %s.
  label = glib.markup_escape_text(_('**Transfer from %s') %
 (nick,))
  self.props.secondary_text = label


 No need to add an extra trans information here. I think translators know
 how to deal with this one.


  @@ -589,7 +591,7 @@ class IncomingTransferPalette(**BaseTransferPalette):
  type_description = mime.get_mime_description(**mime_type)

  size = self._format_size(self.file_**transfer.file_size)
 -label = gtk.Label(_('%s (%s)') % (size, type_description))
 +label = gtk.Label('%s (%s)' % (size, type_description))
  vbox.add(label)
  label.show()


 This one looks good.


  @@ -688,6 +690,7 @@ class OutgoingTransferPalette(**BaseTransferPalette):
  self.file_transfer.connect('**notify::state',
 self.__notify_state_cb)

  nick = str(file_transfer.buddy.props.**nick)
 +# TRANS: do not translate %s.
  label = glib.markup_escape_text(_('**Transfer to %s') % (nick,))
  self.props.secondary_text = label


 Same as above: No need to add an extra trans information here. I think
 translators know how to deal with this one.


  @@ -719,7 +722,7 @@ class OutgoingTransferPalette(**BaseTransferPalette):
  type_description = mime.get_mime_description(**mime_type)

  size = self._format_size(self.file_**transfer.file_size)
 -label = gtk.Label(_('%s (%s)') % (size, type_description))
 +label = gtk.Label('%s (%s)' % (size, type_description))
  vbox.add(label)
  label.show()


 This one looks good.

 Regards,
   Simon

 __**_
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.**org Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/**listinfo/sugar-develhttp://lists.sugarlabs.org/listinfo/sugar-devel

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


[Sugar-devel] re GSoC

2012-02-09 Thread Walter Bender
Last year, we were not awarded any slots because:

Our concern was primarily around your ideas page this year. While
other returning organizations had quite extensive and lengthy ideas,
yours was quite sparse. We would like to see on the order of 8-10
fleshed out ideas listed with potential mentors, use cases,
difficulty, and more information on your project and your community. I
hope you'll apply again next year. Have a great summer.

Let's please get some ideas written up [1]--I am sure there are many
out there--so that we can take advantage of the program this year.

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org

[1] http://wiki.sugarlabs.org/go/Summer_of_Code/2012
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] sl#3149: Localization fixes.

2012-02-09 Thread Simon Schampijer

On 02/09/2012 07:00 PM, Chris Leonard wrote:

I agree with all of Simon's comments.

cjl


Thanks Chris, I pushed this now to move forward with this.

Regards,
   Simon

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


[Sugar-devel] [PATCH sugar-toolkit-gtk3] Do the preview in the activity using cairo intead of GdkPixbuf

2012-02-09 Thread godiard
From: Gonzalo Odiard godi...@gmail.com

Signed-off-by: Gonzalo Odiard gonz...@laptop.org
---
 src/sugar3/activity/activity.py |   33 ++---
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py
index 19c1974..e943d44 100644
--- a/src/sugar3/activity/activity.py
+++ b/src/sugar3/activity/activity.py
@@ -54,11 +54,12 @@ import os
 import time
 from hashlib import sha1
 from functools import partial
+import StringIO
 
 from gi.repository import GConf
 from gi.repository import Gtk
 from gi.repository import Gdk
-from gi.repository import GdkPixbuf
+import cairo
 from gi.repository import GObject
 import dbus
 import dbus.service
@@ -642,26 +643,28 @@ class Activity(Window, Gtk.Container):
 binary content of a png image with a width of 300 and a height of 225
 pixels.
 
-if self.canvas is None or not hasattr(self.canvas, 'get_snapshot'):
+if self.canvas is None or not hasattr(self.canvas, 'get_window'):
 return None
-pixmap = self.canvas.get_snapshot((-1, -1, 0, 0))
 
-width, height = pixmap.get_size()
-pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, 0, 8, width, 
height)
-pixbuf = pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(),
-  0, 0, 0, 0, width, height)
-pixbuf = pixbuf.scale_simple(style.zoom(300), style.zoom(225),
- GdkPixbuf.InterpType.BILINEAR)
+window = self.canvas.get_window()
 
-preview_data = []
+width, height = window.get_width(), window.get_height()
 
-def save_func(buf, data):
-data.append(buf)
+preview_width, preview_height = style.zoom(300), style.zoom(225)
 
-pixbuf.save_to_callback(save_func, 'png', user_data=preview_data)
-preview_data = ''.join(preview_data)
+preview_surface = Gdk.Window.create_similar_surface(window,
+cairo.CONTENT_COLOR, preview_width, preview_height)
 
-return preview_data
+cairo_context = cairo.Context(preview_surface)
+preview_scale_w = preview_width * 1.0 / width
+preview_scale_h = preview_height * 1.0 / height
+cairo_context.scale(preview_scale_w, preview_scale_h)
+Gdk.cairo_set_source_window(cairo_context, window, 0, 0)
+cairo_context.paint()
+
+preview_str = StringIO.StringIO()
+preview_surface.write_to_png(preview_str)
+return preview_str.getvalue()
 
 def _get_buddies(self):
 if self.shared_activity is not None:
-- 
1.7.7.6

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


[Sugar-devel] Activity Errors in Fedora-17-Alpha-TC2-i686-Live-SoaS please fix.

2012-02-09 Thread Thomas C Gilliard
http://wiki.sugarlabs.org/go/Community/Distributions/Fedora-SoaS#Fedora-17-Alpha-TC2-i686-Live-SoaS 


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


[Sugar-devel] Treeview-Treemodel coupling, and persistence (in journal)

2012-02-09 Thread Ajay Garg
Hi all.

I have been trying to integrate the batch-operations (copy, erase) ([1]).
There is already a working patch landed at [2]

However, there is a major performance bottleneck; for every toggling
of the checkbox by the user, the metadata (corresponding to the
checkbox listview) is wriiten on-disk, and a refresh done.
As the number of entries become large, the performance degrades exponentially.

Codewise, the bottleneck is in the section at [2] (I am pasting a fair
section of code, for easy location)


 # Copyright (C) 2009, Tomeu Vizoso
+# Copyright (C) 2012, Walter Bender  wal...@sugarlabs.org
+# Copyright (C) 2012, Gonzalo Odiard gonz...@laptop.org
+# Copyright (C) 2012, Martin Abente  t...@sugarlabs.org
+# Copyright (C) 2012, Ajay Garg  a...@activitycentral.com
 #
 # 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
@@ -98,6 +102,8 @@  class BaseListView(gtk.Bin):
 self._title_column = None
 self.sort_column = None
 self._add_columns()
+self._inhibit_refresh = False
+self._selected_entries = 0

 self.tree_view.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
 [('text/uri-list', 0, 0),
@@ -134,6 +140,18 @@  class BaseListView(gtk.Bin):
 return object_id.startswith(self._query['mountpoints'][0])

 def _add_columns(self):
+cell_select = gtk.CellRendererToggle()
+cell_select.props.indicator_size = style.zoom(26)
+cell_select.props.activatable = True
+cell_select.connect('toggled', self.__selected_cb)
+
+column = gtk.TreeViewColumn()
+column.props.sizing = gtk.TREE_VIEW_COLUMN_FIXED
+column.props.fixed_width = style.GRID_CELL_SIZE
+column.pack_start(cell_select)
+column.add_attribute(cell_select, active, ListModel.COLUMN_SELECT)
+self.tree_view.append_column(column)
+
 cell_favorite = CellRendererFavorite(self.tree_view)
 cell_favorite.connect('clicked', self.__favorite_clicked_cb)

@@ -251,6 +269,30 @@  class BaseListView(gtk.Bin):
 else:
 cell.props.xo_color = None

+def __selected_cb(self, cell, path):
+row = self._model[path]
+metadata = model.get(row[ListModel.COLUMN_UID])
+if metadata.get('selected', '0') == '1':
+metadata['selected'] = '0'
+self._process_new_selected_status('0')
+else:
+metadata['selected'] = '1'
+self._process_new_selected_status('1')
+
+model.write(metadata, update_mtime=False)
+
+def _process_new_selected_status(self, new_status):
+from jarabe.journal.journalactivity import get_journal
+journal = get_journal()
+
+if new_status == '0':
+self._selected_entries = self._selected_entries - 1
+if self._selected_entries == 0:
+journal.switch_to_editing_mode(False)
+else:
+self._selected_entries = self._selected_entries + 1
+journal.switch_to_editing_mode(True)



As can be seen at  def __selected_cb(self, cell, path), whenever the
checkbox is toggled, the metadata field (selected) is toggled, the
metadata wriiten on-disk, and _only then the toggling visible on the
UI_. This works fine when the number of entries is small, but
performance degrades considerably as the number of entries becomes
large.

I have already tried doing


row = self._model[path]
ListModel.COLUMN_SELECT] = '1' (or 0)


but what I get is the exception :

_TypeError: can not set cells in this tree model_




So, I really need help; in particular, I would be grateful if I just
know that is it possible at all to effect the toggling _only in
memory, while at the same time displaying the toggling-effect on the
UI_.

Looking forward to a reply.


Regards,
Ajay


[1] http://wiki.sugarlabs.org/go/Features/Multi_selection
[2] http://patchwork.sugarlabs.org/patch/1172/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] error in ./sugar-jhbuild update

2012-02-09 Thread Kalpa Welivitigoda
Hi,

I was trying to build sugar base system as instruction at here [1] and
I got this error message,

./sugar-jhbuild update
Cloning upstream jhbuild
Cloning into jhbuild...
remote: Counting objects: 30895, done.
remote: Compressing objects: 100% (8597/8597), done.
remote: Total 30895 (delta 23961), reused 28682 (delta 22191)
Receiving objects: 100% (30895/30895), 6.00 MiB | 118 KiB/s, done.
Resolving deltas: 100% (23961/23961), done.
Warning: unknown distro version, automatic fallback to rawhide.
Traceback (most recent call last):
  File ./sugar-jhbuild, line 62, in module
sys.exit(main.main(base_dir, sys.argv[1:]))
  File /home/kalpa/sugar-devel/sugar-jhbuild/sjhbuild/main.py, line
111, in main
rc = jhbuild.commands.run(command, config, args, help=lambda:
jhbuild.main.print_help(parser))
  File 
/home/kalpa/.local/lib/python2.7/site-packages/jhbuild/commands/__init__.py,
line 123, in run
return cmd.execute(config, args, help)
  File 
/home/kalpa/.local/lib/python2.7/site-packages/jhbuild/commands/__init__.py,
line 52, in execute
return self.run(config, options, args, help)
  File 
/home/kalpa/.local/lib/python2.7/site-packages/jhbuild/commands/base.py,
line 63, in run
module_set = jhbuild.moduleset.load(config)
  File /home/kalpa/.local/lib/python2.7/site-packages/jhbuild/moduleset.py,
line 316, in load
ms.modules.update(_parse_module_set(config, uri).modules)
  File /home/kalpa/.local/lib/python2.7/site-packages/jhbuild/moduleset.py,
line 412, in _parse_module_set
inc_moduleset = _parse_module_set(config, inc_uri)
  File /home/kalpa/.local/lib/python2.7/site-packages/jhbuild/moduleset.py,
line 427, in _parse_module_set
repositories, default_repo)
  File 
/home/kalpa/.local/lib/python2.7/site-packages/jhbuild/modtypes/__init__.py,
line 58, in parse_xml_node
return parser(node, config, uri, repositories, default_repo)
  File /home/kalpa/sugar-devel/sugar-jhbuild/sjhbuild/bundlemodule.py,
line 50, in parse_bundle
instance = BundleModule.parse_from_xml(node, config, uri,
repositories, default_repo)
AttributeError: type object 'BundleModule' has no attribute 'parse_from_xml'

How can I get this fixed?

When I try ./sugar-jhbuild depscheck I get the following output,

Warning: unknown distro version, automatic fallback to rawhide.
Missing packages:
gnome-python2-evince

I tried to install gnome-python2-evince through yum and it complains
that there is no package with that name.
My system is F16 with GNOME3

Any help is highly appreciated.

[1] http://wiki.sugarlabs.org/go/Development_Team/Jhbuild
[2] http://fpaste.org/A82L/

-- 
Best Regards,

Kalpa Pathum Welivitigoda
http://about.me/callkalpa
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel