import commands import os import hildon import gtk details = '' less = '' r = commands.getoutput("/usr/bin/dpkg --get-selections") packages = r.rsplit('\n') for index,package in enumerate(packages): print 'Processing packages ',index,' on ',len(packages) #print package.split('\t') s = package.split('\t') if s[(len(s)-1)] == 'install': pkg_files = commands.getoutput("/usr/bin/dpkg -L "+s[0]).split('\n') pkg_size = 0 for pkg_file in pkg_files: #pkg_size = 0 if ('/opt' not in pkg_file) or ('/home' not in pkg_file): try: st = os.stat(pkg_file) if st.st_blocks > 0: details = details + '\n'+ s[0]+':'+pkg_file+':'+str(st.st_size/1024)+'Kb' pkg_size = pkg_size + st.st_size except: pass less = less + '\n' + s[0] + ' : '+str(pkg_size/1024)+'Kb' print less w = hildon.Window() p = hildon.PannableArea() t = hildon.TextView() p.add(t) w.add(p) total = less+'\n\n\n'+details t.get_buffer().set_text(total) w.show_all() gtk.main()