Esempio n. 1
0
    def preview(self, filefolder):

        if (self.has_mp3lame == False):
            self.window.destroy()
            return

        self.init_queue()
        newtree = devede_other.create_tree(self, "wpreview_dialog",
                                           self.gladefile, False)
        timev = newtree.get_object("seconds_preview")
        timev.set_value(60)

        w = newtree.get_object("wpreview_dialog")
        w.show()
        ret = w.run()
        w.hide()
        self.filefolder = filefolder
        if self.filefolder[-1] != os.sep:
            self.filefolder += os.sep
        self.seconds = timev.get_value()
        w.destroy()
        if ret != -6:
            self.window.destroy()
            return

        self.runner = None
        self.queue.append(["PREVIEW"])  # Preview
        self.total_done = 0.0
        self.filename = "previewfile"

        try:
            fichero = open(self.filefolder + "write_check", "w")
            fichero.write("Testing")
            fichero.close()
        except:
            self.show_error(
                _("Failed to write to the destination directory.\nCheck that you have privileges and free space there."
                  ))
            self.window.destroy()
            return

        try:
            os.remove(self.filefolder + "write_check")
        except:
            print "Failed to erase the write check file"

        self.eraser = devede_delete.delete_files(self.filename,
                                                 self.filefolder)
        self.erase_temp = True
        self.timer = gobject.timeout_add(250, self.time_callback)
        self.window.show()
        return
Esempio n. 2
0
    def preview(self, filefolder):

        newtree = gtk.glade.XML(self.gladefile,
                                "wpreview_dialog",
                                domain="devede")
        timev = newtree.get_widget("seconds_preview")
        timev.set_value(60)
        path = newtree.get_widget("temporary_files")
        path.set_filename(filefolder)
        w = newtree.get_widget("wpreview_dialog")
        w.show()
        ret = w.run()
        w.hide()
        self.filefolder = path.get_filename()
        if self.filefolder[-1] != os.sep:
            self.filefolder += os.sep
        self.seconds = timev.get_value()
        w.destroy()
        if ret != -6:
            return self.filefolder

        self.runner = None
        self.current_action = "add_subtitles"
        self.current_title = 0
        self.current_chapter = 0
        self.total_done = 0.0
        self.filename = "previewfile"

        try:
            fichero = open(self.filefolder + "write_check", "w")
            fichero.write("Testing")
            fichero.close()
        except:
            self.show_error(
                _("Failed to write to the destination directory.\nCheck that you have privileges and free space there."
                  ))
            self.window.destroy()
            return self.filefolder

        try:
            os.remove(self.filefolder + "write_check")
        except:
            print "Failed to erase the write check file"

        self.eraser = devede_delete.delete_files(self.filename,
                                                 self.filefolder)
        self.erase_temp = True
        self.timer = gobject.timeout_add(500, self.time_callback)
        self.window.show()
        return self.filefolder
