def _new_face(self, buddy, color): stroke_color, fill_color = buddy.props.color.split(',') stroke_color = style.Color(stroke_color) fill_color = style.Color(fill_color) buddy_face = face.View(fill_color) buddy_face.show_all() inner = CanvasRoundBox( background_color = fill_color.get_int(), ) inner.props.border_color = fill_color.get_int() inner.append(hippo.CanvasWidget(widget=buddy_face), hippo.PACK_EXPAND) inner.props.border = BUDDY_PAD outer = CanvasRoundBox( background_color = stroke_color.get_int(), box_width = BUDDY_SIZE, box_height = BUDDY_SIZE, ) outer.props.border_color = stroke_color.get_int() outer.append(inner, hippo.PACK_EXPAND) outer.props.border = BUDDY_PAD return (buddy_face, outer)
def _new_face(self, buddy, color): colors = buddy.props.color.split(',') lighter = style.Color(colors[_lighter_color(colors)]) buddy_face = face.View(lighter) # FIXME: omit set_border_state causes main face alignment problems buddy_face.set_border_state(False) # FIXME: non-me faces have no mouth buddy_face.show_all() return buddy_face
def __init__(self, handle): self.notebook = gtk.Notebook() SharedActivity.__init__(self, self.notebook, SERVICE, handle) self._mode = MODE_TYPE self.numeyesadj = None # make an audio device for playing back and rendering audio self.connect( "notify::active", self._activeCb ) # make a box to type into self.entrycombo = gtk.combo_box_entry_new_text() self.entrycombo.connect("changed", self._combo_changed_cb) self.entry = self.entrycombo.child self.entry.set_editable(True) self.entry.connect('activate', self._entry_activate_cb) self.entry.connect("key-press-event", self._entry_key_press_cb) self.input_font = pango.FontDescription(str='sans bold 24') self.entry.modify_font(self.input_font) self.face = face.View() self.face.show() # layout the screen box = gtk.VBox(homogeneous=False) box.pack_start(self.face) box.pack_start(self.entrycombo, expand=False) self.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.POINTER_MOTION_MASK) self.connect("motion_notify_event", self._mouse_moved_cb) box.add_events(gtk.gdk.BUTTON_PRESS_MASK) box.connect("button_press_event", self._mouse_clicked_cb) # desktop self.notebook.show() self.notebook.props.show_border = False self.notebook.props.show_tabs = False box.show_all() self.notebook.append_page(box) self.chat = chat.View() self.chat.show_all() self.notebook.append_page(self.chat) # make the text box active right away self.entry.grab_focus() self.entry.connect("move-cursor", self._cursor_moved_cb) self.entry.connect("changed", self._cursor_moved_cb) # toolbar toolbox = ToolbarBox() toolbox.toolbar.insert(ActivityToolbarButton(self), -1) separator = gtk.SeparatorToolItem() separator.set_draw(False) toolbox.toolbar.insert(separator, -1) self.voices = ComboBox() for name in sorted(voice.allVoices().keys()): self.voices.append_item(voice.allVoices()[name], name) self.voices.select(voice.defaultVoice()) all_voices = self.voices.get_model() brain_voices = brain.get_voices() mode_type = RadioToolButton( named_icon='mode-type', tooltip=_('Type something to hear it')) mode_type.connect('toggled', self.__toggled_mode_type_cb, all_voices) toolbox.toolbar.insert(mode_type, -1) mode_robot = RadioToolButton( named_icon='mode-robot', group=mode_type, tooltip=_('Ask robot any question')) mode_robot.connect('toggled', self.__toggled_mode_robot_cb, brain_voices) toolbox.toolbar.insert(mode_robot, -1) mode_chat = RadioToolButton( named_icon='mode-chat', group=mode_type, tooltip=_('Voice chat')) mode_chat.connect('toggled', self.__toggled_mode_chat_cb, all_voices) toolbox.toolbar.insert(mode_chat, -1) separator = gtk.SeparatorToolItem() toolbox.toolbar.insert(separator, -1) voices_toolitem = ToolWidget(widget=self.voices) toolbox.toolbar.insert(voices_toolitem, -1) voice_button = ToolbarButton( page=self.make_voice_bar(), label=_('Voice'), icon_name='voice') toolbox.toolbar.insert(voice_button, -1) face_button = ToolbarButton( page=self.make_face_bar(), label=_('Face'), icon_name='face') toolbox.toolbar.insert(face_button, -1) separator = gtk.SeparatorToolItem() separator.set_draw(False) separator.set_expand(True) toolbox.toolbar.insert(separator, -1) toolbox.toolbar.insert(StopButton(self), -1) toolbox.show_all() self.toolbar_box = toolbox