[Sugar-devel] [PATCH v2] Clipboard menu off screen fixed for long text strings(SL #2201)
Changing maximum text length to a suitable value in clipboardmenu which is dependent on the screen width and pixel size of characters --- src/jarabe/frame/clipboardmenu.py |5 - 1 files changed, 4 insertions(+), 1 deletions(-) v1->v2: text_maxlen dependent on screen size and character pixel size diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py index b998110..b0d141d 100644 --- a/src/jarabe/frame/clipboardmenu.py +++ b/src/jarabe/frame/clipboardmenu.py @@ -38,7 +38,10 @@ from jarabe.model import bundleregistry class ClipboardMenu(Palette): def __init__(self, cb_object): -Palette.__init__(self, text_maxlen=100) +char_lable = gtk.Label() +create_layout = char_lable.create_pango_layout("W") +Palette.__init__(self, text_maxlen=int(0.75 * gtk.gdk.screen_width +() / create_layout.get_pixel_size()[0])) self._cb_object = cb_object -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Clipboard menu off screen fixed for long text strings(SL #2201)
Team, Unfortunately, I had not mentioned the version number in the previous patch. I apologize for the mistake. I am correcting the indentation with adding the versions correctly. Regards, Mukul Gupta Research Engineer, SEETA On Wed, Oct 27, 2010 at 1:22 AM, Mukul Gupta wrote: > Changing maximum text length to a suitable value in clipboardmenu > which is dependent on the screen width and pixel size of > characters > --- > src/jarabe/frame/clipboardmenu.py |5 - > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/src/jarabe/frame/clipboardmenu.py > b/src/jarabe/frame/clipboardmenu.py > index b998110..b0d141d 100644 > --- a/src/jarabe/frame/clipboardmenu.py > +++ b/src/jarabe/frame/clipboardmenu.py > @@ -38,7 +38,10 @@ from jarabe.model import bundleregistry > class ClipboardMenu(Palette): > > def __init__(self, cb_object): > -Palette.__init__(self, text_maxlen=100) > +char_lable = gtk.Label() > +create_layout = char_lable.create_pango_layout("W") > +Palette.__init__(self, text_maxlen=int(0.75 * gtk.gdk.screen_width > +() / create_layout.get_pixel_size()[0])) > > self._cb_object = cb_object > > -- > 1.7.0.4 > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH] Clipboard menu off screen fixed for long text strings(SL #2201)
Changing maximum text length to a suitable value in clipboardmenu which is dependent on the screen width and pixel size of characters --- src/jarabe/frame/clipboardmenu.py |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py index b998110..b0d141d 100644 --- a/src/jarabe/frame/clipboardmenu.py +++ b/src/jarabe/frame/clipboardmenu.py @@ -38,7 +38,10 @@ from jarabe.model import bundleregistry class ClipboardMenu(Palette): def __init__(self, cb_object): -Palette.__init__(self, text_maxlen=100) +char_lable = gtk.Label() +create_layout = char_lable.create_pango_layout("W") +Palette.__init__(self, text_maxlen=int(0.75 * gtk.gdk.screen_width +() / create_layout.get_pixel_size()[0])) self._cb_object = cb_object -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [DESIGN] SL Bug# 2063 : Sugar should bring up an alert when an unhandled Python exception occurs
Bernie, Wish to have your feedback on the design aspect of the ticket 2063 (Sugar should bring up an alert when an unhandled Python exception occurs) - please find the git diff attached below. This is an attempt to display an alert when an unhandled Python exception occurs in the journal. Unfortunately, when the exception takes place in journalactivity.py , I am neither unable to notice the Journal Icon (it disappears), Please find my explanations on the code added as comments. diff --git a/journalactivity.py b/journalactivity.py index 44cc018..36a2e2e 100644 --- a/journalactivity.py +++ b/journalactivity.py @@ -358,8 +358,20 @@ class JournalActivity(Window): self.show_main_view() self.search_grab_focus() ''' Defining an Error Alert function in the Journal Activity Class which displays the message as Operation could not be performed Please check the logviewer activity for details and an OK button ''' +def uncaught_exception_alert(self): +alert = ErrorAlert(title="Operation could not be performed", msg="Please check the logviewer activity for details ") +alert.connect('response', self.__alert_response_cb) +self.add_alert(alert) +alert.show() + _journal = None ''' Defining a function which logs the unhandled exception as well as calls the Error Alert in the Journal whenever any uncaught exception occurs ''' +def _alert_excepthook(exc_type, exc_value, traceback): +logging.exception('Unhandled Python exception: %s', repr((exc_type, exc_value, traceback))) +_journal.uncaught_exception_alert() + ''' When an exception is raised and uncaught, sys.excepthook is called with three arguments, the exception class, exception instance, and a traceback object.The function _alert_excepthook is called only when an unhandled exception occurs. ''' +sys.excepthook = _alert_excepthook + def get_journal(): global _journal if _journal is None: I wish to request you to please review the code and suggest desired changes, if any. Moreover, I have two important questions regarding the bug. 1. To catch all unhandled python exceptions in sugar, where exactly should we be looking forward to be the venue for adding the functionality? Adding it in journalactivity.py doesn't seem to serve all purposes. It has to be added somewhere which is being used all the time. 2. Wish if you could recommend on the GUI feature that could be used for displaying the alert message to the user. Looking forward to for your valuable suggestions, Regards, Mukul Gupta Research Engineer,SEETA ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH] Clipboard menu off screen fixed for long text strings(SL #2201)
Changing maximum text length to a suitable value so that it fits into the screen --- src/jarabe/frame/clipboardmenu.py |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py index b998110..1f5259e 100644 --- a/src/jarabe/frame/clipboardmenu.py +++ b/src/jarabe/frame/clipboardmenu.py @@ -38,7 +38,7 @@ from jarabe.model import bundleregistry class ClipboardMenu(Palette): def __init__(self, cb_object): -Palette.__init__(self, text_maxlen=100) +Palette.__init__(self, text_maxlen=80) self._cb_object = cb_object -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH v4 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 v2->v3:Revised English wording and optimised behaviour for bundles v3->v4:Revised English wordings diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..5005655 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) or misc.is_bundle(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 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
[Sugar-devel] [PATCH v4 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 v2->v3:Revised English wording and optimised behaviour for bundles v3->v4:Revised English wordings diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..5005655 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) or misc.is_bundle(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 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
[Sugar-devel] [PATCH v3 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 | 42 +++ 1 files changed, 25 insertions(+), 17 deletions(-) v1->v2: Patch remade as per pep8 standards v2->v3: Revised English wording and optimised behaviour for bundles diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..aa09cf0 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) or misc.is_bundle(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 is available 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')) @@ -204,9 +212,9 @@ class StartWithMenu(gtk.Menu): if not self.get_children(): if metadata.get('activity_id', ''): -resume_label = _('No activity to resume entry') +resume_label = _('No activity is available to resume entry') else: -resume_label = _('No activity to start entry') +resume_label = _('No activity is available to start entry') menu_item = MenuItem(resume_label) menu_item.set_sensitive(False) self.append(menu_item) -- 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)
Team, Thank you. Appreciate your feedback. I have revised the patch which restores its existing behavior for bundles and have incorporated Frederick's idea of having a common and an understandable English wording. http://lists.sugarlabs.org/archive/sugar-devel/2010-October/027925.html Looking forward to your feedback. Regards, Mukul Gupta On Fri, Oct 15, 2010 at 8:03 PM, Aleksey Lim wrote: > 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
[Sugar-devel] [PATCH v3 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 | 42 +++ 1 files changed, 25 insertions(+), 17 deletions(-) v1->v2: Patch remade as per pep8 standards v2->v3: Revised English wording and optimised behaviour for bundles diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..aa09cf0 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) or misc.is_bundle(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 is available 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')) @@ -204,9 +212,9 @@ class StartWithMenu(gtk.Menu): if not self.get_children(): if metadata.get('activity_id', ''): -resume_label = _('No activity to resume entry') +resume_label = _('No activity is available to resume entry') else: -resume_label = _('No activity to start entry') +resume_label = _('No activity is available to start entry') menu_item = MenuItem(resume_label) menu_item.set_sensitive(False) self.append(menu_item) -- 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 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
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 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
[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
[Sugar-devel] [PATCH] 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 | 99 +-- 1 files changed, 53 insertions(+), 46 deletions(-) diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..56df595 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,51 +62,59 @@ 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() - -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) - -client = gconf.client_get_default() -color = XoColor(client.get_string('/desktop/sugar/user/color')) -menu_item = MenuItem(_('Copy')) -icon = Icon(icon_name='edit-copy', xo_color=color, -icon_size=gtk.ICON_SIZE_MENU) -menu_item.set_image(icon) -menu_item.connect('activate', self.__copy_activate_cb) -self.menu.append(menu_item) -menu_item.show() - -menu_item = MenuItem(_('Send to'), 'document-send') -self.menu.append(menu_item) -menu_item.show() - -friends_menu = FriendsMenu() -friends_menu.connect('friend-selected', self.__friend_selected_cb) -menu_item.set_submenu(friends_menu) - -if detail == True: -menu_item = MenuItem(_('View Details'), 'go-right') -menu_item.connect('activate', self.__detail_activate_cb) -self.menu.append(menu_item) -menu_item.show() - -menu_item = MenuItem(_('Erase'), 'list-remove') -menu_item.connect('activate', self.__erase_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) + + 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')) + menu_item = MenuItem(_('Copy')) + icon = Icon(icon_name='edit-copy', xo_color=color, + icon_size=gtk.ICON_SIZE_MENU) + menu_item.set_image(icon) + menu_item.connect('activate', self.__copy_activate_cb) + self.menu.append(menu_item) + menu_item.show() + + menu_item = MenuItem(_('Send to'), 'document-send') + self.menu.append(menu_item) + menu_item.show() + + friends_menu = FriendsMenu() + friends_menu.connect('friend-selected', self.__friend_selected_cb) + menu_item.set_submenu(friends_menu) + + if detail == True: + menu_item = MenuItem(_('View Details'), 'go-right') + menu_item.connect('activate', self.__detail_activate_cb) + self.menu.append(menu_item) + menu_item.show() + + menu_item = MenuItem(_('Erase'), 'list-remove') + menu_item.connect('activate', self.__erase_activate_cb) + self.menu.append(menu_item) + menu_item.show() def __start_activate_cb(self, menu_item): misc.resume(self._metadata) @@ -219,7 +227,6 @@ class StartWithMenu(gtk.Menu): mime_registry.set_default_activity(mime_type, service_name) misc.resume(self._metadata, service_name) - class BuddyPalette(Palette): def __init__(self, buddy): self._buddy = buddy -- 1.7.
Re: [Sugar-devel] SL Bug #2063
David, Thank you. Appreciate your motivation and feedback. Regards, Mukul Gupta On Thu, Oct 14, 2010 at 1:41 AM, Mukul Gupta wrote: > Please find my explanations on the code added as comments. > > diff --git a/journalactivity.py b/journalactivity.py > index 44cc018..36a2e2e 100644 > --- a/journalactivity.py > +++ b/journalactivity.py > @@ -358,8 +358,20 @@ class JournalActivity(Window): > self.show_main_view() > self.search_grab_focus() > > ''' Defining an Error Alert function in the Journal Activity Class which > displays the message as > > Operation could not be performed > Please check the logviewer activity for details > and an OK button > ''' > > > +def uncaught_exception_alert(self): > +alert = ErrorAlert(title="Operation could not be performed", > msg="Please check the logviewer activity for details ") > +alert.connect('response', self.__alert_response_cb) > +self.add_alert(alert) > +alert.show() > + > _journal = None > > ''' > Defining a function which logs the unhandled exception as well as calls the > Error Alert in the Journal whenever any uncaught exception occurs > ''' > > +def _alert_excepthook(exc_type, exc_value, traceback): > +logging.exception('Unhandled Python exception: %s', repr((exc_type, > exc_value, traceback))) > +_journal.uncaught_exception_alert() > + > ''' > When an exception is raised and uncaught, sys.excepthook is called with > three arguments, the exception class, exception instance, and a traceback > object.The function _alert_excepthook is called only when an unhandled > exception occurs. > ''' > > +sys.excepthook = _alert_excepthook > + > def get_journal(): > global _journal > if _journal is None: > -- > 1.7.0.4 > > > > On Thu, Oct 14, 2010 at 1:33 AM, David Farning wrote: > >> On Wed, Oct 13, 2010 at 2:50 PM, Mukul Gupta wrote: >> > Team, >> > >> > Wish to have your feedback on the design aspect of the ticket 2063 >> (Sugar >> > should bring up an alert when an unhandled Python exception occurs) - >> please >> > find the git diff attached below. This is an attempt to display an alert >> > when an unhandled Python exception occurs in the journal. Unfortunately, >> > when the exception takes place in journalactivity.py , I am neither >> unable >> > to notice the Journal Icon (it disappears), >> > >> > diff --git a/journalactivity.py b/journalactivity.py >> > index 44cc018..36a2e2e 100644 >> > --- a/journalactivity.py >> > +++ b/journalactivity.py >> > @@ -358,8 +358,20 @@ class JournalActivity(Window): >> > self.show_main_view() >> > self.search_grab_focus() >> > >> > +def uncaught_exception_alert(self): >> > +alert = ErrorAlert(title="Operation could not be performed", >> > msg="Please check the logviewer activity for details ") >> > +alert.connect('response', self.__alert_response_cb) >> > +self.add_alert(alert) >> > +alert.show() >> > + >> > _journal = None >> > >> > +def _alert_excepthook(exc_type, exc_value, traceback): >> > +logging.exception('Unhandled Python exception: %s', repr((exc_type, >> > exc_value, traceback))) >> > +_journal.uncaught_exception_alert() >> > + >> > +sys.excepthook = _alert_excepthook >> > + >> > def get_journal(): >> > global _journal >> > if _journal is None: >> > -- >> > 1.7.0.4 >> > >> > I wish to request you to please review the code and suggest desired >> changes, >> > if any. >> > >> > Moreover, I have two important questions regarding the bug. >> > >> > 1. To catch all unhandled python exceptions in sugar, where exactly >> should >> > we be looking forward to be the venue for adding the functionality? >> > Adding it in journalactivity.py doesn't seem to serve all purposes. >> It >> > has to be added somewhere which is being used all the time. >> > >> > 2. Wish if you could recommend on the GUI feature that could be used for >> > displaying the alert message to the user. >> > >> > Looking forward to for your valuable suggestions, >> > >> > Regards, >> > >> > Mukul Gupta >> >> Mukual, >> >> Well asked question. >> >> 1. You followed the 'show me the code' principle. That shows that you >> have thought through the problem far enough for a draft >> implementation. >> >> 2. You are asking for specif help on two specif areas. Based on the >> draft code and specifc questions, it is easy for a reviewer to give >> you the help. >> >> david >> > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] SL Bug #2063
Please find my explanations on the code added as comments. diff --git a/journalactivity.py b/journalactivity.py index 44cc018..36a2e2e 100644 --- a/journalactivity.py +++ b/journalactivity.py @@ -358,8 +358,20 @@ class JournalActivity(Window): self.show_main_view() self.search_grab_focus() ''' Defining an Error Alert function in the Journal Activity Class which displays the message as Operation could not be performed Please check the logviewer activity for details and an OK button ''' +def uncaught_exception_alert(self): +alert = ErrorAlert(title="Operation could not be performed", msg="Please check the logviewer activity for details ") +alert.connect('response', self.__alert_response_cb) +self.add_alert(alert) +alert.show() + _journal = None ''' Defining a function which logs the unhandled exception as well as calls the Error Alert in the Journal whenever any uncaught exception occurs ''' +def _alert_excepthook(exc_type, exc_value, traceback): +logging.exception('Unhandled Python exception: %s', repr((exc_type, exc_value, traceback))) +_journal.uncaught_exception_alert() + ''' When an exception is raised and uncaught, sys.excepthook is called with three arguments, the exception class, exception instance, and a traceback object.The function _alert_excepthook is called only when an unhandled exception occurs. ''' +sys.excepthook = _alert_excepthook + def get_journal(): global _journal if _journal is None: -- 1.7.0.4 On Thu, Oct 14, 2010 at 1:33 AM, David Farning wrote: > On Wed, Oct 13, 2010 at 2:50 PM, Mukul Gupta wrote: > > Team, > > > > Wish to have your feedback on the design aspect of the ticket 2063 (Sugar > > should bring up an alert when an unhandled Python exception occurs) - > please > > find the git diff attached below. This is an attempt to display an alert > > when an unhandled Python exception occurs in the journal. Unfortunately, > > when the exception takes place in journalactivity.py , I am neither > unable > > to notice the Journal Icon (it disappears), > > > > diff --git a/journalactivity.py b/journalactivity.py > > index 44cc018..36a2e2e 100644 > > --- a/journalactivity.py > > +++ b/journalactivity.py > > @@ -358,8 +358,20 @@ class JournalActivity(Window): > > self.show_main_view() > > self.search_grab_focus() > > > > +def uncaught_exception_alert(self): > > +alert = ErrorAlert(title="Operation could not be performed", > > msg="Please check the logviewer activity for details ") > > +alert.connect('response', self.__alert_response_cb) > > +self.add_alert(alert) > > +alert.show() > > + > > _journal = None > > > > +def _alert_excepthook(exc_type, exc_value, traceback): > > +logging.exception('Unhandled Python exception: %s', repr((exc_type, > > exc_value, traceback))) > > +_journal.uncaught_exception_alert() > > + > > +sys.excepthook = _alert_excepthook > > + > > def get_journal(): > > global _journal > > if _journal is None: > > -- > > 1.7.0.4 > > > > I wish to request you to please review the code and suggest desired > changes, > > if any. > > > > Moreover, I have two important questions regarding the bug. > > > > 1. To catch all unhandled python exceptions in sugar, where exactly > should > > we be looking forward to be the venue for adding the functionality? > > Adding it in journalactivity.py doesn't seem to serve all purposes. > It > > has to be added somewhere which is being used all the time. > > > > 2. Wish if you could recommend on the GUI feature that could be used for > > displaying the alert message to the user. > > > > Looking forward to for your valuable suggestions, > > > > Regards, > > > > Mukul Gupta > > Mukual, > > Well asked question. > > 1. You followed the 'show me the code' principle. That shows that you > have thought through the problem far enough for a draft > implementation. > > 2. You are asking for specif help on two specif areas. Based on the > draft code and specifc questions, it is easy for a reviewer to give > you the help. > > david > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] SL Bug #2063
Team, Wish to have your feedback on the design aspect of the ticket 2063 (Sugar should bring up an alert when an unhandled Python exception occurs) - please find the git diff attached below. This is an attempt to display an alert when an unhandled Python exception occurs in the journal. Unfortunately, when the exception takes place in journalactivity.py , I am neither unable to notice the Journal Icon (it disappears), diff --git a/journalactivity.py b/journalactivity.py index 44cc018..36a2e2e 100644 --- a/journalactivity.py +++ b/journalactivity.py @@ -358,8 +358,20 @@ class JournalActivity(Window): self.show_main_view() self.search_grab_focus() +def uncaught_exception_alert(self): +alert = ErrorAlert(title="Operation could not be performed", msg="Please check the logviewer activity for details ") +alert.connect('response', self.__alert_response_cb) +self.add_alert(alert) +alert.show() + _journal = None +def _alert_excepthook(exc_type, exc_value, traceback): +logging.exception('Unhandled Python exception: %s', repr((exc_type, exc_value, traceback))) +_journal.uncaught_exception_alert() + +sys.excepthook = _alert_excepthook + def get_journal(): global _journal if _journal is None: -- 1.7.0.4 I wish to request you to please review the code and suggest desired changes, if any. Moreover, I have two important questions regarding the bug. 1. To catch all unhandled python exceptions in sugar, where exactly should we be looking forward to be the venue for adding the functionality? Adding it in journalactivity.py doesn't seem to serve all purposes. It has to be added somewhere which is being used all the time. 2. Wish if you could recommend on the GUI feature that could be used for displaying the alert message to the user. Looking forward to for your valuable suggestions, Regards, Mukul Gupta Research Engineer,SEETA On Tue, Oct 12, 2010 at 12:46 AM, Mukul Gupta wrote: > Team, > > I had a discussion with Aleksey this morning at IRC on the feedback > recommended yesterday. Thank you Daniel and Tomeu. Appreciate your ideas and > pointers. > > We brainstormed on how the implementation of this functionality could be > done, and found that whenever any uncaught exception is raised, the > interpreter calls the sys.excepthook(type,value,traceback). > > Wish to have the feedback on whether excepthook implementation would be > helpful to our use-case both short-term and long-term. Also, it would be > wonderful if feedback could be shared on its implementation in the context > of Sugar, or otherwise. > > Looking forward to hearing from you. > > Regards, > > Mukul Gupta > > > On Mon, Oct 11, 2010 at 2:14 PM, Manusheel Gupta wrote: > >> Tomeu and Daniel, >> >> >> On Mon, Oct 11, 2010 at 1:50 PM, Tomeu Vizoso wrote: >> >>> On Mon, Oct 11, 2010 at 09:57, Daniel Drake wrote: >>> > On 10 October 2010 20:14, Mukul Gupta wrote: >>> >> With reference to SL Bug # 2063 which deals with bringing some kind of >>> >> notification alert whenever an unhandled python exception occurs, I >>> had a >>> >> few doubts. There are two approaches that I can think of. >>> > >>> > Neither of these sounds sensible. >>> > >>> > What's wrong with the obvious solution of popping up a dialog when the >>> > exception occurs? >>> > >>> > Technically the exceptions are not unhandled, if they were unhandled >>> > then sugar would crash. I guess we're referring to exceptions that are >>> > not handled gracefully and instead fall back to a catch-all handler >>> > which does not have the knowledge to act on them. >>> >>> This is what abrt does with python (and other) processes, maybe we >>> could reuse it or at least steal some of the ideas: >>> >>> https://fedorahosted.org/abrt/ >> >> >> >> Thank you for the feedback and pointers. Appreciate it. >> >> We'll discuss the approach shared by you this afternoon. >> >> Regards, >> >> Manu >> >> >> >> >> > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] SL Bug #2063
Team, I had a discussion with Aleksey this morning at IRC on the feedback recommended yesterday. Thank you Daniel and Tomeu. Appreciate your ideas and pointers. We brainstormed on how the implementation of this functionality could be done, and found that whenever any uncaught exception is raised, the interpreter calls the sys.excepthook(type,value,traceback). Wish to have the feedback on whether excepthook implementation would be helpful to our use-case both short-term and long-term. Also, it would be wonderful if feedback could be shared on its implementation in the context of Sugar, or otherwise. Looking forward to hearing from you. Regards, Mukul Gupta On Mon, Oct 11, 2010 at 2:14 PM, Manusheel Gupta wrote: > Tomeu and Daniel, > > > On Mon, Oct 11, 2010 at 1:50 PM, Tomeu Vizoso wrote: > >> On Mon, Oct 11, 2010 at 09:57, Daniel Drake wrote: >> > On 10 October 2010 20:14, Mukul Gupta wrote: >> >> With reference to SL Bug # 2063 which deals with bringing some kind of >> >> notification alert whenever an unhandled python exception occurs, I had >> a >> >> few doubts. There are two approaches that I can think of. >> > >> > Neither of these sounds sensible. >> > >> > What's wrong with the obvious solution of popping up a dialog when the >> > exception occurs? >> > >> > Technically the exceptions are not unhandled, if they were unhandled >> > then sugar would crash. I guess we're referring to exceptions that are >> > not handled gracefully and instead fall back to a catch-all handler >> > which does not have the knowledge to act on them. >> >> This is what abrt does with python (and other) processes, maybe we >> could reuse it or at least steal some of the ideas: >> >> https://fedorahosted.org/abrt/ > > > > Thank you for the feedback and pointers. Appreciate it. > > We'll discuss the approach shared by you this afternoon. > > Regards, > > Manu > > > > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] SL Bug #2063
With reference to SL Bug # 2063 which deals with bringing some kind of notification alert whenever an unhandled python exception occurs, I had a few doubts. There are two approaches that I can think of. 1. Any unhandled python exception is always logged. Thus, if we can check whenever logging.ERROR has been called, there ,an exception has occured .Thus if we introduce a flag which attains True value when an exception occurs, and by checking the value of the flag in a GUI file we can generate an alert/notification. For this purpose, I have tried to get a git diff of the sugar.logger . However, I have a doubt whether it is through this logger.py file through which logging is taken place . I see the file not being imported by journal files,etc. diff --git a/logger.py b/logger.py index 6a6b574..fd079dc 100644 --- a/logger.py +++ b/logger.py @@ -43,6 +43,9 @@ _LEVELS = { 'trace': TRACE, 'all': 0, } + +CHECK_ALERT = False + logging.addLevelName(TRACE, 'TRACE') @@ -57,8 +60,9 @@ def get_logs_dir(): def set_level(level): if level in _LEVELS: logging.getLogger('').setLevel(_LEVELS[level]) -return - +alert_log_exception(level) +return + try: logging.getLogger('').setLevel(int(level)) except ValueError: @@ -203,3 +207,8 @@ def trace(logger=None, logger_name=None, skip_args=None, skip_kwargs=None, return res return decorator.decorator(_trace) + +def alert_log_exception(level): +if level == 'error' +CHECK_ALERT = True + -- 1.7.0.4 2. Alternatively, if we can make a new file that reads the shell.log line by line and whenever ERROR: is encountered, an alert is raised. However, for this the new file has to be active at all times. It would be great if you could shed some light on what approach should I follow or suggest an alternative way to this problem. Waiting for your response and valuable suggestions, Regards, Mukul Gupta Research Engineer,SEETA ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH] 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 | 99 +-- 1 files changed, 53 insertions(+), 46 deletions(-) diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 7c3e5ff..56df595 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -62,51 +62,59 @@ 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() - -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) - -client = gconf.client_get_default() -color = XoColor(client.get_string('/desktop/sugar/user/color')) -menu_item = MenuItem(_('Copy')) -icon = Icon(icon_name='edit-copy', xo_color=color, -icon_size=gtk.ICON_SIZE_MENU) -menu_item.set_image(icon) -menu_item.connect('activate', self.__copy_activate_cb) -self.menu.append(menu_item) -menu_item.show() - -menu_item = MenuItem(_('Send to'), 'document-send') -self.menu.append(menu_item) -menu_item.show() - -friends_menu = FriendsMenu() -friends_menu.connect('friend-selected', self.__friend_selected_cb) -menu_item.set_submenu(friends_menu) - -if detail == True: -menu_item = MenuItem(_('View Details'), 'go-right') -menu_item.connect('activate', self.__detail_activate_cb) -self.menu.append(menu_item) -menu_item.show() - -menu_item = MenuItem(_('Erase'), 'list-remove') -menu_item.connect('activate', self.__erase_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) + + 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')) + menu_item = MenuItem(_('Copy')) + icon = Icon(icon_name='edit-copy', xo_color=color, + icon_size=gtk.ICON_SIZE_MENU) + menu_item.set_image(icon) + menu_item.connect('activate', self.__copy_activate_cb) + self.menu.append(menu_item) + menu_item.show() + + menu_item = MenuItem(_('Send to'), 'document-send') + self.menu.append(menu_item) + menu_item.show() + + friends_menu = FriendsMenu() + friends_menu.connect('friend-selected', self.__friend_selected_cb) + menu_item.set_submenu(friends_menu) + + if detail == True: + menu_item = MenuItem(_('View Details'), 'go-right') + menu_item.connect('activate', self.__detail_activate_cb) + self.menu.append(menu_item) + menu_item.show() + + menu_item = MenuItem(_('Erase'), 'list-remove') + menu_item.connect('activate', self.__erase_activate_cb) + self.menu.append(menu_item) + menu_item.show() def __start_activate_cb(self, menu_item): misc.resume(self._metadata) @@ -219,7 +227,6 @@ class StartWithMenu(gtk.Menu): mime_registry.set_default_activity(mime_type, service_name) misc.resume(self._metadata, service_name) - class BuddyPalette(Palette): def __init__(self, buddy): self._buddy = buddy -- 1.7.
Re: [Sugar-devel] Patch for SL Bug #630 : Journal Full Message has Issues
Team, I was reconsidering that if the critical limit of 10MB was too low and whether it should be changed to around 35 MB. Please provide your suggestions. Regards, Mukul Gupta Research Engineer,SEETA On Fri, Sep 24, 2010 at 10:37 PM, Mukul Gupta wrote: > Team, > > This is with reference to SL Bug #630 : Journal Full Message has Issues. I > have prepared a patch for the same. Please review the patch and provide me > with your valuable suggestions. > > http://lists.sugarlabs.org/archive/sugar-devel/2010-September/027168.html > > Bug #630:Modal Dialog Fix and Journal Memory Full Alert added > > Description:Modal Dialog should be displayed only once at startup if free > memory is less than 50MB but greater than 10MB. Instead, for every > redundant Modal Dialog Display, an Alert in the Journal signifying > Low Memory is displayed.But when free memory reaches a critical > limit(ie. 10MB) Modal Dialog is displayed repeatedly asking the > user to delete some data in the Journal along with an alert in the > Journal > > Existing Situation: > Modal Dialog asking the user to delete some data from the journal is > displayed at startup if Free Memory is less than 50MB.Then, when reaching > the Journal, the dialog appears redundantly on top of the Journal itself. It > is displayed everytime after exiting an activity. > > After applying the patch: > Dialog Box is displayed only once at startup if free memory is less than > 50MB but greater than 10MB. Instead, for every > redundant Modal Dialog Display, an Alert in the Journal stating Low Memory > is displayed.But when free memory reaches a critical > limit(ie. 10MB) Modal Dialog Box is displayed repeatedly asking the user to > delete some data in the Journal along with an alert in the > Journal. > > Regards, > > Mukul Gupta > Research Engineer, SEETA ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] Patch for SL Bug #630 : Journal Full Message has Issues
Team, This is with reference to SL Bug #630 : Journal Full Message has Issues. I have prepared a patch for the same. Please review the patch and provide me with your valuable suggestions. http://lists.sugarlabs.org/archive/sugar-devel/2010-September/027168.html Bug #630:Modal Dialog Fix and Journal Memory Full Alert added Description:Modal Dialog should be displayed only once at startup if free memory is less than 50MB but greater than 10MB. Instead, for every redundant Modal Dialog Display, an Alert in the Journal signifying Low Memory is displayed.But when free memory reaches a critical limit(ie. 10MB) Modal Dialog is displayed repeatedly asking the user to delete some data in the Journal along with an alert in the Journal Existing Situation: Modal Dialog asking the user to delete some data from the journal is displayed at startup if Free Memory is less than 50MB.Then, when reaching the Journal, the dialog appears redundantly on top of the Journal itself. It is displayed everytime after exiting an activity. After applying the patch: Dialog Box is displayed only once at startup if free memory is less than 50MB but greater than 10MB. Instead, for every redundant Modal Dialog Display, an Alert in the Journal stating Low Memory is displayed.But when free memory reaches a critical limit(ie. 10MB) Modal Dialog Box is displayed repeatedly asking the user to delete some data in the Journal along with an alert in the Journal. Regards, Mukul Gupta Research Engineer, SEETA ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH] Bug #630:Modal Dialog Fix and Journal Memory Full Alert added
Modal Dialog should be displayed only once at startup if free memory is less than 50MB but greater than 10MB. Instead, for every redundant Modal Dialog Display, an Alert in the Journal signifying Low Memory is displayed.But when free memory reaches a critical limit(ie. 10MB) Modal Dialog is displayed repeatedly asking the user to delete some data in the Journal along with an alert in the Journal --- src/jarabe/journal/journalactivity.py | 22 ++ 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py index 44cc018..aa4001b 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -49,7 +49,7 @@ J_DBUS_SERVICE = 'org.laptop.Journal' J_DBUS_INTERFACE = 'org.laptop.Journal' J_DBUS_PATH = '/org/laptop/Journal' -_SPACE_TRESHOLD = 52428800 +_SPACE_THRESHOLD = 52428800 _BUNDLE_ID = 'org.laptop.JournalActivity' class JournalActivityDBusService(dbus.service.Object): @@ -116,7 +116,7 @@ class JournalActivity(Window): self._main_toolbox = None self._detail_toolbox = None self._volumes_toolbar = None - + self.modal_already_shown=False self._setup_main_view() self._setup_secondary_view() @@ -139,7 +139,7 @@ class JournalActivity(Window): self._critical_space_alert = None self._check_available_space() - + def __volume_error_cb(self, gobject, message, severity): alert = ErrorAlert(title=severity, msg=message) alert.connect('response', self.__alert_response_cb) @@ -337,11 +337,17 @@ class JournalActivity(Window): return stat = os.statvfs(env.get_profile_path()) free_space = stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL] -if free_space < _SPACE_TRESHOLD: -self._critical_space_alert = ModalAlert() -self._critical_space_alert.connect('destroy', - self.__alert_closed_cb) -self._critical_space_alert.show() + if free_space < _SPACE_THRESHOLD: + if self.modal_already_shown==False or free_space < _SPACE_THRESHOLD/5: + self._critical_space_alert = ModalAlert() + self._critical_space_alert.connect('destroy', + self.__alert_closed_cb) + self._critical_space_alert.show() + self.modal_already_shown=True + alert = ErrorAlert(title="Journal Almost Full", msg="Please delete some data from journal") + alert.connect('response', self.__alert_response_cb) + self.add_alert(alert) + alert.show() def __alert_closed_cb(self, data): self.show_main_view() -- 1.7.0.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] SL bug #1520
Tomeu, I had a word with Bernie regarding the issue and he says that probably newer versions of the X server actually implement XUngrabKey() with keycode= Any Key as specified in the man-page. He said he had seen the source code and someone (whot) reworked that function sometime back, probably fixing up the bug. I tested sugar-emulator on Ubuntu Maverick and it seemed the keybindings were working. I tried Alt+ Tab and it worked. It seems the component has already been fixed. Regards, Mukul Gupta Research Engineer, SEETA On Tue, Sep 14, 2010 at 1:11 PM, Tomeu Vizoso wrote: > On Fri, Sep 10, 2010 at 18:07, Mukul Gupta wrote: > > Hi, > > > > The patch is a temporary fix. > > According to Bernie,some other component is broken(X server?) and this is > > just a work around. > > Ok, it would be very helpful to know which other component is broken > and in which way. > > > However, I have filed a bug at gnome-bugzilla ( > > https://bugzilla.gnome.org/show_bug.cgi?id=629210#c0 ) regarding the > same. > > Note that in GNOME they use a different patch submission process: > http://live.gnome.org/Git/Developers#Contributing_patches > > Basically, you don't put r* flags and use instead the Status combo in > the Details page for the patch. > > Regards, > > Tomeu > > Regards, > > Tomeu > > > > Regards, > > > > Mukul > > > > On Fri, Sep 10, 2010 at 2:27 PM, Tomeu Vizoso > wrote: > >> > >> On Wed, Sep 8, 2010 at 11:15, Tomeu Vizoso wrote: > >> > On Tue, Sep 7, 2010 at 20:01, Mukul Gupta wrote: > >> >> Team, > >> >> > >> >> I am working on Bug # 1520 on sugarlabs. > >> >> http://bugs.sugarlabs.org/ticket/1520 > >> >> I tried to reproduce the issue on sugar-emulator. I realised that Alt > + > >> >> Tab > >> >> did nothing. Instead, Alt+Tab functioned for GNOME. I tried to run > >> >> sugar > >> >> from sugar-session. Still, Alt+ Tab did nothing. > >> >> Firstly, I would require some pointers on how to reproduce the bug. > >> >> Secondly, when I read the comments on the bugs page, I realised that > >> >> fran > >> >> pointed out that this functioning of the Alt+Tab as mentioned in the > >> >> bug can > >> >> also be considered as a utility rather than a bug. > >> >> A very similar bug to bug #1520 is #1518. > >> >> http://bugs.sugarlabs.org/ticket/1518 > >> >> > >> >> As far as solving the current bug is concerned I realised that Bernie > >> >> had > >> >> created a patch for the same in fedora and that could be implemented > on > >> >> ubuntu. I have studied the patch - > >> >> http://sascha.silbe.org/patches/metacity-ungrab-keybindings.patch > >> > > >> > Should this patch go upstream? > >> > >> Ping, the metacity maintainer has shown interest but wants to give it > >> a good deal of testing before pushing and has requested a bug to be > >> filed. > >> > >> I just want to know if this patch is considered a proper fix that can > >> go upstream. > >> > >> Regards, > >> > >> Tomeu > >> > >> > Regards, > >> > > >> > Tomeu > >> > > >> >> Regards, > >> >> > >> >> Mukul Gupta > >> >> Research Engineer, SEETA > >> >> ___ > >> >> 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] SL bug #1520
Hi, The patch is a temporary fix. According to Bernie,some other component is broken(X server?) and this is just a work around. However, I have filed a bug at gnome-bugzilla ( https://bugzilla.gnome.org/show_bug.cgi?id=629210#c0 ) regarding the same. Regards, Mukul On Fri, Sep 10, 2010 at 2:27 PM, Tomeu Vizoso wrote: > On Wed, Sep 8, 2010 at 11:15, Tomeu Vizoso wrote: > > On Tue, Sep 7, 2010 at 20:01, Mukul Gupta wrote: > >> Team, > >> > >> I am working on Bug # 1520 on sugarlabs. > >> http://bugs.sugarlabs.org/ticket/1520 > >> I tried to reproduce the issue on sugar-emulator. I realised that Alt + > Tab > >> did nothing. Instead, Alt+Tab functioned for GNOME. I tried to run sugar > >> from sugar-session. Still, Alt+ Tab did nothing. > >> Firstly, I would require some pointers on how to reproduce the bug. > >> Secondly, when I read the comments on the bugs page, I realised that > fran > >> pointed out that this functioning of the Alt+Tab as mentioned in the bug > can > >> also be considered as a utility rather than a bug. > >> A very similar bug to bug #1520 is #1518. > >> http://bugs.sugarlabs.org/ticket/1518 > >> > >> As far as solving the current bug is concerned I realised that Bernie > had > >> created a patch for the same in fedora and that could be implemented on > >> ubuntu. I have studied the patch - > >> http://sascha.silbe.org/patches/metacity-ungrab-keybindings.patch > > > > Should this patch go upstream? > > Ping, the metacity maintainer has shown interest but wants to give it > a good deal of testing before pushing and has requested a bug to be > filed. > > I just want to know if this patch is considered a proper fix that can > go upstream. > > Regards, > > Tomeu > > > Regards, > > > > Tomeu > > > >> Regards, > >> > >> Mukul Gupta > >> Research Engineer, SEETA > >> ___ > >> 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] SL bug #1520
Team, I am working on Bug # 1520 on sugarlabs. http://bugs.sugarlabs.org/ticket/1520 I tried to reproduce the issue on sugar-emulator. I realised that Alt + Tab did nothing. Instead, Alt+Tab functioned for GNOME. I tried to run sugar from sugar-session. Still, Alt+ Tab did nothing. Firstly, I would require some pointers on how to reproduce the bug. Secondly, when I read the comments on the bugs page, I realised that fran pointed out that this functioning of the Alt+Tab as mentioned in the bug can also be considered as a utility rather than a bug. A very similar bug to bug #1520 is #1518. http://bugs.sugarlabs.org/ticket/1518 As far as solving the current bug is concerned I realised that Bernie had created a patch for the same in fedora and that could be implemented on ubuntu. I have studied the patch - http://sascha.silbe.org/patches/metacity-ungrab-keybindings.patch Regards, Mukul Gupta Research Engineer, SEETA ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] SL bug #1520
Bernie, I am working on SL #1520 - http://bugs.sugarlabs.org/ticket/1520 with Dipankar. We have identified the problem with reviews from Sascha and Tomeu. Appreciate your reviews and support. Sascha wrote that you have fixed this issue on Fedora. Can you please provide us the link for the patch so that we could study it, and expedite the process of fixing it in other distributions like Debian? Appreciate your support. Regards, Mukul ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel