示例#1
0
	def __init__(self,gladefile,structure,global_vars):
		
		""" Shows a window with a preview of the disc menu """
		
		self.menu_preview=None
		if global_vars["PAL"]:
			newtree=devede_other.create_tree(self,"wmenu_preview_pal",gladefile)
			window=newtree.get_object("wmenu_preview_pal")
			self.menu_preview=newtree.get_object("preview_draw_pal")
		else:
			newtree=devede_other.create_tree(self,"wmenu_preview_ntsc",gladefile)
			window=newtree.get_object("wmenu_preview_ntsc")
			self.menu_preview=newtree.get_object("preview_draw_ntsc")
		print self.menu_preview

		if global_vars.has_key("install_path")==False:
			global_vars["install_path"]=None
		if global_vars.has_key("path")==False:
			global_vars["path"]=""
		if global_vars.has_key("menu_sound")==False:
			global_vars["menu_sound"]=""
		if global_vars.has_key("menu_sound_duration")==False:
			global_vars["menu_sound_duration"]=1
		clase=devede_xml_menu.xml_files(None,None,None,structure,global_vars,"","")
		self.sf=clase.create_menu_bg(0,0,0,True)

		if self.sf==None:
			devede_dialogs.show_error(gladefile,_("Can't find the menu background.\nCheck the menu options."))
		else:
			window.show()
			window.run()
			window.hide()
		window.destroy()
		window=None
示例#2
0
	def on_moviefile_file_set(self,widget):
		
		w=self.tree.get_object("moviefile")
		filename=widget.get_filename()
		
		print "File changed to "+str(filename)
		
		if (filename==None) or (filename==""):
			self.set_widgets()
			self.set_global_values()
			self.set_film_buttons()
			return

		self.global_vars["filmpath"]=os.path.split(filename)[0]
		
		if self.change_file:
			self.set_widgets()
			self.set_global_values()
			self.set_film_buttons()
			self.change_file=False
			return
		
		fine,tracks=self.create_default_video_parameters(filename)
		if fine==False: # it's not a video file
			if tracks==0: # it's not a multimedia file
				devede_dialogs.show_error(self.gladefile,_("File doesn't seem to be a video file."))
			else:
				devede_dialogs.show_error(self.gladefile,_("File seems to be an audio file."))
			w.unselect_all()
		self.set_widgets()
		self.set_global_values()
		self.set_film_buttons()
示例#3
0
	def on_main_go_clicked(self,widget):

		total=0
		for title in self.structure:
			total+=len(title)-1
	
		maxtitles=devede_other.get_max_titles(self.disctocreate)
		if total>maxtitles:
			devede_dialogs.show_error(self.gladefile,(_("Your project contains %(X)d movie files, but the maximum is %(MAX)d. Please, remove some files and try again.")) % {"X":total , "MAX":maxtitles})
			return
	
		actions=0	
		w=self.tree.get_object("only_convert")
		if w.get_active():
			actions=1
		else:
			w=self.tree.get_object("create_dvd")
			if (w.get_active()) or ((self.disctocreate!="dvd") and (self.disctocreate!="divx")):
				actions=2
			else:
				actions=3
	
		self.global_vars["number_actions"]=actions
		
		self.global_vars["erase_temporary_files"]=self.global_vars["erase_files"]
		
		print "Threads: "+str(self.global_vars["multicore"])
		conversor=devede_convert.create_all(self.gladefile,self.structure,self.global_vars,self.callback2)
		if conversor.create_disc():
			self.window.hide()
示例#4
0
	def on_main_go_clicked(self,widget):

		total=0
		for title in self.structure:
			total+=len(title)-1
	
		maxtitles=devede_other.get_max_titles(self.disctocreate)
		if total>maxtitles:
			devede_dialogs.show_error(self.gladefile,(_("Your project contains %(X)d movie files, but the maximum is %(MAX)d. Please, remove some files and try again.")) % {"X":total , "MAX":maxtitles})
			return
	
		actions=0	
		w=self.tree.get_object("only_convert")
		if w.get_active():
			actions=1
		else:
			w=self.tree.get_object("create_dvd")
			if (w.get_active()) or ((self.disctocreate!="dvd") and (self.disctocreate!="divx")):
				actions=2
			else:
				actions=3
	
		self.global_vars["number_actions"]=actions
		
		self.global_vars["erase_temporary_files"]=self.global_vars["erase_files"]
		
		print "Threads: "+str(self.global_vars["multicore"])
		conversor=devede_convert.create_all(self.gladefile,self.structure,self.global_vars,self.callback2)
		if conversor.create_disc():
			self.window.hide()
