Esempio n. 1
0
 def run(self):
     global UNREAD
     while True:
         try:
             srv = IMAP4_SSL("imap.gmail.com")
             count=[]
             srv.login(GMAIL_USERNAME,GMAIL_PASSWORD)
             srv.select()
             status,count=srv.search(None,'UnSeen')
             #unseen= len(c.get_inbox_conversations(is_unread=True))
             UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+str(len(count[0][1:].split()))+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
             srv.close()
             srv.logout()
             sleep(60)
         except:
             sleep(60)
Esempio n. 2
0
 def run(self):
     global CPUTEMP
     while True:
         try:
             f1 = open('/sys/devices/platform/coretemp.0/temp2_input','r')
             f2 = open('/sys/devices/platform/coretemp.0/temp3_input','r')
             TC1 = int(f1.readline())/1000
             TC2 = int(f2.readline())/1000
             C1ritical = int(open('/sys/devices/platform/coretemp.0/temp2_crit','r').readline())/1000
             C2ritical = int(open('/sys/devices/platform/coretemp.0/temp3_crit','r').readline())/1000
             percent1 = int(TC1*100/C1ritical)
             percent2 = int(TC2*100/C2ritical)
             if percent1 > 100:
                 percent1 = 100
             if percent2 > 100:
                 percent2 = 100
             CPUTEMP = "^i("+ICON_PATH+"/temp.xbm) "+ set_gradient_color(100-percent1)+str(TC1)+set_normal_color()+" | "+set_gradient_color(100-percent2)+str(TC2)+set_normal_color()
             f1.close()
             f2.close()
         except IOError:
             CPUTEMP = "N/A"
         sleep(60);
Esempio n. 3
0
 def run(self):
     global RAM,RAM_SLEEP
     while 1:
         used=bytes_to_mb(used_phymem()-cached_mem()-buffers())
         percentage=(100*used)/TOTAL_RAM_MB
         RAM="^i("+ICON_PATH+"/mem.xbm) "+set_gradient_color(percentage)+str(used)+set_normal_color()+"M"
         sleep(int(RAM_SLEEP))
Esempio n. 4
0
from time import sleep
from threading import Thread
from config_mod import GMAIL_BACKGROUND_COLOR,GMAIL_COLOR,GMAIL_UNREAD_COLOR,GMAIL_USERNAME,GMAIL_PASSWORD,ICON_PATH
from colors import set_colors,set_normal_color
from imaplib import IMAP4_SSL
UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+"n/a"+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
def unread():
    return UNREAD
class get_gmail_check(Thread):
    def run(self):
        global UNREAD
        while True:
            try:
                srv = IMAP4_SSL("imap.gmail.com")
                count=[]
                srv.login(GMAIL_USERNAME,GMAIL_PASSWORD)
                srv.select()
                status,count=srv.search(None,'UnSeen')
                #unseen= len(c.get_inbox_conversations(is_unread=True))
                UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+str(len(count[0][1:].split()))+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
                srv.close()
                srv.logout()
                sleep(60)
            except:
                sleep(60)

Esempio n. 5
0
 def run(self):
     global HDDTEMP,HDDTEMP_SLEEP
     while 1:
         s = socket(AF_INET, SOCK_STREAM)
         s.connect(("localhost",7634))
         buf = s.recv(4096)
         s.close()
         temp=buf[-5:-3]
         try:
             percentage=100*(int(temp)-25)/60
         except ValueError:
             continue
         HDDTEMP="^i("+ICON_PATH+"/temp.xbm) "+set_gradient_color(percentage)+temp+set_normal_color()+"C"
         sleep(int(HDDTEMP_SLEEP))
Esempio n. 6
0
    def run(self):
        global CPU,CPU_SLEEP
        MAX_FREQ=0
        MIN_FREQ=999999
        while 1:
            f = open('/proc/cpuinfo', 'r')
##              cpu_frequencies=""
            freqs=[]
            for line in f:
                if line.startswith('cpu MHz'):
                    freqs.append(int(round(float(line.split()[3]),0)))
            f.close()
