Re: [Sugar-devel] [Systems] [Marketing] A little change to www.sugarlabs.org
On Wed, 2010-10-13 at 13:03 +0200, Tomeu Vizoso wrote: On Wed, Oct 13, 2010 at 12:57, Simon Schampijer si...@schampijer.de wrote: On 10/13/2010 10:49 AM, Tomeu Vizoso wrote: [adding the IAEP, marketing and systems mailing lists] Can someone that has access please just make this change. I already asked for that 1 or 2 years ago. Maybe the feedback from the field helps to actually make it happen. Actually we already had feedback from the field more than a year ago: http://lists.sugarlabs.org/archive/marketing/2009-April/000910.html Christian Mark Schmidt is the current maintainer of www.sugarlabs.org . Christian, we should create a service page with the admin contacts for the web site: http://wiki.sugarlabs.org/go/Service/www You can copy-paste this template: http://wiki.sugarlabs.org/go/Service/zzz_template -- // Bernie Innocenti - http://codewiz.org/ \X/ Sugar Labs - http://sugarlabs.org/ ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH v2 sugar] Disable Start menu item for entries that can't be opened(Bug#328)
The patch disables the Start and Start With menu items for files which can't be opened by any installed activity and instead replace it with a hover dropdown with a menu item 'No activity installed to start entry' --- src/jarabe/journal/palettes.py | 38 +++--- 1 files changed, 23 insertions(+), 15 deletions(-) v1-v2: Patch remade as per pep8 standards diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..2ab93fe 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,22 +62,30 @@ class ObjectPalette(Palette): Palette.__init__(self, primary_text=title, icon=activity_icon) -if metadata.get('activity_id', ''): -resume_label = _('Resume') -resume_with_label = _('Resume with') -else: -resume_label = _('Start') -resume_with_label = _('Start with') -menu_item = MenuItem(resume_label, 'activity-start') -menu_item.connect('activate', self.__start_activate_cb) -self.menu.append(menu_item) -menu_item.show() +if misc.get_activities(metadata): +if metadata.get('activity_id', ''): +resume_label = _('Resume') +resume_with_label = _('Resume with') +else: +resume_label = _('Start') +resume_with_label = _('Start with') +menu_item = MenuItem(resume_label, 'activity-start') +menu_item.connect('activate', self.__start_activate_cb) +self.menu.append(menu_item) +menu_item.show() -menu_item = MenuItem(resume_with_label, 'activity-start') -self.menu.append(menu_item) -menu_item.show() -start_with_menu = StartWithMenu(self._metadata) -menu_item.set_submenu(start_with_menu) +menu_item = MenuItem(resume_with_label, 'activity-start') +self.menu.append(menu_item) +menu_item.show() +start_with_menu = StartWithMenu(self._metadata) +menu_item.set_submenu(start_with_menu) + +else: +resume_label = _('No activity installed to start entry') +menu_item = MenuItem(resume_label) +menu_item.set_sensitive(False) +self.menu.append(menu_item) +menu_item.show() client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH v2 sugar] Disable Start menu item for entries that can't be opened(Bug#328)
Please find the explanation to the patch in the comments. On Fri, Oct 15, 2010 at 4:19 PM, Mukul Gupta mu...@seeta.in wrote: The patch disables the Start and Start With menu items for files which can't be opened by any installed activity and instead replace it with a hover dropdown with a menu item 'No activity installed to start entry' --- src/jarabe/journal/palettes.py | 38 +++--- 1 files changed, 23 insertions(+), 15 deletions(-) v1-v2: Patch remade as per pep8 standards diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..2ab93fe 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,22 +62,30 @@ class ObjectPalette(Palette): Palette.__init__(self, primary_text=title, icon=activity_icon) -if metadata.get('activity_id', ''): -resume_label = _('Resume') -resume_with_label = _('Resume with') -else: -resume_label = _('Start') -resume_with_label = _('Start with') -menu_item = MenuItem(resume_label, 'activity-start') -menu_item.connect('activate', self.__start_activate_cb) -self.menu.append(menu_item) -menu_item.show() The function misc.get_activities(metadata) checks whether the file can be opened by any installed activity. If it is True, then Menu items Start and Start with are displayed +if misc.get_activities(metadata): +if metadata.get('activity_id', ''): +resume_label = _('Resume') +resume_with_label = _('Resume with') +else: +resume_label = _('Start') +resume_with_label = _('Start with') +menu_item = MenuItem(resume_label, 'activity-start') +menu_item.connect('activate', self.__start_activate_cb) +self.menu.append(menu_item) +menu_item.show() -menu_item = MenuItem(resume_with_label, 'activity-start') -self.menu.append(menu_item) -menu_item.show() -start_with_menu = StartWithMenu(self._metadata) -menu_item.set_submenu(start_with_menu) +menu_item = MenuItem(resume_with_label, 'activity-start') +self.menu.append(menu_item) +menu_item.show() +start_with_menu = StartWithMenu(self._metadata) +menu_item.set_submenu(start_with_menu) + If misc.get_activities(metadata) is False, the entries Start and Start with are replaced by a single frozen Menu entry stating No activity installed to start entry +else: +resume_label = _('No activity installed to start entry') +menu_item = MenuItem(resume_label) +menu_item.set_sensitive(False) +self.menu.append(menu_item) +menu_item.show() client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Disable Start menu item for entries that can't be opened(Bug#328)
Aleksey, James, Thank you. Appreciate your feedback. I have resubmitted a revised patch as per pep8 standards http://lists.sugarlabs.org/archive/sugar-devel/2010-October/027863.html James, resume_label = _('No activity installed to start entry') For now, I have kept the wordings to be as per Bug Description at the bugtracker. We can have a discussion on it. Looking forwards to your feedback. Regards, Mukul Gupta On Fri, Oct 15, 2010 at 4:55 AM, James Cameron qu...@laptop.org wrote: On Thu, Oct 14, 2010 at 11:32:34PM +0530, Mukul Gupta wrote: The patch disables the Start and Start With menu items for files which can't be opened by any installed activity and instead replace it with a hover dropdown with a menu item 'No activity installed to start entry' The patch added four trailing whitespace errors, according to git am ... which is where there are space or tab characters at the end of the line. I use an editor which shows them. The patch also changed spaces to tabs, for the affected area. Once I removed them and regenerated the diff, I understood the change better. diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..14024fd 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,22 +62,30 @@ class ObjectPalette(Palette): Palette.__init__(self, primary_text=title, icon=activity_icon) -if metadata.get('activity_id', ''): -resume_label = _('Resume') -resume_with_label = _('Resume with') -else: -resume_label = _('Start') -resume_with_label = _('Start with') -menu_item = MenuItem(resume_label, 'activity-start') -menu_item.connect('activate', self.__start_activate_cb) -self.menu.append(menu_item) -menu_item.show() +if misc.get_activities(metadata): +if metadata.get('activity_id', ''): +resume_label = _('Resume') +resume_with_label = _('Resume with') +else: +resume_label = _('Start') +resume_with_label = _('Start with') +menu_item = MenuItem(resume_label, 'activity-start') +menu_item.connect('activate', self.__start_activate_cb) +self.menu.append(menu_item) +menu_item.show() -menu_item = MenuItem(resume_with_label, 'activity-start') -self.menu.append(menu_item) -menu_item.show() -start_with_menu = StartWithMenu(self._metadata) -menu_item.set_submenu(start_with_menu) +menu_item = MenuItem(resume_with_label, 'activity-start') +self.menu.append(menu_item) +menu_item.show() +start_with_menu = StartWithMenu(self._metadata) +menu_item.set_submenu(start_with_menu) + +else: +resume_label = _('No activity installed to start entry') +menu_item = MenuItem(resume_label) +menu_item.set_sensitive(False) +self.menu.append(menu_item) +menu_item.show() client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) -- 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 mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] branching off sucrose-0.90
Hi, patches are accumulating as we wait for 0.90 branches in Pootle. Anybody opposes to branching now in git? I'm under the impression that this will mean that translators won't be able to commit translations for 0.90 until such branches are created. Sayamindu, do you think you could find some time to document how to create branches in the Pootle backend? Regards, Tomeu ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH v2 sugar] Disable Start menu item for entries that can't be opened(Bug#328)
On Fri, Oct 15, 2010 at 7:06 AM, Mukul Gupta mu...@seeta.in wrote: Please find the explanation to the patch in the comments. On Fri, Oct 15, 2010 at 4:19 PM, Mukul Gupta mu...@seeta.in wrote: The patch disables the Start and Start With menu items for files which can't be opened by any installed activity and instead replace it with a hover dropdown with a menu item 'No activity installed to start entry' --- src/jarabe/journal/palettes.py | 38 +++--- 1 files changed, 23 insertions(+), 15 deletions(-) v1-v2: Patch remade as per pep8 standards diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..2ab93fe 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,22 +62,30 @@ class ObjectPalette(Palette): Palette.__init__(self, primary_text=title, icon=activity_icon) -if metadata.get('activity_id', ''): -resume_label = _('Resume') -resume_with_label = _('Resume with') -else: -resume_label = _('Start') -resume_with_label = _('Start with') -menu_item = MenuItem(resume_label, 'activity-start') -menu_item.connect('activate', self.__start_activate_cb) -self.menu.append(menu_item) -menu_item.show() The function misc.get_activities(metadata) checks whether the file can be opened by any installed activity. If it is True, then Menu items Start and Start with are displayed +if misc.get_activities(metadata): +if metadata.get('activity_id', ''): +resume_label = _('Resume') +resume_with_label = _('Resume with') +else: +resume_label = _('Start') +resume_with_label = _('Start with') +menu_item = MenuItem(resume_label, 'activity-start') +menu_item.connect('activate', self.__start_activate_cb) +self.menu.append(menu_item) +menu_item.show() -menu_item = MenuItem(resume_with_label, 'activity-start') -self.menu.append(menu_item) -menu_item.show() -start_with_menu = StartWithMenu(self._metadata) -menu_item.set_submenu(start_with_menu) +menu_item = MenuItem(resume_with_label, 'activity-start') +self.menu.append(menu_item) +menu_item.show() +start_with_menu = StartWithMenu(self._metadata) +menu_item.set_submenu(start_with_menu) + If misc.get_activities(metadata) is False, the entries Start and Start with are replaced by a single frozen Menu entry stating No activity installed to start entry For an uninstantiated Journal entry in Sugar 0.88.1, the 'Start with' menu item reveals an inactive, side sub-palette with the words 'No activity to start entry' in gray. Should we not try to keep the wording consistent for this similar condition? Adding 'installed' to the terse wording may help the Learner understand, but it is still quite technical for the general audience. Would it be better to use more general wording, such as, No activity is available to start the entry. Since it is a side sub-palette, the additional length should not be a hindrance, and any additional clarity would better match Sugar's goals. In messages like this, a grammatically complete sentence (also ending with a period) is also very helpful and instructive for Learners. In summary, if this reasoning is accepted, the sub-palette message should be changed in at least 2 places. --Fred +else: +resume_label = _('No activity installed to start entry') +menu_item = MenuItem(resume_label) +menu_item.set_sensitive(False) +self.menu.append(menu_item) +menu_item.show() client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser
On Thu, Oct 14, 2010 at 20:09, godi...@sugarlabs.org wrote: From: Gonzalo Odiard godi...@sugarlabs.org This is a regresion, probably introduced when changed the toolbar. May be pass self.abiword_canvas and self to ImageToolbar is not the smarter option. You are right, would be better if the activity listened to signals in the toolbar and called methods on the canvas as a result. But in this case, the toolbar can get a reference to the top level window with: http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel Btw, is Write maintained these days? Regards, Tomeu --- AbiWordActivity.py | 2 +- toolbar.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AbiWordActivity.py b/AbiWordActivity.py index f6c54fa..7deab8c 100644 --- a/AbiWordActivity.py +++ b/AbiWordActivity.py @@ -110,7 +110,7 @@ class AbiWordActivity (activity.Activity): toolbar_box.toolbar.insert(list_toolbar, -1) insert_toolbar = ToolbarButton() - insert_toolbar.props.page = InsertToolbar(self.abiword_canvas) + insert_toolbar.props.page = InsertToolbar(self.abiword_canvas, self) insert_toolbar.props.icon_name = 'insert-table' insert_toolbar.props.label = _('Table') toolbar_box.toolbar.insert(insert_toolbar, -1) diff --git a/toolbar.py b/toolbar.py index 75243c7..a16803c 100644 --- a/toolbar.py +++ b/toolbar.py @@ -176,10 +176,11 @@ class EditToolbar(gtk.Toolbar): tool_item.show() class InsertToolbar(gtk.Toolbar): - def __init__(self, abiword_canvas): + def __init__(self, abiword_canvas, parent): gtk.Toolbar.__init__(self) self._abiword_canvas = abiword_canvas + self._parent = parent self._table = abiword.TableCreator() self._table.set_labels(_('Table'), _('Cancel')) @@ -234,7 +235,7 @@ class InsertToolbar(gtk.Toolbar): def cb(object): logging.debug('ObjectChooser: %r' % object) self._abiword_canvas.insert_image(object.file_path, True) - chooser.pick(what=chooser.IMAGE, cb=cb) + chooser.pick(parent=self._parent, what=chooser.IMAGE, cb=cb) def _table_cb(self, abi, rows, cols): self._abiword_canvas.insert_table(rows, cols) -- 1.7.2.3 ___ 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] [PATCH v2 sugar] Disable Start menu item for entries that can't be opened(Bug#328)
On Fri, Oct 15, 2010 at 04:19:43PM +0530, Mukul Gupta wrote: The patch disables the Start and Start With menu items for files which can't be opened by any installed activity and instead replace it with a hover dropdown with a menu item 'No activity installed to start entry' --- src/jarabe/journal/palettes.py | 38 +++--- 1 files changed, 23 insertions(+), 15 deletions(-) v1-v2: Patch remade as per pep8 standards diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..2ab93fe 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,22 +62,30 @@ class ObjectPalette(Palette): Palette.__init__(self, primary_text=title, icon=activity_icon) -if metadata.get('activity_id', ''): -resume_label = _('Resume') -resume_with_label = _('Resume with') -else: -resume_label = _('Start') -resume_with_label = _('Start with') -menu_item = MenuItem(resume_label, 'activity-start') -menu_item.connect('activate', self.__start_activate_cb) -self.menu.append(menu_item) -menu_item.show() +if misc.get_activities(metadata): There is an issue. For bundles, it will change existed beahviour (click on bundles, .xo and .xol, sugar install/start it), you need to check for bundles as well (misc.is_*_bundle). +if metadata.get('activity_id', ''): +resume_label = _('Resume') +resume_with_label = _('Resume with') +else: +resume_label = _('Start') +resume_with_label = _('Start with') +menu_item = MenuItem(resume_label, 'activity-start') +menu_item.connect('activate', self.__start_activate_cb) +self.menu.append(menu_item) +menu_item.show() -menu_item = MenuItem(resume_with_label, 'activity-start') -self.menu.append(menu_item) -menu_item.show() -start_with_menu = StartWithMenu(self._metadata) -menu_item.set_submenu(start_with_menu) +menu_item = MenuItem(resume_with_label, 'activity-start') +self.menu.append(menu_item) +menu_item.show() +start_with_menu = StartWithMenu(self._metadata) +menu_item.set_submenu(start_with_menu) + +else: +resume_label = _('No activity installed to start entry') +menu_item = MenuItem(resume_label) +menu_item.set_sensitive(False) +self.menu.append(menu_item) +menu_item.show() client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) -- 1.7.0.4 -- Aleksey ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [Systems] [Marketing] A little change to www.sugarlabs.org
Hi--I can add this information this weekend. Christian On Oct 15, 2010, at 6:36 AM, Bernie Innocenti ber...@codewiz.org wrote: On Wed, 2010-10-13 at 13:03 +0200, Tomeu Vizoso wrote: On Wed, Oct 13, 2010 at 12:57, Simon Schampijer si...@schampijer.de wrote: On 10/13/2010 10:49 AM, Tomeu Vizoso wrote: [adding the IAEP, marketing and systems mailing lists] Can someone that has access please just make this change. I already asked for that 1 or 2 years ago. Maybe the feedback from the field helps to actually make it happen. Actually we already had feedback from the field more than a year ago: http://lists.sugarlabs.org/archive/marketing/2009-April/000910.html Christian Mark Schmidt is the current maintainer of www.sugarlabs.org . Christian, we should create a service page with the admin contacts for the web site: http://wiki.sugarlabs.org/go/Service/www You can copy-paste this template: http://wiki.sugarlabs.org/go/Service/zzz_template -- // Bernie Innocenti - http://codewiz.org/ \X/ Sugar Labs - http://sugarlabs.org/ ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH v2] Removed hardcoded server url (SL #1976)
Previously registration url was set hardcoded for XO device. Modififed the code for same behavior on all devices. Register url is taken from gconf prop. If the gconf is empty or unset, registration url falls back to 'schoolserver'. --- src/jarabe/desktop/schoolserver.py |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) v1 was reviewed by James Cameron qu...@laptop.org v2 : wrapped the commit message. diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py index a05f56c..57b7ddf 100644 --- a/src/jarabe/desktop/schoolserver.py +++ b/src/jarabe/desktop/schoolserver.py @@ -89,9 +89,12 @@ def register_laptop(url=REGISTER_URL): else: sn = generate_serial_number() uuid_ = str(uuid.uuid1()) -setting_name = '/desktop/sugar/collaboration/jabber_server' -jabber_server = client.get_string(setting_name) -store_identifiers(sn, uuid_, jabber_server) + +setting_name = '/desktop/sugar/collaboration/jabber_server' +jabber_server = client.get_string(setting_name) +store_identifiers(sn, uuid_, jabber_server) + +if jabber_server: url = 'http://' + jabber_server + ':8080/' nick = client.get_string('/desktop/sugar/user/nick') -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Dbus signal when ebook switch is activated
On Thu, Oct 14, 2010 at 5:35 PM, Paul Fox p...@laptop.org wrote: sascha wrote: Excerpts from Gonzalo Odiard's message of Thu Oct 14 22:09:09 +0200 2010: It's simple and it's explained in http://dev.laptop.org/ticket/10396 At least in Read (and in most if not all activities), the dpad should work the same regardless of whether the keyboard is available (non-ebook mode) or not (ebook mode). Thus there's no reason to query the ebook mode switch in the first place. i suspect the point is that in normal mode it's okay for the focus to be elsewhere, since there's a touchpad with which to change the focus. in ebook mode, that's not the case -- if focus isn't on the text area, then you're stuck, and have to open the laptop to click. Yes, this is the problem. A novice user is confused about why the dpad don't work. Gonzalo paul =- paul fox, p...@laptop.org ___ 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] branching off sucrose-0.90
On 10/15/2010 02:04 PM, Tomeu Vizoso wrote: Hi, patches are accumulating as we wait for 0.90 branches in Pootle. Anybody opposes to branching now in git? No, let's do it. Thought about it several times already myself. Regards, Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser
On Fri, Oct 15, 2010 at 17:00, Gonzalo Odiard godi...@sugarlabs.org wrote: On Fri, Oct 15, 2010 at 8:36 AM, Tomeu Vizoso to...@sugarlabs.org wrote: On Thu, Oct 14, 2010 at 20:09, godi...@sugarlabs.org wrote: From: Gonzalo Odiard godi...@sugarlabs.org This is a regresion, probably introduced when changed the toolbar. May be pass self.abiword_canvas and self to ImageToolbar is not the smarter option. You are right, would be better if the activity listened to signals in the toolbar and called methods on the canvas as a result. But in this case, the toolbar can get a reference to the top level window with: http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel Ok, i will redo the patch. Btw, is Write maintained these days? Good question :) You are one of the co-maintainers ;) http://wiki.sugarlabs.org/go/Development_Team/Release/Modules I used to be just a peer until someone changed that page to say co-maintainer :) Regards, Tomeu Regards Gonzalo ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [RELEASE] Browse-119
On 10/15/2010 12:30 AM, Lucian Branescu Mihaila wrote: == Source == http://download.sugarlabs.org/sources/sucrose/fructose/Browse/Browse-119.tar.bz2 == News == This is a bugfix release. * Release 119 (Lucian Branescu Mihaila) * generate preview image for downloaded images (SL#1106) (Gonzalo Odiard) * Fix history on resume. The code is a bit hacky because of xulrunner limitations. I plan to make this code nicer when we move to webkit. (Lucian Branescu Mihaila) * Simon Schampijer's patch to fix autocomplete functionality for the address. (Lucian Branescu Mihaila) * fix #8857 - Browse fails to download some files with non-ascii characters (Gonzalo Odiard) I have two interesting traces. Have not checked the when they occur that is why I do not open a ticket (yet). Regards, Simon ** Message: pygobject_register_sinkfunc is deprecated (HippoCanvasBox) Registering '@mozilla.org/module-loader/python;1' (libpyloader.so) Registering 'Python.TestComponent' (py_test_component.py) Registering '@mozilla.org/network/protocol/about;1?what=python' (pyabout.py) returning /home/olpc/.sugar/default/org.laptop.WebActivity/data/gecko/prefs.js for key NS_APP_PREFS_50_FILE 1287157128.235682 WARNING root: .has_key() is deprecated, use 'in' 1287157128.401394 WARNING root: Not enabling the multiple tabs feature due to a bug in cairo/mozilla 1287157128.474259 WARNING root: No gtk.AccelGroup in the top level window. 1287157128.486208 WARNING root: No gtk.AccelGroup in the top level window. 1287157128.552347 WARNING root: No gtk.AccelGroup in the top level window. 1287157128.578768 WARNING root: No gtk.AccelGroup in the top level window. 1287157128.598987 WARNING root: No gtk.AccelGroup in the top level window. 1287157128.609444 WARNING root: No gtk.AccelGroup in the top level window. Traceback (most recent call last): File /usr/lib/python2.7/site-packages/sugar/activity/activity.py, line 484, in __canvas_map_cb self.read_file(self._jobject.file_path) File /usr/share/sugar/activities/Browse.activity/webactivity.py, line 426, in read_file self._load_urls() File /usr/share/sugar/activities/Browse.activity/webactivity.py, line 429, in _load_urls if self.model.data['currents'] != None: KeyError: 'currents' ** (sugar-activity:2950): DEBUG: Got client ID 108ebca8fc86c3bea91287157129471093002813 ** (sugar-activity:2950): DEBUG: Setting initial properties ** (sugar-activity:2950): DEBUG: Received SaveYourself(SmSaveLocal, !Shutdown, SmInteractStyleNone, !Fast) in state idle ** (sugar-activity:2950): DEBUG: Sending SaveYourselfDone(True) for initial SaveYourself ** (sugar-activity:2950): DEBUG: Received SaveComplete message in state save-yourself-done 1287157134.873605 WARNING root: No gtk.AccelGroup in the top level window. 1287157134.941392 WARNING root: No gtk.AccelGroup in the top level window. 1287157134.942315 WARNING root: No gtk.AccelGroup in the top level window. 1287157135.007847 WARNING root: No gtk.AccelGroup in the top level window. 1287157135.008937 WARNING root: No gtk.AccelGroup in the top level window. 1287157135.009797 WARNING root: No gtk.AccelGroup in the top level window. /usr/lib/python2.7/site-packages/sugar/activity/activity.py:834: Warning: invalid uninstantiatable type `invalid' in cast to `GtkWidget' self.destroy() /usr/lib/python2.7/site-packages/sugar/activity/activity.py:834: GtkWarning: IA__gtk_widget_hide: assertion `GTK_IS_WIDGET (widget)' failed self.destroy() /usr/lib/python2.7/site-packages/sugar/activity/activity.py:834: GtkWarning: IA__gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed self.destroy() Gdk-ERROR **: The program 'sugar-activity' received an X Window System error. This probably reflects a bug in the program. The error was 'RenderBadPicture (invalid Picture parameter)'. (Details: serial 2361 error_code 159 request_code 148 minor_code 7) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) aborting... Terminated by signal 6, pid 2950 data (None, open file 'fdopen', mode 'w' at 0x9e512e0, dbus.ByteArray('e719491c7c88f7286ef8f5631b6490fe38a6e280', variant_level=1)) ** Message: pygobject_register_sinkfunc is deprecated (HippoCanvasBox) returning /home/olpc/.sugar/default/org.laptop.WebActivity/data/gecko/prefs.js for key NS_APP_PREFS_50_FILE 1287157246.715130 WARNING root: Not enabling the multiple tabs feature due to a bug in cairo/mozilla 1287157246.848928 WARNING root: No gtk.AccelGroup in the top level window. 1287157246.880623 WARNING root: No gtk.AccelGroup in the top level window. 1287157246.969052 WARNING root: No gtk.AccelGroup in the top level window. 1287157246.987804 WARNING root: No gtk.AccelGroup in the top level window.
Re: [Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser
What is the status of the other maintainers? I can volunteer to be co-co-maintainer :) Gonzalo On Fri, Oct 15, 2010 at 12:05 PM, Tomeu Vizoso to...@sugarlabs.org wrote: On Fri, Oct 15, 2010 at 17:00, Gonzalo Odiard godi...@sugarlabs.org wrote: On Fri, Oct 15, 2010 at 8:36 AM, Tomeu Vizoso to...@sugarlabs.org wrote: On Thu, Oct 14, 2010 at 20:09, godi...@sugarlabs.org wrote: From: Gonzalo Odiard godi...@sugarlabs.org This is a regresion, probably introduced when changed the toolbar. May be pass self.abiword_canvas and self to ImageToolbar is not the smarter option. You are right, would be better if the activity listened to signals in the toolbar and called methods on the canvas as a result. But in this case, the toolbar can get a reference to the top level window with: http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel Ok, i will redo the patch. Btw, is Write maintained these days? Good question :) You are one of the co-maintainers ;) http://wiki.sugarlabs.org/go/Development_Team/Release/Modules I used to be just a peer until someone changed that page to say co-maintainer :) Regards, Tomeu Regards Gonzalo -- Gonzalo Odiard SugarLabs Argentina ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 0/3 sugar-datastore] PEP8 / pylint cleanups
Make sugar-datastore as PEP8 / pylint clean as possible (again). All remaining complaints are pylint bugs (doesn't recognise keyword arguments in decorators) resp. shortcomings in pep8 (cannot selectively disable a warning for a specific piece of code). Sascha Silbe (3): PEP8 cleanups datastore, migration: remove unused import traceback indexstore: disable pylint warning W0221 for parse_query src/carquinyol/datastore.py |1 - src/carquinyol/filestore.py |3 ++- src/carquinyol/indexstore.py|2 +- src/carquinyol/layoutmanager.py |1 + src/carquinyol/migration.py |1 - 5 files changed, 4 insertions(+), 4 deletions(-) ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 1/3] PEP8 cleanups
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/carquinyol/filestore.py b/src/carquinyol/filestore.py index 9eb975f..5f518ab 100644 --- a/src/carquinyol/filestore.py +++ b/src/carquinyol/filestore.py @@ -155,7 +155,8 @@ class FileStore(object): os.remove(file_path) def hard_link_entry(self, new_uid, existing_uid): -existing_file = layoutmanager.get_instance().get_data_path(existing_uid) +existing_file = layoutmanager.get_instance().get_data_path( +existing_uid) new_file = layoutmanager.get_instance().get_data_path(new_uid) logging.debug('removing %r', new_file) diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py index 8a3de30..38483cb 100644 --- a/src/carquinyol/indexstore.py +++ b/src/carquinyol/indexstore.py @@ -87,7 +87,6 @@ class TermGenerator (xapian.TermGenerator): logging.debug('Invalid value for creation_time property: %s', properties['creation_time']) - self.set_document(document) properties = dict(properties) diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py index 335614f..07f5521 100644 --- a/src/carquinyol/layoutmanager.py +++ b/src/carquinyol/layoutmanager.py @@ -20,6 +20,7 @@ import logging MAX_QUERY_LIMIT = 40960 CURRENT_LAYOUT_VERSION = 6 + class LayoutManager(object): Provide the logic about how entries are stored inside the datastore directory -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 3/3] indexstore: disable pylint warning W0221 for parse_query
No other name I can think of is a better fit and no external code is using this class, so it isn't an issue. Disabling the warning reduces pylint clutter and makes it easier to spot real issues. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py index 38483cb..b8088b2 100644 --- a/src/carquinyol/indexstore.py +++ b/src/carquinyol/indexstore.py @@ -201,6 +201,7 @@ class QueryParser (xapian.QueryParser): logging.warning('Invalid query string: ' + exception.get_msg()) return Query() +# pylint: disable=W0221 def parse_query(self, query_dict, query_string): logging.debug('parse_query %r %r', query_dict, query_string) queries = [] -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 2/3] datastore, migration: remove unused import traceback
Caught by pylint. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py index 86d5b02..28d7247 100644 --- a/src/carquinyol/datastore.py +++ b/src/carquinyol/datastore.py @@ -19,7 +19,6 @@ import logging import uuid import time import os -import traceback import dbus import dbus.service diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py index 686902f..1745f2c 100644 --- a/src/carquinyol/migration.py +++ b/src/carquinyol/migration.py @@ -21,7 +21,6 @@ import os import logging import shutil import time -import traceback import cjson -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [RELEASE] Browse-119
On 15 October 2010 17:15, Simon Schampijer si...@schampijer.de wrote: On 10/15/2010 12:30 AM, Lucian Branescu Mihaila wrote: == Source == http://download.sugarlabs.org/sources/sucrose/fructose/Browse/Browse-119.tar.bz2 == News == This is a bugfix release. * Release 119 (Lucian Branescu Mihaila) * generate preview image for downloaded images (SL#1106) (Gonzalo Odiard) * Fix history on resume. The code is a bit hacky because of xulrunner limitations. I plan to make this code nicer when we move to webkit. (Lucian Branescu Mihaila) * Simon Schampijer's patch to fix autocomplete functionality for the address. (Lucian Branescu Mihaila) * fix #8857 - Browse fails to download some files with non-ascii characters (Gonzalo Odiard) I have two interesting traces. Have not checked the when they occur that is why I do not open a ticket (yet). They're probably introduced by the recent patch to fix the position in the history after resume. Please check if the history is restored correctly. ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 17/21 sugar-toolkit] pylint cleanup: initialise all attributes in __init__()
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py index fcdc2e3..81540e3 100644 --- a/src/sugar/graphics/palettewindow.py +++ b/src/sugar/graphics/palettewindow.py @@ -147,6 +147,7 @@ class PaletteWindow(gtk.Window): self._alignment = None self._up = False self._old_alloc = None +self._palette_state = None self._popup_anim = animator.Animator(.5, 10) self._popup_anim.add(_PopupAnimation(self)) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 00/21 sugar-toolkit] style cleanup series
This is the sugar-toolkit part of the style cleanups I've wanted to land at least two releases ago, but kept missing the window. I have done some basic testing, but naturally cannot test all code paths I've touched (some even appear to be unused). This is why I'd like to land this right after we branched off sucrose-0.90: to ensure it gets enough testing before the next release. The only remaining pylint complaint that isn't either a pylint bug or caused by deprecated imports (that I'd like to kill off for 0.92 as well, but not as part of this series) is this one: [sugar.graphics.palette] W0221:185:Palette.popup: Arguments number differs from overridden method Bulk changes like these are naturally an annoyance to everyone who has pending changes. However I feel that the mid- to long-term benefits overweigh the short-term trouble and now is at least as good a time as any to land the changes. With AC/SEETA hacking away fervently now and in the foreseeable future (awesome!) we're not going to have a window where there are only a few patches pending. We'll always hurt someone so it's better to get it in early in the release cycle. Sascha Silbe (21): fix EOL spaces PEP8 cleanup: fix number of blank lines PEP8 cleanup: ensure lines are shorter than 80 characters PEP8 cleanup: don't use has_key() PEP8 cleanup: fix whitespace around operator PEP8 cleanup: fix inline comment spacing PEP8 cleanup: fix spaces around keyword parameters PEP8 cleanup: fix whitespace before ':' PEP8 cleanup: fix deprecated raise syntax style cleanup: use everywhere style cleanup: prefer ' for strings pylint cleanup: replace disable-msg with disable pylint cleanup: remove unused import sugar.util: use logging.exception instead of traceback.format_exc() pylint cleanup: disable warnings for reasonable catch-all exception handlers pylint cleanup: pass format parameters to log functions instead of using % pylint cleanup: initialise all attributes in __init__() ToolInvoker._get_alignments: fix missing self parameter CellRendererInvoker._redraw_path(): assure column is defined pylint: sugar.wm._property_change_trapped: allow overriding built-in method bundlebuilder: ignore incorrect pylint warning examples/radiopalette.py|3 +- examples/toolbar.py |1 + src/sugar/activity/activity.py | 37 --- src/sugar/activity/activityfactory.py | 14 src/sugar/activity/activityhandle.py|6 ++-- src/sugar/activity/activityservice.py |6 ++-- src/sugar/activity/bundlebuilder.py | 34 +++-- src/sugar/activity/i18n.py |2 +- src/sugar/activity/main.py | 18 +- src/sugar/activity/namingalert.py |3 +- src/sugar/bundle/activitybundle.py | 24 +++--- src/sugar/bundle/bundle.py |4 +- src/sugar/bundle/contentbundle.py |4 +- src/sugar/datastore/datastore.py| 12 src/sugar/env.py| 13 ++-- src/sugar/graphics/alert.py |6 ++- src/sugar/graphics/combobox.py |2 +- src/sugar/graphics/icon.py |5 ++- src/sugar/graphics/objectchooser.py |4 +- src/sugar/graphics/palettegroup.py |2 +- src/sugar/graphics/palettewindow.py | 16 ++ src/sugar/graphics/radiotoolbutton.py |2 +- src/sugar/graphics/style.py | 13 src/sugar/graphics/toggletoolbutton.py |4 +- src/sugar/graphics/toolbutton.py|4 +- src/sugar/graphics/tray.py |6 ++-- src/sugar/graphics/xocolor.py |2 +- src/sugar/network.py| 40 src/sugar/presence/activity.py | 47 + src/sugar/presence/buddy.py |8 +++-- src/sugar/presence/connectionmanager.py | 10 -- src/sugar/presence/presenceservice.py | 20 +++- src/sugar/presence/tubeconn.py |4 +- src/sugar/profile.py| 50 +++--- src/sugar/util.py | 10 +++--- src/sugar/wm.py | 10 -- tests/graphics/common.py|6 +++- tests/graphics/hipposcalability.py |3 +- tests/graphics/iconcache.py |5 ++- tests/graphics/iconwidget.py|4 +- tests/graphics/ticket2855.py|2 +- tests/graphics/ticket2999.py|2 +- tests/graphics/ticket3000.py|2 +- tests/graphics/toolbarpalettes.py |2 +- tests/graphics/tray.py |2 +- tests/lib/test_mime.py | 17 ++ 46 files changed, 260 insertions(+), 231 deletions(-) ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org
[Sugar-devel] [PATCH 07/21 sugar-toolkit] PEP8 cleanup: fix spaces around keyword parameters
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activityhandle.py b/src/sugar/activity/activityhandle.py index 4aeac71..b29973e 100644 --- a/src/sugar/activity/activityhandle.py +++ b/src/sugar/activity/activityhandle.py @@ -69,7 +69,7 @@ class ActivityHandle(object): def create_from_dict(handle_dict): Create a handle from a dictionary of parameters result = ActivityHandle(handle_dict['activity_id'], -object_id = handle_dict.get('object_id'), -uri = handle_dict.get('uri'), -invited = handle_dict.get('invited')) +object_id=handle_dict.get('object_id'), +uri=handle_dict.get('uri'), +invited=handle_dict.get('invited')) return result diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index 2952d71..7bf02ed 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -64,7 +64,7 @@ def list_files(base_dir, ignore_dirs=None, ignore_files=None): class Config(object): -def __init__(self, source_dir=None, dist_dir = None, dist_name = None): +def __init__(self, source_dir=None, dist_dir=None, dist_name=None): self.source_dir = source_dir or os.getcwd() self.dist_dir = dist_dir or os.path.join(self.source_dir, 'dist') self.dist_name = dist_name diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index 2bb0729..dfec7a8 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -135,7 +135,7 @@ class ActivityBundle(Bundle): return lines -def get_files(self, manifest = None): +def get_files(self, manifest=None): files = [line for line in (manifest or self.manifest) if line] if self.is_file('MANIFEST'): diff --git a/src/sugar/graphics/tray.py b/src/sugar/graphics/tray.py index 172123a..0e048d8 100644 --- a/src/sugar/graphics/tray.py +++ b/src/sugar/graphics/tray.py @@ -170,7 +170,7 @@ class _TrayScrollButton(ToolButton): self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE) -self.icon = Icon(icon_name = icon_name, +self.icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR) # The alignment is a hack to work around gtk.ToolButton code # that sets the icon_size when the icon_widget is a gtk.Image diff --git a/src/sugar/util.py b/src/sugar/util.py index 3625f21..9a3b5d0 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -50,7 +50,7 @@ def sha_data(data): return sha_hash.digest() -def unique_id(data = ''): +def unique_id(data=''): Generate a likely-unique ID for whatever purpose data -- suffix appended to working data before hashing -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 08/21 sugar-toolkit] PEP8 cleanup: fix whitespace before ':'
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 0094693..e3654d8 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -928,7 +928,7 @@ class _ClientHandler(dbus.service.Object, DBusProperties): def __get_filters_cb(self): logging.debug('__get_filters_cb') filters = { -CHANNEL + '.ChannelType' : CHANNEL_TYPE_TEXT, +CHANNEL + '.ChannelType': CHANNEL_TYPE_TEXT, CHANNEL + '.TargetHandleType': CONNECTION_HANDLE_TYPE_CONTACT, } filter_dict = dbus.Dictionary(filters, signature='sv') -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 06/21 sugar-toolkit] PEP8 cleanup: fix inline comment spacing
pep8 wants inline comments to be prefixed by at least two spaces. Let's just move them to a separate line as that's easier to read anyway. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py index 100f05a..ea3a9c0 100644 --- a/src/sugar/graphics/icon.py +++ b/src/sugar/graphics/icon.py @@ -61,7 +61,8 @@ class _SVGLoader(object): logging.error( 'Icon %s, entity %s is invalid.', file_name, entity) -import rsvg # XXX this is very slow! why? +# XXX this is very slow! why? +import rsvg return rsvg.Handle(data=icon) diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py index 47de8aa..a057e5a 100644 --- a/src/sugar/presence/activity.py +++ b/src/sugar/presence/activity.py @@ -683,11 +683,16 @@ class _JoinCommand(_BaseCommand): # since only the owner can change invite-only, that would break # activity scope changes. props = { -'anonymous': False, # otherwise buddy resolution breaks -'invite-only': False, # anyone who knows about the channel can join -'invite-restricted': False, # so non-owners can invite others -'persistent': False, # vanish when there are no members -'private': True, # don't appear in server room lists +# otherwise buddy resolution breaks +'anonymous': False, +# anyone who knows about the channel can join +'invite-only': False, +# so non-owners can invite others +'invite-restricted': False, +# vanish when there are no members +'persistent': False, +# don't appear in server room lists +'private': True, } props_to_set = [] for ident, name, sig_, flags in prop_specs: -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 01/21 sugar-toolkit] fix EOL spaces
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py index 3f5188e..2b01366 100644 --- a/src/sugar/datastore/datastore.py +++ b/src/sugar/datastore/datastore.py @@ -153,7 +153,7 @@ class DSObject(object): return self._object_id def set_object_id(self, object_id): -if self._update_signal_match is not None: +if self._update_signal_match is not None: self._update_signal_match.remove() if object_id is not None: self._update_signal_match = _get_data_store().connect_to_signal( diff --git a/src/sugar/wm.py b/src/sugar/wm.py index 418a291..3bf1421 100644 --- a/src/sugar/wm.py +++ b/src/sugar/wm.py @@ -46,7 +46,7 @@ def _property_change_trapped(window, prop, prop_type, format, mode, data): 'a property on a window' % error) raise RuntimeError('Received X Error (%i) while setting ' 'a property on a window' % error) - + def get_activity_id(wnck_window): window = gtk.gdk.window_foreign_new(wnck_window.get_xid()) diff --git a/tests/graphics/iconwidget.py b/tests/graphics/iconwidget.py index cacf501..625306e 100644 --- a/tests/graphics/iconwidget.py +++ b/tests/graphics/iconwidget.py @@ -45,7 +45,7 @@ def create_icon_widgets(box, sensitive=True): icon.set_sensitive(sensitive) icon.show() -icon = Icon(icon_name='computer-xo', +icon = Icon(icon_name='computer-xo', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR, xo_color=XoColor()) box.pack_start(icon) diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py index 3df0ce6..9a9ad61 100644 --- a/tests/lib/test_mime.py +++ b/tests/lib/test_mime.py @@ -33,7 +33,7 @@ class TestMime(unittest.TestCase): ['text/plain', 'text/_moz_htmlcontext', 'text/unicode', 'text/html', 'text/_moz_htmlinfo']) self.assertEqual(mime_type, 'text/html') - + # Mozilla's text in cv mime_type = mime.choose_most_significant( ['text/_moz_htmlcontext', 'STRING', 'text/html', 'text/_moz_htmlinfo', -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 02/21 sugar-toolkit] PEP8 cleanup: fix number of blank lines
Caught by pep8. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/examples/radiopalette.py b/examples/radiopalette.py index 85b43ce..f8336bd 100644 --- a/examples/radiopalette.py +++ b/examples/radiopalette.py @@ -17,6 +17,7 @@ box.pack_start(toolbar, False) text_view = gtk.TextView() box.pack_start(text_view) + def echo(button, label): if not button.props.active: return diff --git a/examples/toolbar.py b/examples/toolbar.py index 2faea1f..c0718d3 100644 --- a/examples/toolbar.py +++ b/examples/toolbar.py @@ -25,6 +25,7 @@ toolbar.toolbar.insert(tollbarbutton_2, -1) toolbar.toolbar.insert(gtk.SeparatorToolItem(), -1) + def del_cb(widget): toolbar.toolbar.remove(tollbarbutton_3) del_b = gtk.Button('delete sub-widget #3') diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 0bda2ea..6774703 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -98,6 +98,7 @@ J_DBUS_INTERFACE = 'org.laptop.Journal' CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties' + class _ActivitySession(gobject.GObject): __gsignals__ = { diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py index a4dd017..0202a66 100644 --- a/src/sugar/graphics/alert.py +++ b/src/sugar/graphics/alert.py @@ -291,6 +291,7 @@ class ConfirmationAlert(Alert): self.add_button(gtk.RESPONSE_OK, _('Ok'), icon) icon.show() + class ErrorAlert(Alert): This is a ready-made one button (Ok) alert. @@ -336,6 +337,7 @@ class ErrorAlert(Alert): self.add_button(gtk.RESPONSE_OK, _('Ok'), icon) icon.show() + class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem): An icon with a round border __gtype_name__ = 'AlertTimeoutIcon' diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py index f51c938..e76e952 100644 --- a/src/sugar/graphics/palettewindow.py +++ b/src/sugar/graphics/palettewindow.py @@ -669,6 +669,7 @@ class Invoker(gobject.GObject): if not self.props.cache_palette: self.set_palette(None) + class WidgetInvoker(Invoker): def __init__(self, parent=None, widget=None): diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py index aa6b396..a1b7a50 100644 --- a/src/sugar/presence/activity.py +++ b/src/sugar/presence/activity.py @@ -463,11 +463,13 @@ class Activity(gobject.GObject): _logger.debug('%r: leaving', self) self.telepathy_text_chan.Close() + class _BaseCommand(gobject.GObject): __gsignals__ = { 'finished': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([object])), } + def __init__(self): gobject.GObject.__init__(self) @@ -532,6 +534,7 @@ class _ShareCommand(_BaseCommand): self._finished = True self.emit('finished', error) + class _JoinCommand(_BaseCommand): def __init__(self, connection, room_handle): _BaseCommand.__init__(self) diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py index 0a72a36..b83bc51 100644 --- a/src/sugar/presence/buddy.py +++ b/src/sugar/presence/buddy.py @@ -144,6 +144,7 @@ class BaseBuddy(gobject.GObject): class Buddy(BaseBuddy): __gtype_name__ = 'PresenceBuddy' + def __init__(self, account_path, contact_id): _logger.debug('Buddy.__init__') BaseBuddy.__init__(self) diff --git a/src/sugar/presence/connectionmanager.py b/src/sugar/presence/connectionmanager.py index e681eb6..6604d3f 100644 --- a/src/sugar/presence/connectionmanager.py +++ b/src/sugar/presence/connectionmanager.py @@ -31,12 +31,14 @@ from telepathy.constants import CONNECTION_STATUS_CONNECTED ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager' + class Connection(object): def __init__(self, account_path, connection): self.account_path = account_path self.connection = connection self.connected = False + class ConnectionManager(object): Track available telepathy connections @@ -108,8 +110,8 @@ class ConnectionManager(object): return account_path return None -_connection_manager = None +_connection_manager = None def get_connection_manager(): global _connection_manager if not _connection_manager: diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py index 51d8625..fa5edcf 100644 --- a/src/sugar/presence/presenceservice.py +++ b/src/sugar/presence/presenceservice.py @@ -37,6 +37,7 @@ from telepathy.interfaces import ACCOUNT, \ CONNECTION from telepathy.constants import HANDLE_TYPE_CONTACT + _logger = logging.getLogger('sugar.presence.presenceservice') ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' @@ -44,6 +45,7 @@ ACCOUNT_MANAGER_PATH =
[Sugar-devel] [PATCH 04/21 sugar-toolkit] PEP8 cleanup: don't use has_key()
has_key() has been deprecated for quite some time now. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 183d4a8..0094693 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -256,7 +256,7 @@ class Activity(Window, gtk.Container): Window.__init__(self) -if os.environ.has_key('SUGAR_ACTIVITY_ROOT'): +if 'SUGAR_ACTIVITY_ROOT' in os.environ: # If this activity runs inside Sugar, we want it to take all the # screen. Would be better if it was the shell to do this, but we # haven't found yet a good way to do it there. See #1263. @@ -307,7 +307,7 @@ class Activity(Window, gtk.Container): self._jobject = datastore.get(handle.object_id) self.set_title(self._jobject.metadata['title']) -if self._jobject.metadata.has_key('share-scope'): +if 'share-scope' in self._jobject.metadata: share_scope = self._jobject.metadata['share-scope'] self.shared_activity = None @@ -509,8 +509,7 @@ class Activity(Window, gtk.Container): which isn't specific to a journal item here. If (meta-)data is in anyway specific to a journal entry, it MUST be stored in the DataStore. -if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \ - os.environ['SUGAR_ACTIVITY_ROOT']: +if os.environ.get('SUGAR_ACTIVITY_ROOT'): return os.environ['SUGAR_ACTIVITY_ROOT'] else: return '/' @@ -974,8 +973,7 @@ def get_bundle_path(): def get_activity_root(): Returns a path for saving Activity specific preferences, etc. -if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \ -os.environ['SUGAR_ACTIVITY_ROOT']: +if os.environ.get('SUGAR_ACTIVITY_ROOT'): return os.environ['SUGAR_ACTIVITY_ROOT'] else: raise RuntimeError(No SUGAR_ACTIVITY_ROOT set.) diff --git a/src/sugar/activity/namingalert.py b/src/sugar/activity/namingalert.py index 72db8dc..c3d45df 100644 --- a/src/sugar/activity/namingalert.py +++ b/src/sugar/activity/namingalert.py @@ -271,8 +271,7 @@ class NamingAlert(gtk.Window): activity_bundle = ActivityBundle(self._bundle_path) file_name = activity_bundle.get_icon() entry_icon = CanvasIcon(file_name=file_name) -if self._activity.metadata.has_key('icon-color') and \ -self._activity.metadata['icon-color']: +if self._activity.metadata.get('icon-color'): entry_icon.props.xo_color = XoColor( \ self._activity.metadata['icon-color']) return entry_icon diff --git a/src/sugar/env.py b/src/sugar/env.py index 655d18d..a427d65 100644 --- a/src/sugar/env.py +++ b/src/sugar/env.py @@ -24,18 +24,11 @@ import os def is_emulator(): -if os.environ.has_key('SUGAR_EMULATOR'): -if os.environ['SUGAR_EMULATOR'] == 'yes': -return True -return False +return os.environ.get('SUGAR_EMULATOR', 'yes') == 'yes' def get_profile_path(path=None): -if os.environ.has_key('SUGAR_PROFILE'): -profile_id = os.environ['SUGAR_PROFILE'] -else: -profile_id = 'default' - +profile_id = os.environ.get('SUGAR_PROFILE', 'default') base = os.path.join(os.path.expanduser('~/.sugar'), profile_id) if not os.path.isdir(base): try: diff --git a/src/sugar/graphics/palettegroup.py b/src/sugar/graphics/palettegroup.py index 05c713c..3f39163 100644 --- a/src/sugar/graphics/palettegroup.py +++ b/src/sugar/graphics/palettegroup.py @@ -26,7 +26,7 @@ _groups = {} def get_group(group_id): -if _groups.has_key(group_id): +if group_id in _groups: group = _groups[group_id] else: group = Group() diff --git a/src/sugar/graphics/style.py b/src/sugar/graphics/style.py index 2828b7f..d5f82ff 100644 --- a/src/sugar/graphics/style.py +++ b/src/sugar/graphics/style.py @@ -35,12 +35,11 @@ _TAB_CURVATURE = 1 def _compute_zoom_factor(): -if os.environ.has_key('SUGAR_SCALING'): -try: -scaling = int(os.environ['SUGAR_SCALING']) -return scaling / 100.0 -except ValueError: -logging.error('Invalid SUGAR_SCALING.') +try: +scaling = int(os.environ.get('SUGAR_SCALING', '100')) +return scaling / 100.0 +except ValueError: +logging.error('Invalid SUGAR_SCALING.') return 1.0 diff --git a/src/sugar/network.py b/src/sugar/network.py index bde8c9f..b72acad 100644 --- a/src/sugar/network.py +++ b/src/sugar/network.py @@ -242,7 +242,7 @@ class GlibURLDownloader(gobject.GObject): self.cleanup(remove=True) def _get_filename_from_headers(self, headers): -if not headers.has_key(Content-Disposition): +if 'Content-Disposition' not in headers: return None ftag = filename= -- 1.7.1
[Sugar-devel] [PATCH 19/21 sugar-toolkit] CellRendererInvoker._redraw_path(): assure column is defined
We know that our code is correct and column should always be assigned, but it never hurts to act defensively and guard against bugs in other pieces of the code (or other components like GTK). Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py index c5deecd..9c3a02a 100644 --- a/src/sugar/graphics/palettewindow.py +++ b/src/sugar/graphics/palettewindow.py @@ -938,9 +938,11 @@ class CellRendererInvoker(Invoker): self.notify_mouse_leave() def _redraw_path(self, path): +column = None for column in self._tree_view.get_columns(): if self._cell_renderer in column.get_cell_renderers(): break +assert column is not None area = self._tree_view.get_background_area(path, column) x, y = \ self._tree_view.convert_bin_window_to_widget_coords(area.x, area.y) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 03/21 sugar-toolkit] PEP8 cleanup: ensure lines are shorter than 80 characters
Caught by PEP8. This is important for Sugar because the XO has a small screen where long lines would make the code hard to understand (because you need to constantly scroll horizontally). Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 6774703..183d4a8 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -569,7 +569,8 @@ class Activity(Window, gtk.Container): if self._closing: self._show_keep_failed_dialog() self._closing = False -raise RuntimeError('Error saving activity object to datastore: %s', err) +raise RuntimeError('Error saving activity object to datastore: %s', +err) def _cleanup_jobject(self): if self._jobject: diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py index a1b7a50..47de8aa 100644 --- a/src/sugar/presence/activity.py +++ b/src/sugar/presence/activity.py @@ -135,7 +135,8 @@ class Activity(gobject.GObject): dbus_interface=CONN_INTERFACE_ACTIVITY_PROPERTIES) def __activity_properties_changed_cb(self, room_handle, properties): -_logger.debug('%r: Activity properties changed to %r', self, properties) +_logger.debug('%r: Activity properties changed to %r', self, +properties) self._update_properties(properties) def __got_properties_cb(self, properties): diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py index b83bc51..e4f54d4 100644 --- a/src/sugar/presence/buddy.py +++ b/src/sugar/presence/buddy.py @@ -182,7 +182,8 @@ class Buddy(BaseBuddy): CONNECTION_INTERFACE_CONTACTS, 'GetContactAttributes', 'auasb', -([self.contact_handle], [CONNECTION_INTERFACE_ALIASING], False), +([self.contact_handle], [CONNECTION_INTERFACE_ALIASING], +False), reply_handler=self.__got_attributes_cb, error_handler=self.__error_handler_cb) diff --git a/src/sugar/presence/connectionmanager.py b/src/sugar/presence/connectionmanager.py index 6604d3f..78b744e 100644 --- a/src/sugar/presence/connectionmanager.py +++ b/src/sugar/presence/connectionmanager.py @@ -77,7 +77,8 @@ class ConnectionManager(object): Connection(account_path, connection) account = bus.get_object(ACCOUNT_MANAGER_SERVICE, account_path) -if account.Get(ACCOUNT, 'ConnectionStatus') == CONNECTION_STATUS_CONNECTED: +status = account.Get(ACCOUNT, 'ConnectionStatus') +if status == CONNECTION_STATUS_CONNECTED: self._connections_per_account[account_path].connected = True else: self._connections_per_account[account_path].connected = False diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py index fa5edcf..feea190 100644 --- a/src/sugar/presence/presenceservice.py +++ b/src/sugar/presence/presenceservice.py @@ -72,8 +72,8 @@ class PresenceService(gobject.GObject): if self._activity_cache is not None: if self._activity_cache.props.id != activity_id: -raise RuntimeError('Activities can only access their own shared' - 'instance') +raise RuntimeError('Activities can only access their own' +' shared instance') return self._activity_cache else: connection_manager = get_connection_manager() @@ -105,8 +105,8 @@ class PresenceService(gobject.GObject): def get_activity_by_handle(self, connection_path, room_handle): if self._activity_cache is not None: if self._activity_cache.room_handle != room_handle: -raise RuntimeError('Activities can only access their own shared' - 'instance') +raise RuntimeError('Activities can only access their own' + ' shared instance') return self._activity_cache else: connection_manager = get_connection_manager() @@ -227,8 +227,8 @@ class PresenceService(gobject.GObject): returns the bus name and the object path of the Telepathy connection -connection_manager = get_connection_manager() -account_path, connection = connection_manager.get_preferred_connection() +manager = get_connection_manager() +account_path, connection = manager.get_preferred_connection() if connection is None: return None else: diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py index fd7006b..860bbdb 100644 --- a/tests/lib/test_mime.py +++ b/tests/lib/test_mime.py @@ -37,15 +37,17 @@ class TestMime(unittest.TestCase): # Mozilla's text in cv mime_type = mime.choose_most_significant( -
[Sugar-devel] [PATCH 05/21 sugar-toolkit] PEP8 cleanup: fix whitespace around operator
I've left the powers as-is because IMO they should directly follow the base, unlike other operators. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index fc8ebc8..2952d71 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -19,6 +19,7 @@ STABLE. +import operator import os import sys import zipfile @@ -84,7 +85,7 @@ class Config(object): self.version = bundle.get_activity_version() self.activity_name = bundle.get_bundle_name() self.bundle_id = bundle.get_bundle_id() -self.bundle_name = reduce(lambda x, y: x+y, self.activity_name.split()) +self.bundle_name = reduce(operator.add, self.activity_name.split()) self.bundle_root_dir = self.bundle_name + '.activity' self.tar_root_dir = '%s-%d' % (self.bundle_name, self.version) diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index 3bbc250..2bb0729 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -334,7 +334,7 @@ class ActivityBundle(Bundle): # Is anything in MANIFEST left over after accounting for all files? if manifestfiles: -err = (Bundle %s: files in MANIFEST not included: %s% +err = (Bundle %s: files in MANIFEST not included: %s % (self._name, str(manifestfiles))) if strict_manifest: raise MalformedBundleException(err) diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py index 0202a66..f032871 100644 --- a/src/sugar/graphics/alert.py +++ b/src/sugar/graphics/alert.py @@ -357,7 +357,7 @@ class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem): radius = min(width * 0.5, height * 0.5) hippo.cairo_set_source_rgba32(cr, self.props.background_color) -cr.arc(xval, yval, radius, 0, 2*math.pi) +cr.arc(xval, yval, radius, 0, 2 * math.pi) cr.fill_preserve() diff --git a/src/sugar/network.py b/src/sugar/network.py index b72acad..069a980 100644 --- a/src/sugar/network.py +++ b/src/sugar/network.py @@ -250,11 +250,11 @@ class GlibURLDownloader(gobject.GObject): fidx = data.find(ftag) if fidx 0: return None -fname = data[fidx+len(ftag):] +fname = data[fidx + len(ftag):] if fname[0] == '' or fname[0] == ': fname = fname[1:] -if fname[len(fname)-1] == '' or fname[len(fname)-1] == ': -fname = fname[:len(fname)-1] +if fname[len(fname) - 1] == '' or fname[len(fname) - 1] == ': +fname = fname[:len(fname) - 1] return fname def _read_next_chunk(self, source, condition): -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 13/21 sugar-toolkit] pylint cleanup: remove unused import
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/presence/connectionmanager.py b/src/sugar/presence/connectionmanager.py index 78b744e..502b7a8 100644 --- a/src/sugar/presence/connectionmanager.py +++ b/src/sugar/presence/connectionmanager.py @@ -24,8 +24,7 @@ from functools import partial import dbus from dbus import PROPERTIES_IFACE from telepathy.interfaces import ACCOUNT, \ - ACCOUNT_MANAGER, \ - CONNECTION + ACCOUNT_MANAGER from telepathy.constants import CONNECTION_STATUS_CONNECTED ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 20/21 sugar-toolkit] pylint: sugar.wm._property_change_trapped: allow overriding built-in method
format is the name of a parameter of the function we are wrapping, so we shouldn't change it. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/wm.py b/src/sugar/wm.py index 00c6fd0..8f1903f 100644 --- a/src/sugar/wm.py +++ b/src/sugar/wm.py @@ -38,6 +38,7 @@ def _property_get_trapped(window, prop, prop_type): def _property_change_trapped(window, prop, prop_type, format, mode, data): +# pylint: disable=W0622 gtk.gdk.error_trap_push() window.property_change(prop, prop_type, format, mode, data) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 16/21 sugar-toolkit] pylint cleanup: pass format parameters to log functions instead of using %
This avoids the overhead from the string formatting on production systems. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/wm.py b/src/sugar/wm.py index eaa196e..00c6fd0 100644 --- a/src/sugar/wm.py +++ b/src/sugar/wm.py @@ -32,7 +32,7 @@ def _property_get_trapped(window, prop, prop_type): error = gtk.gdk.error_trap_pop() if error: logging.debug('Received X Error (%i) while getting ' - 'a property on a window' % error) + 'a property on a window', error) return prop_info @@ -45,7 +45,7 @@ def _property_change_trapped(window, prop, prop_type, format, mode, data): error = gtk.gdk.error_trap_pop() if error: logging.debug('Received X Error (%i) while setting ' - 'a property on a window' % error) + 'a property on a window', error) raise RuntimeError('Received X Error (%i) while setting ' 'a property on a window' % error) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 15/21 sugar-toolkit] pylint cleanup: disable warnings for reasonable catch-all exception handlers
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 64bc840..7229096 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -823,6 +823,7 @@ class Activity(Window, gtk.Container): try: self.save() except: +# pylint: disable=W0702 logging.exception('Error saving activity object to datastore') self._show_keep_failed_dialog() return False diff --git a/src/sugar/util.py b/src/sugar/util.py index e0a431b..df56946 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -335,6 +335,7 @@ def _cleanup_temp_files(): try: os.unlink(path) except: +# pylint: disable=W0702 logging.exception('Exception occured in _cleanup_temp_files') atexit.register(_cleanup_temp_files) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 09/21 sugar-toolkit] PEP8 cleanup: fix deprecated raise syntax
Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/graphics/style.py b/src/sugar/graphics/style.py index d5f82ff..7f48d9a 100644 --- a/src/sugar/graphics/style.py +++ b/src/sugar/graphics/style.py @@ -83,7 +83,7 @@ class Color(object): if html_color[0] == '#': html_color = html_color[1:] if len(html_color) != 6: -raise ValueError, input #%s is not in #RRGGBB format % html_color +raise ValueError('input #%s is not in #RRGGBB format' % html_color) r, g, b = html_color[:2], html_color[2:4], html_color[4:] r, g, b = [int(n, 16) for n in (r, g, b)] -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 10/21 sugar-toolkit] style cleanup: use everywhere
Most of the code uses , so adjust the few deviations. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index 7bf02ed..d058b55 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -277,7 +277,7 @@ class Installer(object): def cmd_dev(config, args): -'''Setup for development''' +Setup for development if args: print 'Usage: %prog dev' @@ -297,7 +297,7 @@ def cmd_dev(config, args): def cmd_dist_xo(config, args): -'''Create a xo bundle package''' +Create a xo bundle package if args: print 'Usage: %prog dist_xo' @@ -308,7 +308,7 @@ def cmd_dist_xo(config, args): def cmd_fix_manifest(config, args): -'''Add missing files to the manifest''' +Add missing files to the manifest if args: print 'Usage: %prog fix_manifest' @@ -319,7 +319,7 @@ def cmd_fix_manifest(config, args): def cmd_dist_source(config, args): -'''Create a tar source package''' +Create a tar source package if args: print 'Usage: %prog dist_source' @@ -330,7 +330,7 @@ def cmd_dist_source(config, args): def cmd_install(config, args): -'''Install the activity in the system''' +Install the activity in the system parser = OptionParser(usage='usage: %prog install [options]') parser.add_option('--prefix', dest='prefix', default=sys.prefix, @@ -345,7 +345,7 @@ def cmd_install(config, args): def cmd_genpot(config, args): -'''Generate the gettext pot file''' +Generate the gettext pot file if args: print 'Usage: %prog genpot' @@ -384,7 +384,7 @@ def cmd_genpot(config, args): def cmd_build(config, args): -'''Build generated files''' +Build generated files if args: print 'Usage: %prog build' diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index dfec7a8..18a08bc 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -346,8 +346,8 @@ class ActivityBundle(Bundle): return install_path def install_mime_type(self, install_path): -''' Update the mime type database and install the mime type icon -''' + Update the mime type database and install the mime type icon + xdg_data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share')) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 21/21 sugar-toolkit] bundlebuilder: ignore incorrect pylint warning
pylint isn't smart enough to figure out the return type of Popen.communicate(), so squelch the warning. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index 1d7b613..60721d3 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -228,6 +228,7 @@ class SourcePackager(Packager): return list_files(self.config.source_dir, IGNORE_DIRS, IGNORE_FILES) +# pylint: disable=E1103 return [path.strip() for path in stdout.strip('\n').split('\n')] def package(self): -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 12/21 sugar-toolkit] pylint cleanup: replace disable-msg with disable
Adapt to upstream format change. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index 6bd661f..a206d15 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -58,7 +58,7 @@ def _close_fds(): for i in xrange(3, MAXFD): try: os.close(i) -# pylint: disable-msg=W0704 +# pylint: disable=W0704 except Exception: pass @@ -284,7 +284,7 @@ class ActivityCreationHandler(gobject.GObject): self._handle.activity_id, self._service_name) def _create_error_handler(self, err): -logging.error('Couldn't create activity %s (%s): %s', +logging.error(Couldn't create activity %s (%s): %s, self._handle.activity_id, self._service_name, err) self._shell.NotifyLaunchFailure( self._handle.activity_id, reply_handler=self._no_reply_handler, diff --git a/src/sugar/presence/tubeconn.py b/src/sugar/presence/tubeconn.py index 88cc729..1014a46 100644 --- a/src/sugar/presence/tubeconn.py +++ b/src/sugar/presence/tubeconn.py @@ -36,7 +36,7 @@ class TubeConnection(Connection): def __new__(cls, conn, tubes_iface, tube_id, address=None, group_iface=None, mainloop=None): -# pylint: disable-msg=W0212 +# pylint: disable=W0212 # Confused by __new__ if address is None: address = tubes_iface.GetDBusTubeAddress(tube_id) @@ -59,7 +59,7 @@ class TubeConnection(Connection): return self def _on_get_self_handle_reply(self, handle): -# pylint: disable-msg=W0201 +# pylint: disable=W0201 # Confused by __new__ self.self_handle = handle match = self._tubes_iface.connect_to_signal('DBusNamesChanged', diff --git a/src/sugar/util.py b/src/sugar/util.py index 16080cf..889cc62 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -133,7 +133,7 @@ class LRU: def __init__(self, count, pairs=[]): -# pylint: disable-msg=W0102,W0612 +# pylint: disable=W0102,W0612 self.count = max(count, 1) self.d = {} self.first = None -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 14/21 sugar-toolkit] sugar.util: use logging.exception instead of traceback.format_exc()
logging.exception() handles exceptions nicely for us, no need to explicitly use traceback. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/util.py b/src/sugar/util.py index 889cc62..e0a431b 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -29,7 +29,6 @@ import gettext import tempfile import logging import atexit -import traceback _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) @@ -336,7 +335,7 @@ def _cleanup_temp_files(): try: os.unlink(path) except: -logging.error(traceback.format_exc()) +logging.exception('Exception occured in _cleanup_temp_files') atexit.register(_cleanup_temp_files) -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 18/21 sugar-toolkit] ToolInvoker._get_alignments: fix missing self parameter
Caught by pylint. I wonder if we need this piece of code as nobody every triggered it. Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py index 81540e3..c5deecd 100644 --- a/src/sugar/graphics/palettewindow.py +++ b/src/sugar/graphics/palettewindow.py @@ -853,7 +853,7 @@ class ToolInvoker(WidgetInvoker): def _get_alignments(self): parent = self._widget.get_parent() if parent is None: -return WidgetInvoker._get_alignments() +return WidgetInvoker._get_alignments(self) if parent.get_orientation() is gtk.ORIENTATION_HORIZONTAL: return self.BOTTOM + self.TOP -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH 11/21 sugar-toolkit] style cleanup: prefer ' for strings
Tomeu prefers ' for strings, so let's use it wherever we don't have a good reason to use . Signed-off-by: Sascha Silbe sascha-...@silbe.org diff --git a/examples/radiopalette.py b/examples/radiopalette.py index f8336bd..3117aec 100644 --- a/examples/radiopalette.py +++ b/examples/radiopalette.py @@ -21,7 +21,7 @@ box.pack_start(text_view) def echo(button, label): if not button.props.active: return -text_view.props.buffer.props.text += \n + label +text_view.props.buffer.props.text += '\n' + label # RadioMenuButton diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index e3654d8..64bc840 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -88,9 +88,9 @@ from sugar.activity.widgets import ActivityToolbox _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) -SCOPE_PRIVATE = private -SCOPE_INVITE_ONLY = invite # shouldn't be shown in UI, it's implicit -SCOPE_NEIGHBORHOOD = public +SCOPE_PRIVATE = 'private' +SCOPE_INVITE_ONLY = 'invite' # shouldn't be shown in UI, it's implicit +SCOPE_NEIGHBORHOOD = 'public' J_DBUS_SERVICE = 'org.laptop.Journal' J_DBUS_PATH = '/org/laptop/Journal' @@ -269,7 +269,7 @@ class Activity(Window, gtk.Container): # but they get truncated anyway so if more characters # are supported in the future we will get a better view # of the processes -proc_title = %s %s % (get_bundle_name(), handle.activity_id) +proc_title = '%s %s' % (get_bundle_name(), handle.activity_id) util.set_proc_title(proc_title) self.connect('realize', self.__realize_cb) @@ -362,16 +362,16 @@ class Activity(Window, gtk.Container): def _set_up_sharing(self, mesh_instance, share_scope): # handle activity share/join -logging.debug(*** Act %s, mesh instance %r, scope %s, +logging.debug('*** Act %s, mesh instance %r, scope %s', self._activity_id, mesh_instance, share_scope) if mesh_instance is not None: # There's already an instance on the mesh, join it -logging.debug(*** Act %s joining existing mesh instance %r, +logging.debug('*** Act %s joining existing mesh instance %r', self._activity_id, mesh_instance) self.shared_activity = mesh_instance self.shared_activity.connect('notify::private', self.__privacy_changed_cb) -self._join_id = self.shared_activity.connect(joined, +self._join_id = self.shared_activity.connect('joined', self.__joined_cb) if not self.shared_activity.props.joined: self.shared_activity.join() @@ -778,7 +778,7 @@ class Activity(Window, gtk.Container): its 'private' property. if self.shared_activity and self.shared_activity.props.joined: -raise RuntimeError(Activity %s already shared. % +raise RuntimeError('Activity %s already shared.' % self._activity_id) verb = private and 'private' or 'public' logging.debug('Requesting %s share of activity %s.', verb, @@ -880,7 +880,7 @@ class Activity(Window, gtk.Container): Returns the jobject metadata or None if there is no jobject. Activities can set metadata in write_file() using: -self.metadata['MyKey'] = Something +self.metadata['MyKey'] = 'Something' and retrieve metadata in read_file() using: self.metadata.get('MyKey', 'aDefaultValue') @@ -976,7 +976,7 @@ def get_activity_root(): if os.environ.get('SUGAR_ACTIVITY_ROOT'): return os.environ['SUGAR_ACTIVITY_ROOT'] else: -raise RuntimeError(No SUGAR_ACTIVITY_ROOT set.) +raise RuntimeError('No SUGAR_ACTIVITY_ROOT set.') def show_object_in_journal(object_id): diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index 46dc346..6bd661f 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -40,16 +40,16 @@ import tempfile import subprocess import pwd -_SHELL_SERVICE = org.laptop.Shell -_SHELL_PATH = /org/laptop/Shell -_SHELL_IFACE = org.laptop.Shell +_SHELL_SERVICE = 'org.laptop.Shell' +_SHELL_PATH = '/org/laptop/Shell' +_SHELL_IFACE = 'org.laptop.Shell' -_ACTIVITY_FACTORY_INTERFACE = org.laptop.ActivityFactory +_ACTIVITY_FACTORY_INTERFACE = 'org.laptop.ActivityFactory' # helper method to close all filedescriptors # borrowed from subprocess.py try: -MAXFD = os.sysconf(SC_OPEN_MAX) +MAXFD = os.sysconf('SC_OPEN_MAX') except ValueError: MAXFD = 256 @@ -284,7 +284,7 @@ class ActivityCreationHandler(gobject.GObject): self._handle.activity_id, self._service_name) def _create_error_handler(self, err): -logging.error(Couldn't create
Re: [Sugar-devel] branching off sucrose-0.90
Excerpts from Simon Schampijer's message of Fri Oct 15 17:54:14 +0200 2010: On 10/15/2010 02:04 PM, Tomeu Vizoso wrote: patches are accumulating as we wait for 0.90 branches in Pootle. Anybody opposes to branching now in git? No, let's do it. Thought about it several times already myself. +1, let's branch and land my cleanups. ;) 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
Re: [Sugar-devel] Review: [PATCH] Downgrading activities not allowed. (#2164)
Excerpts from Manusheel Gupta's message of Sat Oct 09 04:46:02 +0200 2010: Ishan tried to add the tag - Coauthored by in his patch, and that line gets scrubbed off. Have you added it right at the end, like you would do with the Reviewed-By: tag? E.g.: (assuming author is set to Shanjit Singh Jajmann shan...@seeta.in) === Begin === Allow downgrading activities (SL#2164) If the user tries to start an XO bundle containing a version of an activity that is older than the currently installed one, an option to downgrade the activity will be presented in the form of a confirmation alert. Co-Authored-By: Anubhav Aggarwal anub...@seeta.in === End === PS: Please subscribe to the non-digest version of sugar-devel so you don't break threads. If there's a particular reason you're using the digest I can try to suggest an alternative. 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
Re: [Sugar-devel] [PATCH] Change the logic used to determine the format used to save files.
Excerpts from Gonzalo Odiard's message of Thu Oct 14 22:23:35 +0200 2010: Please mention the module name as part of the patch summary, e.g.: [PATCH Write] keep file type across load/save (SL #2127) The subject is created by git send-email. I can change the first line from the patch, but no how you say. Check out the --subject-prefix option of git format-patch. git send-email delegates the actual patch preparation to git format-patch (unless you pass it a pre-formatted patch as a file). [full-quote trimmed] Please remember to trim those parts of your message you don't reply to. 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
Re: [Sugar-devel] [PATCH] Downgrading activities not allowed. (#2164)
Excerpts from shanjit's message of Fri Oct 15 23:37:42 +0200 2010: Downgrading an activity is now made possible. [...] You've told git send-email to mark your patch as a reply to some message that I've not only never received, but that's also the same as the one referenced by a totally different patch against Paint. Because of this both patches now appear in the same thread, turning review into quite a mess. Please don't set In-Reply-To for patches unless you know exactly what you're doing. And even then please think twice whether it's really a good idea. 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