Example #1
0
    def create_aptoncd(self):
        
        #this will hold error information.
        errorMsg = ""
        
        self.progress = ProgressDialog(self.get_main_window())
        self.progress.can_cancel_progress = True
        self.progress.title = constants.MESSAGE_0024 
        self.progress.description = constants.MESSAGE_0025 

        #defines the steps to create this iso.
        process = [constants.MESSAGE_0020, constants.MESSAGE_0021, \
                   constants.MESSAGE_0022, constants.MESSAGE_0023]
        self.steps = stepswidget.ProgressSteps(process)
        self.progress.add_widget(self.steps)
        
        #set temp variables for packages locations
        tmpdir = utils.join_path(self.temp_path, 'aptoncd') #"/tmp/aptoncd/"
        tmpmetapackageDir = utils.join_path(tmpdir , 'metapackage')
        tmppackages = utils.join_path(tmpdir , 'packages')
        
        #creates a temporary location to work with .deb files
        utils.mkdir(tmpdir, True)
        
        #get what files will be on each cd
        if self.values['media_type'] == 'CD':
            isoFileList = self.CreateIsoList(constants.CD)
        else:
            isoFileList = self.CreateIsoList(constants.DVD)
        #we will starting changing here to break process in parts
        # first, copy files from cds to locations
        
        result, msg = self.copy_files(isoFileList,tmpdir)
        # the user clicked cancel button
        if not result :
            self.get_main_window().set_sensitive(True)
            return False
            
        result, msg = self.scan_packages(isoFileList,tmpdir)
        if not result :
            self.get_main_window().set_sensitive(True)
            return False 
        
        self.create_iso(isoFileList,tmpdir)
        
        self.steps.set_current(3)
        gui.processEvents()
        #clean folders created previously    
        utils.removePath(tmpdir)
        self.steps.set_done(3)
        
        burn_list = {}
        index=0
        for indx, burns in enumerate(utils.get_burn_applications(constants.BURNS_DATA)):
        	item = utils.whereis(burns[0])
        	
        	if item:
        		burn_list[index]= { 'name':burns[0], 'location':item , 'parameter':burns[1]}
        		index += 1
        		        
        if index >= 1:
        	dlgburn = FinishedDialog(self, burn_list)
        	self.progress.destroy()
        	result, index = dlgburn.run()
        	
        	if result == 1:
        		for iso in self.isos:
        			command = burn_list[index]['location'] + ' '+ burn_list[index]['parameter'] + iso + ' &'
        			utils.run_command(command)
        	dlgburn.destroy()  
        
        self.get_main_window().set_sensitive(True)
        
        self.main_window = gui.get_glade(constants.MAIN_GUI, 'main')
        self.notebook = gui.get_widget(self.main_window, 'notebook')
        self.notebook.set_current_page(0)