Esempio n. 3
0
	def preview(self,filefolder):
		
		if (self.has_mp3lame==False):
			self.window.destroy()
			return
		
		self.init_queue()
		newtree=devede_other.create_tree(self,"wpreview_dialog",self.gladefile,False)
		timev=newtree.get_object("seconds_preview")
		timev.set_value(60)
		
		w=newtree.get_object("wpreview_dialog")
		w.show()
		ret=w.run()
		w.hide()
		self.filefolder=filefolder
		if self.filefolder[-1]!=os.sep:
			self.filefolder+=os.sep
		self.seconds=timev.get_value()
		w.destroy()
		if ret!=-6:
			self.window.destroy()
			return

		self.runner=None
		self.queue.append(["PREVIEW"]) # Preview
		self.total_done=0.0
		self.filename="previewfile"
		
		try:
			fichero=open(self.filefolder+"write_check","w")
			fichero.write("Testing")
			fichero.close()
		except:
			self.show_error(_("Failed to write to the destination directory.\nCheck that you have privileges and free space there."))
			self.window.destroy()
			return
		
		try:
			os.remove(self.filefolder+"write_check")
		except:
			print "Failed to erase the write check file"
		
		self.eraser=devede_delete.delete_files(self.filename,self.filefolder)
		self.erase_temp=True
		self.timer=gobject.timeout_add(250,self.time_callback)
		self.window.show()
		return
	def preview(self,filefolder):
		
		newtree=gtk.glade.XML(self.gladefile,"wpreview_dialog",domain="devede")
		timev=newtree.get_widget("seconds_preview")
		timev.set_value(60)
		path=newtree.get_widget("temporary_files")
		path.set_filename(filefolder)
		w=newtree.get_widget("wpreview_dialog")
		w.show()
		ret=w.run()
		w.hide()
		self.filefolder=path.get_filename()
		if self.filefolder[-1]!=os.sep:
			self.filefolder+=os.sep
		self.seconds=timev.get_value()
		w.destroy()
		if ret!=-6:
			return self.filefolder

		self.runner=None
		self.current_action="add_subtitles"
		self.current_title=0
		self.current_chapter=0
		self.total_done=0.0
		self.filename="previewfile"
		
		try:
			fichero=open(self.filefolder+"write_check","w")
			fichero.write("Testing")
			fichero.close()
		except:
			self.show_error(_("Failed to write to the destination directory.\nCheck that you have privileges and free space there."))
			self.window.destroy()
			return self.filefolder
		
		try:
			os.remove(self.filefolder+"write_check")
		except:
			print "Failed to erase the write check file"
		
		self.eraser=devede_delete.delete_files(self.filename,self.filefolder)
		self.erase_temp=True
		self.timer=gobject.timeout_add(500,self.time_callback)
		self.window.show()
		return self.filefolder
Esempio n. 5
0
	def create_disc(self):
		
		self.time=0
		
		if (self.has_mp3lame==False):
			self.window.hide()
			self.window.destroy()
			(self.main_window_callback)()
			return False
		
		# first, check for empty titles
		
		empty=False
		for element in self.structure:
			if len(element)<2:
				empty=True
				break
			
		if empty:
			newtree=devede_other.create_tree(self,"wempty_titles_dialog",self.gladefile,False)
			w=newtree.get_object("wempty_titles_dialog")
			w.show()
			value=w.run()
			w.hide()
			w.destroy()
			if value!=-6:
				self.window.hide()
				self.window.destroy()
				(self.main_window_callback)()
				return False

		# ask the folder and filename
		
		newtree=devede_other.create_tree(self,"wfolder_dialog",self.gladefile,False)
		wdir=newtree.get_object("final_directory")
		if self.global_vars["finalfolder"]!="":
			wdir.set_current_folder(self.global_vars["finalfolder"])
		wfile=newtree.get_object("iso_filename")
		wfolder_dialog=newtree.get_object("wfolder_dialog")
		do_shdw=newtree.get_object("do_shutdown")
		wfile.set_text("movie")
		wfile.connect("activate",self.on_iso_filename_activate,wfolder_dialog)
		wfile.connect("changed",self.iso_changed,newtree)
		wdir.connect("current-folder-changed",self.iso_changed,newtree)
		#self.iso_changed("",newtree)

		wfolder_dialog.show()
		wfile.grab_focus()
		print "Entro en RUN"
		value=wfolder_dialog.run()
		print "Salgo de RUN"
		self.global_vars["shutdown_after_disc"]=do_shdw.get_active()
		self.filename=wfile.get_text()
		self.filename.replace("/","_")
		self.filename.replace("|","_")
		self.filename.replace("\\","_")
		
		filefolder=wdir.get_current_folder()
		
		wfolder_dialog.hide()
		wfolder_dialog.destroy()
		if value!=-6:
			self.window.hide()
			self.window.destroy()
			(self.main_window_callback)()
			return False
		
		self.global_vars["finalfolder"]=filefolder
		
		filefolder2=os.path.join(filefolder,self.filename)
		
		self.filefolder=filefolder2
		
		if self.filefolder[-1]!=os.sep:
			self.filefolder+=os.sep
		
		if (os.path.exists(filefolder2)):
			newtree=devede_other.create_tree(self,"wfolder_exists",self.gladefile,False)
			w=newtree.get_object("wfolder_exists")
			wtext=newtree.get_object("folder_exists_label")
			wtext.set_text(_("The file or folder\n\n%(folder)s\n\nalready exists. If you continue, it will be deleted.") % {'folder':filefolder2})
			w.show()
			value=w.run()
			w.hide()
			w.destroy()
			if value!=2:
				self.window.hide()
				self.window.destroy()
				(self.main_window_callback)()
				return False
		
		try:
			os.remove(filefolder2)
		except:
			pass
		
		try:
			os.makedirs(filefolder2)
		except:
			pass
	
		self.eraser=devede_delete.delete_files(self.filename,self.filefolder)
		hasfree,msg=self.check_free_space(self.filefolder,self.structure,self.actions,self.erase_temp,self.global_vars["menu_sound_duration"])
		if hasfree:
			self.window.hide()
			self.window.destroy()
			self.show_error(msg)
			(self.main_window_callback)()
			return False
	
		# erase all conflicting files
		
		self.eraser.delete_all()
		
		# now, create the XML files (even with VCD, SVCD or CVD, to check if we have write permissions)

		xml_files=devede_xml_menu.xml_files(self.partial,self.filename,self.filefolder,self.structure,self.global_vars,self.label)

		counter=0
		counter2=0
		if (self.disk_type=="dvd"):
			if xml_files.do_menus():
				nelements=xml_files.get_elements_per_menu()
				while (len(self.structure[counter:])!=0):
					self.queue.append(["M1",xml_files,counter,counter2])
					counter+=nelements
					counter2+=1

		self.init_queue()

		retorno=xml_files.create_files()
		if retorno!=None:
			self.window.hide()
			self.window.destroy()
			self.show_error(retorno)
			(self.main_window_callback)()
			return False
		
		self.runner=None
		if self.actions!=1: # want to do, at least, the DVD structure, or the VCD image
			if self.disk_type=="dvd":
				self.queue.append(["DVD_STRUCTURE"])
				if self.actions==3: # do DVD image too
					self.queue.append(["DVD_IMAGE"])
			else:
				self.queue.append(["CD_IMAGE"])
		
		self.queue.append(["END"])
		self.seconds=0
		self.total_done=0.0
		self.timer=gobject.timeout_add(250,self.time_callback)
		self.window.show()
		return True
