From 1373141ecb12b09b0ea8b27cb108c36620308809 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Wed, 30 Jul 2014 00:02:41 +0200 Subject: [PATCH] Nos generates the DVAuthor XML file --- src/devede/avconv_converter.py | 57 +++-- src/devede/dvd_menu.py | 35 ++- src/devede/file_movie.py | 6 +- src/devede/interface_manager.py | 5 - src/devede/mux_dvd_menu.py | 10 +- src/devede/project.py | 421 +++++++++++++++++++++++++++++++- 6 files changed, 489 insertions(+), 45 deletions(-) diff --git a/src/devede/avconv_converter.py b/src/devede/avconv_converter.py index 99da844..30f4f5a 100644 --- a/src/devede/avconv_converter.py +++ b/src/devede/avconv_converter.py @@ -50,9 +50,9 @@ class avconv_converter(devede.executor.executor): self.config = devede.configuration_data.configuration.get_config() def convert_file(self,file_project,output_file,video_length): - + self.text = _("Converting %(X)s") % {"X" : file_project.title_name} - + if (video_length == 0): self.final_length = file_project.original_length else: @@ -61,11 +61,11 @@ class avconv_converter(devede.executor.executor): self.command_var.append("avconv") self.command_var.append("-i") self.command_var.append(file_project.file_name) - + if (file_project.volume!=100): self.command_var.append("-vol") self.command_var.append(str((256*file_project.volume)/100)) - + if (file_project.audio_delay != 0.0) and (file_project.copy_sound==False) and (file_project.no_reencode_audio_video==False): self.command_var.append("-itsoffset") self.command_var.append(str(file_project.audio_delay)) @@ -81,13 +81,13 @@ class avconv_converter(devede.executor.executor): if (file_project.no_reencode_audio_video==False): cmd_line="" - + if file_project.deinterlace=="deinterlace_yadif": cmd_line+="yadif" - + vflip=False hflip=False - + if (file_project.rotation=="rotation_90"): if (cmd_line!=""): cmd_line+=",fifo," @@ -99,12 +99,12 @@ class avconv_converter(devede.executor.executor): elif (file_project.rotation=="rotation_180"): vflip=True hflip=True - + if (file_project.mirror_vertical): vflip=not vflip if (file_project.mirror_horizontal): hflip=not hflip - + if (vflip): if (cmd_line!=""): cmd_line+=",fifo," @@ -113,7 +113,7 @@ class avconv_converter(devede.executor.executor): if (cmd_line!=""): cmd_line+=",fifo," cmd_line+="hflip" - + if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height): if (cmd_line!=""): cmd_line+=",fifo," @@ -128,16 +128,16 @@ class avconv_converter(devede.executor.executor): if (cmd_line!=""): cmd_line+=",fifo," cmd_line+="scale="+str(file_project.width_final)+":"+str(file_project.height_final) - + if cmd_line!="": self.command_var.append("-vf") self.command_var.append(cmd_line) - - + + self.command_var.append("-y") vcd=False - + if (self.config.disc_type == "divx"): self.command_var.append("-vcodec") self.command_var.append("mpeg4") @@ -180,7 +180,7 @@ class avconv_converter(devede.executor.executor): self.command_var.append("ntsc-svcd") else: self.command_var.append("pal-svcd") - + if (not file_project.no_reencode_audio_video): self.command_var.append("-sn") # no subtitles @@ -199,7 +199,7 @@ class avconv_converter(devede.executor.executor): if file_project.no_reencode_audio_video: self.command_var.append("-vcodec") self.command_var.append("copy") - + if (vcd==False): if not file_project.format_pal: if (file_project.original_fps==24) and ((self.config.disc_type=="dvd")): @@ -219,12 +219,12 @@ class avconv_converter(devede.executor.executor): elif file_project.gop12 and (file_project.no_reencode_audio_video==False): self.command_var.append("-g") self.command_var.append("12") - + self.command_var.append("-bf") self.command_var.append("2") self.command_var.append("-strict") self.command_var.append("1") - + if video_length != 0: self.command_var.append("-t") self.command_var.append(str(video_length)) @@ -244,26 +244,26 @@ class avconv_converter(devede.executor.executor): if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False): self.command_var.append("-deinterlace") - + if (file_project.no_reencode_audio_video==False) and (vcd==False): self.command_var.append("-s") self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final)) - + self.command_var.append("-trellis") self.command_var.append("1") - + self.command_var.append("-mbd") self.command_var.append("2") - + if (vcd == False) and (file_project.no_reencode_audio_video == False): self.command_var.append("-b:a") self.command_var.append(str(file_project.audio_rate_final)+"k") - + self.command_var.append("-b:v") self.command_var.append(str(file_project.video_rate_final)+"k") self.command_var.append(output_file) - + def create_menu_mpeg(self,n_page,background_music,sound_length,pal,output_path): @@ -310,14 +310,17 @@ class avconv_converter(devede.executor.executor): self.command_var.append("-t") self.command_var.append(str(1+sound_length)) - self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+".mpg")) - + movie_path = os.path.join(output_path,"menu_"+str(n_page)+".mpg") + self.command_var.append(movie_path) + muxer = devede.mux_dvd_menu.mux_dvd_menu() - muxer.create_mpg(n_page,output_path) + final_path = muxer.create_mpg(n_page,output_path,movie_path) # the muxer process depends of the converter process muxer.add_dependency(self) self.add_child_process(muxer) + return (final_path) + def process_stdout(self,data): return diff --git a/src/devede/dvd_menu.py b/src/devede/dvd_menu.py index 7f26dc3..ccf76e6 100644 --- a/src/devede/dvd_menu.py +++ b/src/devede/dvd_menu.py @@ -46,6 +46,7 @@ class dvd_menu(devede.interface_manager.interface_manager): self.add_text("title_text", None, self.update_preview) self.add_group("position_horizontal", ["left", "center", "right"], "center", self.update_preview) + self.add_group("at_startup", ["menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup") self.add_float_adjustment("margin_left", 10.0, self.update_preview) self.add_float_adjustment("margin_top", 12.5, self.update_preview) @@ -54,10 +55,8 @@ class dvd_menu(devede.interface_manager.interface_manager): self.add_float_adjustment("title_horizontal", 0.0, self.update_preview) self.add_float_adjustment("title_vertical", 10.0, self.update_preview) - self.add_group("at_startup", ["menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup") - self.add_fontbutton("title_font", "Sans 28", self.update_preview) - self.add_fontbutton("entry_font", "Sans 18", self.update_preview) + self.add_fontbutton("entry_font", "Sans 28", self.update_preview) self.add_filebutton("background_picture", self.default_background, self.update_preview) self.add_filebutton("background_music", self.default_sound, self.update_music) @@ -129,6 +128,7 @@ class dvd_menu(devede.interface_manager.interface_manager): def on_accept_clicked(self,b): + self.store_ui(self.builder) self.wmenu.destroy() def on_cancel_clicked(self,b): @@ -450,7 +450,13 @@ class dvd_menu(devede.interface_manager.interface_manager): """ Creates the menu XML file """ - xml_file=open(os.path.join(path,"menu_"+str(n_page)+".xml"),"w") + file_name = os.path.join(path,"menu_"+str(n_page)+".xml") + entry_data = {} + entry_data["chapters"] = [] + entry_data["right"] = None + entry_data["left"] = None + + xml_file=open(file_name,"w") xml_file.write('\n\t\n\t\t 0: @@ -508,7 +523,7 @@ class dvd_menu(devede.interface_manager.interface_manager): xml_file.write("\n\n\n") xml_file.close() - return False + return entry_data def create_dvd_menus(self, file_list, base_path): @@ -524,6 +539,7 @@ class dvd_menu(devede.interface_manager.interface_manager): n_page = 0 self.pages = 1 processes = [] + menu_entries = [] menu_converter = cv.get_menu_converter() while n_page < self.pages: self.sf = None @@ -538,10 +554,13 @@ class dvd_menu(devede.interface_manager.interface_manager): self.sf = None self.paint_menu(False, False, True, n_page) self.sf.write_to_png(os.path.join(menu_folder,"menu_"+str(n_page)+"_active_bg.png")) - self.create_menu_stream(menu_folder, n_page, coordinates) + entry_data = self.create_menu_stream(menu_folder, n_page, coordinates) converter = menu_converter() - converter.create_menu_mpeg(n_page,self.background_music,self.sound_length,self.config.PAL,menu_folder) + final_path = converter.create_menu_mpeg(n_page,self.background_music,self.sound_length,self.config.PAL,menu_folder) + entry_data["filename"] = final_path + menu_entries.append(entry_data) # add this process without dependencies processes.append(converter) n_page += 1 - return processes \ No newline at end of file + + return processes,menu_entries \ No newline at end of file diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py index 9bfe105..bceb06a 100644 --- a/src/devede/file_movie.py +++ b/src/devede/file_movie.py @@ -70,7 +70,7 @@ class file_movie(devede.interface_manager.interface_manager): self.add_group("scaling", ["add_black_bars", "scale_picture" ,"cut_picture"], "add_black_bars") self.add_group("rotation",["rotation_0","rotation_90","rotation_180","rotation_270"], "rotation_0") self.add_group("deinterlace", ["deinterlace_none", "deinterlace_ffmpeg", "deinterlace_yadif"], "deinterlace_none") - self.add_group("actions", ["action_stop","action_play_first","action__play_previous","action_play_again","action_play_next","action_play_last"], "action_stop") + self.add_group("actions", ["action_stop","action_play_first","action_play_previous","action_play_again","action_play_next","action_play_last"], "action_stop") self.add_integer_adjustment("volume", 100) if (self.disc_type == "dvd"): @@ -82,6 +82,7 @@ class file_movie(devede.interface_manager.interface_manager): self.add_integer_adjustment("audio_rate", 224) self.add_integer_adjustment("subt_font_size", 28) self.add_float_adjustment("audio_delay", 0.0) + self.add_integer_adjustment("chapter_size", 5) self.add_list("subtitles_list") @@ -142,6 +143,8 @@ class file_movie(devede.interface_manager.interface_manager): self.video_rate_final = self.video_rate self.audio_rate_final = self.audio_rate self.aspect_ratio_final = None + self.converted_filename = None + def get_max_resolution(self,rx,ry,aspect): @@ -458,6 +461,7 @@ class file_movie(devede.interface_manager.interface_manager): def do_conversion(self, output_path, duration = 0): + self.converted_filename = output_path self.set_final_size_aspect() cv = devede.converter.converter.get_converter() disc_converter = cv.get_disc_converter() diff --git a/src/devede/interface_manager.py b/src/devede/interface_manager.py index 2c99654..b639426 100644 --- a/src/devede/interface_manager.py +++ b/src/devede/interface_manager.py @@ -283,13 +283,9 @@ class interface_manager(GObject.GObject): to_enable = [] for e2 in element[1]: to_enable.append(builder.get_object(e2)) - if (builder.get_object(e2) == None): - print("Error en "+str(e2)) to_disable = [] for e3 in element[2]: to_disable.append(builder.get_object(e3)) - if (builder.get_object(e3) == None): - print("Error en "+str(e3)) self.interface_enable_disable_obj[obj] = [to_enable, to_disable] obj.connect('toggled',self.toggled_element2) self.toggled_element2(obj) @@ -412,7 +408,6 @@ class interface_manager(GObject.GObject): final_row = [] for c in range(0,ncolumns): final_row.append(row.model[row.iter][c]) - print (final_row) exec('self.'+element[0]+'.append(final_row)') for element in self.interface_comboboxes: diff --git a/src/devede/mux_dvd_menu.py b/src/devede/mux_dvd_menu.py index d887f76..ce9c1fb 100644 --- a/src/devede/mux_dvd_menu.py +++ b/src/devede/mux_dvd_menu.py @@ -28,16 +28,20 @@ class mux_dvd_menu(devede.executor.executor): devede.executor.executor.__init__(self) self.config = devede.configuration_data.configuration.get_config() - def create_mpg(self,n_page,output_path): + def create_mpg(self,n_page,output_path,movie_path): self.n_page = n_page self.text = _("Mixing menu %(X)d") % {"X": self.n_page} + final_path = os.path.join(output_path,"menu_"+str(n_page)+"B.mpg") + self.command_var=[] self.command_var.append("spumux") self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+".xml")) - self.stdin_file = os.path.join(output_path,"menu_"+str(n_page)+".mpg") - self.stdout_file = os.path.join(output_path,"menu_"+str(n_page)+"B.mpg") + self.stdin_file = movie_path + self.stdout_file = final_path + + return final_path def process_stderr(self,data): diff --git a/src/devede/project.py b/src/devede/project.py index 013f870..1661de8 100644 --- a/src/devede/project.py +++ b/src/devede/project.py @@ -264,9 +264,12 @@ class devede_project: run_window = devede.runner.runner() file_movies = self.get_all_files() if (self.wcreate_menu.get_active()): - processes = self.menu.create_dvd_menus(file_movies, data.path) + processes,menu_entries = self.menu.create_dvd_menus(file_movies, data.path) for p in processes: run_window.add_process(p) + else: + menu_entries = None + movie_folder = os.path.join(data.path,"movies") try: os.makedirs(movie_folder) @@ -277,10 +280,426 @@ class devede_project: p = movie.do_conversion(os.path.join(movie_folder,"movie_"+str(counter)+".mpg")) run_window.add_process(p) counter += 1 + + if (self.menu.at_startup == "menu_show_at_startup"): + start_with_menu = True + else: + start_with_menu = False + + if (self.disc_type == "dvd"): + self.create_dvdauthor_xml(data.path,file_movies,menu_entries, start_with_menu) + run_window.connect("done",self.disc_done) self.wmain_window.hide() run_window.run() + def expand_xml(self,text): + + text=text.replace('&','&') + text=text.replace('<','<') + text=text.replace('>','>') + text=text.replace('"','"') + text=text.replace("'",''') + return text + + def create_dvdauthor_xml(self,movie_folder, file_movies, menu_entries, start_with_menu): + + xmlpath = os.path.join(movie_folder,"xml_data") + datapath = os.path.join(movie_folder,"dvd_tree") + try: + os.makedirs(xmlpath) + except: + pass + try: + os.makedirs(datapath) + except: + pass + + if (len(file_movies) == 1) and (menu_entries == None): + onlyone = True + else: + onlyone = False + + if (menu_entries == None): + elements_per_menu = 1000 + else: + elements_per_menu = len(menu_entries[0]["chapters"]) + + xml_file=open(os.path.join(xmlpath,"dvdauthor.xml"),"w") + xml_file.write('\n') + + if onlyone: + xml_file.write('\t\n') + else: + xml_file.write('\t\n') + + # MENU + + # in the FPC we do a jump to the first menu in the first titleset if we wanted MENU + # or we jump to the second titleset if we didn't want MENU at startup + + xml_file.write('\t\t\n') + xml_file.write('\t\t\tg0=100;\n') + if (menu_entries != None) and (start_with_menu): + xml_file.write('\t\t\tg1=0;\n') + else: + xml_file.write('\t\t\tg1=100;\n') + xml_file.write('\t\t\tg2=1024;\n') + xml_file.write('\t\t\tjump menu 1;\n') + xml_file.write('\t\t\n') + + + # in the VMGM menu we create a code to jump to the title specified in G0 + # but if the title is 100, we jump to the menus. There we show the menu number + # contained in G1 + + xml_file.write("\t\t\n") + + xml_file.write('\t\t\t\n') + + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\t
\n')
+
+            counter=1
+            for element in file_movies:
+                xml_file.write('\t\t\t\t\tif (g0 eq '+str(counter)+') {\n')
+                xml_file.write('\t\t\t\t\t\tjump titleset '+str(1+counter)+' menu;\n')
+                xml_file.write('\t\t\t\t\t}\n')
+                counter+=1
+            xml_file.write('\t\t\t\t\tif (g0 eq 100) {\n')
+            xml_file.write('\t\t\t\t\t\tg2=1024;\n')
+            xml_file.write('\t\t\t\t\t\tjump titleset 1 menu;\n')
+            xml_file.write('\t\t\t\t\t}\n')
+            xml_file.write('\t\t\t\t
\n') + # fake video (one black picture with one second of sound) to ensure 100% compatibility + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t
\n') + xml_file.write('\t\t
\n') + xml_file.write("\t
\n") + + xml_file.write("\n") + + + # the first titleset contains all the menus. G1 allows us to jump to the desired menu + + xml_file.write('\t\n') + xml_file.write('\t\t\n') + xml_file.write('\t\t\t\n') + + first_entry = True + menu_number = 0 + + counter = 1 + title_list = [] + for element in file_movies: + if element.show_in_menu: + title_list.append(counter) + counter += 1 + + if (menu_entries != None): + nmenues = len(menu_entries) + button_counter = 0 + for menu_page in menu_entries: + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\t
\n')
+                    # first we recover the currently selected button
+                    xml_file.write('\t\t\t\t\ts8=g2;\n')
+
+                    if first_entry: # here we add some code to jump to each menu
+                        for menu2 in range(nmenues-1):
+                            xml_file.write('\t\t\t\t\tif (g1 eq '+str(menu2+1)+') {\n')
+                            xml_file.write('\t\t\t\t\t\tjump menu '+str(menu2+2)+';\n')
+                            xml_file.write('\t\t\t\t\t}\n')
+
+                        # this code is to fix a bug in some players
+                        xml_file.write('\t\t\t\t\tif (g1 eq 100) {\n')
+                        xml_file.write('\t\t\t\t\t\tjump title 1;\n') #menu '+str(self.nmenues+1)+';\n')
+                        xml_file.write('\t\t\t\t\t}\n')
+                    first_entry = False
+
+                    xml_file.write('\t\t\t\t
\n') + xml_file.write('\t\t\t\t\n') + + for nbutton in menu_page["chapters"]: + xml_file.write('\t\t\t\t\n') + button_counter+=1 + + if (menu_page["left"] != None): + xml_file.write('\t\t\t\t\n') + + if (menu_page["right"] != None): + xml_file.write('\t\t\t\t\n') + + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t\t\tg2=s8;\n') + xml_file.write('\t\t\t\t\tg1='+str(menu_number)+';\n') + xml_file.write('\t\t\t\t\tjump menu '+str(menu_number+1)+';\n') + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t
\n') + menu_number += 1 + + xml_file.write('\t\t
\n') + else: + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\t
\n')
+                # first we recover the currently selected button
+                xml_file.write('\t\t\t\t\ts8=g2;\n')
+
+                # this code is to fix a bug in some players
+                xml_file.write('\t\t\t\t\tif (g1 eq 100) {\n')
+                xml_file.write('\t\t\t\t\t\tjump title 1;\n') #menu '+str(self.nmenues+1)+';\n')
+                xml_file.write('\t\t\t\t\t}\n')
+
+                xml_file.write('\t\t\t\t
\n') + xml_file.write('\t\t\t\t\n') + + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t\t\tg2=s8;\n') + xml_file.write('\t\t\t\t\tg1=0;\n') + xml_file.write('\t\t\t\t\tjump menu 1;\n') + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t
\n') + + xml_file.write('\t\t\n') + + xml_file.write('\t\t\n') + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t\t\tg0=1;\n') + xml_file.write('\t\t\t\t\tg1=0;\n') + xml_file.write('\t\t\t\t\tg2=1024;\n') + xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n') + xml_file.write('\t\t\t\t\n') + xml_file.write('\t\t\t\n') + xml_file.write('\t\t\n') + xml_file.write("\t
\n") + + xml_file.write("\n") + + + # Now, create the titleset for each video + + total_t=len(file_movies) + titleset=1 + titles=0 + counter=0 + for element in file_movies: + files=0 + action=element.actions + + xml_file.write("\n") + + if element.is_mpeg_ps: + + # if it's already an MPEG-2 compliant file, we use the original values + if element.original_fps == 25: + pal_ntsc="pal" + ispal=True + else: + pal_ntsc="ntsc" + ispal=False + + if element.original_aspect_ratio > 1.6: + faspect='16:9' + fwide=True + else: + faspect='4:3' + fwide=False + + else: + # but if we are converting it, we use the desired values + if element.format_pal: + pal_ntsc="pal" + ispal=True + else: + pal_ntsc="ntsc" + ispal=False + + if element.aspect_ratio_final > 1.6: + faspect='16:9' + fwide=True + else: + faspect='4:3' + fwide=False + + xml_file.write("\t\n") + + if not onlyone: + xml_file.write("\t\t\n") + xml_file.write('\t\t\t\n') + + xml_file.write("\t\t\t\n") + xml_file.write("\t\t\t\t
\n")
+                xml_file.write('\t\t\t\t\tif (g0 eq 100) {\n')
+                xml_file.write('\t\t\t\t\t\tjump vmgm menu entry title;\n')
+                xml_file.write('\t\t\t\t\t}\n')
+                xml_file.write('\t\t\t\t\tg0=100;\n')
+                xml_file.write('\t\t\t\t\tg1='+str(int(titles/elements_per_menu))+';\n')
+                xml_file.write('\t\t\t\t\tjump title 1;\n')
+                xml_file.write('\t\t\t\t
\n') + # fake video to ensure compatibility + xml_file.write('\t\t\t\t\n') + xml_file.write("\t\t\t
\n") + xml_file.write("\t\t
\n") + + xml_file.write("\t\t\n") + xml_file.write('\t\t\t\n') + +# subtitles part +# for element3 in element2["sub_list"]: +# xml_file.write('\t\t\t\n') + xml_file.write('\t\t\t\n') + +# if (element2["force_subs"]) and (len(element2["sub_list"])!=0): +# xml_file.write('\t\t\t\t
\n')
+#                 xml_file.write('\t\t\t\t\tsubtitle=64;\n')
+#                 xml_file.write('\t\t\t\t
\n') + + xml_file.write('\t\t\t\t\n') + + if not onlyone: + xml_file.write('\t\t\t\t\n') + files+=1 + xml_file.write('\t\t\t\t\tg1='+str(int(titles/elements_per_menu))+';\n') + if (action=="action_stop"): + xml_file.write('\t\t\t\t\tg0=100;\n') + xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n') + else: + xml_file.write('\t\t\t\t\tg0=') + if action=="action_play_previous": + if titles == 0: + prev_t = total_t - 1 + else: + prev_t = titles - 1 + xml_file.write(str(title_list[prev_t])) + elif action=="action_play_again": + xml_file.write(str(title_list[titles])) + elif action=="action_play_next": + if titles==total_t-1: + next_t=0 + else: + next_t=titles+1 + xml_file.write(str(title_list[next_t])) + elif action=="action_play_last": + xml_file.write(str(title_list[total_t-1])) + else: + xml_file.write('1') # first + + xml_file.write(';\n') + xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n') + xml_file.write('\t\t\t\t\n') + xml_file.write("\t\t\t
\n") + xml_file.write("\t\t
\n") + xml_file.write("\t
\n") + counter+=1 + titles+=1 + + xml_file.write("
") + + xml_file.close() + + + def return_time(self,seconds,empty): + + """ cuts a time in seconds into seconds, minutes and hours """ + + seconds2=int(seconds) + + hours=str(int(seconds2/3600)) + if empty: + if len(hours)==1: + hours="0"+hours + else: + if hours=="0": + hours="" + if hours!="": + hours+=":" + + minutes=str(int((seconds2/60)%60)) + if empty or (hours!=""): + if len(minutes)==1: + minutes="0"+minutes + elif (minutes=="0") and (hours==""): + minutes="" + if minutes!="": + minutes+=":" + + secs=str(int(seconds2%60)) + if (len(secs)==1) and (minutes!=""): + secs="0"+secs + + return hours+minutes+secs + + def disc_done(self,object,value): self.wmain_window.show()