示例#5
0
    def __init__(self, gladefile, installpath, filename):

        devede_executor.executor.__init__(self)
        self.printout = False

        if (sys.platform == "win32") or (sys.platform == "win64"):
            webbrowser.open_new(os.path.join(installpath, filename))
            return

        self.printout = False

        launch_list = [[True, "yelp"], [False, "epiphany"],
                       [False, "konqueror"], [False, "firefox", "-new-window"],
                       [False, "opera", "-newwindow"]]

        file = os.path.join(installpath, "html", filename)

        for program in launch_list:
            if program[0]:
                program.append("file://" + file)
            else:
                program.append(file)
            retval = self.launch_program(program[1:], 80, False)
            if retval != None:
                break

        if retval == None:
            msg = devede_dialogs.show_error(gladefile,
                                            _("Can't open the help files."))
	def __init__(self,gladefile,installpath,filename):
		
		file="file://"+os.path.join(installpath,"html",filename)	
		
		retval = gtk.show_uri(None,file,gtk.gdk.CURRENT_TIME)
		if retval==False:
			msg=devede_dialogs.show_error(gladefile,_("Can't open the help files."))
示例#7
0
	def __init__(self,gladefile,installpath,filename):
		
		devede_executor.executor.__init__(self)
		self.printout=False
		
		if (sys.platform=="win32") or (sys.platform=="win64"):
			webbrowser.open_new(os.path.join(installpath, filename))
			return

		self.printout=False

		launch_list=[[True,"yelp"],[False,"epiphany"],[False,"konqueror"],[False,"firefox","-new-window"],[False,"opera","-newwindow"]]

		file=os.path.join(installpath,"html",filename)	
		
		for program in launch_list:
			if program[0]:
				program.append("file://"+file)
			else:
				program.append(file)
			retval=self.launch_program(program[1:],80,False)
			if retval!=None:
				break
			
		if retval==None:
			msg=devede_dialogs.show_error(gladefile,_("Can't open the help files."))
示例#8
0
    def __init__(self, gladefile, installpath, filename):

        file = "file://" + os.path.join(installpath, "html", filename)

        retval = gtk.show_uri(None, file, gtk.gdk.CURRENT_TIME)
        if retval == False:
            msg = devede_dialogs.show_error(gladefile,
                                            _("Can't open the help files."))
示例#9
0
	def draganddrop(self,widget,drag_context, x, y, selection, info, time):

		""" Manages the Drag&Drop in the property window """

		sub_extensions3=[".sub",".srt",".ssa",".smi",".txt",".aqt",".jss", ".ass"]
		sub_extensions2=[".rt",".js"]

		lista=self.split_dnd(selection.data)

		if len(lista)==0:
			return

		if len(lista)>1:
			devede_dialogs.show_error(self.gladefile,_("Please, add only one file each time."))
			return

		if self.disctocreate!="divx":
			print("Entro en subs")
			filename=str(lista[0]).lower()
			if len(filename)>=4:
				extension3=filename[-4:]
				extension2=filename[-3:]
				print "Extensiones: "+str(extension3)+" "+str(extension2)
				if (0!=sub_extensions3.count(extension3)) or (0!=sub_extensions2.count(extension2)): # is a subtitle
					current_file=self.tree.get_object("moviefile").get_filename()
					if (current_file=="") or (current_file==None):
						devede_dialogs.show_error(self.gladefile,_("Please, add a movie file before adding subtitles."))
						return
					window=ask_subtitle(self.gladefile,self.global_vars["filmpath"],self.global_vars,lista[0])
					ret=window.run()
					window=None
					if ret!=None:
						self.file_properties["sub_list"].append(ret)
						self.refresh_subtitles()
						self.set_global_values()
					return

		w=self.tree.get_object("moviefile")
		print "Adding "+str(lista[0])
		w.set_filename(str(lista[0]))
