Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-14 Thread Gonzalo Odiard
Thanks for all the feedback.
Will do a new release soon.

Gonzalo


On Thu, May 14, 2015 at 4:01 AM, James Cameron qu...@laptop.org wrote:

 The problem followed the SD card.

 Booting from NAND Flash on two different systems, the
 GStreamer-CRITICAL warnings and related silence occur roughly one out
 of every 30 starts from journal.

 So there is a race condition of some sort, but it affects some laptops
 more than others, because of storage I/O timing.

 It might have been there already, so unless you can reproduce it,
 don't worry about it.

 On Thu, May 14, 2015 at 12:52:37PM +1000, James Cameron wrote:
  Thanks.  Applied both.  Continue to show segmentation faults, the
  GStreamer-CRITICAL warnings, a lock up CPU loop (not fixed by stop in
  frame), and rarely:
 
  *** glibc detected *** python2: malloc(): memory corruption: 0x0a2dcb68
 ***
  Terminated by signal 11, pid 2688 data (None, open file 'fdopen',
 mode 'w' at 0x993a9c0, '3d0b3c7e93a6309a37688bcf60186a2ed9533795')
 
  The same hardware is not showing any other signs of distress.
 
  But it is running from SD card, so I'll try from internal NAND Flash.
 
  On Wed, May 13, 2015 at 12:40:11PM -0300, Gonzalo Odiard wrote:
   I have pushed two changes to the clock activity repo
   and send a pr to sugar-toolkit-gtk3 [1]
  
   The pr avoid checking if the espeak plugin is installed every time
   the enabled() function is called. I suppose that could remove the
 scanning.
  
   I couldn't reproduce the crash here, testing in sugar-build on F21,
   in a xo-1 with 13.2.4 and in a vm with ubuntu.
  
   Gonzalo
  
   [1] [1]https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
  
   On Tue, May 12, 2015 at 7:21 PM, James Cameron [2]qu...@laptop.org
 wrote:
  
   On Tue, May 12, 2015 at 06:22:42PM -0300, Gonzalo Odiard wrote:
I think I found the problem.
Could you confirm replacing the attached file in the activity
 dir?
  
   Thanks, that's much better.  The warning about rate and the delay
   before speaking have been fixed.
  
   Rarely, about one in 10 times, it doesn't speak, and reports in log
  
   (sugar-activity:2492): GStreamer-CRITICAL **:
 gst_memory_new_wrapped:
   assertion `offset + size = maxsize' failed
  
   (sugar-activity:2492): GStreamer-CRITICAL **:
 gst_buffer_insert_memory:
   assertion `mem != NULL' failed
  
   Rarely, about one in 5 times, it does segmentation fault.  I've
   captured two core dumps by adding ulimit -c unlimited to
   ~/.sugar/debug.  Both showed similar stack traces; a thread busy
 doing
   an fts_open and fts_sort at the same time as the main thread doing
   something else.
  
   [3]http://dev.laptop.org/~quozl/z/1YsIKF.txt
  
   Speculation: the Gst.init() in src/sugar3/speech.py creates a
 thread
   which is racing with something in the main thread.  fts_open and
   fts_sort are necessary calls for scanning plugins.
  
   Sometimes the race condition corrupts pointers and we get the
 silence
   with GStreamer-CRITICAL messages.  Sometimes the corruption causes
 a
   segmentation fault.
  
   Perhaps _GstSpeechPlayer should wait for good Gst.State before the
   next call into Gst?
  
   I remember recent work on GStreamer plugin scan initialisation in
   Sugar, but I can't find it yet.
  
   --
   James Cameron
   [4]http://quozl.linux.org.au/
  
   --
   Gonzalo Odiard
  
   SugarLabs - Software for children learning
  
   References:
  
   [1] https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
   [2] mailto:qu...@laptop.org
   [3] http://dev.laptop.org/~quozl/z/1YsIKF.txt
   [4] http://quozl.linux.org.au/
 
   ___
   Sugar-devel mailing list
   Sugar-devel@lists.sugarlabs.org
   http://lists.sugarlabs.org/listinfo/sugar-devel
 
 
  --
  James Cameron
  http://quozl.linux.org.au/

 --
 James Cameron
 http://quozl.linux.org.au/




