def _shutdown_dialog_callback(dialog, response_id): dialog.destroy() if response_id == Gtk.ResponseType.CLOSE:# "Don't Save" pass elif response_id == Gtk.ResponseType.YES:# "Save" if editorstate.PROJECT().last_save_path != None: persistance.save_project(editorstate.PROJECT(), editorstate.PROJECT().last_save_path) else: dialogutils.warning_message(_("Project has not been saved previously"), _("Save project with File -> Save As before closing."), gui.editor_window.window) return else: # "Cancel" return # --- APP SHUT DOWN --- # print "Exiting app..." # Sep-2018 - SvdB - Stop wave form threads for thread_termination in threading.enumerate(): # We only terminate threads with a 'process', as these are launched # by the audiowaveformrenderer try: thread_termination.process.terminate() except: None # No more auto saving stop_autosave() # Save window dimensions on exit alloc = gui.editor_window.window.get_allocation() x, y, w, h = alloc.x, alloc.y, alloc.width, alloc.height editorpersistance.prefs.exit_allocation = (w, h) if gui.editor_window.window2 != None: alloc = gui.editor_window.window2.get_allocation() pos_x, pos_y = gui.editor_window.window2.get_position() editorpersistance.prefs.exit_allocation_window_2 = (alloc.width, alloc.height, pos_x, pos_y) editorpersistance.prefs.app_v_paned_position = gui.editor_window.app_v_paned.get_position() editorpersistance.prefs.top_paned_position = gui.editor_window.top_paned.get_position() try: # This fails if preference for top row layout changed, we just ignore saving these values then. if editorwindow.top_level_project_panel() == True: editorpersistance.prefs.mm_paned_position = 200 # This is not used until user sets preference to not have top level project panel else: editorpersistance.prefs.mm_paned_position = gui.editor_window.mm_paned.get_position() except: pass editorpersistance.save() # Block reconnecting consumer before setting window not visible updater.player_refresh_enabled = False gui.editor_window.window.set_visible(False) if gui.editor_window.window2 != None: gui.editor_window.window2.set_visible(False) # Close and destroy app when gtk finds time to do it after hiding window GLib.idle_add(_app_destroy)
def _shutdown_dialog_callback(dialog, response_id): dialog.destroy() if response_id == Gtk.ResponseType.CLOSE:# "Don't Save" pass elif response_id == Gtk.ResponseType.YES:# "Save" if editorstate.PROJECT().last_save_path != None: persistance.save_project(editorstate.PROJECT(), editorstate.PROJECT().last_save_path) else: dialogutils.warning_message(_("Project has not been saved previously"), _("Save project with File -> Save As before closing."), gui.editor_window.window) return else: # "Cancel" return # --- APP SHUT DOWN --- # print "Exiting app..." # Sep-2018 - SvdB - Stop wave form threads for thread_termination in threading.enumerate(): # We only terminate threads with a 'process', as these are launched # by the audiowaveformrenderer try: thread_termination.process.terminate() except: None # No more auto saving stop_autosave() # Save window dimensions on exit alloc = gui.editor_window.window.get_allocation() x, y, w, h = alloc.x, alloc.y, alloc.width, alloc.height editorpersistance.prefs.exit_allocation = (w, h) if gui.editor_window.window2 != None: alloc = gui.editor_window.window2.get_allocation() pos_x, pos_y = gui.editor_window.window2.get_position() editorpersistance.prefs.exit_allocation_window_2 = (alloc.width, alloc.height, pos_x, pos_y) editorpersistance.prefs.app_v_paned_position = gui.editor_window.app_v_paned.get_position() editorpersistance.prefs.top_paned_position = gui.editor_window.top_paned.get_position() try: # This fails if preference for top row layout changed, we just ignore saving these values then. if editorwindow.top_level_project_panel() == True: editorpersistance.prefs.mm_paned_position = 200 # This is not used until user sets preference to not have top level project panel else: editorpersistance.prefs.mm_paned_position = gui.editor_window.mm_paned.get_position() except: pass editorpersistance.save() # Block reconnecting consumer before setting window not visible updater.player_refresh_enabled = False gui.editor_window.window.set_visible(False) if gui.editor_window.window2 != None: gui.editor_window.window2.set_visible(False) # Close and destroy app when gtk finds time to do it after hiding window GLib.idle_add(_app_destroy)
def create_gui(): """ Called at app start to create gui objects and handles for them. """ tlinewidgets.load_icons() kftoolmode.load_icons() updater.set_clip_edit_mode_callback = modesetting.set_clip_monitor_edit_mode updater.load_icons() # Notebook indexes are different for 1 and 2 window layouts if editorpersistance.prefs.global_layout != appconsts.SINGLE_WINDOW: medialog.range_log_notebook_index = 0 compositeeditor.compositor_notebook_index = 2 clipeffectseditor.filters_notebook_index = 1 jobs.jobs_notebook_index = 3 if editorwindow.top_level_project_panel() == False: jobs.jobs_notebook_index = 4 else: if editorwindow.top_level_project_panel() == False: jobs.jobs_notebook_index = 5 # Create window and all child components editor_window = editorwindow.EditorWindow() # Make references to various gui components available via gui module gui.capture_references(editor_window) # All widgets are now realized and references captured so can find out theme colors gui.set_theme_colors() tlinewidgets.set_dark_bg_color() gui.pos_bar.set_dark_bg_color() # Connect window global key listener gui.editor_window.window.connect("key-press-event", keyevents.key_down) if editorpersistance.prefs.global_layout != appconsts.SINGLE_WINDOW: gui.editor_window.window2.connect("key-press-event", keyevents.key_down) # Give undo a reference to uimanager for menuitem state changes undo.set_menu_items(gui.editor_window.uimanager) updater.display_sequence_in_monitor()