Ejemplo n.º 1
0
    def finish_initializing(self):
        self.AboutDialog = self.builder.get_object("about_gdiskdump_dialog")

        # Code for other initialization actions should be added here.
        self.input=[None,None,None,None,None]
        self.output=[None,None,None]
        self.get_partition_liststore()
        self.get_hd_liststore()
        self.datapath =getdatapath()
        filter = gtk.FileFilter()
        filter.set_name(_('All Files'))
        filter.add_pattern('*')
        self.all_filter=filter
        filter = gtk.FileFilter()
        filter.set_name('img')
        filter.add_pattern('*.tar.gz')
        filter.add_pattern('*.img.gz')
        filter.add_pattern('*.img')
        self.img_filter=filter
        filter = gtk.FileFilter()
        filter.set_name('img')
        filter.add_pattern('*')
        self.empty_img_filter=filter
        self.builder.get_object("i_filechooserwidget").add_filter(self.img_filter)
        self.builder.get_object("i_filechooserwidget").add_filter(self.all_filter)
        self.builder.get_object("o_filechooserwidget").add_filter(self.empty_img_filter)
        self.builder.get_object("o_filechooserwidget").add_filter(self.all_filter)
        print 'finished initializing' 
Ejemplo n.º 2
0
 def get_partition_liststore(self):
     liststore=self.builder.get_object("partition_liststore")
     process = subprocess.Popen(['fdisk', '-l'],stdout=subprocess.PIPE,shell=False)
     outstr,err=process.communicate()
     pix=gtk.gdk.pixbuf_new_from_file(getdatapath() +'/media/drive-harddisk.svg')
     devlist=outstr.splitlines()
     for i in range(len(devlist)):
         if devlist[i].startswith(('/dev/')):
             row=devlist[i].replace('*','')
             partinfo=row.split(None,5)
             part=partinfo[0]
             blocks=partinfo[3].strip('+ ')
             size=(int(blocks) * 1024)
             convsize=self.convert_bytes(size)
             system=partinfo[5]
             rowiter=liststore.append()
             liststore.set(rowiter,0,pix,1,part,2,blocks,3,size,4,convsize,5,system)
     print 'got partition list'
Ejemplo n.º 3
0
 def get_hd_liststore(self):
     liststore=self.builder.get_object("hd_liststore")
     process = subprocess.Popen(['fdisk','-l'],stdout=subprocess.PIPE,shell=False)
     outstr,err=process.communicate()
     pix=gtk.gdk.pixbuf_new_from_file(getdatapath() +'/media/drive-harddisk.svg')
     devlist=outstr.splitlines()
     for i in range(len(devlist)):
         if len(devlist[i].split(', ')) == 2 and len(devlist[i].split()) <= 7 and devlist[i].split()[1].startswith('/dev/'):
             hdinfo=devlist[i].split()
             hd=hdinfo[1].rstrip(':')
             blocks=0
             #language support
             if hdinfo[4].strip(' ').isdigit():
                 size=hdinfo[4].replace(' ','')
             else:
                 size=hdinfo[5].replace(' ','')                    
             convsize=self.convert_bytes(size)                
             rowiter=liststore.append()
             liststore.set(rowiter,0,pix,1,hd,2,blocks,3,size,4,convsize)
     print 'got hd list'