def __init__(self, fill_color=style.COLOR_BUTTON_GREY): Gtk.EventBox.__init__(self) self.status = Status() self.fill_color = fill_color self.connect('size-allocate', self._size_allocate_cb) self._audio = espeak.AudioGrab() # make an empty box for some eyes self._eyes = None self._eyebox = Gtk.HBox() self._eyebox.show() # make an empty box to put the mouth in self._mouth = None self._mouthbox = Gtk.HBox() self._mouthbox.show() # layout the screen self._box = Gtk.VBox(homogeneous=False) self._box.pack_start(self._eyebox, True, True, 0) self._box.pack_start(self._mouthbox, False, True, 0) self._box.set_border_width(FACE_PAD) self.modify_bg(Gtk.StateType.NORMAL, self.fill_color.get_gdk_color()) self.add(self._box) self._peding = None self.connect('map', self.__map_cb) self.update()
def __init__(self, pixbuf, left_eye, right_eye, mouth, fill_color=style.COLOR_BUTTON_GREY): Gtk.DrawingArea.__init__(self) self.status = Status() self._color = fill_color self.status.left_eye = left_eye self.status.right_eye = right_eye self.status.mouth = mouth self.status.pixbuf = pixbuf self._buffers = [] self._buffer_size = 256 self._main_buffers = [] self._newest_buffer = [] self._volume = 0 self._look_x = None self._look_y = None self._audio = espeak.AudioGrab() self._audio.connect('peak', self.__peak_cb) self._pending = None self.connect('draw', self.__draw_cb)
def decir(pitch, speed, word_gap, voice, text): global _audio try: _audio.speak(text, pitch, speed, voice) except: _audio = espeak.AudioGrab() _audio.speak(text, pitch, speed, voice)