示例#10
0
    def __init__(self, gladefile, structure, global_vars):
        """ Shows a window with a preview of the disc menu """

        self.menu_preview = None
        if global_vars["PAL"]:
            newtree = devede_other.create_tree(self, "wmenu_preview_pal",
                                               gladefile)
            window = newtree.get_object("wmenu_preview_pal")
            self.menu_preview = newtree.get_object("preview_draw_pal")
        else:
            newtree = devede_other.create_tree(self, "wmenu_preview_ntsc",
                                               gladefile)
            window = newtree.get_object("wmenu_preview_ntsc")
            self.menu_preview = newtree.get_object("preview_draw_ntsc")
        print self.menu_preview

        if global_vars.has_key("install_path") == False:
            global_vars["install_path"] = None
        if global_vars.has_key("path") == False:
            global_vars["path"] = ""
        if global_vars.has_key("menu_sound") == False:
            global_vars["menu_sound"] = ""
        if global_vars.has_key("menu_sound_duration") == False:
            global_vars["menu_sound_duration"] = 1
        clase = devede_xml_menu.xml_files(None, None, None, structure,
                                          global_vars, "", "")
        self.sf = clase.create_menu_bg(0, 0)

        if self.sf == None:
            devede_dialogs.show_error(
                gladefile,
                _("Can't find the menu background.\nCheck the menu options."))
        else:
            window.show()
            window.run()
            window.hide()
        window.destroy()
        window = None
示例#11
0
	def on_menu_sound_selection_changed(self,widget):
		
		print "Entro"
		
		if self.adding_sound:
			self.adding_sound=False
			return
		
		filename=widget.get_filename()
		if (filename==None) or (filename==""):
			return
		
		test=devede_newfiles.file_get_params()
		check,channels=test.read_file_values(filename,True)
		if (check!=False) or (channels!=1):
			filename=os.path.join(self.global_vars["path"],"silence.ogg")
			widget.set_filename(filename)
			w = devede_dialogs.show_error(self.gladefile,_("The menu soundtrack seems damaged. Using the default silent soundtrack."))
			w = None
		test=None
示例#12
0
    def draganddrop(self, widget, drag_context, x, y, selection, info, time):
        """ Manages the Drag&Drop in the main window """

        converter = devede_newfiles.newfile(self.global_vars["PAL"],
                                            self.disctocreate)

        list = converter.split_dnd(selection.data)

        if (len(list) == 1):  # check if it's a configuration file
            filename = list[0].lower()
            if len(filename) > 6:
                if filename[-7:] == ".devede":
                    self.on_devede_open_activate(None, list[0])
                    drag_context.finish(True, False, time)
                    return

        fine = True
        list2 = []
        for element in list:
            done, audio = converter.create_default_video_parameters(
                element)  # check if files are videos
            print done
            print audio
            if (done == False):
                fine = False
                break
            list2.append(converter.file_properties)

        if fine:
            title, chapter = self.get_marked()
            element = self.structure[title]
            for element2 in list2:
                element.append(element2)
            self.refresh_chapters()
            self.set_buttons()
        else:
            error = devede_dialogs.show_error(
                self.gladefile,
                _("Some files weren't video files.\nNone added."))
            error = None
        drag_context.finish(True, False, time)
示例#13
0
	def draganddrop(self,widget,drag_context, x, y, selection, info, time):
	
		""" Manages the Drag&Drop in the main window """
		
		converter=devede_newfiles.newfile(self.global_vars["PAL"],self.disctocreate)
		
		list=converter.split_dnd(selection.data)
		
		if (len(list)==1): # check if it's a configuration file
			filename=list[0].lower()
			if len(filename)>6:
				if filename[-7:]==".devede":
					self.on_devede_open_activate(None, list[0])
					drag_context.finish(True,False,time)
					return
		
		fine=True
		list2=[]
		for element in list:
			# Win32 Fix for unicode characters on win32 eg. á element.encode(sys.getfilesystemencoding()
			done,audio=converter.create_default_video_parameters(element.encode(sys.getfilesystemencoding())) # check if files are videos
			print done
			print audio
			if (done==False):
				fine=False
				break
			list2.append(converter.file_properties)
		
		if fine:
			title,chapter=self.get_marked()
			element=self.structure[title]
			for element2 in list2:
				element.append(element2)
			self.refresh_chapters()
			self.set_buttons()
		else:
			error=devede_dialogs.show_error(self.gladefile,_("Some files weren't video files.\nNone added."))
			error=None
		drag_context.finish(True,False,time)
