Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2013-10-01 22:15:32 (GMT)
committer flavio <fdanesse@gmail.com>2013-10-01 22:15:32 (GMT)
commitb61c84e88bede42252990620f5289838508e376c (patch)
tree833ccf7d84a263fefa500138d650072c2beb11cd
parent1ddd85641d906607b256c0e5b5197adc471d3dc9 (diff)
Anular TimeWriter
-rwxr-xr-xclock.py68
-rwxr-xr-xspeaker.py2
2 files changed, 38 insertions, 32 deletions
diff --git a/clock.py b/clock.py
index 195efb2..ea09e0f 100755
--- a/clock.py
+++ b/clock.py
@@ -121,7 +121,7 @@ class ClockActivity(activity.Activity):
super(ClockActivity, self).__init__(handle)
# TRANS: Title of the activity
- self.set_title(_('What Time Is It?'))
+ self.set_title(_('Qué hora es?'))
# TRANS: The format used when writing the time in full
# letters. You must take care to use a font size large enough
@@ -130,7 +130,7 @@ class ClockActivity(activity.Activity):
# screen is rotated. Pango markup:
# http://www.pygtk.org/docs/pygtk/pango-markup-language.html
self._TIME_LETTERS_FORMAT = _('<markup>\
-<span lang="en" font_desc="Sans 20">%s</span></markup>')
+<span lang="es" font_desc="Sans 20">%s</span></markup>')
# TRANS: The format used to display the weekday and date
# (example: Tuesday 10/21/2008) We recommend to use the same
@@ -138,7 +138,7 @@ class ClockActivity(activity.Activity):
# http://docs.python.org/lib/module-time.html for available
# strftime formats. xgettext:no-python-format
self._DATE_SHORT_FORMAT = _('<markup>\
-<span lang="en" font_desc="Sans 20">\
+<span lang="es" font_desc="Sans 20">\
<span foreground="#B20008">%A</span>, \
<span foreground="#5E008C">%m</span>/\
<span foreground="#B20008">%d</span>/\
@@ -406,13 +406,15 @@ class ClockActivity(activity.Activity):
thread.start()
def _do_write_time(self):
- """Translate the time to full letters.
"""
+ Translate the time to full letters.
+ """
+
if self._time_writer is None:
self._time_writer = TimeWriter()
hour = self._clock.get_time().hour
minute = self._clock.get_time().minute
- self._time_in_letters = self._time_writer.write_time(hour, minute)
+ self._time_in_letters = "Son las %s con %s minutos" % (hour, minute) #self._time_writer.write_time(hour, minute)
self._time_letters.set_markup(self._TIME_LETTERS_FORMAT % self._time_in_letters)
def _do_speak_time(self):
@@ -428,7 +430,7 @@ class ClockActivity(activity.Activity):
pipeline = 'espeak text="%(text)s" voice="%(voice)s" pitch="%(pitch)s" \
rate="%(rate)s" gap="%(gap)s" ! autoaudiosink' % {
- 'text':self._untag(self._time_in_letters),
+ 'text': self._time_in_letters, #self._untag(self._time_in_letters),
'voice':self._time_speaker.VOICE,
'pitch':self._time_speaker.PITCH,
'rate':self._time_speaker.SPEED,
@@ -440,7 +442,7 @@ class ClockActivity(activity.Activity):
bus.connect('message', gstmessage_cb, pipe)
pipe.set_state(Gst.State.PLAYING)
except:
- self._time_speaker.speak(self._untag(self._time_in_letters))
+ self._time_speaker.speak(self._time_in_letters)#(self._untag(self._time_in_letters))
def _untag(self, text):
"""Remove all the tags (pango markup) from a text.
@@ -534,30 +536,34 @@ class ClockFace(Gtk.DrawingArea):
of the clock, radius).
"""
- # Store the measures of the clock face widget
- self._center_x = int(allocation.width / 2.0)
- self._center_y = int(allocation.height / 2.0)
- self._radius = max(min(int(allocation.width / 2.0), \
- int(allocation.height / 2.0)) - 20, 0)
- self._width = allocation.width
- self._height = allocation.height
- self._line_width = int(self._radius / 150)
-
- # Reload the svg handle
- self._svg_handle = Rsvg.Handle.new_from_file("clock.svg")
- cr = self.get_property('window').cairo_create()
- self._nice_background_cache = cr.get_target().create_similar(
- cairo.CONTENT_COLOR_ALPHA, self._radius * 2,
- self._radius * 2)
- cache_ctx = cairo.Context(self._nice_background_cache)
- scale_x = self._radius * 2.0 / self._svg_handle.props.width
- scale_y = self._radius * 2.0 / self._svg_handle.props.height
- matrix = cairo.Matrix(xx=scale_x, yy=scale_y)
- cache_ctx.transform(matrix)
- self._svg_handle.render_cairo(cache_ctx)
-
- self.initialized = True
-
+ try:
+ # Store the measures of the clock face widget
+ self._center_x = int(allocation.width / 2.0)
+ self._center_y = int(allocation.height / 2.0)
+ self._radius = max(min(int(allocation.width / 2.0), \
+ int(allocation.height / 2.0)) - 20, 0)
+ self._width = allocation.width
+ self._height = allocation.height
+ self._line_width = int(self._radius / 150)
+
+ # Reload the svg handle
+ self._svg_handle = Rsvg.Handle.new_from_file("clock.svg")
+ cr = self.get_property('window').cairo_create()
+ self._nice_background_cache = cr.get_target().create_similar(
+ cairo.CONTENT_COLOR_ALPHA, self._radius * 2,
+ self._radius * 2)
+ cache_ctx = cairo.Context(self._nice_background_cache)
+ scale_x = self._radius * 2.0 / self._svg_handle.props.width
+ scale_y = self._radius * 2.0 / self._svg_handle.props.height
+ matrix = cairo.Matrix(xx=scale_x, yy=scale_y)
+ cache_ctx.transform(matrix)
+ self._svg_handle.render_cairo(cache_ctx)
+
+ self.initialized = True
+
+ except:
+ pass
+
def _expose_cb(self, widget, event):
"""The widget is exposed and must draw itself on the graphic
context.
diff --git a/speaker.py b/speaker.py
index 1963747..cd21708 100755
--- a/speaker.py
+++ b/speaker.py
@@ -50,7 +50,7 @@ class Speaker:
# TRANS: The language and voice variant
# Look at http://espeak.sourceforge.net/commands.html for details, and
# http://espeak.sourceforge.net/languages.html to see if your language is supported.
- VOICE = _("en")
+ VOICE = _("es")
# Temporary file to save the 'espeak -w' output and then play it
# with 'playwave' command