Example #1
0
 def getTime(self):
     """
     @description: a function that let google2ubuntu read and display
     the current timme
     """
     var=time.strftime('%H:%M',time.localtime())
     hour=var.split(':')[0]
     minute=var.split(':')[1]
     
     message = _('it is')+' '+hour+' '+_('hour')+' '+minute+' '+_('minute')
     os.system('echo "'+var+'" > /tmp/g2u_display_'+self.pid)
     tts(message)
 def getTime(self):
     """
     @description: a function that let google2ubuntu read and display
     the current timme
     """
     var=time.strftime('%H:%M',time.localtime())
     hour=var.split(':')[0]
     minute=var.split(':')[1]
     
     message = _('it is')+' '+hour+' '+_('hour')+' '+minute+' '+_('minute')
     os.system('echo "'+var+'" > /tmp/g2u_display_'+self.pid)
     print message
     tts(message)
Example #3
0
    def read_clipboard(self):
        """
        @description: A function to make google2ubuntu reads the selected
        text
        """
        clipboard = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)

        text = clipboard.wait_for_text()
        if text != None:
            text=text.replace("'",' ')
            print text
            tts(text)
        else:
            tts(_('Nothing in the clipboard'))
    def read_clipboard(self):
        """
        @description: A function to make google2ubuntu reads the selected
        text
        """
        clipboard = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)

        text = clipboard.wait_for_text()
        if text != None:
            text=text.replace("'",' ')
            print "read:", text
            tts(text)
        else:
            tts(_('Nothing in the clipboard'))
Example #5
0
 def getPower(self):
     """
     @description: a function that let google2ubuntu read and display
     the current power state
     """
     command = "acpi -b"
     process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     output,error  = process.communicate()
     #parsing output
     if output.count('Battery') > 0:
         pcent = output.split(' ')[3]
         rtime = output.split(' ')[4]
         
         if output.count('Charging') > 0:
             message = _('Charging')+': '+pcent+'\n'+rtime+' '+_('before charging')
         else:
             message = _('Discharging')+': '+pcent+'\n'+rtime+' '+_('remaining')
     else:
         message = _('battery is not plugged')
     
     os.system('echo "'+message+'" > /tmp/g2u_display_'+self.pid)
     tts(message)
 def getPower(self):
     """
     @description: a function that let google2ubuntu read and display
     the current power state
     """
     command = "acpi -b"
     process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     output,error  = process.communicate()
     #parsing output
     if output.count('Battery') > 0:
         pcent = output.split(' ')[3]
         rtime = output.split(' ')[4]
         
         if output.count('Charging') > 0:
             message = _('Charging')+': '+pcent+'\n'+rtime+' '+_('before charging')
         else:
             message = _('Discharging')+': '+pcent+'\n'+rtime+' '+_('remaining')
     else:
         message = _('battery is not plugged')
     
     os.system('echo "'+message+'" > /tmp/g2u_display_'+self.pid)
     tts(message)
Example #7
0
from urllib2 import urlopen

locale.setlocale(locale.LC_ALL, '')
lang = locale.getdefaultlocale()[0]
lang = lang.split('_')[0]

sys.path.append('/usr/share/google2ubuntu/librairy')
from Googletts import tts

if len(sys.argv) >= 2:
    null = None
    keyword = sys.argv[1]
    #keyword = keyword.replace(' ','+')
    print keyword
    data = urlopen(
        "http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q="
        + keyword + "&sl=" + lang + "&tl=" + lang +
        "&restrict=pr%2Cde&client=te").read()[25:-1]

    d = eval('(' + data + ')')
    if d[1] == 200:
        result = d[0]

        if 'webDefinitions' in result:
            webd = result.get('webDefinitions')[0]
            entries = webd.get('entries')
            entry = entries[0]
            for term in entry.get('terms'):
                if term.get('type') == 'text':
                    tts(term.get('text'))
Example #8
0
from subprocess import *
from os.path import expanduser
import sys, subprocess, os, json, unicodedata, time, locale
from urllib2 import urlopen

locale.setlocale(locale.LC_ALL, '')
lang = locale.getdefaultlocale()[0]
lang=lang.split('_')[0]

sys.path.append('/usr/share/google2ubuntu/librairy')
from Googletts import tts

if len(sys.argv) >= 2:
    null = None
    keyword = sys.argv[1]
    #keyword = keyword.replace(' ','+')
    print keyword
    data = urlopen("http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q="+keyword+"&sl="+lang+"&tl="+lang+"&restrict=pr%2Cde&client=te").read()[25:-1]
 
    d = eval('('+data+')')
    if d[1] == 200:
        result = d[0]
          
        if 'webDefinitions' in result:
            webd = result.get('webDefinitions')[0]
            entries = webd.get('entries')
            entry=entries[0]
            for term in entry.get('terms'):
                if term.get('type') == 'text':
                    tts(term.get('text'))