示例#14
0
    def on_menu_sound_selection_changed(self, widget):

        print "Entro"

        if self.adding_sound:
            self.adding_sound = False
            return

        filename = widget.get_filename()
        if (filename == None) or (filename == ""):
            return

        test = devede_newfiles.file_get_params()
        check, channels = test.read_file_values(filename, True)
        if (check != False) or (channels != 1):
            filename = os.path.join(self.global_vars["path"], "silence.ogg")
            widget.set_filename(filename)
            w = devede_dialogs.show_error(
                self.gladefile,
                _("The menu soundtrack seems damaged. Using the default silent soundtrack."
                  ))
            w = None
        test = None
示例#15
0
	def show_error(self,message):
		
		self.window.hide()
		self.window.destroy()
		devede_dialogs.show_error(self.gladefile,message)
		return
示例#16
0
    def show_error(self, message):

        self.window.hide()
        self.window.destroy()
        devede_dialogs.show_error(self.gladefile, message)
        return
示例#17
0
	def on_autosize_clicked(self,widget):
		
		""" Adjust the videorate of each file to ensure that the disk usage is optimal """
		
		fixed_size=[]
		variable_size=[]
		
		# First, set the non-adjustable bitrate videos in a different list
		
		for element in self.structure:
			for element2 in element[1:]:
				if (element2["ismpeg"]) or (element2["isvob"]):
					fixed_size.append(element2)
				else:
					variable_size.append(element2)
		
		discsize,minrate,maxrate=devede_other.get_dvd_size(self.tree,self.disctocreate)	
		discsize*=1000 # size in kbytes
		# remove the space needed by menus
		discsize-=devede_other.calcule_menu_size(self.structure,self.global_vars["menu_sound_duration"])
		
		size_error=False
		dowhile=True
		while(dowhile):
			dowhile=False
			v_fixed_size=0
			for element in fixed_size:
				size,surface,length,arate = self.get_surface(element)
				subrate=8*len(element["sub_list"])
				v_fixed_size+=size+int((subrate*element["olength"])/8)

			available_size=discsize-v_fixed_size
				
			if (available_size<0): # the fixed_size videos need more disk space than the currently available
				size_error=True
				break
			
			if (len(variable_size)==0):
				break
			
			total_len=0.0
			total_surface=0.0
			for element in variable_size:
				size,surface,length,arate = self.get_surface(element)
				total_len+=length
				total_surface+=surface*length
				
			for element in variable_size:
				subrate=8*len(element["sub_list"])
				size,surface,length,arate = self.get_surface(element)
				videorate=8*(float(available_size))*((surface*length)/total_surface)
				videorate/=length
				videorate-=(arate+subrate)
				element["vrate"]=int(videorate)
				print int(videorate)
				if videorate<minrate:
					element["vrate"]=minrate
					dowhile=True
					fixed_size.append(element)
					variable_size.remove(element)
					break
				if videorate>maxrate:
					element["vrate"]=maxrate
					dowhile=True
					fixed_size.append(element)
					variable_size.remove(element)
					break

		if size_error:
			devede_dialogs.show_error(self.gladefile,_("Too many videos for this disc size.\nPlease, select a bigger disc type or remove some videos."))
		
		self.set_video_values()
