From 674c9a61fa22625f12cb0134e83d7d3b1dfe9707 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Wed, 19 Jan 2011 18:04:06 +0000 Subject: Auto feedback feature related changes --- diff --git a/rpms/common/branches b/rpms/common/branches index 15ecc09..b9592ee 100644 --- a/rpms/common/branches +++ b/rpms/common/branches @@ -2,3 +2,4 @@ sugar:dist-f11-updates-candidate:.fc11:fedora:11 sugar-toolkit:dist-f11-updates-candidate:.fc11:fedora:11 sugar-datastore:dist-f11-updates-candidate:.fc11:fedora:11 sugar-artwork:dist-f11-updates-candidate:.fc11:fedora:11 +sugar-base:dist-f11-updates-candidate:.fc11:fedora:11 diff --git a/rpms/sugar-artwork/Modified-Patch-for-adding-feedback-icon.svg-to-sugar-artwork.patch b/rpms/sugar-artwork/Modified-Patch-for-adding-feedback-icon.svg-to-sugar-artwork.patch new file mode 100644 index 0000000..1400e4a --- /dev/null +++ b/rpms/sugar-artwork/Modified-Patch-for-adding-feedback-icon.svg-to-sugar-artwork.patch @@ -0,0 +1,422 @@ +From patchwork Tue Jan 18 14:27:07 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: Modified Patch for adding feedback-icon.svg to sugar-artwork +Date: Tue, 18 Jan 2011 19:27:07 -0000 +From: Mukesh Gupta +X-Patchwork-Id: 590 +Message-Id: <1295360827-2382-1-git-send-email-mukeshgupta.2006@gmail.com> +To: dextrose@lists.sugarlabs.org + +From: root + +1)Icon converted to plain svg format + +Signed-off-by: Mukesh Gupta + +--- +icons/scalable/device/Makefile.am | 1 + + icons/scalable/device/feedback-icon.svg | 378 +++++++++++++++++++++++++++++++ + 2 files changed, 379 insertions(+), 0 deletions(-) + mode change 100644 => 100755 icons/scalable/device/Makefile.am + create mode 100755 icons/scalable/device/feedback-icon.svg + +diff --git a/icons/scalable/device/Makefile.am b/icons/scalable/device/Makefile.am +old mode 100644 +new mode 100755 +index bca43f0..d75985c +--- a/icons/scalable/device/Makefile.am ++++ b/icons/scalable/device/Makefile.am +@@ -3,6 +3,7 @@ category=device + icondir = $(datadir)/icons/sugar/$(iconsize)/$(category) + + icon_DATA = \ ++ feedback-icon.svg \ + battery-000.icon \ + battery-000.svg \ + battery-010.icon \ +diff --git a/icons/scalable/device/feedback-icon.svg b/icons/scalable/device/feedback-icon.svg +new file mode 100755 +index 0000000..c7fc9a8 +--- /dev/null ++++ b/icons/scalable/device/feedback-icon.svg +@@ -0,0 +1,378 @@ ++ ++ ++ ++ ++ ++ ++ ++ image/svg+xml ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ? ++ ++ ++ ++ ++ ++ ++ ++ diff --git a/rpms/sugar-artwork/sugar-artwork.spec b/rpms/sugar-artwork/sugar-artwork.spec index 9d9ab89..c908140 100644 --- a/rpms/sugar-artwork/sugar-artwork.spec +++ b/rpms/sugar-artwork/sugar-artwork.spec @@ -1,7 +1,7 @@ Summary: Artwork for Sugar look-and-feel Name: sugar-artwork Version: 0.88.1 -Release: 1.10dxo%{?dist} +Release: 1.11dxo%{?dist} URL: http://sugarlabs.org Group: User Interface/Desktops License: LGPLv2+ @@ -27,6 +27,9 @@ Patch301: ad_hoc_artwork.patch # Update computer happy/normal/sad icons (thanks to garycmartin) Patch401: Update-computer-happy-normal-sad-icons-garycmartin.patch +# Auto-feedback reporting feature icon +Patch501: Modified-Patch-for-adding-feedback-icon.svg-to-sugar-artwork.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gtk2-devel >= 2.9.0 @@ -58,6 +61,8 @@ look and feel. %patch401 -p1 +%patch501 -p1 + %build autoreconf --force --install -v %configure @@ -92,7 +97,10 @@ touch --no-create %{_datadir}/icons/sugar || : %{_libdir}/gtk-2.0/*/engines/*.so %changelog -* Thu Jan 18 2011 Anish Mangal - 0.88.1-10 +* Thu Jan 19 2011 Anish Mangal - 0.88.1-11 +- Added auto-feeback feature icon + +* Tue Jan 18 2011 Anish Mangal - 0.88.1-10 - Update computer happy/normal/sad icons (garycmartin, patch401) * Thu Jun 3 2010 Peter Robinson - 0.88.1-1 diff --git a/rpms/sugar-base/Do-not-set-unhandled-exceptions-handler-to-not-affect-feedback-s-one.patch b/rpms/sugar-base/Do-not-set-unhandled-exceptions-handler-to-not-affect-feedback-s-one.patch new file mode 100644 index 0000000..db4dc5d --- /dev/null +++ b/rpms/sugar-base/Do-not-set-unhandled-exceptions-handler-to-not-affect-feedback-s-one.patch @@ -0,0 +1,50 @@ +From patchwork Tue Jan 18 10:47:27 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: Do not set unhandled exceptions handler to not affect feedback's one +Date: Tue, 18 Jan 2011 15:47:27 -0000 +From: Aleksey Lim +X-Patchwork-Id: 588 +Message-Id: <1295347647-16070-1-git-send-email-alsroot@member.fsf.org> +To: dextrose@lists.sugarlabs.org + +--- + src/sugar/logger.py | 16 ---------------- + 1 files changed, 0 insertions(+), 16 deletions(-) + + +diff --git a/src/sugar/logger.py b/src/sugar/logger.py +index 275c57d..ae2caa2 100644 +--- a/src/sugar/logger.py ++++ b/src/sugar/logger.py +@@ -64,20 +64,6 @@ def set_level(level): + logging.warning('Invalid log level: %r', level) + + +-# pylint: disable-msg=E1101,F0401 +-def _except_hook(exctype, value, traceback): +- # Attempt to provide verbose IPython tracebacks. +- # Importing IPython is slow, so we import it lazily. +- try: +- from IPython.ultraTB import AutoFormattedTB +- sys.excepthook = AutoFormattedTB(mode='Verbose', +- color_scheme='NoColor') +- except ImportError: +- sys.excepthook = sys.__excepthook__ +- +- sys.excepthook(exctype, value, traceback) +- +- + def start(log_filename=None): + # remove existing handlers, or logging.basicConfig() won't have no effect. + root_logger = logging.getLogger('') +@@ -130,8 +116,6 @@ def start(log_filename=None): + if e.errno != errno.ENOSPC: + raise e + +- sys.excepthook = _except_hook +- + + class TraceRepr(repr_.Repr): + diff --git a/rpms/sugar-base/Makefile b/rpms/sugar-base/Makefile new file mode 100644 index 0000000..04f4ab2 --- /dev/null +++ b/rpms/sugar-base/Makefile @@ -0,0 +1,21 @@ +# Makefile for source rpm: sugar +# $Id: Makefile,v 1.2 2009/11/25 23:15:39 notting Exp $ +NAME := sugar +SPECFILE = $(firstword $(wildcard *.spec)) + +define find-makefile-common +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +endef + +MAKEFILE_COMMON := $(shell $(find-makefile-common)) + +ifeq ($(MAKEFILE_COMMON),) +# attept a checkout +define checkout-makefile-common +test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 +endef + +MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) +endif + +include $(MAKEFILE_COMMON) diff --git a/rpms/sugar-base/sugar-base.spec b/rpms/sugar-base/sugar-base.spec new file mode 100644 index 0000000..581008b --- /dev/null +++ b/rpms/sugar-base/sugar-base.spec @@ -0,0 +1,171 @@ +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} + +Summary: Base Sugar library +Name: sugar-base +Version: 0.88.0 +Release: 2%{?dist} +URL: http://sugarlabs.org/ +Source0: http://download.sugarlabs.org/sources/sucrose/glucose/%{name}/%{name}-%{version}.tar.bz2 + +#changes related to auto-feedback feature +patch1: Do-not-set-unhandled-exceptions-handler-to-not-affect-feedback-s-one.patch + +License: LGPLv2 +Group: System Environment/Libraries +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: python-devel +BuildRequires: pygobject2-devel +BuildRequires: pygtk2-codegen +BuildRequires: gettext +BuildRequires: perl-XML-Parser +BuildRequires: intltool + +Requires: python-decorator + +%description + +The base libary for Sugar, the user interface of the One Laptop Per +Child project. It provides helpers for the development of services and +activities. + +%prep +%setup -q + +%patch1 -p1 + +%build +%configure +make %{?_smp_mflags} V=1 + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} + +%find_lang %name + +#Remove libtool archives. +find %{buildroot} -name '*.la' -exec rm -f {} ';' + +%clean +rm -rf %{buildroot} + +%files -f %{name}.lang +%defattr(-,root,root,-) +%{python_sitelib}/* + +%changelog +* Wed Jan 19 2011 Anish Mangal - 0.88.0-2 +- Add changes related to auto-feedback feature + +* Tue Mar 20 2010 Peter Robinson - 0.88.0-1 +- New upstream stable 0.88.0 release + +* Thu Feb 11 2010 Sebastian Dziallas - 0.87.3-1 +- New upstream release + +* Wed Jan 13 2010 Mathieu Bridon 0.87.2-1 +- New upstream release + +* Sat Jan 9 2010 Peter Robinson - 0.87.1-3 +- Updated to the new python sysarch spec file reqs + +* Fri Dec 18 2009 Peter Robinson 0.87.1-2 +- Remove libtool archives + +* Tue Dec 01 2009 Sebastian Dziallas - 0.87.1-1 +- New upstream release + +* Fri Sep 25 2009 Mathieu Bridon - 0.86.0-1 +- New upstream release + +* Fri Sep 18 2009 Tomeu Vizoso - 0.85.6-1 +- New upstream release + +* Fri Sep 11 2009 Tomeu Vizoso - 0.85.5-1 +- New upstream release + +* Wed Sep 02 2009 Tomeu Vizoso - 0.85.4-1 +- New upstream release + +* Wed Aug 26 2009 Tomeu Vizoso - 0.85.3-1 +- New upstream release + +* Sun Jul 26 2009 Fedora Release Engineering - 0.85.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sat Jul 18 2009 Tomeu Vizoso - 0.85.2-1 +- New upstream release + +* Mon Apr 06 2009 Simon Schampijer - 0.84.1-1 +- sugar/dispatch/license.txt is missing from the sugar-base source tarball #704 + +* Tue Mar 03 2009 Simon Schampijer - 0.84.0-1 +- Rebuild for 0.84 + +* Wed Feb 25 2009 Fedora Release Engineering - 0.83.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 23 2009 Simon Schampijer - 0.83.4-1 +- Many new translations! + +* Tue Jan 20 2009 Marco Pesenti Gritti - 0.83.3-2 +- Don't print logs to tty instead of shell.log in the emulator +- Trivial port to GIO instead of GnomeVFS + +* Sun Jan 04 2009 Simon Schampijer - 0.83.2-1 +- add intltool as build dep +- new download url +- Adding language he, bi, hu, sw, cs, sv, sk, wa +- Updated translations + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.83.1-2 +- Rebuild for Python 2.6 + +* Tue Nov 4 2008 Marco Pesenti Gritti - 0.83.1-1 +- Update to 0.83.1 + +* Thu Aug 28 2008 Marco Pesenti Gritti - 0.82.2-1 +- Translation updates + +* Thu Aug 07 2008 Marco Pesenti Gritti - 0.82.1-1 +- added languages Norwegian and Slovenian +- translation update + +* Fri Aug 01 2008 Morgan Collett - 0.81.3-1 +- Update to 0.81.3 +- Make logger safe to full disk +- Translation updates + +* Tue Jul 08 2008 Simon Schampijer - 0.81.2-3 +- BuildRequires: perl-XML-Parser + +* Tue Jul 08 2008 Simon Schampijer - 0.81.2-2 +- added gettext as build require + +* Tue Jul 08 2008 Simon Schampijer - 0.81.2-1 +- gained its own translation module and some languages have already been contributed + +* Mon Jun 09 2008 Simon Schampijer - 0.81.1-1 +- Fix logging (Tomeu) + +* Tue Apr 22 2008 Tomeu Vizoso - 0.79.1-1 +- Pylint cleanup. + +* Sat Feb 9 2008 Marco Pesenti Gritti - 0.79.0-1 +- Update to 0.79.0 + +* Sun Nov 25 2007 Marco Pesenti Gritti - 0.1.1-1 +- Update to 0.1.1 + +* Tue Nov 13 2007 Marco Pesenti Gritti - 0.1-0.6.20071113git1a04bb7c71 +- #4838 More verbose traces (mstone) + +* Fri Nov 2 2007 Marco Pesenti Gritti - 0.1-0.5.20071102git15797de32a +- New snapshot + +* Thu Nov 1 2007 Marco Pesenti Gritti - 0.1-0.4.20071016git7364e0078e +- Remove unnecessary pkgconfig buildreq + +* Sat Oct 20 2007 Marco Pesenti Gritti - 0.1-0.3.20071016git7364e0078e +- New snapshot diff --git a/rpms/sugar-toolkit/sugar-toolkit-Report-to-the-shell-on-errors.patch b/rpms/sugar-toolkit/sugar-toolkit-Report-to-the-shell-on-errors.patch new file mode 100644 index 0000000..443ccc4 --- /dev/null +++ b/rpms/sugar-toolkit/sugar-toolkit-Report-to-the-shell-on-errors.patch @@ -0,0 +1,212 @@ +From patchwork Tue Jan 18 03:00:27 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [sugar-toolkit] Report to the shell on errors +Date: Tue, 18 Jan 2011 08:00:27 -0000 +From: Aleksey Lim +X-Patchwork-Id: 587 +Message-Id: <1295319627-10604-1-git-send-email-alsroot@member.fsf.org> +To: dextrose@lists.sugarlabs.org + +m 72f0694200feccd88646e21aadb1c5bde36e7ca3 Mon Sep 17 00:00:00 2001 +From: Aleksey Lim +Date: Wed, 19 Jan 2011 18:47:58 +0000 +Subject: [PATCH sugar-toolkit] Report to the shell on errors + +--- + src/sugar/Makefile.am | 1 + + src/sugar/activity/activityfactory.py | 10 +++- + src/sugar/activity/main.py | 4 +- + src/sugar/feedback.py | 103 +++++++++++++++++++++++++++++++++ + 4 files changed, 115 insertions(+), 3 deletions(-) + create mode 100644 src/sugar/feedback.py + +diff --git a/src/sugar/Makefile.am b/src/sugar/Makefile.am +index 236e337..9730a00 100644 +--- a/src/sugar/Makefile.am ++++ b/src/sugar/Makefile.am +@@ -2,6 +2,7 @@ SUBDIRS = activity bundle graphics presence datastore + + sugardir = $(pythondir)/sugar + sugar_PYTHON = \ ++ feedback.py \ + env.py \ + network.py \ + profile.py \ +diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py +index 6b4ba32..3e7a07f 100644 +--- a/src/sugar/activity/activityfactory.py ++++ b/src/sugar/activity/activityfactory.py +@@ -23,6 +23,7 @@ the moment there is no reason to stabilize this API. + + import logging + ++import cjson + import dbus + import gobject + +@@ -274,7 +275,7 @@ class ActivityCreationHandler(gobject.GObject): + + gobject.child_watch_add(child.pid, + _child_watch_cb, +- (environment_dir, log_file, ++ (environment_dir, log_file, log_path, + self._handle.activity_id)) + + def _no_reply_handler(self, *args): +@@ -338,7 +339,7 @@ def create_with_object_id(bundle, object_id): + def _child_watch_cb(pid, condition, user_data): + # FIXME we use standalone method here instead of ActivityCreationHandler's + # member to have workaround code, see #1123 +- environment_dir, log_file, activity_id = user_data ++ environment_dir, log_file, log_path, activity_id = user_data + if environment_dir is not None: + subprocess.call(['/bin/rm', '-rf', environment_dir]) + +@@ -381,6 +382,11 @@ def _child_watch_cb(pid, condition, user_data): + def error_handler_cb(error): + logging.error('Cannot send NotifyLaunchFailure to the shell') + ++ report = cjson.encode({'failed_exit': 1}) ++ shell.Feedback(activity_id, report, log_path, ++ reply_handler=reply_handler_cb, ++ error_handler=error_handler_cb) ++ + # TODO send launching failure but activity could already show + # main window, see http://bugs.sugarlabs.org/ticket/1447#comment:19 + shell.NotifyLaunchFailure(activity_id, +diff --git a/src/sugar/activity/main.py b/src/sugar/activity/main.py +index 0647e81..f502893 100644 +--- a/src/sugar/activity/main.py ++++ b/src/sugar/activity/main.py +@@ -30,7 +30,7 @@ from sugar.activity import activityhandle + from sugar.activity import i18n + from sugar.bundle.activitybundle import ActivityBundle + from sugar.graphics import style +-from sugar import logger ++from sugar import logger, feedback + + + def create_activity_instance(constructor, handle): +@@ -110,6 +110,8 @@ def main(): + gettext.bindtextdomain('sugar-toolkit', sugar.locale_path) + gettext.textdomain(bundle.get_bundle_id()) + ++ feedback.start(options.activity_id) ++ + splitted_module = args[0].rsplit('.', 1) + module_name = splitted_module[0] + class_name = splitted_module[1] +diff --git a/src/sugar/feedback.py b/src/sugar/feedback.py +new file mode 100644 +index 0000000..56dacab +--- /dev/null ++++ b/src/sugar/feedback.py +@@ -0,0 +1,103 @@ ++# Copyright (C) 2011, Aleksey Lim ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++import os ++import sys ++import atexit ++import logging ++ ++import dbus ++import cjson ++ ++ ++_SHELL_SERVICE = "org.laptop.Shell" ++_SHELL_PATH = "/org/laptop/Shell" ++_SHELL_IFACE = "org.laptop.Shell" ++ ++_report = {} ++_need_log = False ++_log_formatter = None ++ ++ ++def start(activity_id, log_path=None): ++ if log_path is None: ++ # TODO more portable solution ++ stdout_file = os.readlink('/proc/self/fd/%s' % sys.stdout.fileno()) ++ if os.path.isfile(stdout_file): ++ log_path = stdout_file ++ else: ++ log_path = '' ++ ++ atexit.register(_send, activity_id, log_path) ++ ++ ++def trigger(key, need_log=False): ++ global _need_log ++ ++ if key not in _report: ++ _report[key] = 0 ++ _report[key] += 1 ++ _need_log = _need_log or need_log ++ ++ logging.debug('Feedback[%s] == %s', key, _report[key]) ++ ++ ++def flush(): ++ global _report ++ global _need_log ++ ++ report = _report ++ need_log = _need_log ++ _report = {} ++ _need_log = False ++ ++ return report, need_log ++ ++ ++def _send(activity_id, log_path): ++ if not _report: ++ return ++ ++ report, need_log = flush() ++ ++ bus = dbus.SessionBus() ++ bus_object = bus.get_object(_SHELL_SERVICE, _SHELL_PATH) ++ shell = dbus.Interface(bus_object, _SHELL_IFACE) ++ shell.Feedback(activity_id, cjson.encode(report), ++ log_path if need_log else '') ++ ++ ++def _excepthook(exctype, value, tb): ++ global _log_formatter ++ ++ if _log_formatter is None: ++ try: ++ # Attempt to provide verbose IPython tracebacks. ++ # Importing IPython is slow, so we import it lazily. ++ from IPython.ultraTB import AutoFormattedTB ++ formatter = AutoFormattedTB(mode='Verbose', color_scheme='NoColor') ++ _log_formatter = formatter.text ++ except ImportError: ++ import traceback ++ _log_formatter = \ ++ lambda * args: ''.join(traceback.format_exception(*args)) ++ ++ message = _log_formatter(exctype, value, tb) ++ logging.error(message) ++ ++ trigger('unhandled_exception', need_log=True) ++ ++ ++sys.excepthook = _excepthook +-- +1.7.3.4 + diff --git a/rpms/sugar-toolkit/sugar-toolkit.spec b/rpms/sugar-toolkit/sugar-toolkit.spec index b74bf52..50e3102 100644 --- a/rpms/sugar-toolkit/sugar-toolkit.spec +++ b/rpms/sugar-toolkit/sugar-toolkit.spec @@ -3,7 +3,7 @@ Summary: Sugar toolkit Name: sugar-toolkit Version: 0.88.1 -Release: 4.12dxo%{?dist} +Release: 4.13dxo%{?dist} URL: http://wiki.laptop.org/go/Sugar Source0: http://download.sugarlabs.org/sources/sucrose/glucose/%{name}/%{name}-%{version}.tar.bz2 Source1: macros.sugar @@ -49,6 +49,9 @@ patch702: sugar-toolkit-2-4-Do-not-break-if-the-string-contains-no-conversion-sp patch703: sugar-toolkit-3-4-bundlebuilder-install-mimetypes.xml-and-associated-icon-2262.patch patch704: sugar-toolkit-4-4-XoColor-don-t-choke-if-passed-the-wrong-type-SL-1408.patch +#Auto-feedback feature related changes +patch801: sugar-toolkit-Report-to-the-shell-on-errors.patch + License: LGPLv2+ Group: System Environment/Libraries Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -114,6 +117,8 @@ to interact with system services like presence and the datastore. %patch703 -p1 %patch704 -p1 +%patch801 -p1 + %build %configure make %{?_smp_mflags} V=1 @@ -141,7 +146,10 @@ rm -rf %{buildroot} %{_sysconfdir}/rpm/macros.sugar %changelog -* Thu Jan 17 2011 Anish Mangal - 0.88.1-4.12 +* Wed Jan 19 2011 Anish Mangal - 0.88.1-4.13 +- Added auto-feedback feature related changes + +* Mon Jan 17 2011 Anish Mangal - 0.88.1-4.12 - 0.90 fixes backported * Mon Jan 14 2011 Anish Mangal - 0.88.1-4.11 diff --git a/rpms/sugar/sugar-1-2-Two-kinds-of-feedback-submits.patch b/rpms/sugar/sugar-1-2-Two-kinds-of-feedback-submits.patch new file mode 100644 index 0000000..66cd383 --- /dev/null +++ b/rpms/sugar/sugar-1-2-Two-kinds-of-feedback-submits.patch @@ -0,0 +1,266 @@ +From patchwork Tue Jan 18 02:53:44 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [sugar,1/2] Two kinds of feedback submits +Date: Tue, 18 Jan 2011 07:53:44 -0000 +From: Aleksey Lim +X-Patchwork-Id: 585 +Message-Id: <1295319225-10211-1-git-send-email-alsroot@member.fsf.org> +To: dextrose@lists.sugarlabs.org + +--- + extensions/deviceicon/feedback.py | 214 +++++++++++++++++++++++-------------- + 1 files changed, 132 insertions(+), 82 deletions(-) + + +diff --git a/extensions/deviceicon/feedback.py b/extensions/deviceicon/feedback.py +index 2a0075e..add633c 100644 +--- a/extensions/deviceicon/feedback.py ++++ b/extensions/deviceicon/feedback.py +@@ -16,113 +16,163 @@ + + import logging + from gettext import gettext as _ ++ + import gconf + import gtk ++ ++from sugar import profile + from sugar.graphics import style ++from sugar.graphics.icon import Icon + from sugar.graphics.tray import TrayIcon + from sugar.graphics.palette import Palette +-from sugar.graphics.xocolor import XoColor ++from sugar.graphics.menuitem import MenuItem ++from sugar.graphics.toolbutton import ToolButton ++ + from jarabe.model import feedback_collector +-from jarabe.view import launcher +-from sugar.activity import activityfactory +-from jarabe.model import bundleregistry +-from sugar.activity.activityhandle import ActivityHandle ++ + + _ICON_NAME = 'feedback-icon' + ++ + class DeviceView(TrayIcon): ++ + FRAME_POSITION_RELATIVE = 100 ++ + def __init__(self): +- client = gconf.client_get_default() +- self._color = XoColor(client.get_string('/desktop/sugar/user/color')) +- TrayIcon.__init__(self, icon_name=_ICON_NAME, xo_color=self._color) ++ TrayIcon.__init__(self, icon_name=_ICON_NAME, ++ xo_color=profile.get_color()) + self.create_palette() +- ++ + def create_palette(self): + logging.debug('palette created') +- self.palette = BugsPalette(_('Bugs')) ++ self.palette = _Palette(_('Feedback')) + self.palette.set_group_id('frame') + return self.palette + + +-class BugsPalette(Palette): +- ++class _Palette(Palette): ++ + def __init__(self, primary_text): + Palette.__init__(self, primary_text) +- self._level = 0 +- self._status_label = gtk.Label() +- self._status_label.show() +- self.vbox = gtk.VBox() +- self.hbox = gtk.HBox() +- self.set_content(self.vbox) +- self._bugs_count_text = gtk.Label() +- self.vbox.pack_start(self._bugs_count_text, +- padding = style.DEFAULT_PADDING) +- self.vbox.pack_start(self.hbox, padding = style.DEFAULT_PADDING) +- self.vbox.show() +- self.hbox.pack_start(self._status_label, +- padding = style.DEFAULT_PADDING) +- self.hbox.show() +- self._open_log_button = gtk.Button("Open Log") +- self._open_log_button.connect("clicked", +- self.__open_log_activity) +- self.hbox.pack_start(self._open_log_button, +- padding = style.DEFAULT_PADDING) +- self._send_report_button = gtk.Button("Send Report") +- self._send_report_button.connect("clicked", self.__send_bug_report) +- self.hbox.pack_start(self._send_report_button, +- padding = style.DEFAULT_PADDING) +- self.__get_bug_count() +- self._bugs_count_text.show() +- self._open_log_button.show() +- self._send_report_button.show() +- ++ ++ icon = Icon() ++ icon.set_from_icon_name('emblem-favorite', gtk.ICON_SIZE_MENU) ++ icon.props.xo_color = profile.get_color() ++ ++ personalized = MenuItem(_('Personalized submit...')) ++ personalized.set_image(icon) ++ personalized.connect('activate', self.__personalized_activate_cb) ++ personalized.show() ++ self.menu.append(personalized) ++ ++ self._anonymous = MenuItem(_('Anonymous submit'), 'emblem-favorite') ++ self._anonymous.connect('activate', self.__anonymous_activate_cb) ++ self._anonymous.show() ++ self.menu.append(self._anonymous) ++ + def popup(self, immediate=False, state=None): ++ self._anonymous.set_sensitive(not feedback_collector.is_empty()) + Palette.popup(self, immediate=immediate, state=state) +- self.__update_bug_palette() +- +- +- def __send_bug_report(self, button): +- feedback_collector.submit() +- +- def __open_log_activity(self, path): +- +- registry = bundleregistry.get_registry() +- bundle = registry.get_bundle('org.laptop.Log') +- activity_id = activityfactory.create_activity_id() +- client = gconf.client_get_default() +- xo_color = XoColor(client.get_string('/desktop/sugar/user/color')) +- launcher.add_launcher(activity_id, bundle.get_icon(), xo_color) +- activityfactory.create(bundle, ActivityHandle(activity_id)) +- +- def __get_bug_count(self): +- """This method returns the total error count""" +- bugs_count = 0 +- +- +- return bugs_count +- +- def __update_bug_palette(self): +- bugs_count = self.__get_bug_count() +- self._open_log_button.set_sensitive(False) +- have_reports, have_errors = feedback_collector.stat() +- #have_reports, have_errors=[True,False] +- if have_errors: +- self._open_log_button.set_sensitive(True) ++ ++ def __anonymous_activate_cb(self, button): ++ feedback_collector.anonymous_submit() ++ ++ def __personalized_activate_cb(self, button): ++ window = _Window() ++ window.show() ++ ++ ++class _Window(gtk.Window): ++ ++ __gtype_name__ = 'FeedbackWindow' ++ ++ def __init__(self): ++ gtk.Window.__init__(self) ++ ++ self.set_border_width(style.LINE_WIDTH) ++ offset = style.GRID_CELL_SIZE ++ width = gtk.gdk.screen_width() - offset * 2 ++ height = gtk.gdk.screen_height() - offset * 2 ++ self.set_size_request(width, height) ++ self.set_position(gtk.WIN_POS_CENTER_ALWAYS) ++ self.set_decorated(False) ++ self.set_resizable(False) ++ self.set_modal(True) ++ ++ canvas = gtk.VBox() ++ self.add(canvas) ++ ++ self._toolbar = gtk.Toolbar() ++ canvas.pack_start(self._toolbar, False) ++ ++ icon = Icon() ++ icon.set_from_icon_name('emblem-favorite', gtk.ICON_SIZE_LARGE_TOOLBAR) ++ icon.props.xo_color = profile.get_color() ++ self._add_widget(icon) ++ ++ self._add_separator(False) ++ ++ title = gtk.Label(_('Submit feedback with contact infromation')) ++ self._add_widget(title) ++ ++ self._add_separator(True) ++ ++ submit = ToolButton('dialog-ok', tooltip=_('Submit')) ++ submit.connect('clicked', lambda button: self._submit()) ++ self._toolbar.insert(submit, -1) ++ ++ cancel = ToolButton('dialog-cancel', tooltip=_('Cancel')) ++ cancel.connect('clicked', lambda button: self.destroy()) ++ self._toolbar.insert(cancel, -1) ++ ++ bg = gtk.EventBox() ++ bg.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color()) ++ canvas.pack_start(bg) ++ ++ self._message = gtk.TextView() ++ scrolled = gtk.ScrolledWindow() ++ scrolled.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) ++ scrolled.set_border_width(style.DEFAULT_PADDING) ++ scrolled.add(self._message) ++ bg.add(scrolled) ++ ++ self.show_all() ++ self.set_focus(self._message) ++ ++ self.connect("realize", self.__realize_cb) ++ ++ def do_key_press_event(self, event): ++ if event.keyval == gtk.keysyms.Escape: ++ self.destroy() ++ elif event.keyval == gtk.keysyms.Return and \ ++ event.state & gtk.gdk.CONTROL_MASK: ++ self._submit() + else: +- self._open_log_button.set_sensitive(False) +- +- +- if have_reports: +- self._send_report_button.set_sensitive(True) ++ gtk.Window.do_key_press_event(self, event) ++ ++ def _add_widget(self, widget): ++ tool_item = gtk.ToolItem() ++ tool_item.add(widget) ++ self._toolbar.insert(tool_item, -1) ++ ++ def _add_separator(self, expand): ++ separator = gtk.SeparatorToolItem() ++ separator.props.draw = False ++ if expand: ++ separator.set_expand(True) + else: +- self._send_report_button.set_sensitive(False) +- +- if bugs_count == 0: +- self._bugs_count_text.set_label('No Errors') +- else : +- self._bugs_count_text.set_label(_('Total Errors: %d' % bugs_count)) +- ++ separator.set_size_request(style.DEFAULT_SPACING, -1) ++ self._toolbar.insert(separator, -1) ++ ++ def _submit(self): ++ feedback_collector.submit(self._message.props.buffer.props.text) ++ self.destroy() ++ ++ def __realize_cb(self, widget): ++ self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) ++ self.window.set_accept_focus(True) ++ ++ + def setup(tray): + client = gconf.client_get_default() + if client.get_bool('/desktop/sugar/feedback/enabled'): diff --git a/rpms/sugar/sugar-2-2-Initial-client-implementation-for-feedback-feature.patch b/rpms/sugar/sugar-2-2-Initial-client-implementation-for-feedback-feature.patch new file mode 100644 index 0000000..6a44665 --- /dev/null +++ b/rpms/sugar/sugar-2-2-Initial-client-implementation-for-feedback-feature.patch @@ -0,0 +1,383 @@ +From patchwork Tue Jan 18 02:53:45 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [sugar,2/2] Initial client implementation for feedback feature +Date: Tue, 18 Jan 2011 07:53:45 -0000 +From: Aleksey Lim +X-Patchwork-Id: 584 +Message-Id: <1295319225-10211-2-git-send-email-alsroot@member.fsf.org> +To: dextrose@lists.sugarlabs.org + +--- + bin/sugar-session | 8 +- + data/sugar.schemas.in | 44 +++++++ + src/jarabe/model/Makefile.am | 1 + + src/jarabe/model/feedback_collector.py | 201 ++++++++++++++++++++++++++++++++ + src/jarabe/model/shell.py | 16 +++ + src/jarabe/view/service.py | 5 + + 6 files changed, 274 insertions(+), 1 deletions(-) + create mode 100644 src/jarabe/model/feedback_collector.py + + +diff --git a/bin/sugar-session b/bin/sugar-session +index 0501311..d4362ef 100755 +--- a/bin/sugar-session ++++ b/bin/sugar-session +@@ -229,7 +229,7 @@ def main(): + gettext.textdomain('sugar') + + from jarabe.desktop import homewindow +- from jarabe.model import sound ++ from jarabe.model import sound, feedback_collector + from jarabe import intro + + logger.start('shell') +@@ -238,6 +238,12 @@ def main(): + client.set_string('/apps/metacity/general/mouse_button_modifier', + '') + ++ if client.get_bool('/desktop/sugar/feedback/enabled'): ++ feedback_collector.start( ++ client.get_string('/desktop/sugar/feedback/server_host'), ++ client.get_int('/desktop/sugar/feedback/server_port'), ++ client.get_int('/desktop/sugar/feedback/auto_submit_delay')) ++ + timezone = client.get_string('/desktop/sugar/date/timezone') + if timezone is not None and timezone: + os.environ['TZ'] = timezone +diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in +index a3817e9..880c9d1 100644 +--- a/data/sugar.schemas.in ++++ b/data/sugar.schemas.in +@@ -2,6 +2,50 @@ + + + ++ /schemas/desktop/sugar/feedback/enabled ++ /desktop/sugar/feedback/enabled ++ sugar ++ bool ++ false ++ ++ Enable of disable feedback feature ++ Setting value to false will disable any feedback reports. ++ ++ ++ ++ /schemas/desktop/sugar/feedback/server_host ++ /desktop/sugar/feedback/server_host ++ sugar ++ string ++ feedback.sugarlabs.org ++ ++ Server host to send reports to ++ Server that will handle reports sent via HTTPS POST requests. ++ ++ ++ ++ /schemas/desktop/sugar/feedback/server_port ++ /desktop/sugar/feedback/server_port ++ sugar ++ int ++ 80 ++ ++ Server port to send reports to ++ TCP port that will used to send HTTPS POST requests. ++ ++ ++ ++ /schemas/desktop/sugar/feedback/auto_submit_delay ++ /desktop/sugar/feedback/auto_submit_delay ++ sugar ++ int ++ 0 ++ ++ Delay in seconds to send anonymous reports automatically ++ Setting value to 0 will disable automatic submiting. ++ ++ ++ + /schemas/desktop/sugar/user/nick + /desktop/sugar/user/nick + sugar +diff --git a/src/jarabe/model/Makefile.am b/src/jarabe/model/Makefile.am +index 374d6fc..c221e86 100644 +--- a/src/jarabe/model/Makefile.am ++++ b/src/jarabe/model/Makefile.am +@@ -19,4 +19,5 @@ sugar_PYTHON = \ + session.py \ + sound.py \ + processmanagement.py \ ++ feedback_collector.py \ + virtualkeyboard.py +diff --git a/src/jarabe/model/feedback_collector.py b/src/jarabe/model/feedback_collector.py +new file mode 100644 +index 0000000..c0deae2 +--- /dev/null ++++ b/src/jarabe/model/feedback_collector.py +@@ -0,0 +1,201 @@ ++# Copyright (C) 2011, Aleksey Lim ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++import os ++import time ++import httplib ++import logging ++import tarfile ++import threading ++from cStringIO import StringIO ++from os.path import join, exists, basename ++from email.mime.multipart import MIMEMultipart ++from email.mime.application import MIMEApplication ++from email.generator import Generator ++from email.encoders import encode_noop ++ ++import gconf ++import gobject ++import simplejson ++ ++from sugar import logger, feedback, util ++ ++ ++_reports = {} ++_logs = set() ++_host = None ++_port = None ++ ++ ++def start(host, port, auto_submit_delay): ++ global _host ++ global _port ++ ++ _host = host ++ _port = port ++ ++ if auto_submit_delay > 0: ++ gobject.timeout_add_seconds(auto_submit_delay, _submit) ++ ++ ++def update(bundle_id, report, log_file): ++ if bundle_id not in _reports: ++ _reports[bundle_id] = {} ++ stat = _reports[bundle_id] ++ ++ for key, count in report.items(): ++ if key not in stat: ++ stat[key] = 0 ++ stat[key] += count ++ ++ if log_file: ++ _logs.add(log_file) ++ ++ ++def is_empty(): ++ report, shell_log = feedback.flush() ++ if report: ++ if shell_log: ++ shell_log = join(logger.get_logs_dir(), 'shell.log') ++ update('shell', report, shell_log) ++ ++ return not _reports ++ ++ ++def submit(message): ++ from jarabe.journal import misc ++ ++ client = gconf.client_get_default() ++ jabber = client.get_string('/desktop/sugar/collaboration/jabber_server') ++ nick = client.get_string("/desktop/sugar/user/nick") ++ ++ data = {'message': message, ++ 'serial_number': misc.get_xo_serial(), ++ 'nick': nick, ++ 'jabber_server': jabber, ++ } ++ _submit(data) ++ ++ ++def anonymous_submit(): ++ _submit() ++ ++ ++def _submit(data=None): ++ if data: ++ _reports.update(data) ++ if is_empty(): ++ return True ++ ++ logging.debug('Sending feedback report: %r', _reports) ++ ++ report = simplejson.dumps(_reports) ++ _reports.clear() ++ ++ tar_file = util.TempFilePath() ++ tar = tarfile.open(tar_file, 'w:gz') ++ ++ while _logs: ++ log_file = _logs.pop() ++ if exists(log_file): ++ tar.add(log_file, arcname=basename(log_file)) ++ ++ report_file = tarfile.TarInfo('report') ++ report_file.mode = 0644 ++ report_file.mtime = int(time.time()) ++ report_file.size = len(report) ++ tar.addfile(report_file, StringIO(report)) ++ ++ tar.close() ++ ++ _SubmitThread(tar_file).run() ++ ++ return True ++ ++ ++class _SubmitThread(threading.Thread): ++ ++ def __init__(self, tar_file): ++ threading.Thread.__init__(self) ++ self._tar_file = tar_file ++ ++ def run(self): ++ try: ++ message = _FormData() ++ attachment = MIMEApplication(file(self._tar_file).read(), ++ _encoder=encode_noop) ++ message.attach_file(attachment, ++ name='report', filename='report.tar.gz') ++ body, headers = message.get_request_data() ++ ++ conn = httplib.HTTPSConnection(_host, _port) ++ conn.request('POST', '/', body, headers) ++ response = conn.getresponse() ++ ++ if response.status != 200: ++ logging.error('Incorrect feedback submit: %s, %s', ++ response.status, response.read()) ++ ++ except Exception: ++ logging.exception('Cannot submit feedback') ++ finally: ++ os.unlink(self._tar_file) ++ self._tar_file = None ++ ++ ++class _FormData(MIMEMultipart): ++ '''A simple RFC2388 multipart/form-data implementation. ++ ++ A snippet from http://bugs.python.org/issue3244 ++ ++ ''' ++ ++ def __init__(self, boundary=None, _subparts=None, **kwargs): ++ MIMEMultipart.__init__(self, _subtype='form-data', ++ boundary=boundary, _subparts=_subparts, **kwargs) ++ ++ def attach(self, subpart): ++ if 'MIME-Version' in subpart: ++ if subpart['MIME-Version'] != self['MIME-Version']: ++ raise ValueError('subpart has incompatible MIME-Version') ++ # Note: This isn't strictly necessary, but there is no point in ++ # including a MIME-Version header in each subpart. ++ del subpart['MIME-Version'] ++ MIMEMultipart.attach(self, subpart) ++ ++ def attach_file(self, subpart, name, filename): ++ ''' ++ Attach a subpart, setting it's Content-Disposition header to "file". ++ ''' ++ name = name.replace('"', '\\"') ++ filename = filename.replace('"', '\\"') ++ subpart['Content-Disposition'] = \ ++ 'form-data; name="%s"; filename="%s"' % (name, filename) ++ self.attach(subpart) ++ ++ def get_request_data(self, trailing_newline=True): ++ '''Return the encoded message body.''' ++ f = StringIO() ++ generator = Generator(f, mangle_from_=False) ++ # pylint: disable-msg=W0212 ++ generator._dispatch(self) ++ # HTTP needs a trailing newline. Since our return value is likely to ++ # be passed directly to an HTTP connection, we might as well add it ++ # here. ++ if trailing_newline: ++ f.write('\n') ++ body = f.getvalue() ++ headers = dict(self) ++ return body, headers +diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py +index 69b45e2..b9cb0c2 100644 +--- a/src/jarabe/model/shell.py ++++ b/src/jarabe/model/shell.py +@@ -23,12 +23,14 @@ import wnck + import gobject + import gtk + import dbus ++import simplejson + + from sugar import wm + from sugar import dispatch + from sugar.graphics.xocolor import XoColor + from sugar.presence import presenceservice + ++from jarabe.model import feedback_collector + from jarabe.model.bundleregistry import get_registry + + _SERVICE_NAME = "org.laptop.Activity" +@@ -220,6 +222,12 @@ class Activity(gobject.GObject): + else: + return self._activity_info.get_path() + ++ def get_bundle_id(self): ++ if self._activity_info is None: ++ return None ++ else: ++ return self._activity_info.get_bundle_id() ++ + def get_activity_name(self): + """Returns the activity's bundle name""" + if self._activity_info is None: +@@ -618,6 +626,14 @@ class ShellModel(gobject.GObject): + logging.error('Model for activity id %s does not exist.', + activity_id) + ++ def notify_feedback(self, activity_id, report, log_file): ++ home_activity = self.get_activity_by_id(activity_id) ++ if home_activity is not None: ++ feedback_collector.update(home_activity.get_bundle_id(), ++ simplejson.loads(report), log_file) ++ else: ++ logging.error('No %s activity for sending feedback', activity_id) ++ + def _check_activity_launched(self, activity_id): + home_activity = self.get_activity_by_id(activity_id) + +diff --git a/src/jarabe/view/service.py b/src/jarabe/view/service.py +index bb71694..a576eb9 100644 +--- a/src/jarabe/view/service.py ++++ b/src/jarabe/view/service.py +@@ -97,6 +97,11 @@ class UIService(dbus.service.Object): + def NotifyLaunchFailure(self, activity_id): + shell.get_model().notify_launch_failed(activity_id) + ++ @dbus.service.method(_DBUS_SHELL_IFACE, ++ in_signature="sss", out_signature="") ++ def Feedback(self, activity_id, report, log_file): ++ shell.get_model().notify_feedback(activity_id, report, log_file) ++ + @dbus.service.signal(_DBUS_OWNER_IFACE, signature="s") + def ColorChanged(self, color): + pass diff --git a/rpms/sugar/sugar-Patch-to-add-feedback-icon-to-frame.patch b/rpms/sugar/sugar-Patch-to-add-feedback-icon-to-frame.patch new file mode 100644 index 0000000..5cf3625 --- /dev/null +++ b/rpms/sugar/sugar-Patch-to-add-feedback-icon-to-frame.patch @@ -0,0 +1,169 @@ +From patchwork Tue Jan 18 02:54:15 2011 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [sugar] Patch to add feedback icon to frame +Date: Tue, 18 Jan 2011 07:54:15 -0000 +From: Aleksey Lim +X-Patchwork-Id: 586 +Message-Id: <1295319255-10250-1-git-send-email-alsroot@member.fsf.org> +To: dextrose@lists.sugarlabs.org +Cc: Mukesh Gupta + +From: Mukesh Gupta + +Signed-off-by: Mukesh Gupta + +--- +extensions/deviceicon/Makefile.am | 4 +- + extensions/deviceicon/feedback.py | 129 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 132 insertions(+), 1 deletions(-) + create mode 100644 extensions/deviceicon/feedback.py + +diff --git a/extensions/deviceicon/Makefile.am b/extensions/deviceicon/Makefile.am +index 3a74053..b38cbb3 100644 +--- a/extensions/deviceicon/Makefile.am ++++ b/extensions/deviceicon/Makefile.am +@@ -8,4 +8,6 @@ sugar_PYTHON = \ + speaker.py \ + touchpad.py \ + virtualkeyboard.py \ +- volume.py ++ volume.py \ ++ feedback.py ++ +diff --git a/extensions/deviceicon/feedback.py b/extensions/deviceicon/feedback.py +new file mode 100644 +index 0000000..2a0075e +--- /dev/null ++++ b/extensions/deviceicon/feedback.py +@@ -0,0 +1,129 @@ ++# Copyright (C) Mukesh Gupta ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ ++import logging ++from gettext import gettext as _ ++import gconf ++import gtk ++from sugar.graphics import style ++from sugar.graphics.tray import TrayIcon ++from sugar.graphics.palette import Palette ++from sugar.graphics.xocolor import XoColor ++from jarabe.model import feedback_collector ++from jarabe.view import launcher ++from sugar.activity import activityfactory ++from jarabe.model import bundleregistry ++from sugar.activity.activityhandle import ActivityHandle ++ ++_ICON_NAME = 'feedback-icon' ++ ++class DeviceView(TrayIcon): ++ FRAME_POSITION_RELATIVE = 100 ++ def __init__(self): ++ client = gconf.client_get_default() ++ self._color = XoColor(client.get_string('/desktop/sugar/user/color')) ++ TrayIcon.__init__(self, icon_name=_ICON_NAME, xo_color=self._color) ++ self.create_palette() ++ ++ def create_palette(self): ++ logging.debug('palette created') ++ self.palette = BugsPalette(_('Bugs')) ++ self.palette.set_group_id('frame') ++ return self.palette ++ ++ ++class BugsPalette(Palette): ++ ++ def __init__(self, primary_text): ++ Palette.__init__(self, primary_text) ++ self._level = 0 ++ self._status_label = gtk.Label() ++ self._status_label.show() ++ self.vbox = gtk.VBox() ++ self.hbox = gtk.HBox() ++ self.set_content(self.vbox) ++ self._bugs_count_text = gtk.Label() ++ self.vbox.pack_start(self._bugs_count_text, ++ padding = style.DEFAULT_PADDING) ++ self.vbox.pack_start(self.hbox, padding = style.DEFAULT_PADDING) ++ self.vbox.show() ++ self.hbox.pack_start(self._status_label, ++ padding = style.DEFAULT_PADDING) ++ self.hbox.show() ++ self._open_log_button = gtk.Button("Open Log") ++ self._open_log_button.connect("clicked", ++ self.__open_log_activity) ++ self.hbox.pack_start(self._open_log_button, ++ padding = style.DEFAULT_PADDING) ++ self._send_report_button = gtk.Button("Send Report") ++ self._send_report_button.connect("clicked", self.__send_bug_report) ++ self.hbox.pack_start(self._send_report_button, ++ padding = style.DEFAULT_PADDING) ++ self.__get_bug_count() ++ self._bugs_count_text.show() ++ self._open_log_button.show() ++ self._send_report_button.show() ++ ++ def popup(self, immediate=False, state=None): ++ Palette.popup(self, immediate=immediate, state=state) ++ self.__update_bug_palette() ++ ++ ++ def __send_bug_report(self, button): ++ feedback_collector.submit() ++ ++ def __open_log_activity(self, path): ++ ++ registry = bundleregistry.get_registry() ++ bundle = registry.get_bundle('org.laptop.Log') ++ activity_id = activityfactory.create_activity_id() ++ client = gconf.client_get_default() ++ xo_color = XoColor(client.get_string('/desktop/sugar/user/color')) ++ launcher.add_launcher(activity_id, bundle.get_icon(), xo_color) ++ activityfactory.create(bundle, ActivityHandle(activity_id)) ++ ++ def __get_bug_count(self): ++ """This method returns the total error count""" ++ bugs_count = 0 ++ ++ ++ return bugs_count ++ ++ def __update_bug_palette(self): ++ bugs_count = self.__get_bug_count() ++ self._open_log_button.set_sensitive(False) ++ have_reports, have_errors = feedback_collector.stat() ++ #have_reports, have_errors=[True,False] ++ if have_errors: ++ self._open_log_button.set_sensitive(True) ++ else: ++ self._open_log_button.set_sensitive(False) ++ ++ ++ if have_reports: ++ self._send_report_button.set_sensitive(True) ++ else: ++ self._send_report_button.set_sensitive(False) ++ ++ if bugs_count == 0: ++ self._bugs_count_text.set_label('No Errors') ++ else : ++ self._bugs_count_text.set_label(_('Total Errors: %d' % bugs_count)) ++ ++def setup(tray): ++ client = gconf.client_get_default() ++ if client.get_bool('/desktop/sugar/feedback/enabled'): ++ tray.add_device(DeviceView()) diff --git a/rpms/sugar/sugar.spec b/rpms/sugar/sugar.spec index 14d001d..ad075b2 100644 --- a/rpms/sugar/sugar.spec +++ b/rpms/sugar/sugar.spec @@ -3,7 +3,7 @@ Summary: Constructionist learning platform Name: sugar Version: 0.88.1 -Release: 5.45dxo%{?dist} +Release: 5.46dxo%{?dist} URL: http://sugarlabs.org/ Source0: http://download.sugarlabs.org/sources/sucrose/glucose/%{name}/%{name}-%{version}.tar.bz2 @@ -123,6 +123,11 @@ patch1509: sugar-09-11-datastore.write-expects-a-DSObject-not-an-id.patch patch1510: sugar-10-11-Fix-more-sugar.datastore-breakage.patch patch1511: sugar-11-11-fix-journal-scan-of-external-media-dev.laptop.org-10140.patch +#Auto-feedback feature +patch1601: sugar-Patch-to-add-feedback-icon-to-frame.patch +patch1602: sugar-1-2-Two-kinds-of-feedback-submits.patch +patch1603: sugar-2-2-Initial-client-implementation-for-feedback-feature.patch + License: GPLv2+ Group: User Interface/Desktops Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -291,6 +296,10 @@ multiple instances of sugar. %patch1510 -p1 %patch1511 -p1 +%patch1601 -p1 +%patch1602 -p1 +%patch1603 -p1 + %build autoreconf %configure @@ -367,6 +376,9 @@ rm -rf %{buildroot} %{_datadir}/icons/hicolor/scalable/apps/sugar-xo.svg %changelog +* Wed Jan 19 2011 Anish Mangal - 0.88.1-5.46 +- Incorporate auto-feedback feature + * Mon Jan 17 2011 Anish Mangal - 0.88.1-5.45 - 0.90 bugfix backports -- cgit v0.9.1