Re: [Sugar-devel] New IRC channel for newby questiones regarding sugar development

2010-09-04 Thread Sascha Silbe
Excerpts from Aleksey Lim's message of Sat Sep 04 02:49:05 +0200 2010:

   * its topic says Ask your nub question about sugar development here.
 so, it will help with making incoming borders lower.

We should state clearly that
a) the channel is logged and
b) questions are equally welcome in #sugar, which isn't logged.

Especially as a newbie I would (or do, in other channels) not feel
very comfortable with everything I ask in IRC (which is informal, casual
communication to me) getting logged on virtually eternal, world-readable
storage.

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] Review of patch submitted by Martin for bug #2087

2010-09-04 Thread Kandarp Kaushik
Dear team members,

Wish if we could expedite the review of patch submitted by Martin
(tch) for bug #2087 - http://bugs.sugarlabs.org/ticket/2087. Appending
it.

Thank you. Appreciate your support as always.

Regards,
Kandarp.



From 47678b9155b0c7d970e2c503aadb6e9024317473 Mon Sep 17 00:00:00 2001
From: Martin Abente mabe...@paraguayeduca.org
Date: Thu, 19 Aug 2010 13:55:21 -0400
Subject: [PATCH] Protected Activities Support
Organization: Paraguay Educa

Activities deletion causes troubles during classes. Teachers from
Paraguay and Uruguay asked for a mechanism to protect activities
from being easily deleted.

This patch provides a mechanism that uses a gconf value to determine
which activities will not contain the erase option at the list view
palette.

The gconf value contains a list of activities bundle indentifiers.

More information at http://bugs.sugarlabs.org/ticket/2087

Signed-off-by: Martin Abente mabe...@paraguayeduca.org
---
 data/sugar.schemas.in|   14 ++
 src/jarabe/desktop/activitieslist.py |   17 +
 src/jarabe/model/bundleregistry.py   |7 +++
 3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index 2e6b820..5733627 100644
--- a/data/sugar.schemas.in
+++ b/data/sugar.schemas.in
@@ -343,5 +343,19 @@
   /locale
 /schema

+schema
+  key/schemas/desktop/sugar/protected_activities/key
+  applyto/desktop/sugar/protected_activities/applyto
+  ownersugar/owner
+  typelist/type
+  list_typestring/list_type
+  default[]/default
+  locale name=C
+shortProtected Activities Bundle Indentifiers/short
+longUsers will not be allowed to erase these
+activities through the list view./long
+  /locale
+/schema
+
   /schemalist
 /gconfschemafile
diff --git a/src/jarabe/desktop/activitieslist.py
b/src/jarabe/desktop/activitieslist.py
index c14d31e..3ad882f 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -400,14 +400,15 @@ class ActivityListPalette(ActivityPalette):
 self.menu.append(self._favorite_item)
 self._favorite_item.show()