示例#18
0
	def load(self,file_name):
		
		""" This method loads a configuration file """
		
		self.done = False
		
		if (len(self.structure)>1) or (len(self.structure[0])>1):
			w = devede_dialogs.ask_overwrite_onload(self.gladefile)
			retval = w.run()
			w = None
			if retval!=-8:
				return

		if file_name==None:
			tree=devede_other.create_tree(self,"wloadconfig",self.gladefile,False)
			window = tree.get_object("wloadconfig")
			
			filter = gtk.FileFilter()
			filter.add_pattern("*.devede")
			filter.set_name(".devede")
			window.add_filter(filter)
			
			window.show()
			retval = window.run()
			window.hide()
			if retval!=-5:
				window.destroy()
				window = None
				return
			
			file_name=window.get_filename()
			window.destroy()
			window = None
		
		try:
			output=open(file_name)
		except:
			w = devede_dialogs.show_error(self.gladefile,_("Can't open the file."))
			w = None
			return
	
		try:
			values=pickle.load(output)
		except:
			w = devede_dialogs.show_error(self.gladefile,_("That file doesn't contain a disc structure."))
			w = None
			return
		
		if values!="DeVeDe":
			w = devede_dialogs.show_error(self.gladefile,_("That file doesn't contain a disc structure."))
			w = None
			return
		
		global_vars2={}
		try:
			values=pickle.load(output)
			global_vars2=pickle.load(output)
		except:
			w = devede_dialogs.show_error(self.gladefile,_("That file doesn't contain a DeVeDe structure."))
			w = None
			return
	
		
		output.close()
		
		not_found=[]
		for element in values:
			for element2 in element[1:]:
				try:
					v=os.stat(element2["path"])
				except:
					not_found.append(str(element2["path"]))
					continue
				
				if False==element2.has_key("copy_audio"):
					element2["copy_audio"]=False # for backward compatibility
				if False==element2.has_key("sound51"):
					element2["sound51"]=False # for backward compatibility
				if False==element2.has_key("rotate"):
					element2["rotate"]=0
				if False==element2.has_key("vmirror"):
					element2["vmirror"]=False
				if False==element2.has_key("hmirror"):
					element2["hmirror"]=False
				if False==element2.has_key("gop12"):
					element2["gop12"]=True # for backward compatibility
				if False==element2.has_key("isvob"):
					element2["isvob"]=False # for backward compatibility
				if False==element2.has_key("swap_fields"):
					element2["swap_fields"]=False # for backward compatibility
				if False==element2.has_key("twopass"):
					element2["twopass"]=False # for backward compatibility
				if False==element2.has_key("turbo1stpass"):
					element2["turbo1stpass"]=False # for backward compatibility
				if False==element2.has_key("subfont_size"):
					element2["subfont_size"]=28 # subtitle font size
				if False==element2.has_key("sub_fill_color"):
					element2["sub_fill_color"]=[65535,65535,65535,65535] # subtitle fill color
				if False==element2.has_key("sub_outline_color"):
					element2["sub_outline_color"]=[0,0,0,65535] # subtitle outline color
				if False==element2.has_key("volume"):
					element2["volume"]=100 # default volume (in percentage)
				if False==element2.has_key("force_subs"):
					element2["force_subs"]=False # by default, subtitles aren't forced
				
				if False==element2.has_key("audio_stream"):
					fileprop=devede_newfiles.newfile("","")
					(fine,audio)=fileprop.read_file_values(element2["path"],0)
					if fine and (audio==0):
						element2["audio_list"]=fileprop.file_values["audio_list"]
						element2["audio_stream"]=fileprop.file_values["audio_stream"]
						fileprop=None
				
				if False==element2.has_key("sub_list"):
					element2["sub_list"]=[]
					if element2["subtitles"]!="":
						tmp={}
						tmp["subtitles"]=element2["subtitles"]
						tmp["sub_codepage"]=element2["sub_codepage"]
						tmp["sub_language"]="EN (ENGLISH)"
						tmp["subtitles_up"]=element2["subtitles_up"]
						del element2["subtitles"]
						del element2["sub_codepage"]
						del element2["subtitles_up"]
						element2["sub_list"].append(tmp)
				
	
		if len(not_found)!=0:
			t_string=_("Can't find the following movie files. Please, add them and try to load the disc structure again.\n")
			for element in not_found:
				t_string+="\n"+element
			w = devede_dialogs.show_error(self.gladefile,t_string)
			w = None
			return
		
		try:
			os.stat(global_vars2["menu_bg"])
		except:
			w = devede_dialogs.show_error(self.gladefile,_("Can't find the menu background. I'll open the disc structure anyway with the default menu background, so don't forget to fix it before creating the disc."))
			w = None
			global_vars2["menu_bg"]=os.path.join(self.global_vars["path"],"backgrounds","default_bg.png")
			
		use_default_sound=False
	
		if False==global_vars2.has_key("menu_sound"):
			use_default_sound=True
		else:
			if (global_vars2["menu_sound"][-11:]=="silence.mp3"):
				global_vars2["menu_sound"]=os.path.join(self.global_vars["path"],"silence.ogg")
			try:
				os.stat(global_vars2["menu_sound"])
			except:
				use_default_sound=True
				w = devede_dialogs.show_error(self.gladefile,_("Can't find the menu soundtrack file. I'll open the disc structure anyway with a silent soundtrack, so don't forget to fix it before creating the disc."))
				w = None
		
		if (use_default_sound):
			global_vars2["menu_sound"]=os.path.join(self.global_vars["path"],"silence.ogg")

		if False==global_vars2.has_key("with_menu"):
			global_vars2["with_menu"]=True
		
		if False==global_vars2.has_key("menu_halignment"):
			global_vars2["menu_halignment"]=2 # center
			
		if False==global_vars2.has_key("menu_shadow_color"):
			global_vars2["menu_shadow_color"]=[0,0,0,0]
			
		if False==global_vars2.has_key("menu_title_shadow"):
			global_vars2["menu_title_shadow"]=[0,0,0,0]

		test=devede_newfiles.file_get_params()
		check,channels=test.read_file_values(global_vars2["menu_sound"],True)
		if (check!=False) or (channels!=1):
			global_vars2["menu_sound"]=os.path.join(self.global_vars["path"],"silence.ogg")
			w = devede_dialogs.show_error(self.gladefile,_("The menu soundtrack seems damaged. Using the default silent soundtrack."))
			w = None
			check,channels=test.read_file_values(global_vars2["menu_sound"],True)

		global_vars2["menu_sound_duration"]=test.length
		test=None

		while (len(self.structure)>0):
			self.structure.pop()
		
		for element in values:
			self.structure.append(element)
		for element in global_vars2:
			self.global_vars[element]=global_vars2[element]
		
		if self.global_vars.has_key("menu_top_margin")==False:
			self.global_vars["menu_top_margin"]=0.125
			self.global_vars["menu_bottom_margin"]=0.125
			self.global_vars["menu_left_margin"]=0.1
			self.global_vars["menu_right_margin"]=0.1
		
		if self.global_vars.has_key("menu_bgcolor")==False:
			self.global_vars["menu_bgcolor"]=[0,0,0,49152]
			self.global_vars["menu_font_color"]=[65535,65535,65535]
			self.global_vars["menu_selc_color"]=[0,65535,65535,65535]
			self.global_vars["menu_alignment"]=2 # middle

		if self.global_vars.has_key("menu_title_text")==False:
			self.global_vars["menu_title_color"]=[0,0,0,65535]
			self.global_vars["menu_title_text"]=""
			self.global_vars["menu_title_fontname"]="Sans 14"

		if global_vars2.has_key("erase_files")==False:
			w=self.tree.get_object("create_iso")
			w.set_active(True)

		self.global_vars["struct_name"]=file_name # update the path
		
		self.done = True