-- 
Gonzalo Odiard

SugarLabs - Software for children learning
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-14 Thread James Cameron
The problem followed the SD card.

Booting from NAND Flash on two different systems, the
GStreamer-CRITICAL warnings and related silence occur roughly one out
of every 30 starts from journal.

So there is a race condition of some sort, but it affects some laptops
more than others, because of storage I/O timing.

It might have been there already, so unless you can reproduce it,
don't worry about it.

On Thu, May 14, 2015 at 12:52:37PM +1000, James Cameron wrote:
 Thanks.  Applied both.  Continue to show segmentation faults, the
 GStreamer-CRITICAL warnings, a lock up CPU loop (not fixed by stop in
 frame), and rarely:
 
 *** glibc detected *** python2: malloc(): memory corruption: 0x0a2dcb68 ***
 Terminated by signal 11, pid 2688 data (None, open file 'fdopen', mode 'w' 
 at 0x993a9c0, '3d0b3c7e93a6309a37688bcf60186a2ed9533795')
 
 The same hardware is not showing any other signs of distress.
 
 But it is running from SD card, so I'll try from internal NAND Flash.
 
 On Wed, May 13, 2015 at 12:40:11PM -0300, Gonzalo Odiard wrote:
  I have pushed two changes to the clock activity repo
  and send a pr to sugar-toolkit-gtk3 [1]
  
  The pr avoid checking if the espeak plugin is installed every time
  the enabled() function is called. I suppose that could remove the scanning.
  
  I couldn't reproduce the crash here, testing in sugar-build on F21,
  in a xo-1 with 13.2.4 and in a vm with ubuntu.
  
  Gonzalo
  
  [1] [1]https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
  
  On Tue, May 12, 2015 at 7:21 PM, James Cameron [2]qu...@laptop.org wrote:
  
  On Tue, May 12, 2015 at 06:22:42PM -0300, Gonzalo Odiard wrote:
   I think I found the problem. 
   Could you confirm replacing the attached file in the activity dir?
  
  Thanks, that's much better.  The warning about rate and the delay
  before speaking have been fixed.
  
  Rarely, about one in 10 times, it doesn't speak, and reports in log
  
  (sugar-activity:2492): GStreamer-CRITICAL **: gst_memory_new_wrapped:
  assertion `offset + size = maxsize' failed
  
  (sugar-activity:2492): GStreamer-CRITICAL **: gst_buffer_insert_memory:
  assertion `mem != NULL' failed
  
  Rarely, about one in 5 times, it does segmentation fault.  I've
  captured two core dumps by adding ulimit -c unlimited to
  ~/.sugar/debug.  Both showed similar stack traces; a thread busy doing
  an fts_open and fts_sort at the same time as the main thread doing
  something else.
  
  [3]http://dev.laptop.org/~quozl/z/1YsIKF.txt
  
  Speculation: the Gst.init() in src/sugar3/speech.py creates a thread
  which is racing with something in the main thread.  fts_open and
  fts_sort are necessary calls for scanning plugins.
  
  Sometimes the race condition corrupts pointers and we get the silence
  with GStreamer-CRITICAL messages.  Sometimes the corruption causes a
  segmentation fault.
  
  Perhaps _GstSpeechPlayer should wait for good Gst.State before the
  next call into Gst?
  
  I remember recent work on GStreamer plugin scan initialisation in
  Sugar, but I can't find it yet.
  
  --
  James Cameron
  [4]http://quozl.linux.org.au/
  
  --
  Gonzalo Odiard
  
  SugarLabs - Software for children learning 
  
  References:
  
  [1] https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
  [2] mailto:qu...@laptop.org
  [3] http://dev.laptop.org/~quozl/z/1YsIKF.txt
  [4] http://quozl.linux.org.au/
 
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
 
 -- 
 James Cameron
 http://quozl.linux.org.au/

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-13 Thread Gonzalo Odiard
I have pushed two changes to the clock activity repo
and send a pr to sugar-toolkit-gtk3 [1]