-if activity_info.is_user_activity():
-menu_item = MenuItem(_('Erase'), 'list-remove')
-menu_item.connect('activate', self.__erase_activate_cb)
-self.menu.append(menu_item)
-menu_item.show()
-
-if not os.access(activity_info.get_path(), os.W_OK):
-menu_item.props.sensitive = False
+if activity_info.is_user_activity() and \
+not registry.is_activity_protected(self._bundle_id):
+menu_item = MenuItem(_('Erase'), 'list-remove')
+menu_item.connect('activate', self.__erase_activate_cb)
+self.menu.append(menu_item)
+menu_item.show()
+
+if not os.access(activity_info.get_path(), os.W_OK):
+menu_item.props.sensitive = False

 registry = bundleregistry.get_registry()
 self._activity_changed_sid = registry.connect('bundle_changed',
diff --git a/src/jarabe/model/bundleregistry.py
b/src/jarabe/model/bundleregistry.py
index b96de86..1c839d7 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -19,6 +19,7 @@ import os
 import logging
 import traceback

+import gconf
 import gobject
 import gio
 import simplejson
@@ -66,6 +67,9 @@ class BundleRegistry(gobject.GObject):
 self._last_defaults_mtime = -1
 self._favorite_bundles = {}

+client = gconf.client_get_default()
+self._protected_activities =
client.get_list('/desktop/sugar/protected_activities',
+  gconf.VALUE_STRING)
 try:
 self._load_favorites()
 except Exception:
@@ -312,6 +316,9 @@ class BundleRegistry(gobject.GObject):
 key = self._get_favorite_key(bundle_id, version)
 return key in self._favorite_bundles

+def is_activity_protected(self, bundle_id):
+return bundle_id in self._protected_activities
+
 def set_bundle_position(self, bundle_id, version, x, y):
 key = self._get_favorite_key(bundle_id, version)
 if key not in self._favorite_bundles:
-- 
1.6.0.4
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Review of patch submitted by Martin for bug #2087

2010-09-04 Thread Sascha Silbe
Excerpts from Kandarp Kaushik's message of Sat Sep 04 16:16:57 +0200 2010:

[data/sugar.schemas.in]
 +  locale name=C
 +shortProtected Activities Bundle Indentifiers/short

Typo. Also a bit hard to understand. Something along the lines of
Bundle IDs of protected activities might be better.

 +longUsers will not be allowed to erase these
 +activities through the list view./long

[src/jarabe/desktop/activitieslist.py]
 +if activity_info.is_user_activity() and \
 +not registry.is_activity_protected(self._bundle_id):
 +menu_item = MenuItem(_('Erase'), 'list-remove')
 +menu_item.connect('activate', self.__erase_activate_cb)
 +self.menu.append(menu_item)
 +menu_item.show()
 +
 +if not os.access(activity_info.get_path(), os.W_OK):
 +menu_item.props.sensitive = False

This is getting convoluted. Please factor it out and turn your condition
into one or several guards [1]. E.g.:

def _add_erase_option(self, activity_info):
if not activity_info.is_user_activity():
return
if registry.is_activity_protected(self._bundle_id):
return
# show menu item etc.

A suitable docstring is left as an exercise for the reader. ;)


[src/jarabe/model/bundleregistry.py]
 +client = gconf.client_get_default()
 +self._protected_activities =
 client.get_list('/desktop/sugar/protected_activities',
 +  gconf.VALUE_STRING)

I have a feeling this will break badly if the GConf value is not set.
See #1147 [2] for a similar case.

And please don't indent this much for a continuation. Personally I'd use
regular indentation (i.e. four spaces); maybe Tomeu can state his
preference so we can agree on some guideline.


