Date: Friday, April 7, 2017 @ 14:01:09 Author: bgyorgy Revision: 221214
Add sugar-activity-paint (part of sugar-fructose) Added: sugar-activity-paint/ sugar-activity-paint/trunk/ sugar-activity-paint/trunk/PKGBUILD sugar-activity-paint/trunk/fix-drawing-area.patch sugar-activity-paint/trunk/fix-text-tool.patch sugar-activity-paint/trunk/fix-type-error.patch ------------------------+ PKGBUILD | 37 +++++++ fix-drawing-area.patch | 22 ++++ fix-text-tool.patch | 232 +++++++++++++++++++++++++++++++++++++++++++++++ fix-type-error.patch | 35 +++++++ 4 files changed, 326 insertions(+) Added: sugar-activity-paint/trunk/PKGBUILD =================================================================== --- sugar-activity-paint/trunk/PKGBUILD (rev 0) +++ sugar-activity-paint/trunk/PKGBUILD 2017-04-07 14:01:09 UTC (rev 221214) @@ -0,0 +1,37 @@ +# $Id$ +# Maintainer: Balló György <ballogyor+arch at gmail dot com> + +pkgname=sugar-activity-paint +_pkgname=Paint +pkgver=65 +pkgrel=1 +pkgdesc="Sugar activity to create paintings or drawings" +arch=('any') +url="https://wiki.sugarlabs.org/go/Activities/Paint" +license=('GPL') +groups=('sugar-fructose') +depends=('sugar-toolkit-gtk3') +source=(https://download.sugarlabs.org/sources/honey/$_pkgname/$_pkgname-$pkgver.tar.bz2 + fix-type-error.patch + fix-text-tool.patch + fix-drawing-area.patch) +sha256sums=('9b53cf296fac1bfff691d2d2ec8f5db43771e41b9e3dffaf346f99f424132c67' + 'df6ff08acaf4a9f080321a26429ac1820d6afe1916aa12b600ee6b01ce61f4b1' + 'b7cc84895d1c920ccab457fed8987c19bcc5c82b8d9fd0bdaf6e60726fd23750' + '023c0eefe5168bab0152fe7c6df391d3dccabf806b17bd12ed3539d01e8c1066') + +prepare() { + cd $_pkgname-$pkgver + sed -i 's@^#!.*python$@#!/usr/bin/python2@' setup.py + + patch -Np1 -i ../fix-type-error.patch + patch -Np1 -i ../fix-text-tool.patch + patch -Np1 -i ../fix-drawing-area.patch + + rm -r fill +} + +package() { + cd $_pkgname-$pkgver + python2 setup.py install --prefix "$pkgdir/usr" +} Property changes on: sugar-activity-paint/trunk/PKGBUILD ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: sugar-activity-paint/trunk/fix-drawing-area.patch =================================================================== --- sugar-activity-paint/trunk/fix-drawing-area.patch (rev 0) +++ sugar-activity-paint/trunk/fix-drawing-area.patch 2017-04-07 14:01:09 UTC (rev 221214) @@ -0,0 +1,22 @@ +From 4a10a044e40c98226d7b5cd54589db3fce598136 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gy=C3=B6rgy=20Ball=C3=B3?= <ballog...@gmail.com> +Date: Fri, 7 Apr 2017 15:25:50 +0200 +Subject: [PATCH] Explicitely call map_cp on start + +Without this, the drawing area is invisible. +--- + OficinaActivity.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/OficinaActivity.py b/OficinaActivity.py +index ef9a64b..b5966bc 100644 +--- a/OficinaActivity.py ++++ b/OficinaActivity.py +@@ -153,6 +153,7 @@ def size_allocate_cb(widget, allocation): + size_allocate_cb) + + self._setup_handle = self.connect('map', map_cp) ++ map_cp(self) + + # Handle screen rotation + Gdk.Screen.get_default().connect('size-changed', self._configure_cb) Added: sugar-activity-paint/trunk/fix-text-tool.patch =================================================================== --- sugar-activity-paint/trunk/fix-text-tool.patch (rev 0) +++ sugar-activity-paint/trunk/fix-text-tool.patch 2017-04-07 14:01:09 UTC (rev 221214) @@ -0,0 +1,232 @@ +From dd0d018e6e8fdad539daa130fc21606c6c9ef2a1 Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:11:16 +1100 +Subject: [PATCH 1/6] Remove several normal log messages + +--- + Area.py | 4 ++-- + OficinaActivity.py | 2 +- + fill/__init__.py | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Area.py b/Area.py +index 77ecc05..6912000 100644 +--- a/Area.py ++++ b/Area.py +@@ -91,7 +91,7 @@ + try: + from fill import fill + FALLBACK_FILL = False +- logging.error('Found fill binaries.') ++ logging.debug('Found fill binaries.') + except: + logging.error('No valid fill binaries. Using slower python code') + pass +@@ -131,7 +131,7 @@ + def _get_screen_dpi(): + xft_dpi = Gtk.Settings.get_default().get_property('gtk-xft-dpi') + dpi = float(xft_dpi / 1024) +- logging.error('Setting dpi to: %f', dpi) ++ logging.debug('Setting dpi to: %f', dpi) + return dpi + + bundle_path = activity.get_bundle_path() +diff --git a/OficinaActivity.py b/OficinaActivity.py +index e5fdce0..ad0354e 100644 +--- a/OficinaActivity.py ++++ b/OficinaActivity.py +@@ -261,7 +261,7 @@ def toolset_intialize_from_journal(self): + self.area.tool = json.loads(self.metadata['state']) + logging.debug('self.area.tool %s', self.area.tool) + except Exception as e: +- logging.error("exception %s", e) ++ logging.debug("exception %s", e) + + def __textview_event_cb(self, widget, event): + if event.type in (Gdk.EventType.TOUCH_BEGIN, +diff --git a/fill/__init__.py b/fill/__init__.py +index 92b2eaf..34b4d37 100644 +--- a/fill/__init__.py ++++ b/fill/__init__.py +@@ -11,11 +11,11 @@ + sys.path = _sys_path + [os.path.join('.', path)] + try: + from _fill import * +- logging.error('use %s blobs' % path) ++ logging.debug('use %s blobs' % path) + _sys_path = None + break + except Exception, e: +- logging.error('skip %s blobs: %s' % (path, e)) ++ logging.debug('skip %s blobs: %s' % (path, e)) + + if _sys_path: + raise('cannot find proper binary blobs') + +From a3cefec53e18ec23f91d5949fb849c4645e03253 Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:11:53 +1100 +Subject: [PATCH 2/6] Discard useless messages about versions + +--- + OficinaActivity.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/OficinaActivity.py b/OficinaActivity.py +index ad0354e..696d681 100644 +--- a/OficinaActivity.py ++++ b/OficinaActivity.py +@@ -61,6 +61,11 @@ + + """ + ++import gi ++gi.require_version('Gtk', '3.0') ++gi.require_version('Gst', '1.0') ++gi.require_version('PangoCairo', '1.0') ++ + from gi.repository import Gtk + from gi.repository import Gdk + from gi.repository import GObject + +From 4d228363cb9f7a97c469650b656e2474e2a2458a Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:18:47 +1100 +Subject: [PATCH 3/6] Use set_text of Gtk.TextBuffer + +- exception was always happening, + +- Gtk.TextView does not have set_text, + +- use set_text of the buffer always. +--- + Desenho.py | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/Desenho.py b/Desenho.py +index 89b828b..d166c78 100644 +--- a/Desenho.py ++++ b/Desenho.py +@@ -682,7 +682,6 @@ def text(self, widget, coord_x, coord_y): + GObject.idle_add(self._finalize_text, widget, textview) + + def _finalize_text(self, widget, textview): +- buf = textview.get_buffer() + window = textview.get_window(Gtk.TextWindowType.TEXT) + ctx = widget.drawing_ctx + tv_alloc = textview.get_allocation() +@@ -692,10 +691,7 @@ def _finalize_text(self, widget, textview): + widget.activity.textview.hide() + widget.drawing_canvas.flush() + +- try: +- widget.activity.textview.set_text('') +- except AttributeError: +- buf.set_text('') ++ textview.get_buffer().set_text('') + + widget.enable_undo() + widget.queue_draw() + +From ef2a2338f1dd8f42e783e6cd5eca72d1f79004a3 Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:20:14 +1100 +Subject: [PATCH 4/6] Make explicit TextView callbacks return + +- returning False or True has significance, + +- use an explicit False instead of allowing it to default to False. +--- + OficinaActivity.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/OficinaActivity.py b/OficinaActivity.py +index 696d681..16ebbd4 100644 +--- a/OficinaActivity.py ++++ b/OficinaActivity.py +@@ -286,6 +286,7 @@ def __textview_event_cb(self, widget, event): + text_buf = self.textview.get_buffer() + end_text_iter = text_buf.get_end_iter() + text_buf.select_range(end_text_iter, end_text_iter) ++ return False + + def __textview_mouse_move_cb(self, widget, event): + x = event.x +@@ -295,3 +296,4 @@ def __textview_mouse_move_cb(self, widget, event): + dy = y - self._initial_textview_touch_y + tv_alloc = self.textview.get_allocation() + self.move_textview(tv_alloc.x + dx, tv_alloc.y + dy) ++ return False + +From 083b7e3fea8a4699b19d049353bef858f240437c Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:42:13 +1100 +Subject: [PATCH 5/6] Fix for text tool + +- on Ubuntu 16.04, selecting the text tool then clicking the drawing +area seems to do nothing, + +- caused by the Gtk.TextView stacked underneath the drawing area, + +- fix is to put the Gtk.TextView last inside the Gtk.Fixed, + +- did not affect Fedora 18. +--- + OficinaActivity.py | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/OficinaActivity.py b/OficinaActivity.py +index 16ebbd4..ef9a64b 100644 +--- a/OficinaActivity.py ++++ b/OficinaActivity.py +@@ -98,7 +98,6 @@ def __init__(self, handle): + self.fixed = Gtk.Fixed() + self._width = Gdk.Screen.width() + self._height = Gdk.Screen.height() +- self.fixed.show() + self.fixed.modify_bg(Gtk.StateType.NORMAL, + style.COLOR_WHITE.get_gdk_color()) + +@@ -114,13 +113,13 @@ def __init__(self, handle): + self.textview.connect('event', self.__textview_event_cb) + self.textview.connect("motion_notify_event", + self.__textview_mouse_move_cb) ++ self.textview.hide() # will be shown when text tool is used + +- self.fixed.put(self.textview, 0, 0) +- +- # These attributes are used in other classes, so they should be public + self.area = Area(self) + self.area.show() + self.fixed.put(self.area, 0, 0) ++ self.fixed.put(self.textview, 0, 0) ++ self.fixed.show() + + self._sw = Gtk.ScrolledWindow() + self._sw.set_kinetic_scrolling(False) + +From c309fa3940a27f8e9a4d4ca41a70c5efb6d0281c Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 16 Feb 2017 16:46:16 +1100 +Subject: [PATCH 6/6] Defend against Gtk3 cursor new_from_name bug + +- fix bad syntax, + +- regression introduced in 7e74623. +--- + Area.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Area.py b/Area.py +index 6912000..de5050b 100644 +--- a/Area.py ++++ b/Area.py +@@ -1772,7 +1772,7 @@ def set_tool_cursor(self): + + cursor = Gdk.Cursor.new_from_pixbuf(display, pixbuf, + hotspot_x, hotspot_y) +- except GObject.GError, TypeError: ++ except (GObject.GError, TypeError): + cursor = None + if self.get_window() is not None: + self.get_window().set_cursor(cursor) Added: sugar-activity-paint/trunk/fix-type-error.patch =================================================================== --- sugar-activity-paint/trunk/fix-type-error.patch (rev 0) +++ sugar-activity-paint/trunk/fix-type-error.patch 2017-04-07 14:01:09 UTC (rev 221214) @@ -0,0 +1,35 @@ +From 7e74623513fa170fb568f149a703cfc489965ebf Mon Sep 17 00:00:00 2001 +From: James Cameron <qu...@laptop.org> +Date: Thu, 9 Feb 2017 10:18:54 +1100 +Subject: [PATCH] Defend against Gtk3 cursor new_from_name bug + +On Ubuntu 16.10 and later, Gdk.Cursor raises a TypeError instead of +returning None as documented. + +Fixes + + File "/usr/share/sugar/activities/Paint.activity/Area.py", line 1754, in + set_tool_cursor + cursor = Gdk.Cursor.new_from_name(display, name) + TypeError: constructor returned NULL + +Documentation reference: + +https://lazka.github.io/pgi-docs/Gdk-3.0/classes/Cursor.html#Gdk.Cursor.new_from_name +--- + Area.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Area.py b/Area.py +index db227f8..77ecc05 100644 +--- a/Area.py ++++ b/Area.py +@@ -1772,7 +1772,7 @@ def set_tool_cursor(self): + + cursor = Gdk.Cursor.new_from_pixbuf(display, pixbuf, + hotspot_x, hotspot_y) +- except GObject.GError: ++ except GObject.GError, TypeError: + cursor = None + if self.get_window() is not None: + self.get_window().set_cursor(cursor)