def main(): conversation = Conversation(DEFAULT_LOCALE, API_KEY, SPHINX_HMM, SPHINX_LM, SPHINX_DIC, update_status, mp3player=MP3_PLAY, offline_tts=OFFLINETTS) mm.conversation = conversation silence(conversation) try: while 1: reply = conversation.listen() if reply.find(SPHINX_TRIGGER) < 0: continue conversation.say(_('Yes?'), use_cache=True) reply = conversation.listen(use_google=True) if not reply: conversation.say(_('What?'), use_cache=True) else: conversation.say(reply) except KeyboardInterrupt: print print 'Bye Bye'
def text_describe(impl): """Returns a description of the interfaces of the given class.""" textlist = [] interfaces = Interface.get_interfaces(impl) for i in interfaces: out = "" ident = Interface.get_id(i) out += ident + '\n\n' for key in dir(i): value = impl.__dict__.get(key) if (not value): continue if (isinstance(value, property)): out += " " out += key.ljust(25) perm = str(Permission.Permission(value)).ljust(4) out += perm out += "%s \n" % (value.__doc__ or _("no description"), ) out += "\n" textlist.append(out) return ''.join(textlist)
def human_readable_bytes(bytes): try: import gnomevfs return gnomevfs.format_file_size_for_display(bytes) except ImportError: global _TERA, _GIGA, _MEGA, _KILO if bytes >= _TERA: return _("%.2f TB") % (float(bytes) / _TERA) elif bytes >= _GIGA: return _("%.2f GB") % (float(bytes) / _GIGA) elif bytes >= _MEGA: return _("%.2f MB") % (float(bytes) / _MEGA) elif bytes >= _KILO: return _("%.2f kB") % (float(bytes) / _KILO) else: return _("%d B") % bytes
def main(): conversation = Conversation(DEFAULT_LOCALE, API_KEY, SPHINX_HMM, SPHINX_LM, SPHINX_DIC, update_status, mp3player = MP3_PLAY, offline_tts = OFFLINETTS) mm.conversation = conversation silence(conversation) try: while 1: reply = conversation.listen() if reply.find(SPHINX_TRIGGER) < 0: continue conversation.say(_('Yes?'), use_cache = True) reply = conversation.listen(use_google = True) if not reply: conversation.say(_('What?'), use_cache = True) else: conversation.say(reply) except KeyboardInterrupt: print print 'Bye Bye'
def __init__(self, sensorconfigurators): HIGDialog.__init__(self, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)) self.set_property("title", _("Configuration")) def destroy(*args): self.destroy() self.connect("response", destroy) # close functions pages = [] for c in sensorconfigurators: if (c): lbl = gtk.Label(c.get_name()) lbl.show() pages.append((c, lbl)) # use a special page when there are no config options if (not pages): lbl = gtk.Label(_("This desklet is not configurable.")) lbl.show() pages.append((lbl, None)) # only use the notebook when there are more than one pages if (len(pages) == 1): self.vbox.add(pages[0][0]) else: align = gtk.Alignment(0.0, 0.0, 0.0, 0.0) align.show() notebook = gtk.Notebook() notebook.set_property("border-width", 6) notebook.show() align.add(notebook) self.vbox.pack_start(align, False, False, 0) for page, tab in pages: notebook.append_page(page, tab) self.show()
def main(): conversation = Conversation(DEFAULT_LOCALE, API_KEY, callback = update_status, mp3player = MP3_PLAY, offline_tts = OFFLINETTS) mm.conversation = conversation silence(conversation) try: while 1: reply = conversation.listen() if not reply: conversation.say(_('What?'), use_cache = True) else: conversation.say(reply) except KeyboardInterrupt: print print 'Bye Bye'
def main(): conversation = Conversation(DEFAULT_LOCALE, API_KEY, callback=update_status, mp3player=MP3_PLAY, offline_tts=OFFLINETTS) mm.conversation = conversation silence(conversation) try: while 1: reply = conversation.listen() if not reply: conversation.say(_('What?'), use_cache=True) else: conversation.say(reply) except KeyboardInterrupt: print print 'Bye Bye'
def gui_describe(impl): guilist = [] interfaces = Interface.get_interfaces(impl) for i in interfaces: items = [] for key in dir(i): value = impl.__dict__.get(key) if (not value): continue if (isinstance(value, property)): items.append((key, str(Permission.Permission(value)), value.__doc__ or _("no description"))) guilist.append( (Interface.get_id(i), items) ) return guilist