##              for i in range (len(freqs)):
##                  cpu_frequencies+=" Core"+str(i)+"@ "+str(freqs[i])
            freq=max(freqs)
            if MAX_FREQ<freq:
                MAX_FREQ=freq
            if MIN_FREQ>freq:
                MIN_FREQ=freq-1
            fpercentage=100*(freq-MIN_FREQ)/(MAX_FREQ-MIN_FREQ)
            cpu_frequencies=" @ "+set_gradient_color(fpercentage)+str(round(freq/1000.,1))+set_normal_color()+"GHz"
            percentage=round(cpu_percent(), 1)
            CPU="^i("+ICON_PATH+"/cpu.xbm) "+set_gradient_color(percentage)+"^r("+str(ceil(float(percentage/2)))+"x8)"+set_color(CPU_BAR_COLOR)+"^r("+str(50-ceil(float(percentage/2)))+"x8)"+set_normal_color()+cpu_frequencies
            sleep(int(CPU_SLEEP))
Esempio n. 7
0
 def run ( self ):
     global WEATHER_COND,WEATHER_SLEEP,REQ
 
     while True:
         try:
             request = Request(REQ)
             response = urlopen(request)
             the_page = response.read()
             result= search('e:.*?C',the_page)
             result_sum = search('"summary">.*?<',the_page)
             WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+result_sum.group(0)[10:len(result_sum.group(0))-2]+ result.group(0)[2:len(result.group(0))-6]+"C"+set_normal_color()
             sleep(float(WEATHER_SLEEP))
             continue
         except (URLError,AttributeError):
             WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()
             sleep(60)
             continue
Esempio n. 8
0
from time import sleep
from threading import Thread
from re import search
from urllib2 import Request, urlopen, URLError
from config_mod import WEATHER_BACKGROUND_COLOR, WEATHER_COLOR, WEATHER_SLEEP, REQ
from colors import set_colors,set_normal_color
WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()

def weather_cond():
    return WEATHER_COND
class get_weather(Thread):
    def run ( self ):
        global WEATHER_COND,WEATHER_SLEEP,REQ
    
        while True:
            try:
                request = Request(REQ)
                response = urlopen(request)
                the_page = response.read()
                result= search('e:.*?C',the_page)
                result_sum = search('"summary">.*?<',the_page)
                WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+result_sum.group(0)[10:len(result_sum.group(0))-2]+ result.group(0)[2:len(result.group(0))-6]+"C"+set_normal_color()
                sleep(float(WEATHER_SLEEP))
                continue
            except (URLError,AttributeError):
                WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()
                sleep(60)
                continue
Esempio n. 9
0
def NOW():
    return set_colors(TIME_COLOR, TIME_BACKGROUND_COLOR) + strftime("%d-%m %H:%M") + set_normal_color()
Esempio n. 10
0
    def run( self ):
        global STATUS,STATUSNET
        download_url().start()
        while True:
            try:
              #			status = simplejson.load(urllib2.urlopen(STATUSNET_URL))
              #			STATUSNET = status[1]['user']['name']
                for i in range(0,3):
                    status_user = set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+'StatusNet [' + str(i+1) + '/3]: ' +set_colors(STATUSNET_USER_COLOR,STATUSNET_BACKGROUND_COLOR)+' '+STATUS[i]['user']['screen_name']+set_normal_color()
                    text = STATUS[i]['text']
#                    text = text.decode('utf-8')
                    text = text.encode('iso-8859-7', 'replace')

                    from_chars = u'áâãäåæçèéêëìíîïðñóòôõö÷øùÜÝÞßúÀüýûàþÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖ×ØÙ¶¸¹ºÚ¼¾Û¿'.encode('latin1')
                    to_chars =  u'abgdezh8iklmn3oprsstufxywaehiiiouuuwABGDEZH8IKLMNJOPRSTYFXCWAEHIIOUUW'.encode('latin1')
                    trantab = maketrans( from_chars, to_chars )
                    #trantab = dict((ord(a), b) for a, b in zip(from_chars, to_chars))
                    text = translate( text, trantab )
                    #text = text.translate(trantab)
                    #text = test
                    for j in range(0,len(text),20):
                        status_text = ' '+set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+text[j:j+25]
                        STATUSNET =  status_user + status_text
                        sleep(3)
            except:
                sleep(3)
Esempio n. 11
0
 def run ( self ):
     global STATUS,STATUSNET
     while True:
         try:
             STATUS = load(urlopen("http://status.foss.ntua.gr/api/statuses/public_timeline.as?count=3"))
             sleep(60)
         except URLError:
             STATUSNET=set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+"Cannot connect"+set_normal_color()
             sleep(60)