Esempio n. 6
0
    def create_disc(self):

        self.time = 0

        if (self.has_mp3lame == False):
            self.window.hide()
            self.window.destroy()
            (self.main_window_callback)()
            return False

        # first, check for empty titles

        empty = False
        for element in self.structure:
            if len(element) < 2:
                empty = True
                break

        if empty:
            newtree = devede_other.create_tree(self, "wempty_titles_dialog",
                                               self.gladefile, False)
            w = newtree.get_object("wempty_titles_dialog")
            w.show()
            value = w.run()
            w.hide()
            w.destroy()
            if value != -6:
                self.window.hide()
                self.window.destroy()
                (self.main_window_callback)()
                return False

        # ask the folder and filename

        newtree = devede_other.create_tree(self, "wfolder_dialog",
                                           self.gladefile, False)
        wdir = newtree.get_object("final_directory")
        if self.global_vars["finalfolder"] != "":
            wdir.set_current_folder(self.global_vars["finalfolder"])
        wfile = newtree.get_object("iso_filename")
        wfolder_dialog = newtree.get_object("wfolder_dialog")
        do_shdw = newtree.get_object("do_shutdown")
        wfile.set_text("movie")
        wfile.connect("activate", self.on_iso_filename_activate,
                      wfolder_dialog)
        wfile.connect("changed", self.iso_changed, newtree)
        wdir.connect("current-folder-changed", self.iso_changed, newtree)
        #self.iso_changed("",newtree)

        wfolder_dialog.show()
        wfile.grab_focus()
        print "Entro en RUN"
        value = wfolder_dialog.run()
        print "Salgo de RUN"
        self.global_vars["shutdown_after_disc"] = do_shdw.get_active()
        self.filename = wfile.get_text()
        self.filename.replace("/", "_")
        self.filename.replace("|", "_")
        self.filename.replace("\\", "_")

        filefolder = wdir.get_current_folder()

        wfolder_dialog.hide()
        wfolder_dialog.destroy()
        if value != -6:
            self.window.hide()
            self.window.destroy()
            (self.main_window_callback)()
            return False

        self.global_vars["finalfolder"] = filefolder

        filefolder2 = os.path.join(filefolder, self.filename)

        self.filefolder = filefolder2

        if self.filefolder[-1] != os.sep:
            self.filefolder += os.sep

        if (os.path.exists(filefolder2)):
            newtree = devede_other.create_tree(self, "wfolder_exists",
                                               self.gladefile, False)
            w = newtree.get_object("wfolder_exists")
            wtext = newtree.get_object("folder_exists_label")
            wtext.set_text(
                _("The file or folder\n\n%(folder)s\n\nalready exists. If you continue, it will be deleted."
                  ) % {'folder': filefolder2})
            w.show()
            value = w.run()
            w.hide()
            w.destroy()
            if value != 2:
                self.window.hide()
                self.window.destroy()
                (self.main_window_callback)()
                return False

        try:
            os.remove(filefolder2)
        except:
            pass

        try:
            os.mkdir(filefolder2)
        except:
            pass

        self.eraser = devede_delete.delete_files(self.filename,
                                                 self.filefolder)
        hasfree, msg = self.check_free_space(
            self.filefolder, self.structure, self.actions, self.erase_temp,
            self.global_vars["menu_sound_duration"])
        if hasfree:
            self.window.hide()
            self.window.destroy()
            self.show_error(msg)
            (self.main_window_callback)()
            return False

        # erase all conflicting files

        self.eraser.delete_all()

        # now, create the XML files (even with VCD, SVCD or CVD, to check if we have write permissions)

        xml_files = devede_xml_menu.xml_files(self.partial, self.filename,
                                              self.filefolder, self.structure,
                                              self.global_vars, self.label)

        counter = 0
        counter2 = 0
        if (self.disk_type == "dvd"):
            if xml_files.do_menus():
                nelements = xml_files.get_elements_per_menu()
                while (len(self.structure[counter:]) != 0):
                    self.queue.append(["M1", xml_files, counter, counter2])
                    counter += nelements
                    counter2 += 1

        self.init_queue()

        retorno = xml_files.create_files()
        if retorno != None:
            self.window.hide()
            self.window.destroy()
            self.show_error(retorno)
            (self.main_window_callback)()
            return False

        self.runner = None
        if self.actions != 1:  # want to do, at least, the DVD structure, or the VCD image
            if self.disk_type == "dvd":
                self.queue.append(["DVD_STRUCTURE"])
                if self.actions == 3:  # do DVD image too
                    self.queue.append(["DVD_IMAGE"])
            else:
                self.queue.append(["CD_IMAGE"])

        self.queue.append(["END"])
        self.seconds = 0
        self.total_done = 0.0
        self.timer = gobject.timeout_add(250, self.time_callback)
        self.window.show()
        return True