PS: Please use git-send-email or some equivalent method of sending
patches. Your message has had at least one line of the patch
wrapped; I would have been unable to try out the patch (because
it wouldn't apply).

Sascha

[1] http://en.wikipedia.org/wiki/Guard_(computing)
[2] https://bugs.sugarlabs.org/ticket/1147
--
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


Re: [Sugar-devel] GSoC question

2010-09-04 Thread Christoph Derndorfer
On Wed, Aug 25, 2010 at 3:03 PM, Lucian Branescu
lucian.brane...@gmail.comwrote:

 On 25 August 2010 19:44, samir menon menon.sa...@gmail.com wrote:

 So I have hearing a lot about Google Summer of Code on the mailing list
 (specifically,, Dinko Galetic's project!) What happens when they finish
 their project? Do the projects (read: Dinko's project) get submitted as a
 patch for the respective activity (read: Pippy)? Or is the project just for
 their personal learning experience? I checked Dinko's email, but the
 attached files didn't seem to be written in python...Are theyhosted
 somewhere else?

 Any clarification would be very much appreciated,


 It is up to the individual maintainers whether or not they merge the work
 done by students over GSoC.


Is there any page on the wiki where I can find out what was achieved by this
year's GSoC projects?

Looking at http://wiki.sugarlabs.org/go/Summer_of_Code and its sub-pages I
also have a hard time figuring out which projects were actually worked on...

Thanks,
Christoph

-- 
Christoph Derndorfer
co-editor, olpcnews
url: www.olpcnews.com
e-mail: christ...@olpcnews.com
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Protected-Activities-Support.3

2010-09-04 Thread Kandarp Kaushik
---
 data/sugar.schemas.in|   14 ++
 src/jarabe/desktop/activitieslist.py |   23 +++
 src/jarabe/model/bundleregistry.py   |   11 +++
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index b9606ba..9b4ec87 100644
--- a/data/sugar.schemas.in
+++ b/data/sugar.schemas.in
@@ -329,5 +329,19 @@
   /locale
 /schema
 
+schema
+  key/schemas/desktop/sugar/protected_activities/key
+  applyto/desktop/sugar/protected_activities/applyto
+  ownersugar/owner
+  typelist/type
+  list_typestring/list_type
+  default[]/default
+  locale name=C
+shortBundle IDs of protected activities/short
+longUsers will not be allowed to erase these
+activities through the list view./long
+  /locale
+/schema
+
   /schemalist
 /gconfschemafile
diff --git a/src/jarabe/desktop/activitieslist.py 
b/src/jarabe/desktop/activitieslist.py
index e14d0f7..4d5d3c5 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -400,14 +400,7 @@ class ActivityListPalette(ActivityPalette):
 self.menu.append(self._favorite_item)
 self._favorite_item.show()
 
-if activity_info.is_user_activity():
-menu_item = MenuItem(_('Erase'), 'list-remove')
-menu_item.connect('activate', self.__erase_activate_cb)
-self.menu.append(menu_item)
-menu_item.show()
-
-if not os.access(activity_info.get_path(), os.W_OK):
-menu_item.props.sensitive = False
+self._add_erase_option( activity_info )
 
 registry = bundleregistry.get_registry()
 self._activity_changed_sid = registry.connect('bundle_changed',
@@ -416,6 +409,20 @@ class ActivityListPalette(ActivityPalette):
 
 self.connect('destroy', self.__destroy_cb)
 
+def _add_erase_option(self, activity_info):
+Add Erase option to the GUI for user or unprotected activities.
+if not activity_info.is_user_activity():
+return
+if registry.is_activity_protected(self._bundle_id):
+return
+menu_item = MenuItem(_('Erase'), 'list-remove')
+menu_item.connect('activate', self.__erase_activate_cb)
+self.menu.append(menu_item)
+menu_item.show()
+
+if not os.access(activity_info.get_path(), os.W_OK):
+menu_item.props.sensitive = False
+
 def __destroy_cb(self, palette):
 self.disconnect(self._activity_changed_sid)
 
diff --git a/src/jarabe/model/bundleregistry.py 
b/src/jarabe/model/bundleregistry.py
index 86a2738..2eb2ed4 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -19,6 +19,7 @@ import os
 import logging
 import traceback
 
+import gconf
 import gobject
 import gio
 import simplejson
@@ -65,6 +66,13 @@ class BundleRegistry(gobject.GObject):
 
 self._last_defaults_mtime = -1
 self._favorite_bundles = {}
+
+client = gconf.client_get_default()
+try:
+self._protected_activities = 
client.get_list('/desktop/sugar/protected_activities',
+gconf.VALUE_STRING)
+except Exception:
+self._protected_activities = []
 
 try:
 self._load_favorites()
@@ -302,6 +310,9 @@ class BundleRegistry(gobject.GObject):
 key = self._get_favorite_key(bundle_id, version)
 return key in self._favorite_bundles
 
+def is_activity_protected(self, bundle_id):
+return bundle_id in self._protected_activities
+
 def set_bundle_position(self, bundle_id, version, x, y):
 key = self._get_favorite_key(bundle_id, version)
 if key not in self._favorite_bundles:
-- 
1.7.1

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


Re: [Sugar-devel] New IRC channel for newby questiones regarding sugar development

2010-09-04 Thread Aleksey Lim
On Sat, Sep 04, 2010 at 12:31:16PM +0200, Sascha Silbe wrote:
 Excerpts from Aleksey Lim's message of Sat Sep 04 02:49:05 +0200 2010:
 
* its topic says Ask your nub question about sugar development here.
  so, it will help with making incoming borders lower.
 
 We should state clearly that
 a) the channel is logged and
 b) questions are equally welcome in #sugar, which isn't logged.

ok, lets hope everyone will see entirely channel title :)

 Especially as a newbie I would (or do, in other channels) not feel
 very comfortable with everything I ask in IRC (which is informal, casual
 communication to me) getting logged on virtually eternal, world-readable
 storage.
 
 Sascha
 
 --
 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


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


Re: [Sugar-devel] [PATCH] Protected-Activities-Support.3

2010-09-04 Thread Sascha Silbe
Excerpts from Kandarp Kaushik's message of Sat Sep 04 21:41:10 +0200 2010:

Thanks for submitting the patch with git send-email, I could apply it
now.

Please:
- test your patch before submitting it (there's a syntax error)
- provide a useful subject and description
- fix the white space errors (I recommend using 
  git config --global color.diff auto to enable diff coloring)
- adjust the _add_erase_option() docstring: only user activities
  (i.e. those in ~/Activities) can be removed at all, so
  user or unprotected activities doesn't make sense.

On the ticket [1] Gary suggested to deactivate (instead of remove) the
Erase option for protected activities (like we're already doing for
system activities). +1 from me, but maybe someone else from the design
team wants to chime in.

Sascha

[1] https://bugs.sugarlabs.org/ticket/2087
--
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


Re: [Sugar-devel] Review of patch submitted by Martin for bug #2087

2010-09-04 Thread Aleksey Lim
On Sat, Sep 04, 2010 at 05:13:03PM +0200, Sascha Silbe wrote:
 Excerpts from Kandarp Kaushik's message of Sat Sep 04 16:16:57 +0200 2010:
 
 [data/sugar.schemas.in]
  +  locale name=C
  +shortProtected Activities Bundle Indentifiers/short
 
 Typo. Also a bit hard to understand. Something along the lines of
 Bundle IDs of protected activities might be better.
 
  +longUsers will not be allowed to erase these
  +activities through the list view./long
 
 [src/jarabe/desktop/activitieslist.py]
  +if activity_info.is_user_activity() and \
  +not registry.is_activity_protected(self._bundle_id):
  +menu_item = MenuItem(_('Erase'), 'list-remove')
  +menu_item.connect('activate', self.__erase_activate_cb)
  +self.menu.append(menu_item)
  +menu_item.show()
  +
  +if not os.access(activity_info.get_path(), os.W_OK):
  +menu_item.props.sensitive = False
 
 This is getting convoluted. Please factor it out and turn your condition
 into one or several guards [1]. E.g.:
 
 def _add_erase_option(self, activity_info):
 if not activity_info.is_user_activity():
 return
 if registry.is_activity_protected(self._bundle_id):
 return
 # show menu item etc.
 
 A suitable docstring is left as an exercise for the reader. ;)
 
 
 [src/jarabe/model/bundleregistry.py]
  +client = gconf.client_get_default()
  +self._protected_activities =
  client.get_list('/desktop/sugar/protected_activities',
  +  gconf.VALUE_STRING)
 
 I have a feeling this will break badly if the GConf value is not set.
 See #1147 [2] for a similar case.

I've found that there is no way to call has() method(all sugar code
calls get_* methods w/o any checks). If everything is installed, we
will get key value in any case (default from shcheme), but if
installation is inproper... I've managed to coredump python for unknow
keys.

 And please don't indent this much for a continuation. Personally I'd use
 regular indentation (i.e. four spaces); maybe Tomeu can state his
 preference so we can agree on some guideline.
 
 
 PS: Please use git-send-email or some equivalent method of sending
 patches. Your message has had at least one line of the patch
 wrapped; I would have been unable to try out the patch (because
 it wouldn't apply).
 
 Sascha
 
 [1] http://en.wikipedia.org/wiki/Guard_(computing)
 [2] https://bugs.sugarlabs.org/ticket/1147
 --
 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


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