Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Speak.activity/face.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-12-25 12:22:35 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-12-25 12:22:35 (GMT)
commit070882bcfecee3d17a909c4072da7b2f160d41d3 (patch)
tree5f364b26912dc6904c307ae49df4bd9cdd739a93 /Speak.activity/face.py
parentea7c199885e7295cfa6b6038f3a9865fee9e7f7b (diff)
Switch to new toolbar design
Diffstat (limited to 'Speak.activity/face.py')
-rw-r--r--Speak.activity/face.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/Speak.activity/face.py b/Speak.activity/face.py
index 5ad632c..a3b5d7b 100644
--- a/Speak.activity/face.py
+++ b/Speak.activity/face.py
@@ -110,7 +110,7 @@ class View(gtk.EventBox):
self._mouth = None
self._mouthbox = gtk.HBox()
self._mouthbox.show()
-
+
# layout the screen
box = gtk.VBox(homogeneous=False)
box.pack_start(self._eyebox)
@@ -119,14 +119,12 @@ class View(gtk.EventBox):
self.modify_bg(gtk.STATE_NORMAL, self.fill_color.get_gdk_color())
self.add(box)
- self._mapped = False
self._peding = None
- self.connect("map_event",self._map_event)
+ self.connect('map', self.__map_cb)
self.update()
-
- def _map_event(self, widget, event):
- self._mapped = True
+
+ def __map_cb(self, widget):
if self._peding:
self.update(self._peding)
self._peding = None
@@ -135,15 +133,20 @@ class View(gtk.EventBox):
if self._eyes:
map(lambda e: e.look_ahead(), self._eyes)
- def look_at(self, x, y):
+ def look_at(self, pos=None):
if self._eyes:
- map(lambda e, x=x, y=y: e.look_at(x,y), self._eyes)
+ if pos is None:
+ display = gtk.gdk.display_get_default()
+ screen_, x, y, modifiers_ = display.get_pointer()
+ else:
+ x, y = pos
+ map(lambda e, x=x, y=y: e.look_at(x, y), self._eyes)
def update(self, status = None):
if not status:
status = self.status
else:
- if not self._mapped:
+ if not self.flags() & gtk.MAPPED:
self._peding = status
return
self.status = status
@@ -169,6 +172,10 @@ class View(gtk.EventBox):
# enable mouse move events so we can track the eyes while the mouse is over the mouth
#self._mouth.add_events(gtk.gdk.POINTER_MOTION_MASK)
+ def set_voice(self, voice):
+ self.status.voice = voice
+ self.say_notification(voice.friendlyname)
+
def say(self, something):
self._audio.speak(self._peding or self.status, something)