The pr avoid checking if the espeak plugin is installed every time
the enabled() function is called. I suppose that could remove the scanning.

I couldn't reproduce the crash here, testing in sugar-build on F21,
in a xo-1 with 13.2.4 and in a vm with ubuntu.

Gonzalo


[1] https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215

On Tue, May 12, 2015 at 7:21 PM, James Cameron qu...@laptop.org wrote:

 On Tue, May 12, 2015 at 06:22:42PM -0300, Gonzalo Odiard wrote:
  I think I found the problem.
  Could you confirm replacing the attached file in the activity dir?

 Thanks, that's much better.  The warning about rate and the delay
 before speaking have been fixed.

 Rarely, about one in 10 times, it doesn't speak, and reports in log

 (sugar-activity:2492): GStreamer-CRITICAL **: gst_memory_new_wrapped:
 assertion `offset + size = maxsize' failed

 (sugar-activity:2492): GStreamer-CRITICAL **: gst_buffer_insert_memory:
 assertion `mem != NULL' failed

 Rarely, about one in 5 times, it does segmentation fault.  I've
 captured two core dumps by adding ulimit -c unlimited to
 ~/.sugar/debug.  Both showed similar stack traces; a thread busy doing
 an fts_open and fts_sort at the same time as the main thread doing
 something else.

 http://dev.laptop.org/~quozl/z/1YsIKF.txt

 Speculation: the Gst.init() in src/sugar3/speech.py creates a thread
 which is racing with something in the main thread.  fts_open and
 fts_sort are necessary calls for scanning plugins.

 Sometimes the race condition corrupts pointers and we get the silence
 with GStreamer-CRITICAL messages.  Sometimes the corruption causes a
 segmentation fault.

 Perhaps _GstSpeechPlayer should wait for good Gst.State before the
 next call into Gst?

 I remember recent work on GStreamer plugin scan initialisation in
 Sugar, but I can't find it yet.

 --
 James Cameron
 http://quozl.linux.org.au/




-- 
Gonzalo Odiard

SugarLabs - Software for children learning
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-13 Thread James Cameron
Thanks.  Applied both.  Continue to show segmentation faults, the
GStreamer-CRITICAL warnings, a lock up CPU loop (not fixed by stop in
frame), and rarely:

*** glibc detected *** python2: malloc(): memory corruption: 0x0a2dcb68 ***
Terminated by signal 11, pid 2688 data (None, open file 'fdopen', mode 'w' 
at 0x993a9c0, '3d0b3c7e93a6309a37688bcf60186a2ed9533795')

The same hardware is not showing any other signs of distress.

But it is running from SD card, so I'll try from internal NAND Flash.

