[arch-commits] Commit in sugar-activity-pippy/trunk (4 files)
Balló György
bgyorgy at archlinux.org
Thu Mar 30 18:54:04 UTC 2017
Date: Thursday, March 30, 2017 @ 18:54:03
Author: bgyorgy
Revision: 220115
upgpkg: sugar-activity-pippy 70-2
Add various fixes from upstream
Added:
sugar-activity-pippy/trunk/collabwrapper.patch
sugar-activity-pippy/trunk/various-fixes.patch
Modified:
sugar-activity-pippy/trunk/PKGBUILD
Deleted:
sugar-activity-pippy/trunk/fix-missing-icons.patch
-------------------------+
PKGBUILD | 13
collabwrapper.patch | 76 ++++
fix-missing-icons.patch | 49 --
various-fixes.patch | 782 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 865 insertions(+), 55 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-03-30 18:54:01 UTC (rev 220114)
+++ PKGBUILD 2017-03-30 18:54:03 UTC (rev 220115)
@@ -4,7 +4,7 @@
pkgname=sugar-activity-pippy
_pkgname=Pippy
pkgver=70
-pkgrel=1
+pkgrel=2
pkgdesc="Sugar activity to learn and develop in Python programming language"
arch=('any')
url="https://wiki.sugarlabs.org/go/Activities/Pippy"
@@ -12,17 +12,18 @@
groups=('sugar-fructose')
depends=('python2-pybox2d' 'python2-pygame' 'sugar' 'vte3')
source=($pkgname-$pkgver.tar.gz::https://github.com/sugarlabs/$_pkgname/archive/v$pkgver.tar.gz
- fix-missing-icons.patch)
+ collabwrapper.patch
+ various-fixes.patch)
sha256sums=('7c7ca995661a4e1c0964e5788ad5dfce539beca7acaa46b278b7f71429ccf575'
- '38bc051a8a4b5c2dbee2c1d4b73083eb8708b689935448b9767f5d339a684f44')
+ 'ef94c4f263c45515bc3c2b1a506ad6385203f5e691f7a6221ca1716406410490'
+ '48c514de0f440a0f33278a0d7f5e477a7472a3c8e495856cffe5f39b3bc62652')
prepare() {
cd $_pkgname-$pkgver
- patch -Np1 -i ../fix-missing-icons.patch
+ patch -Np1 -i ../collabwrapper.patch
+ patch -Np1 -i ../various-fixes.patch
find . -type f | xargs sed -i 's@^#!.*python$@#!/usr/bin/python2@'
sed -i 's/python %s; sleep 1/python2 %s; sleep 1/' pippy_app.py
- sed -i "s/require_version('Vte', '2.90')/require_version('Vte', '2.91')/" activity.py pippy_app.py
- sed -i 's/self._collab.props.leader/self._collab._leader/' pippy_app.py texteditor.py
rm -r library/box2d_*/ library/Box2D.py library/LICENSE
}
Added: collabwrapper.patch
===================================================================
--- collabwrapper.patch (rev 0)
+++ collabwrapper.patch 2017-03-30 18:54:03 UTC (rev 220115)
@@ -0,0 +1,76 @@
+From 95a0365a2a14cfcb5a9c10cd72351801c12e4a26 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 9 Mar 2016 15:13:08 +1100
+Subject: [PATCH] use latest collabwrapper.py
+
+Fixes failure to start in Pippy-70, tested on Ubuntu 15.10, caused by
+my mixing versions of collabwrapper sources.
+
+Traceback (most recent call last):
+ File "/usr/bin/sugar-activity", line 169, in <module>
+ main()
+ File "/usr/bin/sugar-activity", line 164, in main
+ instance = create_activity_instance(activity_constructor, activity_handle)
+ File "/usr/bin/sugar-activity", line 42, in create_activity_instance
+ activity = constructor(handle)
+ File "/usr/share/sugar/activities/Pippy.activity/pippy_app.py", line 160, in __init__
+ self.set_canvas(self.initialize_display())
+ File "/usr/share/sugar/activities/Pippy.activity/pippy_app.py", line 387, in initialize_display
+ self._source_tabs.add_tab() # New instance, ergo empty tab
+ File "/usr/share/sugar/activities/Pippy.activity/notebook.py", line 209, in add_tab
+ buffer_text, editor_id, self._collab)
+ File "/usr/share/sugar/activities/Pippy.activity/notebook.py", line 151, in __init__
+ text_buffer, editor_id, collab)
+ File "/usr/share/sugar/activities/Pippy.activity/texteditor.py", line 80, in __init__
+ if not self._collab.props.leader:
+AttributeError: 'gi._gobject.GProps' object has no attribute 'leader'
+---
+ collabwrapper.py | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/collabwrapper.py b/collabwrapper.py
+index 80c5967..ab178da 100644
+--- a/collabwrapper.py
++++ b/collabwrapper.py
+@@ -178,6 +178,7 @@ def setup(self):
+ self._alert(_('Joining activity...'),
+ _('Please wait for the connection...'))
+ else:
++ self._leader = True
+ if not self.activity.metadata or self.activity.metadata.get(
+ 'share-scope', SCOPE_PRIVATE) == \
+ SCOPE_PRIVATE:
+@@ -203,8 +204,6 @@ def __shared_cb(self, sender):
+ self.shared_activity = self.activity.shared_activity
+ self._setup_text_channel()
+ self._listen_for_channels()
+-
+- self._leader = True
+ _logger.debug('I am sharing...')
+
+ def __joined_cb(self, sender):
+@@ -364,6 +363,14 @@ def get_client_name(self):
+ '''
+ return CLIENT + '.' + self.activity.get_bundle_id()
+
++ @GObject.property
++ def leader(self):
++ '''
++ Boolean of if this client is the leader in this activity. The
++ way the leader is decided may change, however there should only
++ ever be 1 leader for an activity.
++ '''
++ return self._leader
+
+ FT_STATE_NONE = 0
+ FT_STATE_PENDING = 1
+@@ -657,8 +664,7 @@ def __init__(self, buddy, conn, path, filename, description, mime):
+ self._create_channel(file_size)
+
+ def _get_input_stream(self):
+- logging.debug('opening %s for reading', self._file_name)
+- input_stream = Gio.File.new_for_path(self._file_name).read(None)
++ input_stream = Gio.File.new_for_path(self._path).read(None)
+
+
+ class OutgoingBlobTransfer(_BaseOutgoingTransfer):
Deleted: fix-missing-icons.patch
===================================================================
--- fix-missing-icons.patch 2017-03-30 18:54:01 UTC (rev 220114)
+++ fix-missing-icons.patch 2017-03-30 18:54:03 UTC (rev 220115)
@@ -1,49 +0,0 @@
-From 3f4af9d67adb530503e42ec10f39f2f6255df0ad Mon Sep 17 00:00:00 2001
-From: James Cameron <quozl at laptop.org>
-Date: Wed, 18 May 2016 12:00:33 +1000
-Subject: [PATCH] Fix missing run, stop, clear icons
-
-Three toolbar icons were not visible until pressed.
-
-Cause was missing show() method call.
----
- pippy_app.py | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/pippy_app.py b/pippy_app.py
-index fadf74f..55297bc 100644
---- a/pippy_app.py
-+++ b/pippy_app.py
-@@ -256,8 +256,10 @@ def initialize_display(self):
-
- icon_bw = Gtk.Image()
- icon_bw.set_from_file(os.path.join(icons_path, 'run_bw.svg'))
-+ icon_bw.show()
- icon_color = Gtk.Image()
- icon_color.set_from_file(os.path.join(icons_path, 'run_color.svg'))
-+ icon_color.show()
- button = ToolButton(label=_('Run!'))
- button.props.accelerator = _('<alt>r')
- button.set_icon_widget(icon_bw)
-@@ -270,8 +272,10 @@ def initialize_display(self):
-
- icon_bw = Gtk.Image()
- icon_bw.set_from_file(os.path.join(icons_path, 'stopit_bw.svg'))
-+ icon_bw.show()
- icon_color = Gtk.Image()
- icon_color.set_from_file(os.path.join(icons_path, 'stopit_color.svg'))
-+ icon_color.show()
- button = ToolButton(label=_('Stop'))
- button.props.accelerator = _('<alt>s')
- button.set_icon_widget(icon_bw)
-@@ -284,8 +288,10 @@ def initialize_display(self):
-
- icon_bw = Gtk.Image()
- icon_bw.set_from_file(os.path.join(icons_path, 'eraser_bw.svg'))
-+ icon_bw.show()
- icon_color = Gtk.Image()
- icon_color.set_from_file(os.path.join(icons_path, 'eraser_color.svg'))
-+ icon_color.show()
- button = ToolButton(label=_('Clear'))
- button.props.accelerator = _('<alt>c')
- button.set_icon_widget(icon_bw)
Added: various-fixes.patch
===================================================================
--- various-fixes.patch (rev 0)
+++ various-fixes.patch 2017-03-30 18:54:03 UTC (rev 220115)
@@ -0,0 +1,782 @@
+From aac1691ef7516f67f88ce372b094d7ce53a9d886 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 11:05:39 +1000
+Subject: [PATCH 01/10] Use either Vte version
+
+---
+ activity.py | 5 ++++-
+ pippy_app.py | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/activity.py b/activity.py
+index 15f89f4..d51f710 100755
+--- a/activity.py
++++ b/activity.py
+@@ -24,7 +24,10 @@
+ from gi.repository import Gtk
+ from gi.repository import Gdk
+ from gi.repository import Pango
+-require_version('Vte', '2.90')
++try:
++ require_version('Vte', '2.91')
++except:
++ require_version('Vte', '2.90')
+ from gi.repository import Vte
+ from gi.repository import GLib
+
+diff --git a/pippy_app.py b/pippy_app.py
+index 5b36da3..fadf74f 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -46,7 +46,10 @@
+ from gi.repository import Gdk
+ from gi.repository import GLib
+ from gi.repository import Pango
+-require_version('Vte', '2.90')
++try:
++ require_version('Vte', '2.91')
++except:
++ require_version('Vte', '2.90')
+ from gi.repository import Vte
+ from gi.repository import GObject
+
+
+From 3f4af9d67adb530503e42ec10f39f2f6255df0ad Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 12:00:33 +1000
+Subject: [PATCH 02/10] Fix missing run, stop, clear icons
+
+Three toolbar icons were not visible until pressed.
+
+Cause was missing show() method call.
+---
+ pippy_app.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/pippy_app.py b/pippy_app.py
+index fadf74f..55297bc 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -256,8 +256,10 @@ def initialize_display(self):
+
+ icon_bw = Gtk.Image()
+ icon_bw.set_from_file(os.path.join(icons_path, 'run_bw.svg'))
++ icon_bw.show()
+ icon_color = Gtk.Image()
+ icon_color.set_from_file(os.path.join(icons_path, 'run_color.svg'))
++ icon_color.show()
+ button = ToolButton(label=_('Run!'))
+ button.props.accelerator = _('<alt>r')
+ button.set_icon_widget(icon_bw)
+@@ -270,8 +272,10 @@ def initialize_display(self):
+
+ icon_bw = Gtk.Image()
+ icon_bw.set_from_file(os.path.join(icons_path, 'stopit_bw.svg'))
++ icon_bw.show()
+ icon_color = Gtk.Image()
+ icon_color.set_from_file(os.path.join(icons_path, 'stopit_color.svg'))
++ icon_color.show()
+ button = ToolButton(label=_('Stop'))
+ button.props.accelerator = _('<alt>s')
+ button.set_icon_widget(icon_bw)
+@@ -284,8 +288,10 @@ def initialize_display(self):
+
+ icon_bw = Gtk.Image()
+ icon_bw.set_from_file(os.path.join(icons_path, 'eraser_bw.svg'))
++ icon_bw.show()
+ icon_color = Gtk.Image()
+ icon_color.set_from_file(os.path.join(icons_path, 'eraser_color.svg'))
++ icon_color.show()
+ button = ToolButton(label=_('Clear'))
+ button.props.accelerator = _('<alt>c')
+ button.set_icon_widget(icon_bw)
+
+From 8fe56e16a67105dc29ee175c5d73c1598c8a901d Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Thu, 12 May 2016 17:39:48 +1000
+Subject: [PATCH 03/10] Repair Gtk tutorial examples
+
+- gi.require_version added,
+
+- trailing blanks removed,
+
+- double blank line after class.
+---
+ data/en/tutorials/Tutorial_07_gtk_basic_form.py | 3 +++
+ data/en/tutorials/Tutorial_08_gtk_button_form.py | 10 ++++++----
+ data/en/tutorials/Tutorial_09_gtk_entry.py | 6 ++++--
+ data/es/tutorials/Tutorial_07_gtk_ventana_basica.py | 3 +++
+ data/es/tutorials/Tutorial_08_gtk_ventana_boton.py | 10 ++++++----
+ data/es/tutorials/Tutorial_09_gtk_caja_de_texto.py | 6 ++++--
+ 6 files changed, 26 insertions(+), 12 deletions(-)
+
+diff --git a/data/en/tutorials/Tutorial_07_gtk_basic_form.py b/data/en/tutorials/Tutorial_07_gtk_basic_form.py
+index 26d5e04..65f5eb8 100644
+--- a/data/en/tutorials/Tutorial_07_gtk_basic_form.py
++++ b/data/en/tutorials/Tutorial_07_gtk_basic_form.py
+@@ -1,3 +1,5 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+
+ class PyApp(Gtk.Window):
+@@ -10,5 +12,6 @@ def __init__(self):
+ self.set_size_request(250, 150)
+ self.show()
+
++
+ PyApp()
+ Gtk.main()
+diff --git a/data/en/tutorials/Tutorial_08_gtk_button_form.py b/data/en/tutorials/Tutorial_08_gtk_button_form.py
+index ce8b886..5cca4b7 100644
+--- a/data/en/tutorials/Tutorial_08_gtk_button_form.py
++++ b/data/en/tutorials/Tutorial_08_gtk_button_form.py
+@@ -1,14 +1,16 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+
+ class PyApp(Gtk.Window):
+ def __init__(self):
+
+ super(PyApp, self).__init__()
+-
++
+ self.set_title('Button')
+ self.set_size_request(250, 200)
+ self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
+-
++
+ def button_cb(widget):
+ print 'click'
+
+@@ -16,9 +18,9 @@ def button_cb(widget):
+ fixed = Gtk.Fixed()
+ fixed.put(button, 20, 30)
+ button.connect('clicked', button_cb)
+-
++
+ self.connect('destroy', Gtk.main_quit)
+-
++
+ self.add(fixed)
+ self.show_all()
+
+diff --git a/data/en/tutorials/Tutorial_09_gtk_entry.py b/data/en/tutorials/Tutorial_09_gtk_entry.py
+index a38639b..5ad6a22 100644
+--- a/data/en/tutorials/Tutorial_09_gtk_entry.py
++++ b/data/en/tutorials/Tutorial_09_gtk_entry.py
+@@ -1,3 +1,5 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+ from gi.repository import Gdk
+
+@@ -8,10 +10,10 @@ def __init__(self):
+ self.set_title('Text Entry')
+ self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
+ self.set_size_request(250, 150)
+-
++
+ def entry_cb(widget, event):
+ if Gdk.keyval_name(event.keyval) == 'Return':
+- print widget.get_text()
++ print widget.get_text()
+
+ entry = Gtk.Entry()
+ entry.connect('key_press_event', entry_cb)
+diff --git a/data/es/tutorials/Tutorial_07_gtk_ventana_basica.py b/data/es/tutorials/Tutorial_07_gtk_ventana_basica.py
+index 0b233b4..60b281f 100644
+--- a/data/es/tutorials/Tutorial_07_gtk_ventana_basica.py
++++ b/data/es/tutorials/Tutorial_07_gtk_ventana_basica.py
+@@ -1,3 +1,5 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+
+ class PyApp(Gtk.Window):
+@@ -12,5 +14,6 @@ def __init__(self):
+
+ self.show()
+
++
+ PyApp()
+ Gtk.main()
+diff --git a/data/es/tutorials/Tutorial_08_gtk_ventana_boton.py b/data/es/tutorials/Tutorial_08_gtk_ventana_boton.py
+index 5380dc7..f195e94 100644
+--- a/data/es/tutorials/Tutorial_08_gtk_ventana_boton.py
++++ b/data/es/tutorials/Tutorial_08_gtk_ventana_boton.py
+@@ -1,13 +1,15 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+
+ class PyApp(Gtk.Window):
+ def __init__(self):
+ super(PyApp, self).__init__()
+-
++
+ self.set_title("Boton")
+ self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
+ self.set_size_request(250, 200)
+-
++
+ def button_cb(widget):
+ print 'click'
+
+@@ -15,9 +17,9 @@ def button_cb(widget):
+ fixed = Gtk.Fixed()
+ fixed.put(button, 20, 30)
+ button.connect('clicked', button_cb)
+-
++
+ self.connect("destroy", Gtk.main_quit)
+-
++
+ self.add(fixed)
+ self.show_all()
+
+diff --git a/data/es/tutorials/Tutorial_09_gtk_caja_de_texto.py b/data/es/tutorials/Tutorial_09_gtk_caja_de_texto.py
+index 96d4cb2..2016758 100644
+--- a/data/es/tutorials/Tutorial_09_gtk_caja_de_texto.py
++++ b/data/es/tutorials/Tutorial_09_gtk_caja_de_texto.py
+@@ -1,3 +1,5 @@
++import gi
++gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+ from gi.repository import Gdk
+
+@@ -8,10 +10,10 @@ def __init__(self):
+ self.set_title('Entrada de Texto')
+ self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
+ self.set_size_request(250, 150)
+-
++
+ def entry_cb(widget, event):
+ if Gdk.keyval_name(event.keyval) == 'Return':
+- print widget.get_text()
++ print widget.get_text()
+
+ entry = Gtk.Entry()
+ entry.connect('key_press_event', entry_cb)
+
+From cce542fdeb8caf183c3d0a53bb9e5eaeefad4d23 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 11 May 2016 18:59:41 +1000
+Subject: [PATCH 04/10] Pong example playability
+
+- use mouse instead of keyboard, as mouse can be positioned rapidly,
+
+- constrain to 25 frames per second (fps), tested on XO-1,
+
+- when waiting for start, constrain to 5 fps,
+
+- raise ball speed; maximum four seconds across 1200 pixel width.
+---
+ data/en/graphics/pong | 21 +++++++--------------
+ 1 file changed, 7 insertions(+), 14 deletions(-)
+
+diff --git a/data/en/graphics/pong b/data/en/graphics/pong
+index bd2f75f..7cb71c9 100644
+--- a/data/en/graphics/pong
++++ b/data/en/graphics/pong
+@@ -24,9 +24,6 @@ size = width, height = screen.get_size()
+ # turn off the cursor
+ pygame.mouse.set_visible(False)
+
+-# turn on key repeating (repeat 40 times per second)
+-pygame.key.set_repeat(25, 25)
+-
+ # start the screen all black
+ bgcolor = (0, 0, 0)
+ screen.fill(bgcolor)
+@@ -36,7 +33,6 @@ paddle_width = 20
+ paddle_length = 100
+ paddle_radius = paddle_length / 2
+ paddle_color = (250, 250, 250)
+-step = 6 # paddle moves 3 pixels at a go
+
+ # ball constants
+ ball_color = (250, 250, 250)
+@@ -44,7 +40,7 @@ ball_radius = 25
+
+ # game constants
+ fsize = 48
+-msg = 'Press \'g\' to start game'
++msg = "Press 'g' to start game"
+
+ font = pygame.font.Font(None, fsize)
+ text = font.render(msg, True, (250, 250, 250))
+@@ -81,7 +77,7 @@ while pippy.pygame.next_frame():
+ while balls > 0:
+
+ ball_position = [ball_radius, ball_radius]
+- ball_mvect = [randint(3, 5), randint(3, 5)]
++ ball_mvect = [randint(9, 12), randint(5, 12)]
+ ball_limit = size
+ balls = balls - 1
+
+@@ -94,14 +90,8 @@ while pippy.pygame.next_frame():
+ elif event.type == KEYDOWN:
+ if event.key == K_ESCAPE:
+ sys.exit()
+- elif event.key == 273 \
+- or event.key == 265 \
+- or event.key == 264: # up
+- paddle_location = paddle_location - step
+- elif event.key == 274 \
+- or event.key == 259 \
+- or event.key == 258: # down
+- paddle_location = paddle_location + step
++
++ (_, paddle_location) = pygame.mouse.get_pos()
+
+ # make sure the paddle is in-bounds
+ if paddle_location - paddle_radius < 0:
+@@ -132,6 +122,7 @@ while pippy.pygame.next_frame():
+
+ # update the display
+ pygame.display.flip()
++ pippy.pygame.next_frame(max_fps=25)
+
+ # update the ball
+ for i in range(2):
+@@ -152,3 +143,5 @@ while pippy.pygame.next_frame():
+ and ball_position[1] < paddle_location + paddle_radius:
+ ball_position[i] = ball_limit[i] - ball_radius - paddle_width - 1
+ ball_mvect[i] = (-1) * ball_mvect[i]
++
++ pippy.pygame.next_frame(max_fps=5)
+
+From d80d2f7ce7a758b0fdfa0ec25bcf3b13e5a07e21 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 14:42:45 +1000
+Subject: [PATCH 05/10] Load example; omit En and Es directories
+
+After internationalisation the data/ directory has en/ and es/
+subdirectories, which were being shown as files in the file dialog.
+
+Only show files for loading in the file dialog, by switching from
+os.listdir to os.walk; the latter separates files from directories.
+---
+ filedialog.py | 32 ++++++++++++++++----------------
+ 1 file changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/filedialog.py b/filedialog.py
+index 166e29a..0c3e59d 100644
+--- a/filedialog.py
++++ b/filedialog.py
+@@ -129,22 +129,22 @@ def build_expand(self, path, name):
+ Gdk.color_parse('black'))
+
+ vbox = Gtk.VBox()
+- files = sorted(os.listdir(path))
+-
+- if not files:
+- return None
+-
+- for _file in files:
+- if _file.endswith('~'):
+- continue
+- entry = {"name": _(_file.capitalize()),
+- "path": os.path.join(path, _file)}
+-
+- button = Gtk.Button(entry['name'])
+- button.set_tooltip_text(entry['path'])
+- button.set_has_tooltip(False)
+- button.connect('clicked', self._destroy, True)
+- vbox.pack_start(button, False, False, 1)
++ for root, dirs, files in os.walk(path):
++
++ if not files:
++ return None
++
++ for _file in files:
++ if _file.endswith('~'):
++ continue
++ entry = {"name": _(_file.capitalize()),
++ "path": os.path.join(path, _file)}
++
++ button = Gtk.Button(entry['name'])
++ button.set_tooltip_text(entry['path'])
++ button.set_has_tooltip(False)
++ button.connect('clicked', self._destroy, True)
++ vbox.pack_start(button, False, False, 1)
+
+ expander.add(vbox)
+
+
+From d6d00fc644bca1dd8792ce2712968ee7c47606a0 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 14:43:55 +1000
+Subject: [PATCH 06/10] Save as library; only if writable
+
+When the bundle is installed by the system the data directory is not
+writable. This causes;
+
+Traceback (most recent call last):
+ File "/usr/share/sugar/activities/Pippy.activity/pippy_app.py", line 703, in _save_as_library
+ with open(os.path.join(library_dir, file_name), 'w') as f:
+IOError: [Errno 13] Permission denied: '/usr/share/sugar/activities/Pippy.activity/library/test.py'
+
+Make the button insensitive if the data directory cannot be written to.
+---
+ pippy_app.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/pippy_app.py b/pippy_app.py
+index 55297bc..ceb64f2 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -197,6 +197,8 @@ def initialize_display(self):
+ button.set_tooltip(_('Save this file to the Pippy library'))
+ button.connect('clicked', self._save_as_library)
+ activity_toolbar.insert(button, -1)
++ if not self._library_writable():
++ button.set_sensitive(False)
+ button.show()
+
+ button = ToolButton('pippy-export-example')
+@@ -689,6 +691,9 @@ def _stop_button_cb(self, button):
+ except:
+ pass # Process must already be dead.
+
++ def _library_writable(self):
++ return os.access(os.path.join(get_bundle_path(), 'library'), os.W_OK)
++
+ def _save_as_library(self, button):
+ library_dir = os.path.join(get_bundle_path(), 'library')
+ file_name = self._source_tabs.get_current_file_name()
+
+From 6fe6a905417590873385c0da255addcda44251f3 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 15:02:12 +1000
+Subject: [PATCH 07/10] Typo, disutils to distutils
+
+---
+ NEWS | 2 +-
+ icons/pippy-create-distutils.svg | 50 ++++++++++++++++++++++++++++++++++++++++
+ icons/pippy-create-disutils.svg | 50 ----------------------------------------
+ pippy_app.py | 20 ++++++++--------
+ 4 files changed, 61 insertions(+), 61 deletions(-)
+ create mode 100644 icons/pippy-create-distutils.svg
+ delete mode 100644 icons/pippy-create-disutils.svg
+
+diff --git a/NEWS b/NEWS
+index b8580c8..4c490df 100644
+--- a/NEWS
++++ b/NEWS
+@@ -100,7 +100,7 @@ BUG FIX:
+ 55
+
+ ENHANCEMENTS:
+-* Export as disutils, as library, as example (Sai Vineet)
++* Export as distutils, as library, as example (Sai Vineet)
+ * Edit on multiple tabs (Sai Vineet)
+ * Add custom icon selection when saving as Sugar activity (Ignacio Rodriguez)
+ * New icons
+diff --git a/icons/pippy-create-distutils.svg b/icons/pippy-create-distutils.svg
+new file mode 100644
+index 0000000..3f0717c
+--- /dev/null
++++ b/icons/pippy-create-distutils.svg
+@@ -0,0 +1,50 @@
++<?xml version="1.0" encoding="UTF-8" standalone="no"?>
++<!-- Created with Inkscape (http://www.inkscape.org/) -->
++
++<svg
++ xmlns:dc="http://purl.org/dc/elements/1.1/"
++ xmlns:cc="http://creativecommons.org/ns#"
++ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
++ xmlns:svg="http://www.w3.org/2000/svg"
++ xmlns="http://www.w3.org/2000/svg"
++ version="1.1"
++ width="55"
++ height="55"
++ viewBox="0 0 55 55"
++ id="svg2"
++ xml:space="preserve"><metadata
++ id="metadata12"><rdf:RDF><cc:Work
++ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
++ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
++ id="defs10" /><path
++ d="m 25.71298,32.769402 3.289473,-3.289473 6.578948,0 3.289473,3.289473 13.157895,0 0,20.394737 -26.315789,0 z"
++ id="path3854"
++ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
++ transform="matrix(1,0,0,-1,-27.367494,50.58726)"
++ id="g4770"
++ style="stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><g
++ transform="translate(34.0803,-1006.42)"
++ id="g4772"
++ style="stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><polyline
++ transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)"
++ style="fill:none;stroke:#ffffff;stroke-width:3.01383209;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
++ points="51.562,15.306 41.17,16.188 42.053,5.794"
++ id="polyline4774" /><path
++ d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067"
++ id="path4776"
++ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><g
++ transform="translate(-8.815209,-10.212129)"
++ id="g4709-6"
++ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><path
++ d="m 28.090497,40.381834 c 3.974667,-0.06221 9.878139,-1.753708 9.878139,-6.911631 0,-5.73755 -4.497322,-6.751378 -6.645938,-7.265877 -2.341015,-0.560569 -4.551388,-0.765446 -4.645545,-1.7177 -0.161426,-1.632578 0.768742,-2.268447 2.619566,-2.268447 0,0 4.402457,2.26367 8.142826,0.457274 1.05398,-0.509016 2.942197,-2.884533 2.942197,-4.523303 0,-1.639388 -6.094837,-3.533985 -7.944332,-3.533985 -1.850824,0 -3.424821,2.377206 -3.424821,2.377206 -3.700318,0 -7.401302,3.278776 -7.401302,6.557553 0,3.278158 3.417627,6.165937 7.653709,6.85261 1.962616,0.318142 3.729994,1.076753 3.3563,3.065286 -0.303435,1.614661 -1.696316,2.770905 -5.258386,2.736319 -2.749295,-0.02669 -6.417645,0.138525 -8.840139,-1.714654 -1.314772,-1.005784 -1.146531,-3.578075 -1.146531,-3.578075 0,0 -3.4034,0.162415 -2.757976,3.376412 0.965274,4.806741 6.251099,6.204027 13.472233,6.091012 z"
++ id="path2474-6"
++ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path
++ d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788"
++ id="path2476-1"
++ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle
++ cx="35.805"
++ cy="10.96"
++ r="1.676"
++ transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)"
++ id="circle2478-8"
++ style="fill:none;stroke:#ffffff;stroke-width:5.94110632;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></svg>
+\ No newline at end of file
+diff --git a/icons/pippy-create-disutils.svg b/icons/pippy-create-disutils.svg
+deleted file mode 100644
+index 3f0717c..0000000
+--- a/icons/pippy-create-disutils.svg
++++ /dev/null
+@@ -1,50 +0,0 @@
+-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+-<!-- Created with Inkscape (http://www.inkscape.org/) -->
+-
+-<svg
+- xmlns:dc="http://purl.org/dc/elements/1.1/"
+- xmlns:cc="http://creativecommons.org/ns#"
+- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+- xmlns:svg="http://www.w3.org/2000/svg"
+- xmlns="http://www.w3.org/2000/svg"
+- version="1.1"
+- width="55"
+- height="55"
+- viewBox="0 0 55 55"
+- id="svg2"
+- xml:space="preserve"><metadata
+- id="metadata12"><rdf:RDF><cc:Work
+- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+- id="defs10" /><path
+- d="m 25.71298,32.769402 3.289473,-3.289473 6.578948,0 3.289473,3.289473 13.157895,0 0,20.394737 -26.315789,0 z"
+- id="path3854"
+- style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
+- transform="matrix(1,0,0,-1,-27.367494,50.58726)"
+- id="g4770"
+- style="stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><g
+- transform="translate(34.0803,-1006.42)"
+- id="g4772"
+- style="stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><polyline
+- transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)"
+- style="fill:none;stroke:#ffffff;stroke-width:3.01383209;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+- points="51.562,15.306 41.17,16.188 42.053,5.794"
+- id="polyline4774" /><path
+- d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067"
+- id="path4776"
+- style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><g
+- transform="translate(-8.815209,-10.212129)"
+- id="g4709-6"
+- style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><path
+- d="m 28.090497,40.381834 c 3.974667,-0.06221 9.878139,-1.753708 9.878139,-6.911631 0,-5.73755 -4.497322,-6.751378 -6.645938,-7.265877 -2.341015,-0.560569 -4.551388,-0.765446 -4.645545,-1.7177 -0.161426,-1.632578 0.768742,-2.268447 2.619566,-2.268447 0,0 4.402457,2.26367 8.142826,0.457274 1.05398,-0.509016 2.942197,-2.884533 2.942197,-4.523303 0,-1.639388 -6.094837,-3.533985 -7.944332,-3.533985 -1.850824,0 -3.424821,2.377206 -3.424821,2.377206 -3.700318,0 -7.401302,3.278776 -7.401302,6.557553 0,3.278158 3.417627,6.165937 7.653709,6.85261 1.962616,0.318142 3.729994,1.076753 3.3563,3.065286 -0.303435,1.614661 -1.696316,2.770905 -5.258386,2.736319 -2.749295,-0.02669 -6.417645,0.138525 -8.840139,-1.714654 -1.314772,-1.005784 -1.146531,-3.578075 -1.146531,-3.578075 0,0 -3.4034,0.162415 -2.757976,3.376412 0.965274,4.806741 6.251099,6.204027 13.472233,6.091012 z"
+- id="path2474-6"
+- style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path
+- d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788"
+- id="path2476-1"
+- style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle
+- cx="35.805"
+- cy="10.96"
+- r="1.676"
+- transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)"
+- id="circle2478-8"
+- style="fill:none;stroke:#ffffff;stroke-width:5.94110632;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></svg>
+\ No newline at end of file
+diff --git a/pippy_app.py b/pippy_app.py
+index ceb64f2..0c463c7 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -101,7 +101,7 @@
+
+ groupthink_mimetype = 'pickle/groupthink-pippy'
+
+-DISUTILS_SETUP_SCRIPT = """#!/usr/bin/python
++DISTUTILS_SETUP_SCRIPT = """#!/usr/bin/python
+ # -*- coding: utf-8 -*-
+ from distutils.core import setup
+ setup(name='{modulename}',
+@@ -112,7 +112,7 @@
+ )
+ """ # This is .format()'ed with the list of the file names.
+
+-DISUTILS_SETUP_SCRIPT = """#!/usr/bin/python
++DISTUTILS_SETUP_SCRIPT = """#!/usr/bin/python
+ # -*- coding: utf-8 -*-
+ from distutils.core import setup
+ setup(name='{modulename}',
+@@ -213,10 +213,10 @@ def initialize_display(self):
+ activity_toolbar.insert(button, -1)
+ button.show()
+
+- button = ToolButton('pippy-create-disutils')
++ button = ToolButton('pippy-create-distutils')
+ # TRANS: A distutils package is used to distribute Python modules
+- button.set_tooltip(_('Export as a disutils package'))
+- button.connect('clicked', self._export_disutils_cb)
++ button.set_tooltip(_('Export as a distutils package'))
++ button.connect('clicked', self._export_distutils_cb)
+ activity_toolbar.insert(button, -1)
+ button.show()
+
+@@ -858,7 +858,7 @@ def _write_text_buffer(self, filename):
+ for line in text:
+ f.write(line)
+
+- def _export_disutils_cb(self, button):
++ def _export_distutils_cb(self, button):
+ app_temp = os.path.join(self.get_activity_root(), 'instance')
+ data = self._source_tabs.get_all_data()
+ for filename, content in zip(data[0], data[1]):
+@@ -871,17 +871,17 @@ def _export_disutils_cb(self, button):
+ title = self._pippy_instance.metadata['title']
+ if title is _('Pippy Activity'):
+ alert = Alert()
+- alert.props.title = _('Save as disutils package error')
++ alert.props.title = _('Save as distutils package error')
+ alert.props.msg = _('Please give your activity a meaningful '
+ 'name before attempting to save it '
+- 'as an disutils package.')
++ 'as an distutils package.')
+ ok_icon = Icon(icon_name='dialog-ok')
+ alert.add_button(Gtk.ResponseType.OK, _('Ok'), ok_icon)
+ alert.connect('response', self._dismiss_alert_cb)
+ self.add_alert(alert)
+ return
+
+- setup_script = DISUTILS_SETUP_SCRIPT.format(modulename=title,
++ setup_script = DISTUTILS_SETUP_SCRIPT.format(modulename=title,
+ filenames=filenames)
+ setupfile = open(os.path.join(app_temp, 'setup.py'), 'w')
+ setupfile.write(setup_script)
+@@ -897,7 +897,7 @@ def _export_disutils_cb(self, button):
+ os.chmod(app_temp, 0777)
+ jobject = datastore.create()
+ metadata = {
+- 'title': '%s disutils bundle' % title,
++ 'title': '%s distutils bundle' % title,
+ 'title_set_by_user': '1',
+ 'mime_type': 'application/x-gzip',
+ }
+
+From 60d73542fbbbb3a4cd3614266bb394adae1bb1f8 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 15:46:29 +1000
+Subject: [PATCH 08/10] Load examples in new tab
+
+With an example already loading, loading another causes empty new tab,
+and the previous tab content is erased and loaded with the new example.
+
+Reproducer: start Pippy, load an example, load a second example.
+
+Was caused by commit b45deb6297ef75dcf1f9d6de09f7815b1a6ca542 ('Fix
+issue #27, #29') trying to allow multiple examples to be open in
+different tabs; after the call to _add_source_cb a new call to
+get_text_buffer() was needed.
+
+However, there isn't a good reason to automatically destroy the original
+empty tab, and by removing that behaviour the code is simplified. The
+user can always destroy the tab if there is more than one.
+---
+ pippy_app.py | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/pippy_app.py b/pippy_app.py
+index 0c463c7..d6424b7 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -562,17 +562,8 @@ def _selection_cb(self, value):
+ _logger.debug('clicked! %s' % value['path'])
+ _file = open(value['path'], 'r')
+ lines = _file.readlines()
++ self._add_source_cb(None)
+ text_buffer = self._source_tabs.get_text_buffer()
+- current_content = text_buffer.get_text(
+- *text_buffer.get_bounds(),
+- include_hidden_chars=True)
+- if current_content != "":
+- # Add a new page to the notebook with the example
+- self._add_source_cb(None)
+- if text_buffer.get_modified():
+- self._source_tabs.add_tab()
+- self.session_data.append(None)
+- text_buffer = self._source_tabs.get_text_buffer()
+ text_buffer.set_text(''.join(lines))
+ text_buffer.set_modified(False)
+ self._pippy_instance.metadata['title'] = value['name']
+
+From 037467502bf064005f0d5c1620fabd50bd1b5208 Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Wed, 18 May 2016 15:56:52 +1000
+Subject: [PATCH 09/10] Rename example load to open
+
+The feature opens a new tab to show a file, so use "load" instead of
+"open". Avoid "bundle," which can be confused with Sugar activity
+bundles.
+
+Did not regenerate the POT file, as it is very very old. Out of scope.
+---
+ filedialog.py | 2 +-
+ pippy_app.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/filedialog.py b/filedialog.py
+index 0c3e59d..1ac2740 100644
+--- a/filedialog.py
++++ b/filedialog.py
+@@ -76,7 +76,7 @@ def build_toolbar(self):
+ toolbox = ToolbarBox()
+ toolbar = toolbox.toolbar
+
+- label = Gtk.Label(_('Open an example bundle'))
++ label = Gtk.Label(_('Choose an example to open'))
+ label.modify_fg(Gtk.StateType.NORMAL,
+ Gdk.color_parse('white'))
+
+diff --git a/pippy_app.py b/pippy_app.py
+index d6424b7..3b33447 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -311,7 +311,7 @@ def initialize_display(self):
+ separator.show()
+
+ button = ToolButton('pippy-openoff')
+- button.set_tooltip(_('Load example'))
++ button.set_tooltip(_('Open an example'))
+ button.connect('clicked', self._load_example_cb)
+ self.get_toolbar_box().toolbar.insert(button, -1)
+ button.show()
+
+From fd6f0b7bea0069c4880630b40b5585bd576962ee Mon Sep 17 00:00:00 2001
+From: James Cameron <quozl at laptop.org>
+Date: Mon, 23 May 2016 12:35:34 +1000
+Subject: [PATCH 10/10] Copy from Vte or text buffer
+
+---
+ pippy_app.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/pippy_app.py b/pippy_app.py
+index 3b33447..15ff830 100644
+--- a/pippy_app.py
++++ b/pippy_app.py
+@@ -627,8 +627,11 @@ def __redobutton_cb(self, button):
+
+ def __copybutton_cb(self, button):
+ text_buffer = self._source_tabs.get_text_buffer()
+- clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
+- text_buffer.copy_clipboard(clipboard)
++ if self._vte.get_has_selection():
++ self._vte.copy_clipboard()
++ elif text_buffer.get_has_selection():
++ clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
++ text_buffer.copy_clipboard(clipboard)
+
+ def __pastebutton_cb(self, button):
+ text_buffer = self._source_tabs.get_text_buffer()
More information about the arch-commits
mailing list