示例#19
0
	def save(self,mode):
	
		""" This method stores the current disc structure in a file. If MODE is True,
			it will ask before a new name. If it's False and there's a filename
			(from a previous save), it will overwrite the old file """
	
		if mode or (self.global_vars["struct_name"]==""):
			tree=devede_other.create_tree(self,"wsaveconfig",self.gladefile,False)
			saveconfig=tree.get_object("wsaveconfig")
			
			filter=gtk.FileFilter()
			filter.add_pattern("*.devede")
			filter.set_name(".devede")
			saveconfig=tree.get_object("wsaveconfig")
			saveconfig.add_filter(filter)
			saveconfig.set_do_overwrite_confirmation(True)

			saveconfig.show()
			value=saveconfig.run()
			saveconfig.hide()
			if value!=-5:
				saveconfig.destroy()
				saveconfig=None
				return
			fname=saveconfig.get_filename()
			saveconfig.destroy()
			saveconfig=None
			
			if fname==None:
				w=devede_dialogs.show_error(self.gladefile,_("No filename"))
				w=None
				return

			if (len(fname)<7) or (fname[-7:]!=".devede"):
				fname+=".devede"

			self.global_vars["struct_name"]=fname
		
		try:
			output=open(self.global_vars["struct_name"],"wb")
			id="DeVeDe"
			pickle.dump(id,output)
			pickle.dump(self.structure,output)
			vars={}
			vars["disctocreate"]=self.global_vars["disctocreate"]
			vars["titlecounter"]=self.global_vars["titlecounter"]
			vars["do_menu"]=self.global_vars["do_menu"]
			vars["with_menu"]=self.global_vars["with_menu"]
			vars["menu_widescreen"]=self.global_vars["menu_widescreen"]
			vars["PAL"]=self.global_vars["PAL"]
			vars["menu_bg"]=self.global_vars["menu_bg"]
			vars["menu_sound"]=self.global_vars["menu_sound"]
			vars["menu_bgcolor"]=self.global_vars["menu_bgcolor"]
			vars["menu_font_color"]=self.global_vars["menu_font_color"]
			vars["menu_selc_color"]=self.global_vars["menu_selc_color"]
			vars["menu_shadow_color"]=self.global_vars["menu_shadow_color"]
			vars["menu_alignment"]=self.global_vars["menu_alignment"]
			vars["menu_halignment"]=self.global_vars["menu_halignment"]
			vars["struct_name"]=self.global_vars["struct_name"]
			vars["fontname"]=self.global_vars["fontname"]
			vars["menu_title_color"]=self.global_vars["menu_title_color"]
			vars["menu_title_shadow"]=self.global_vars["menu_title_shadow"]
			vars["menu_title_text"]=self.global_vars["menu_title_text"]
			vars["menu_title_fontname"]=self.global_vars["menu_title_fontname"]
			vars["menu_top_margin"]=self.global_vars["menu_top_margin"]
			vars["menu_bottom_margin"]=self.global_vars["menu_bottom_margin"]
			vars["menu_left_margin"]=self.global_vars["menu_left_margin"]
			vars["menu_right_margin"]=self.global_vars["menu_right_margin"]

			if self.tree.get_object("create_iso").get_active():
				vars["action_todo"]=2
			elif self.tree.get_object("create_dvd").get_active():
				vars["action_todo"]=1
			else:
				vars["action_todo"]=0

			print "Action: "+str(vars["action_todo"])
			print "Variables: "+str(vars)
			pickle.dump(vars,output)
			output.close()
		except:
			w=devede_dialogs.show_error(self.gladefile,_("Can't save the file."))
			w=None