On Wed, May 13, 2015 at 12:40:11PM -0300, Gonzalo Odiard wrote:
 I have pushed two changes to the clock activity repo
 and send a pr to sugar-toolkit-gtk3 [1]
 
 The pr avoid checking if the espeak plugin is installed every time
 the enabled() function is called. I suppose that could remove the scanning.
 
 I couldn't reproduce the crash here, testing in sugar-build on F21,
 in a xo-1 with 13.2.4 and in a vm with ubuntu.
 
 Gonzalo
 
 [1] [1]https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
 
 On Tue, May 12, 2015 at 7:21 PM, James Cameron [2]qu...@laptop.org wrote:
 
 On Tue, May 12, 2015 at 06:22:42PM -0300, Gonzalo Odiard wrote:
  I think I found the problem. 
  Could you confirm replacing the attached file in the activity dir?
 
 Thanks, that's much better.  The warning about rate and the delay
 before speaking have been fixed.
 
 Rarely, about one in 10 times, it doesn't speak, and reports in log
 
 (sugar-activity:2492): GStreamer-CRITICAL **: gst_memory_new_wrapped:
 assertion `offset + size = maxsize' failed
 
 (sugar-activity:2492): GStreamer-CRITICAL **: gst_buffer_insert_memory:
 assertion `mem != NULL' failed
 
 Rarely, about one in 5 times, it does segmentation fault.  I've
 captured two core dumps by adding ulimit -c unlimited to
 ~/.sugar/debug.  Both showed similar stack traces; a thread busy doing
 an fts_open and fts_sort at the same time as the main thread doing
 something else.
 
 [3]http://dev.laptop.org/~quozl/z/1YsIKF.txt
 
 Speculation: the Gst.init() in src/sugar3/speech.py creates a thread
 which is racing with something in the main thread.  fts_open and
 fts_sort are necessary calls for scanning plugins.
 
 Sometimes the race condition corrupts pointers and we get the silence
 with GStreamer-CRITICAL messages.  Sometimes the corruption causes a
 segmentation fault.
 
 Perhaps _GstSpeechPlayer should wait for good Gst.State before the
 next call into Gst?
 
 I remember recent work on GStreamer plugin scan initialisation in
 Sugar, but I can't find it yet.
 
 --
 James Cameron
 [4]http://quozl.linux.org.au/
 
 --
 Gonzalo Odiard
 
 SugarLabs - Software for children learning 
 
 References:
 
 [1] https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/215
 [2] mailto:qu...@laptop.org
 [3] http://dev.laptop.org/~quozl/z/1YsIKF.txt
 [4] http://quozl.linux.org.au/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Clock-17

2015-05-12 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4191

Sugar Platform:
0.98 - 0.104

Download Now:
http://activities.sugarlabs.org/downloads/file/29101/clock-17.xo

Release notes:
Make the text to speech compatible with F18, using tts in the sugar toolkit.
Need Sugar 0.104


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-12 Thread James Cameron
On Tue, May 12, 2015 at 12:00:42PM -0400, Sugar Labs Activities wrote:
 Activity Homepage:
 http://activities.sugarlabs.org/addon/4191
 
 Sugar Platform:
 0.98 - 0.104

As it needs 0.104, can you please change it in ASLO?

 Download Now:
 http://activities.sugarlabs.org/downloads/file/29101/clock-17.xo

Applied using Software Update.

Sometimes speaks.

When it doesn't speak, it reports in log:

(sugar-activity:965): GStreamer-CRITICAL **: gst_memory_new_wrapped: assertion 
`offset + size = maxsize' failed

(sugar-activity:965): GStreamer-CRITICAL **: gst_buffer_insert_memory: 
assertion `mem != NULL' failed

Sometimes stops activity, and reports in log:

Terminated by signal 11, pid 877 data (None, open file 'fdopen', mode 'w' at 
0xa2c3de0, '1bb8235db05c7a9492d53840cbe64cf87c343a51')

Always reports in log:

/home/olpc/Activities/Clock.activity/clock.py:495: Warning: value 170 of type 
`gint' is invalid or out of range for property `rate' of type `gint'
  pipe = Gst.parse_launch(pipeline)

Always takes an additional second to speak.

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ASLO] Release Clock-17

2015-05-12 Thread Gonzalo Odiard
I think I found the problem.
Could you confirm replacing the attached file in the activity dir?
Thanks!

Gonzalo

On Tue, May 12, 2015 at 5:39 PM, James Cameron qu...@laptop.org wrote:

 On Tue, May 12, 2015 at 12:00:42PM -0400, Sugar Labs Activities wrote:
  Activity Homepage:
  http://activities.sugarlabs.org/addon/4191
 
  Sugar Platform:
  0.98 - 0.104

 As it needs 0.104, can you please change it in ASLO?

  Download Now:
  http://activities.sugarlabs.org/downloads/file/29101/clock-17.xo

 Applied using Software Update.

 Sometimes speaks.

 When it doesn't speak, it reports in log:

 (sugar-activity:965): GStreamer-CRITICAL **: gst_memory_new_wrapped:
 assertion `offset + size = maxsize' failed

 (sugar-activity:965): GStreamer-CRITICAL **: gst_buffer_insert_memory:
 assertion `mem != NULL' failed

 Sometimes stops activity, and reports in log:

 Terminated by signal 11, pid 877 data (None, open file 'fdopen', mode
 'w' at 0xa2c3de0, '1bb8235db05c7a9492d53840cbe64cf87c343a51')

 Always reports in log:

 /home/olpc/Activities/Clock.activity/clock.py:495: Warning: value 170 of
 type `gint' is invalid or out of range for property `rate' of type `gint'
   pipe = Gst.parse_launch(pipeline)

 Always takes an additional second to speak.

 --
 James Cameron
 http://quozl.linux.org.au/