Esempio n. 7
0
    def create_disc(self):

        self.time = 0

        # first, check for empty titles

        vacio = False
        for elemento in self.structure:
            if len(elemento) < 2:
                vacio = True
                break

        if vacio:
            newtree = gtk.glade.XML(self.gladefile,
                                    "wempty_titles_dialog",
                                    domain="devede")
            w = newtree.get_widget("wempty_titles_dialog")
            w.show()
            value = w.run()
            w.hide()
            w.destroy()
            if value != -6:
                return False

        # ask the folder and filename

        newtree = gtk.glade.XML(self.gladefile,
                                "wfolder_dialog",
                                domain="devede")
        wdir = newtree.get_widget("final_directory")
        wfile = newtree.get_widget("iso_filename")
        wfile.set_text("movie")
        wfile.connect("changed", self.iso_changed, newtree)
        self.iso_changed("", newtree)
        w = newtree.get_widget("wfolder_dialog")
        w.show()
        value = w.run()
        self.filename = wfile.get_text()
        self.filefolder = wdir.get_filename()
        if self.filefolder[-1] != os.sep:
            self.filefolder += os.sep
        w.hide()
        w.destroy()
        if value != -6:
            return False

        self.eraser = devede_delete.delete_files(self.filename,
                                                 self.filefolder)
        hasfree, msg = self.check_free_space(self.filefolder, self.structure,
                                             self.actions, self.erase_temp)
        if hasfree:
            self.window.hide()
            self.window.destroy()
            self.show_error(msg)
            self.main_window.show()
            return False

        # erase all conflicting files

        self.eraser.delete_all()

        # now, create the XML files (even with VCD, SVCD or CVD, to check if we have write permissions)

        xml_files = devede_xml_menu.xml_files()
        retorno = xml_files.create_files(
            self.filename, self.filefolder, self.structure,
            self.global_vars["do_menu"], self.global_vars["menu_PAL"],
            self.global_vars["menu_widescreen"], self.global_vars["path"],
            self.global_vars["menu_bg"], self.global_vars["fontname"],
            self.global_vars["path"])
        if retorno != None:
            self.window.hide()
            self.window.destroy()
            self.show_error(retorno)
            self.main_window.show()
            return False

        xml_files.end_process(self.eraser, self.erase_temp)
        xml_files = None
        self.runner = None
        self.current_action = "add_subtitles"
        self.current_title = 0
        self.current_chapter = 0
        self.seconds = 0
        self.total_done = 0.0
        self.timer = gobject.timeout_add(500, self.time_callback)
        self.window.show()
        return True
	def create_disc(self):
		
		self.time=0
		
		# first, check for empty titles
		
		vacio=False
		for elemento in self.structure:
			if len(elemento)<2:
				vacio=True
				break
			
		if vacio:
			newtree=gtk.glade.XML(self.gladefile,"wempty_titles_dialog",domain="devede")
			w=newtree.get_widget("wempty_titles_dialog")
			w.show()
			value=w.run()
			w.hide()
			w.destroy()
			if value!=-6:
				return False

		# ask the folder and filename
		
		newtree=gtk.glade.XML(self.gladefile,"wfolder_dialog",domain="devede")
		wdir=newtree.get_widget("final_directory")
		wfile=newtree.get_widget("iso_filename")
		wfile.set_text("movie")
		wfile.connect("changed",self.iso_changed,newtree)
		self.iso_changed("",newtree)
		w=newtree.get_widget("wfolder_dialog")
		w.show()
		value=w.run()
		self.filename=wfile.get_text()
		self.filefolder=wdir.get_filename()
		if self.filefolder[-1]!=os.sep:
			self.filefolder+=os.sep
		w.hide()
		w.destroy()
		if value!=-6:
			return False
	
		self.eraser=devede_delete.delete_files(self.filename,self.filefolder)
		hasfree,msg=self.check_free_space(self.filefolder,self.structure,self.actions,self.erase_temp)
		if hasfree:
			self.window.hide()
			self.window.destroy()
			self.show_error(msg)
			self.main_window.show()
			return False
	
		# erase all conflicting files
		
		self.eraser.delete_all()
		
		# now, create the XML files (even with VCD, SVCD or CVD, to check if we have write permissions)

		xml_files=devede_xml_menu.xml_files()
		retorno=xml_files.create_files(self.filename,self.filefolder,self.structure,self.global_vars["do_menu"],self.global_vars["menu_PAL"],self.global_vars["menu_widescreen"],self.global_vars["path"],self.global_vars["menu_bg"],self.global_vars["fontname"],self.global_vars["path"])
		if retorno!=None:
			self.window.hide()
			self.window.destroy()
			self.show_error(retorno)
			self.main_window.show()
			return False
	
		xml_files.end_process(self.eraser,self.erase_temp)
		xml_files=None
		self.runner=None
		self.current_action="add_subtitles"
		self.current_title=0
		self.current_chapter=0
		self.seconds=0
		self.total_done=0.0
		self.timer=gobject.timeout_add(500,self.time_callback)
		self.window.show()
		return True