示例#20
0
	def on_autosize_clicked(self,widget):
		
		""" Adjust the videorate of each file to ensure that the disk usage is optimal """
		
		fixed_size=[]
		variable_size=[]
		
		# First, set the non-adjustable bitrate videos in a different list
		
		for element in self.structure:
			for element2 in element[1:]:
				if (element2["ismpeg"]) or (element2["isvob"]):
					fixed_size.append(element2)
				else:
					variable_size.append(element2)
		
		discsize,minrate,maxrate=devede_other.get_dvd_size(self.tree,self.disctocreate)	
		discsize*=1000 # size in kbytes
		# remove the space needed by menus
		discsize-=devede_other.calcule_menu_size(self.structure,self.global_vars["menu_sound_duration"])
		
		size_error=False
		dowhile=True
		while(dowhile):
			dowhile=False
			v_fixed_size=0
			for element in fixed_size:
				size,surface,length,arate = self.get_surface(element)
				subrate=8*len(element["sub_list"])
				v_fixed_size+=size+int((subrate*element["olength"])/8)

			available_size=discsize-v_fixed_size
				
			if (available_size<0): # the fixed_size videos need more disk space than the currently available
				size_error=True
				break
			
			if (len(variable_size)==0):
				break
			
			total_len=0.0
			total_surface=0.0
			for element in variable_size:
				size,surface,length,arate = self.get_surface(element)
				total_len+=length
				total_surface+=surface*length
				
			for element in variable_size:
				subrate=8*len(element["sub_list"])
				size,surface,length,arate = self.get_surface(element)
				videorate=8*(float(available_size))*((surface*length)/total_surface)
				videorate/=length
				videorate-=(arate+subrate)
				element["vrate"]=int(videorate)
				print int(videorate)
				if videorate<minrate:
					element["vrate"]=minrate
					dowhile=True
					fixed_size.append(element)
					variable_size.remove(element)
					break
				if videorate>maxrate:
					element["vrate"]=maxrate
					dowhile=True
					fixed_size.append(element)
					variable_size.remove(element)
					break

		if size_error:
			devede_dialogs.show_error(self.gladefile,_("Too many videos for this disc size.\nPlease, select a bigger disc type or remove some videos."))
		
		self.set_video_values()