-- 
Gonzalo Odiard

SugarLabs - Software for children learning
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Code released in the Public Domain. You can do whatever you want
# with this package.  Though I'm learning Python, I've tried to use
# the best practices in XO development.  Look at NOTES file to see how
# to adapt this program.  Originally written by Pierre Métras
# pie...@alterna.tv for the OLPC XO laptop.


Learning time.
==
The XO is missing a simple clock for kids to learn how to
read time, but more importantly to know what time is is. When you
don't own a clock, the XO can be used to display the time to
arrive in time at school...
A clock can also be used to learn how to count and read numbers.

Display and behavior can be changed with the buttons in the toolbar:
- A simple clock with hours figures to learn to tell the time.
- A nice clock face, without hours numbers.
- A digital clock with a time scale.
Also, the clock can print the current time in full letters. Or speak
it aloud.

To help learning the time, all the clocks displays use a consistent
color code:
- Hours blue: #005FE4
- Minutes   green: #00B20D
- Seconds   red: #E6000A
- Days  dark red: #B20008
- Monthspurple: #5E008C
- Years brown: #9A5200


An analog clock is also very helpfull to determine where the North is when you
don't have a compass!
Check http://www.wikihow.com/Find-True-North-Without-a-Compass
And knowing where the True North is, you can build a Sun Clock!

Author: Pierre Metras pie...@alterna.tv
Based on work from Davyd Madeley, Lawrence Oluyede l.oluy...@gmail.com
SVG background adapted from Open ClipArt:
http://openclipart.org/people/rihard/rihard_Clock_Calendar_2.svg

More about clocks and time in the World
---
- Clock face: http://en.wikipedia.org/wiki/Clock_face
- 12 hours clock: http://en.wikipedia.org/wiki/12-hour_clock
- 24 hours clock: http://en.wikipedia.org/wiki/24-hour_clock
- Thai 6 hours clock: http://en.wikipedia.org/wiki/Thai_six-hour_clock

- Time and date in the World:
  http://en.wikipedia.org/wiki/Date_and_time_notation_by_country



# We initialize threading in GObject. As we will detach another thread
# to translate the time to text, this other thread will eventually
# update the display with idle_add() calls, because it is not running
# in the main event thread. But idle_add() puts a callback in the
# message queue with the lowest priority. When the nice clock is
# displayed, it can spend a few seconds (20 to 30 is common) before
# the GTK loop will process this low priority message. When we enable
# the threads, the processing is almost instantaneous.

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Rsvg
from gi.repository import Pango
from gi.repository import GObject
from gi.repository import PangoCairo

import logging
import os
import re
import math
import cairo
from datetime import datetime

from gettext import gettext as _

from sugar3.graphics import style
from sugar3.activity import activity
from sugar3.activity.widgets import StopButton
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphics.radiotoolbutton import RadioToolButton
from sugar3.graphics.toggletoolbutton import ToggleToolButton

from speaker import Speaker
from timewriter import TimeWriter

import dbus

# The display modes of the clock
_MODE_SIMPLE_CLOCK = 0
_MODE_NICE_CLOCK = 1
_MODE_DIGITAL_CLOCK = 2

# directory exists if powerd is running.  create a file here,
# named after our pid, to inhibit suspend.
POWERD_INHIBIT_DIR =