def run(self): Gdk.threads_enter() recreate_progress_window = dialogs.recreate_icons_progress_dialog() time.sleep(0.1) Gdk.threads_leave() no_icon_path = respaths.IMAGE_PATH + projectdata.FALLBACK_THUMB loaded = 0 for key in PROJECT().media_files.iterkeys(): media_file = PROJECT().media_files[key] Gdk.threads_enter() recreate_progress_window.info.set_text(media_file.name) Gdk.threads_leave() if ((not isinstance(media_file, patternproducer.AbstractBinClip)) and (not isinstance(media_file, projectdata.BinColorClip))): if media_file.type == appconsts.AUDIO: icon_path = respaths.IMAGE_PATH + "audio_file.png" media_file.info = None else: (icon_path, length, info) = projectdata.thumbnailer.write_image( media_file.path) media_file.info = info media_file.icon_path = icon_path media_file.create_icon() loaded = loaded + 1 Gdk.threads_enter() loaded_frac = float(loaded) / float(len(PROJECT().media_files)) recreate_progress_window.progress_bar.set_fraction(loaded_frac) time.sleep(0.01) Gdk.threads_leave() # Update editor gui Gdk.threads_enter() recreate_progress_window.destroy() time.sleep(0.3) Gdk.threads_leave() Gdk.threads_enter() gui.media_list_view.fill_data_model() gui.bin_list_view.fill_data_model() gui.enable_save() Gdk.threads_leave()
def run(self): # NEEDS FIXING FOR COMPACT PROJECTS Gdk.threads_enter() recreate_progress_window = dialogs.recreate_icons_progress_dialog() time.sleep(0.1) Gdk.threads_leave() no_icon_path = respaths.IMAGE_PATH + projectdata.FALLBACK_THUMB loaded = 0 for key in PROJECT().media_files.iterkeys(): media_file = PROJECT().media_files[key] Gdk.threads_enter() recreate_progress_window.info.set_text(media_file.name) Gdk.threads_leave() if ((not isinstance(media_file, patternproducer.AbstractBinClip)) and (not isinstance(media_file, projectdata.BinColorClip))): if media_file.icon_path == no_icon_path: if media_file.type == appconsts.AUDIO: icon_path = respaths.IMAGE_PATH + "audio_file.png" else: (icon_path, length) = projectdata.thumbnailer.write_image(media_file.path) media_file.icon_path = icon_path media_file.create_icon() loaded = loaded + 1 Gdk.threads_enter() loaded_frac = float(loaded) / float(len(PROJECT().media_files)) recreate_progress_window.progress_bar.set_fraction(loaded_frac) time.sleep(0.01) Gdk.threads_leave() # Update editor gui Gdk.threads_enter() recreate_progress_window.destroy() time.sleep(0.3) Gdk.threads_leave() Gdk.threads_enter() gui.media_list_view.fill_data_model() gui.bin_list_view.fill_data_model() gui.enable_save() Gdk.threads_leave()