def _handle_tline_key_event(event): """ This is called when timeline widgets have focus and key is pressed. Returns True for handled key presses to stop those keyevents from going forward. """ # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == Gdk.KEY_Tab: updater.switch_monitor_display() return True # M if event.keyval == Gdk.KEY_m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == Gdk.KEY_1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_3: if editorstate.edit_mode != editorstate.ONE_ROLL_TRIM and editorstate.edit_mode != editorstate.ONE_ROLL_TRIM_NO_EDIT: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() else: gui.editor_window.toggle_trim_ripple_mode() return True if event.keyval == Gdk.KEY_4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_7: gui.editor_window.handle_box_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == Gdk.KEY_x: tlineaction.cut_pressed() return True # G if event.keyval == Gdk.KEY_g: medialog.log_range_clicked() return True # R if event.keyval == Gdk.KEY_r: gui.editor_window.toggle_trim_ripple_mode() return True # Key bindings for keyboard trimming if editorstate.current_is_active_trim_mode() == True: # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: trimmodes.left_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: trimmodes.right_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True if event.keyval == Gdk.KEY_Return: trimmodes.enter_pressed() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode( ) or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == Gdk.KEY_Up: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.up_arrow_seek_on_monitor_clip() # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # T if event.keyval == Gdk.KEY_t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == Gdk.KEY_y: if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == Gdk.KEY_u: tlineaction.append_button_pressed() return True # J if event.keyval == Gdk.KEY_j: monitorevent.j_pressed() return True # K if event.keyval == Gdk.KEY_k: monitorevent.k_pressed() return True # L if event.keyval == Gdk.KEY_l: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # S if event.keyval == Gdk.KEY_s: tlineaction.resync_button_pressed() return True # DELETE if event.keyval == Gdk.KEY_Delete: # Clip selection and compositor selection are mutually exclusive, # so max one one these will actually delete something tlineaction.splice_out_button_pressed() compositormodes.delete_current_selection() # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True # END if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True else: # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) _move_to_beginning() return True # END if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_end() _move_to_end() return True return False
def _handle_tline_key_event(event): """ This is called when timeline widgets have focus and key is pressed. Returns True for handled key presses to stop those keyevents from going forward. """ tool_was_selected = workflow.tline_tool_keyboard_selected(event) if tool_was_selected == True: return True action = _get_shortcut_action(event) prefs = editorpersistance.prefs if action == 'mark_in': monitorevent.mark_in_pressed() return True if action == 'to_mark_in': monitorevent.to_mark_in_pressed() return True if action == 'zoom_out': updater.zoom_out() if action == 'zoom_in': updater.zoom_in() if action == 'mark_out': monitorevent.mark_out_pressed() return True if action == 'to_mark_out': monitorevent.to_mark_out_pressed() return True if action == 'play_pause': if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True if action == 'switch_monitor': updater.switch_monitor_display() return True if action == 'add_marker': tlineaction.add_marker() return True if action == 'cut': tlineaction.cut_pressed() return True if action == 'sequence_split': tlineaction.sequence_split_pressed() return True if action == 'log_range': medialog.log_range_clicked() return True """ THis may need rethinking if action == 'toggle_ripple': gui.editor_window.toggle_trim_ripple_mode() return True """ # Key bindings for keyboard trimming if editorstate.current_is_active_trim_mode() == True: if action == 'prev_frame': trimmodes.left_arrow_pressed((event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True elif action == 'next_frame': trimmodes.right_arrow_pressed((event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True elif action == 'enter_edit': trimmodes.enter_pressed() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode() or editorstate.current_is_active_trim_mode() == False: if action == 'next_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.up_arrow_seek_on_monitor_clip() if action == 'prev_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # Apr-2017 - SvdB - Add different speeds for different modifiers # Allow user to select what speed belongs to what modifier, knowing that a combo of mods # will MULTIPLY all speeds # Available: SHIFT_MASK LOCK_MASK CONTROL_MASK if action == 'prev_frame' or action == 'next_frame': if action == 'prev_frame': seek_amount = -1 else: seek_amount = 1 if (event.get_state() & Gdk.ModifierType.SHIFT_MASK): seek_amount = seek_amount * prefs.ffwd_rev_shift if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): seek_amount = seek_amount * prefs.ffwd_rev_ctrl if (event.get_state() & Gdk.ModifierType.LOCK_MASK): seek_amount = seek_amount * prefs.ffwd_rev_caps PLAYER().seek_delta(seek_amount) return True if action == '3_point_overwrite': tlineaction.three_point_overwrite_pressed() return True if action == 'insert': if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True if action == 'append': tlineaction.append_button_pressed() return True if action == 'slower': monitorevent.j_pressed() return True if action == 'stop': monitorevent.k_pressed() return True if action == 'faster': monitorevent.l_pressed() return True if action == 'log_range': medialog.log_range_clicked() return True if action == 'resync': tlineaction.resync_button_pressed() return True if action == 'delete': # Clip selection and compositor selection are mutually exclusive, # so max one one these will actually delete something tlineaction.splice_out_button_pressed() compositormodes.delete_current_selection() if action == 'to_start': if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True if action == 'to_end': if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True else: if action == 'to_start': if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.set_default_edit_tool() PLAYER().seek_frame(0) _move_to_beginning() return True if action == 'to_end': if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.set_default_edit_tool() PLAYER().seek_end() _move_to_end() return True return False
def __init__(self): global IMG_PATH IMG_PATH = respaths.IMAGE_PATH # Read cursors global INSERTMOVE_CURSOR, OVERWRITE_CURSOR, TWOROLL_CURSOR, ONEROLL_CURSOR, \ ONEROLL_NO_EDIT_CURSOR, TWOROLL_NO_EDIT_CURSOR, SLIDE_CURSOR, SLIDE_NO_EDIT_CURSOR, \ MULTIMOVE_CURSOR, MULTIMOVE_NO_EDIT_CURSOR INSERTMOVE_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "insertmove_cursor.png") OVERWRITE_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "overwrite_cursor.png") TWOROLL_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "tworoll_cursor.png") ONEROLL_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "oneroll_cursor.png") SLIDE_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "slide_cursor.png") ONEROLL_NO_EDIT_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "oneroll_noedit_cursor.png") TWOROLL_NO_EDIT_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "tworoll_noedit_cursor.png") SLIDE_NO_EDIT_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "slide_noedit_cursor.png") MULTIMOVE_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "multimove_cursor.png") MULTIMOVE_NO_EDIT_CURSOR = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "multimove_cursor.png") # Window self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL) self.window.set_icon_from_file(respaths.IMAGE_PATH + "flowbladeappicon.png") self.window.set_border_width(5) # To ask confirmation for shutdown self.window.connect("delete-event", lambda w, e:app.shutdown()) # Player consumer has to be stopped and started when window resized self.window.connect("window-state-event", lambda w, e:updater.refresh_player()) # Build menubar # Menubar build resources menu_actions = [ ('FileMenu', None, _('_File')), ('New', None, _('_New...'), '<control>N', None, lambda a:projectaction.new_project()), ('Open', None, _('_Open...'), '<control>O', None, lambda a:projectaction.load_project()), ('OpenRecent', None, _('Open Recent')), ('Save', None, _('_Save'), '<control>S', None, lambda a:projectaction.save_project()), ('Save As', None, _('_Save As...'), None, None, lambda a:projectaction.save_project_as()), ('SaveSnapshot', None, _('Save Backup Snapshot...'), None, None, lambda a:projectaction.save_backup_snapshot()), ('ExportMenu', None, _('Export')), ('ExportMeltXML', None, _('MLT XML'), None, None, lambda a:exporting.MELT_XML_export()), ('ExportEDL', None, _('EDL CMX 3600'), None, None, lambda a:exporting.EDL_export()), ('ExportScreenshot', None, _('Current Frame'), None, None, lambda a:exporting.screenshot_export()), ('Close', None, _('_Close'), None, None, lambda a:projectaction.close_project()), ('Quit', None, _('_Quit'), '<control>Q', None, lambda a:app.shutdown()), ('EditMenu', None, _('_Edit')), ('Undo', None, _('_Undo'), '<control>Z', None, undo.do_undo_and_repaint), ('Redo', None, _('_Redo'), '<control>Y', None, undo.do_redo_and_repaint), ('AddFromMonitor', None, _('Add Monitor Clip')), ('AppendClip', None, _('Append'), None, None, lambda a:tlineaction.append_button_pressed()), ('InsertClip', None, _('Insert'), None, None, lambda a:tlineaction.insert_button_pressed()), ('ThreepointOverWriteClip', None, _('Three Point Overwrite'), None, None, lambda a:tlineaction.three_point_overwrite_pressed()), ('RangeOverWriteClip', None, _('Range Overwrite'), None, None, lambda a:tlineaction.range_overwrite_pressed()), ('CutClip', None, _('Cut Clip'), None, None, lambda a:tlineaction.cut_pressed()), ('DeleteClip', None, _('Lift'), None, None, lambda a:tlineaction.lift_button_pressed()), ('SpliceOutClip', None, _('Splice Out'), None, None, lambda a:tlineaction.splice_out_button_pressed()), ('ResyncSelected', None, _('Resync'), None, None, lambda a:tlineaction.resync_button_pressed()), ('SetSyncParent', None, _('Set Sync Parent'), None, None, lambda a:_this_is_not_used()), ('AddTransition', None, _('Add Single Track Transition'), None, None, lambda a:tlineaction.add_transition_menu_item_selected()), ('AddFade', None, _('Add Single Track Fade'), None, None, lambda a:tlineaction.add_fade_menu_item_selected()), ('ClearFilters', None, _('Clear Filters'), None, None, lambda a:clipmenuaction.clear_filters()), ('ChangeSequenceTracks', None, _('Change Sequence Tracks Count...'), None, None, lambda a:projectaction.change_sequence_track_count()), ('Watermark', None, _('Watermark...'), None, None, lambda a:menuactions.edit_watermark()), ('ProfilesManager', None, _('Profiles Manager'), None, None, lambda a:menuactions.profiles_manager()), ('Preferences', None, _('Preferences'), None, None, lambda a:preferenceswindow.preferences_dialog()), ('ViewMenu', None, _('View')), ('ProjectMenu', None, _('Project')), ('AddMediaClip', None, _('Add Media Clip...'), None, None, lambda a: projectaction.add_media_files()), ('AddImageSequence', None, _('Add Image Sequence...'), None, None, lambda a:projectaction.add_image_sequence()), ('CreateColorClip', None, _('Create Color Clip...'), None, None, lambda a:patternproducer.create_color_clip()), ('PatternProducersMenu', None, _('Create Pattern Producer')), ('CreateNoiseClip', None, _('Noise'), None, None, lambda a:patternproducer.create_noise_clip()), ('CreateBarsClip', None, _('EBU Bars'), None, None, lambda a:patternproducer.create_bars_clip()), ('CreateIsingClip', None, _('Ising'), None, None, lambda a:patternproducer.create_icing_clip()), ('CreateColorPulseClip', None, _('Color Pulse'), None, None, lambda a:patternproducer.create_color_pulse_clip()), ('LogClipRange', None, _('Log Marked Clip Range'), '<control>L', None, lambda a:medialog.log_range_clicked()), ('RecreateMediaIcons', None, _('Recreate Media Icons...'), None, None, lambda a:menuactions.recreate_media_file_icons()), ('RemoveUnusedMedia', None, _('Remove Unused Media...'), None, None, lambda a:projectaction.remove_unused_media()), ('JackAudio', None, _("JACK Audio..."), None, None, lambda a: menuactions.jack_output_managing()), ('ProxyManager', None, _('Proxy Manager'), None, None, lambda a:proxyediting.show_proxy_manager_dialog()), ('ProjectType', None, _("Change Project Type..."), None, None, lambda a:projectaction.change_project_type()), ('ProjectInfo', None, _('Project Info'), None, None, lambda a:menuactions.show_project_info()), ('RenderMenu', None, _('Render')), ('AddToQueue', None, _('Add To Batch Render Queue...'), None, None, lambda a:projectaction.add_to_render_queue()), ('BatchRender', None, _('Batch Render Queue'), None, None, lambda a:batchrendering.launch_batch_rendering()), ('Render', None, _('Render Timeline'), None, None, lambda a:projectaction.do_rendering()), ('ToolsMenu', None, _('Tools')), ('Titler', None, _('Titler'), None, None, lambda a:titler.show_titler()), ('AudioMix', None, _('Audio Mixer'), None, None, lambda a:audiomonitoring.show_audio_monitor()), ('MediaLink', None, _('Media Relinker'), None, None, lambda a:medialinker.display_linker()), ('HelpMenu', None, _('_Help')), ('QuickReference', None, _('Contents'), None, None, lambda a:menuactions.quick_reference()), ('Environment', None, _('Runtime Environment'), None, None, lambda a:menuactions.environment()), ('KeyboardShortcuts', None, _('Keyboard Shortcuts'), None, None, lambda a:dialogs.keyboard_shortcuts_dialog(self.window)), ('About', None, _('About'), None, None, lambda a:menuactions.about()), ('InsertMode', None, None, '1', None, lambda a:_this_is_not_used()), ('OverMode', None, None, '2', None, lambda a:_this_is_not_used()), ('OneRollMode', None, None, '3', None, lambda a:_this_is_not_used()), ('TwoRollMode', None, None, '4', None, lambda a:_this_is_not_used()), ('SlideMode', None, None, '5', None, lambda a:_this_is_not_used()), ('MultiMode', None, None, '6', None, lambda a:_this_is_not_used()) ] menu_string = """<ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> <menu action='OpenRecent'/> <menuitem action='Save'/> <menuitem action='Save As'/> <menuitem action='SaveSnapshot'/> <separator/> <menu action='ExportMenu'> <menuitem action='ExportMeltXML'/> <menuitem action='ExportScreenshot'/> </menu> <separator/> <menuitem action='Close'/> <menuitem action='Quit'/> </menu> <menu action='EditMenu'> <menuitem action='Undo'/> <menuitem action='Redo'/> <separator/> <menu action='AddFromMonitor'> <menuitem action='AppendClip'/> <menuitem action='InsertClip'/> <menuitem action='ThreepointOverWriteClip'/> <menuitem action='RangeOverWriteClip'/> </menu> <separator/> <menuitem action='CutClip'/> <separator/> <menuitem action='SpliceOutClip'/> <menuitem action='DeleteClip'/> <menuitem action='ResyncSelected'/> <menuitem action='ClearFilters'/> <separator/> <menuitem action='AddTransition'/> <menuitem action='AddFade'/> <separator/> <menuitem action='ChangeSequenceTracks'/> <menuitem action='Watermark'/> <separator/> <menuitem action='ProfilesManager'/> <menuitem action='Preferences'/> </menu> <menu action='ViewMenu'> </menu> <menu action='ProjectMenu'> <menuitem action='AddMediaClip'/> <menuitem action='AddImageSequence'/> <separator/> <menuitem action='CreateColorClip'/> <menu action='PatternProducersMenu'> <menuitem action='CreateNoiseClip'/> <menuitem action='CreateColorPulseClip'/> <menuitem action='CreateIsingClip'/> <menuitem action='CreateBarsClip'/> </menu> <separator/> <menuitem action='LogClipRange'/> <separator/> <menuitem action='RecreateMediaIcons'/> <menuitem action='RemoveUnusedMedia'/> <separator/> <menuitem action='ProxyManager'/> </menu> <menu action='RenderMenu'> <menuitem action='AddToQueue'/> <menuitem action='BatchRender'/> <separator/> <menuitem action='Render'/> </menu> <menu action='ToolsMenu'> <menuitem action='Titler'/> <menuitem action='AudioMix'/> <separator/> <menuitem action='MediaLink'/> </menu> <menu action='HelpMenu'> <menuitem action='QuickReference'/> <menuitem action='KeyboardShortcuts'/> <menuitem action='Environment'/> <separator/> <menuitem action='About'/> </menu> </menubar> </ui>""" # Create global action group action_group = Gtk.ActionGroup('WindowActions') action_group.add_actions(menu_actions, user_data=None) # Create UIManager and add accelators to window ui = Gtk.UIManager() ui.insert_action_group(action_group, 0) ui.add_ui_from_string(menu_string) accel_group = ui.get_accel_group() self.window.add_accel_group(accel_group) # Get menu bar self.menubar = ui.get_widget('/MenuBar') # Set reference to UI manager and acclegroup self.uimanager = ui self.accel_group = accel_group # Add recent projects to menu editorpersistance.fill_recents_menu_widget(ui.get_widget('/MenuBar/FileMenu/OpenRecent'), projectaction.open_recent_project) # Disable audio mixer if not available if editorstate.audio_monitoring_available == False: ui.get_widget('/MenuBar/ToolsMenu/AudioMix').set_sensitive(False) # Menu box menu_vbox = Gtk.VBox(False, 0) menu_vbox.pack_start(self.menubar, False, True, 0) # Media manager self.bin_list_view = guicomponents.BinListView( projectaction.bin_selection_changed, projectaction.bin_name_edited) dnd.connect_bin_tree_view(self.bin_list_view.treeview, projectaction.move_files_to_bin) self.bin_list_view.set_property("can-focus", True) bins_panel = panels.get_bins_panel(self.bin_list_view, lambda w,e: projectaction.add_new_bin(), lambda w,e: projectaction.delete_selected_bin()) bins_panel.set_size_request(MEDIA_MANAGER_WIDTH, 10) # this component is always expanded, so 10 for minimum size ok bins_panel.set_margin_right(4) self.media_list_view = guicomponents.MediaPanel(projectaction.media_file_menu_item_selected, updater.set_and_display_monitor_media_file) view = Gtk.Viewport() view.add(self.media_list_view.widget) view.set_shadow_type(Gtk.ShadowType.NONE) self.media_scroll_window = Gtk.ScrolledWindow() self.media_scroll_window.add(view) self.media_scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.media_scroll_window.set_size_request(guicomponents.MEDIA_OBJECT_WIDGET_WIDTH * 2 + 70, guicomponents.MEDIA_OBJECT_WIDGET_HEIGHT) self.media_scroll_window.show_all() media_panel = panels.get_media_files_panel( self.media_scroll_window, lambda w,e: projectaction.add_media_files(), lambda w,e: projectaction.delete_media_files(), projectaction.columns_count_launch_pressed, lambda w,e: proxyediting.create_proxy_files_pressed(), projectaction.media_filtering_select_pressed) guiutils.set_margins(media_panel, 6, 6, 4, 6) self.media_panel = media_panel self.mm_paned = Gtk.HPaned() self.mm_paned.pack1(bins_panel, resize=True, shrink=True) self.mm_paned.pack2(media_panel, resize=True, shrink=False) mm_panel = guiutils.set_margins(self.mm_paned, 2, 2, 6, 2) # Effects self.effect_select_list_view = guicomponents.FilterListView() self.effect_select_combo_box = Gtk.ComboBoxText() self.effect_select_list_view.treeview.connect("row-activated", clipeffectseditor.effect_select_row_double_clicked) dnd.connect_effects_select_tree_view(self.effect_select_list_view.treeview) clip_editor_panel = clipeffectseditor.get_clip_effects_editor_panel( self.effect_select_combo_box, self.effect_select_list_view) clipeffectseditor.widgets.effect_stack_view.treeview.connect("button-press-event", clipeffectseditor.filter_stack_button_press) effects_editor_panel = guiutils.set_margins(clipeffectseditor.widgets.value_edit_frame, 0, 0, 4, 0) effects_hbox = Gtk.HBox() effects_hbox.set_border_width(5) effects_hbox.pack_start(clip_editor_panel, False, False, 0) effects_hbox.pack_start(effects_editor_panel, True, True, 0) self.effects_panel = guiutils.set_margins(effects_hbox, 2, 2, 2, 2) # Compositors compositor_clip_panel = compositeeditor.get_compositor_clip_panel() compositor_editor_panel = guiutils.set_margins(compositeeditor.widgets.value_edit_frame, 0, 0, 4, 0) compositors_hbox = Gtk.HBox() compositors_hbox.set_border_width(5) compositors_hbox.pack_start(compositor_clip_panel, False, False, 0) compositors_hbox.pack_start(compositor_editor_panel, True, True, 0) self.compositors_panel = compositors_hbox # Render try: render.create_widgets() render_panel_left = rendergui.get_render_panel_left(render.widgets) except IndexError: print "No rendering options found" render_panel_left = None # 'None' here means that no possible rendering options were available # and creating panel failed. Inform user of this and hide render GUI if render_panel_left == None: render_hbox = Gtk.VBox(False, 5) render_hbox.pack_start(Gtk.Label(label="Rendering disabled."), False, False, 0) render_hbox.pack_start(Gtk.Label(label="No available rendering options found."), False, False, 0) render_hbox.pack_start(Gtk.Label(label="See Help->Environment->Render Options for details."), False, False, 0) render_hbox.pack_start(Gtk.Label(label="Install codecs to make rendering available."), False, False, 0) render_hbox.pack_start(Gtk.Label(label=" "), True, True, 0) else: # all is good render_panel_right = rendergui.get_render_panel_right(render.widgets, lambda w,e: projectaction.do_rendering(), lambda w,e: projectaction.add_to_render_queue()) render_hbox = Gtk.HBox(True, 5) render_hbox.pack_start(render_panel_left, True, True, 0) render_hbox.pack_start(render_panel_right, True, True, 0) render_panel = guiutils.set_margins(render_hbox, 2, 6, 8, 6) # Media log events List media_log_events_list_view = medialog.get_media_log_list_view() events_panel = medialog.get_media_log_events_panel(media_log_events_list_view) media_log_vbox = Gtk.HBox() media_log_vbox.pack_start(events_panel, True, True, 0) media_log_panel = guiutils.set_margins(media_log_vbox, 6, 6, 6, 6) self.media_log_events_list_view = media_log_events_list_view # Sequence list self.sequence_list_view = guicomponents.SequenceListView( projectaction.sequence_name_edited) seq_panel = panels.get_sequences_panel( self.sequence_list_view, lambda w,e: projectaction.change_edit_sequence(), lambda w,e: projectaction.add_new_sequence(), lambda w,e: projectaction.delete_selected_sequence()) # Project info project_info_panel = projectinfogui.get_project_info_panel() # Project vbox and panel project_vbox = Gtk.HBox() project_vbox.pack_start(project_info_panel, False, True, 0) project_vbox.pack_start(seq_panel, True, True, 0) project_panel = guiutils.set_margins(project_vbox, 0, 2, 6, 2) # Notebook self.notebook = Gtk.Notebook() self.notebook.set_size_request(appconsts.NOTEBOOK_WIDTH, appconsts.TOP_ROW_HEIGHT) media_label = Gtk.Label(label=_("Media")) media_label.no_dark_bg = True self.notebook.append_page(mm_panel, media_label) self.notebook.append_page(media_log_panel, Gtk.Label(label=_("Range Log"))) self.notebook.append_page(self.effects_panel, Gtk.Label(label=_("Filters"))) self.notebook.append_page(self.compositors_panel, Gtk.Label(label=_("Compositors"))) self.notebook.append_page(project_panel, Gtk.Label(label=_("Project"))) self.notebook.append_page(render_panel, Gtk.Label(label=_("Render"))) self.notebook.set_tab_pos(Gtk.PositionType.BOTTOM) #self.notebook.set_show_tabs(False) # Right notebook, used for Widescreen and Two row layouts self.right_notebook = Gtk.Notebook() self.right_notebook.set_tab_pos(Gtk.PositionType.BOTTOM) # Position bar and decorative frame for it self.pos_bar = PositionBar() pos_bar_frame = Gtk.Frame() pos_bar_frame.add(self.pos_bar.widget) pos_bar_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN) pos_bar_frame.set_margin_top(4) pos_bar_frame.set_margin_bottom(4) pos_bar_frame.set_margin_left(6) # Play buttons row self._create_monitor_row_widgets() self.player_buttons = glassbuttons.PlayerButtons() self.player_buttons.widget.set_tooltip_text(_("Prev Frame - Arrow Left\nNext Frame - Arrow Right\nPlay - Space\nStop - Space\nMark In - I\nMark Out - O\nClear Marks\nTo Mark In\nTo Mark Out")) self.monitor_source.modify_font(Pango.FontDescription("sans bold 8")) player_buttons_row = Gtk.HBox(False, 0) player_buttons_row.pack_start(self.player_buttons.widget, False, True, 0) player_buttons_row.pack_start(self.monitor_source, True, True, 0) player_buttons_row.set_margin_bottom(2) # Creates monitor switch buttons self._create_monitor_buttons() # Switch / pos bar row self.view_mode_select = guicomponents.get_monitor_view_select_combo(lambda w, e: tlineaction.view_mode_menu_lauched(w, e)) sw_pos_hbox = Gtk.HBox(False, 1) sw_pos_hbox.pack_start(self.sequence_editor_b, False, True, 0) sw_pos_hbox.pack_start(self.clip_editor_b, False, True, 0) sw_pos_hbox.pack_start(pos_bar_frame, True, True, 0) sw_pos_hbox.pack_start(self.view_mode_select.widget, False, False, 0) sw_pos_hbox.set_margin_top(4) sw_pos_hbox.set_margin_left(2) # Video display black_box = Gtk.EventBox() black_box.add(Gtk.Label()) bg_color = Gdk.Color(red=0.0, green=0.0, blue=0.0) black_box.modify_bg(Gtk.StateType.NORMAL, bg_color) self.tline_display = black_box # This could be any GTK+ widget (that is not "windowless"), only its XWindow draw rect # is used to position and scale SDL overlay that actually displays video. dnd.connect_video_monitor(self.tline_display) # Monitor monitor_vbox = Gtk.VBox(False, 1) monitor_vbox.pack_start(self.tline_display, True, True, 0) monitor_vbox.pack_start(sw_pos_hbox, False, True, 0) monitor_vbox.pack_start(player_buttons_row, False, True, 0) monitor_align = guiutils.set_margins(monitor_vbox, 3, 0, 3, 3) monitor_frame = Gtk.Frame() monitor_frame.add(monitor_align) monitor_frame.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) monitor_frame.set_size_request(MONITOR_AREA_WIDTH, appconsts.TOP_ROW_HEIGHT) # Notebook panel notebook_vbox = Gtk.VBox(False, 1) notebook_vbox.no_dark_bg = True notebook_vbox.pack_start(self.notebook, True, True, 0) # Top row paned self.top_paned = Gtk.HPaned() self.top_paned.pack1(notebook_vbox, resize=False, shrink=False) self.top_paned.pack2(monitor_frame, resize=True, shrink=False) # Top row self.top_row_hbox = Gtk.HBox(False, 0) self.top_row_hbox.pack_start(self.top_paned, True, True, 0) self._update_top_row() # Edit buttons rows self.edit_buttons_row = self._get_edit_buttons_row() if editorpersistance.prefs.dark_theme == False: self.edit_buttons_frame = Gtk.Frame() self.edit_buttons_frame.add(self.edit_buttons_row) self.edit_buttons_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN) else: self.edit_buttons_frame = self.edit_buttons_row # Timeline scale self.tline_scale = tlinewidgets.TimeLineFrameScale(editevent.insert_move_mode_pressed, updater.mouse_scroll_zoom) self.tline_info = Gtk.HBox() info_contents = Gtk.Label() self.tline_info.add(info_contents) self.tline_info.info_contents = info_contents # this switched and saved as member of its container info_h = Gtk.HBox() info_h.pack_start(self.tline_info, False, False, 0) info_h.pack_start(Gtk.Label(), True, True, 0) info_h.set_size_request(tlinewidgets.COLUMN_WIDTH - 22 - 22,# - 22, # room for 2 menu launch buttons tlinewidgets.SCALE_HEIGHT) marker_surface = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "marker.png") markers_launcher = guicomponents.get_markers_menu_launcher(tlineaction.marker_menu_lauch_pressed, marker_surface) tracks_launcher_surface = cairo.ImageSurface.create_from_png(respaths.IMAGE_PATH + "track_menu_launch.png") tracks_launcher = guicomponents.PressLaunch(trackaction.all_tracks_menu_launch_pressed, tracks_launcher_surface) # Timeline top row tline_hbox_1 = Gtk.HBox() tline_hbox_1.pack_start(info_h, False, False, 0) tline_hbox_1.pack_start(tracks_launcher.widget, False, False, 0) tline_hbox_1.pack_start(markers_launcher.widget, False, False, 0) tline_hbox_1.pack_start(self.tline_scale.widget, True, True, 0) # Timeline column self.tline_column = tlinewidgets.TimeLineColumn( trackaction.track_active_switch_pressed, trackaction.track_center_pressed) # Timeline editpanel self.tline_canvas = tlinewidgets.TimeLineCanvas( editevent.tline_canvas_mouse_pressed, editevent.tline_canvas_mouse_moved, editevent.tline_canvas_mouse_released, editevent.tline_canvas_double_click, updater.mouse_scroll_zoom, self.tline_cursor_leave, self.tline_cursor_enter) dnd.connect_tline(self.tline_canvas.widget, editevent.tline_effect_drop, editevent.tline_media_drop) # Timeline middle row tline_hbox_2 = Gtk.HBox() tline_hbox_2.pack_start(self.tline_column.widget, False, False, 0) tline_hbox_2.pack_start(self.tline_canvas.widget, True, True, 0) # Bottom row filler self.left_corner = guicomponents.TimeLineLeftBottom() self.left_corner.widget.set_size_request(tlinewidgets.COLUMN_WIDTH, 20) # Timeline scroller self.tline_scroller = tlinewidgets.TimeLineScroller(updater.tline_scrolled) # Timeline bottom row tline_hbox_3 = Gtk.HBox() tline_hbox_3.pack_start(self.left_corner.widget, False, False, 0) tline_hbox_3.pack_start(self.tline_scroller, True, True, 0) # Timeline hbox tline_vbox = Gtk.VBox() tline_vbox.pack_start(tline_hbox_1, False, False, 0) tline_vbox.pack_start(tline_hbox_2, True, True, 0) tline_vbox.pack_start(tline_hbox_3, False, False, 0) # Timeline box self.tline_box = Gtk.HBox() self.tline_box.pack_start(tline_vbox, True, True, 0) # Timeline pane tline_pane = Gtk.VBox(False, 1) tline_pane.pack_start(self.edit_buttons_frame, False, True, 0) tline_pane.pack_start(self.tline_box, True, True, 0) #tline_pane.override_background_color(Gtk.StateFlags.NORMAL, gui.get_bg_color()) self.tline_pane = tline_pane # VPaned top row / timeline self.app_v_paned = Gtk.VPaned() self.app_v_paned.pack1(self.top_row_hbox, resize=False, shrink=False) self.app_v_paned.pack2(tline_pane, resize=True, shrink=False) self.app_v_paned.no_dark_bg = True # Pane pane = Gtk.VBox(False, 1) pane.pack_start(menu_vbox, False, True, 0) pane.pack_start(self.app_v_paned, True, True, 0) # Tooltips self._add_tool_tips() # GUI preferences self._init_gui_to_prefs() # Viewmenu initial state self._init_view_menu(ui.get_widget('/MenuBar/ViewMenu')) # Set pane and show window self.window.add(pane) self.window.set_title("Flowblade") # Maximize if it seems that we exited maximized, else set size w, h = editorpersistance.prefs.exit_allocation if w != 0: # non-existing prefs file causes w and h to be 0 if (float(w) / editorstate.SCREEN_WIDTH > 0.95) and (float(h) / editorstate.SCREEN_HEIGHT > 0.95): self.window.maximize() print "maximize" else: self.window.resize(w, h) self.window.set_position(Gtk.WindowPosition.CENTER) else: self.window.set_position(Gtk.WindowPosition.CENTER) # Show window and all of its components self.window.show_all() # Set paned positions self.mm_paned.set_position(editorpersistance.prefs.mm_paned_position) self.top_paned.set_position(editorpersistance.prefs.top_paned_position) self.app_v_paned.set_position(editorpersistance.prefs.app_v_paned_position)
def _handle_tline_key_event(event): """ This is called when timeline widgets have focus and key is pressed. Returns True for handled key presses to stop those keyevents from going forward. """ # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == Gdk.KEY_Tab: updater.switch_monitor_display() return True # M if event.keyval == Gdk.KEY_m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == Gdk.KEY_1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_3: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == Gdk.KEY_x: tlineaction.cut_pressed() return True # G if event.keyval == Gdk.KEY_g: medialog.log_range_clicked() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode() or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == Gdk.KEY_Up: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) return True else: monitorevent.up_arrow_seek_on_monitor_clip() # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # T if event.keyval == Gdk.KEY_t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == Gdk.KEY_y: if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == Gdk.KEY_u: tlineaction.append_button_pressed() return True # J if event.keyval == Gdk.KEY_j: monitorevent.j_pressed() return True # K if event.keyval == Gdk.KEY_k: monitorevent.k_pressed() return True # L if event.keyval == Gdk.KEY_l: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # CTRL+C if event.keyval == Gdk.KEY_c: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.do_timeline_objects_copy() return True # CTRL+V if event.keyval == Gdk.KEY_v: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.do_timeline_objects_paste() return True # DELETE if event.keyval == Gdk.KEY_Delete: # Clip selection and compositor selection are mutually exclusive, # so max one one these will actually delete something tlineaction.splice_out_button_pressed() compositormodes.delete_current_selection() # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True else: # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) return True return False
def __init__(self): global IMG_PATH IMG_PATH = respaths.IMAGE_PATH # Read cursors global INSERTMOVE_CURSOR, OVERWRITE_CURSOR, TWOROLL_CURSOR, ONEROLL_CURSOR, \ ONEROLL_NO_EDIT_CURSOR, TWOROLL_NO_EDIT_CURSOR, SLIDE_CURSOR, SLIDE_NO_EDIT_CURSOR, \ MULTIMOVE_CURSOR, MULTIMOVE_NO_EDIT_CURSOR INSERTMOVE_CURSOR = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "insertmove_cursor.png") OVERWRITE_CURSOR = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "overwrite_cursor.png") TWOROLL_CURSOR = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "tworoll_cursor.png") ONEROLL_CURSOR = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "oneroll_cursor.png") SLIDE_CURSOR = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "slide_cursor.png") ONEROLL_NO_EDIT_CURSOR = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "oneroll_noedit_cursor.png") TWOROLL_NO_EDIT_CURSOR = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "tworoll_noedit_cursor.png") SLIDE_NO_EDIT_CURSOR = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "slide_noedit_cursor.png") MULTIMOVE_CURSOR = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "multimove_cursor.png") MULTIMOVE_NO_EDIT_CURSOR = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "multimove_cursor.png") # Window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_icon_from_file(respaths.IMAGE_PATH + "flowbladeappicon.png") self.window.set_border_width(5) # To ask confirmation for shutdown self.window.connect("delete-event", lambda w, e: app.shutdown()) # Player consumer has to be stopped and started when window resized self.window.connect("window-state-event", lambda w, e: updater.refresh_player()) # Build menubar # Menubar build resources menu_actions = [ ('FileMenu', None, _('_File')), ('New', None, _('_New...'), '<control>N', None, lambda a: projectaction.new_project()), ('Open', None, _('_Open...'), '<control>O', None, lambda a: projectaction.load_project()), ('OpenRecent', None, _('Open Recent')), ('Save', None, _('_Save'), '<control>S', None, lambda a: projectaction.save_project()), ('Save As', None, _('_Save As...'), None, None, lambda a: projectaction.save_project_as()), ('SaveSnapshot', None, _('Save Backup Snapshot...'), None, None, lambda a: projectaction.save_backup_snapshot()), ('ExportMenu', None, _('Export')), ('ExportMeltXML', None, _('MLT XML'), None, None, lambda a: exporting.MELT_XML_export()), ('ExportEDL', None, _('EDL CMX 3600'), None, None, lambda a: exporting.EDL_export()), ('ExportScreenshot', None, _('Current Frame'), None, None, lambda a: exporting.screenshot_export()), ('Close', None, _('_Close'), None, None, lambda a: projectaction.close_project()), ('Quit', None, _('_Quit'), '<control>Q', None, lambda a: app.shutdown()), ('EditMenu', None, _('_Edit')), ('Undo', None, _('_Undo'), '<control>Z', None, undo.do_undo_and_repaint), ('Redo', None, _('_Redo'), '<control>Y', None, undo.do_redo_and_repaint), ('AddFromMonitor', None, _('Add Monitor Clip')), ('AppendClip', None, _('Append'), None, None, lambda a: tlineaction.append_button_pressed()), ('InsertClip', None, _('Insert'), None, None, lambda a: tlineaction.insert_button_pressed()), ('ThreepointOverWriteClip', None, _('Three Point Overwrite'), None, None, lambda a: tlineaction.three_point_overwrite_pressed()), ('RangeOverWriteClip', None, _('Range Overwrite'), None, None, lambda a: tlineaction.range_overwrite_pressed()), ('CutClip', None, _('Cut Clip'), None, None, lambda a: tlineaction.cut_pressed()), ('DeleteClip', None, _('Lift'), None, None, lambda a: tlineaction.lift_button_pressed()), ('SpliceOutClip', None, _('Splice Out'), None, None, lambda a: tlineaction.splice_out_button_pressed()), ('ResyncSelected', None, _('Resync'), None, None, lambda a: tlineaction.resync_button_pressed()), ('SetSyncParent', None, _('Set Sync Parent'), None, None, lambda a: _this_is_not_used()), ('AddTransition', None, _('Add Single Track Transition'), None, None, lambda a: tlineaction.add_transition_menu_item_selected()), ('AddFade', None, _('Add Single Track Fade'), None, None, lambda a: tlineaction.add_fade_menu_item_selected()), ('ClearFilters', None, _('Clear Filters'), None, None, lambda a: clipmenuaction.clear_filters()), ('ChangeSequenceTracks', None, _('Change Sequence Tracks Count...'), None, None, lambda a: projectaction.change_sequence_track_count()), ('Watermark', None, _('Watermark...'), None, None, lambda a: menuactions.edit_watermark()), ('ProfilesManager', None, _('Profiles Manager'), None, None, lambda a: menuactions.profiles_manager()), ('Preferences', None, _('Preferences'), None, None, lambda a: preferenceswindow.preferences_dialog()), ('ViewMenu', None, _('View')), ('ProjectMenu', None, _('Project')), ('AddMediaClip', None, _('Add Media Clip...'), None, None, lambda a: projectaction.add_media_files()), ('AddImageSequence', None, _('Add Image Sequence...'), None, None, lambda a: projectaction.add_image_sequence()), ('CreateColorClip', None, _('Create Color Clip...'), None, None, lambda a: patternproducer.create_color_clip()), ('PatternProducersMenu', None, _('Create Pattern Producer')), ('CreateNoiseClip', None, _('Noise'), None, None, lambda a: patternproducer.create_noise_clip()), ('CreateBarsClip', None, _('EBU Bars'), None, None, lambda a: patternproducer.create_bars_clip()), ('CreateIsingClip', None, _('Ising'), None, None, lambda a: patternproducer.create_icing_clip()), ('CreateColorPulseClip', None, _('Color Pulse'), None, None, lambda a: patternproducer.create_color_pulse_clip()), ('LogClipRange', None, _('Log Marked Clip Range'), '<control>L', None, lambda a: medialog.log_range_clicked()), ('RecreateMediaIcons', None, _('Recreate Media Icons...'), None, None, lambda a: menuactions.recreate_media_file_icons()), ('RemoveUnusedMedia', None, _('Remove Unused Media...'), None, None, lambda a: projectaction.remove_unused_media()), ('JackAudio', None, _("JACK Audio..."), None, None, lambda a: menuactions.jack_output_managing()), ('ProxyManager', None, _('Proxy Manager'), None, None, lambda a: proxyediting.show_proxy_manager_dialog()), ('ProjectType', None, _("Change Project Type..."), None, None, lambda a: projectaction.change_project_type()), ('ProjectInfo', None, _('Project Info'), None, None, lambda a: menuactions.show_project_info()), ('RenderMenu', None, _('Render')), ('AddToQueue', None, _('Add To Batch Render Queue...'), None, None, lambda a: projectaction.add_to_render_queue()), ('BatchRender', None, _('Batch Render Queue'), None, None, lambda a: batchrendering.launch_batch_rendering()), ('Render', None, _('Render Timeline'), None, None, lambda a: projectaction.do_rendering()), ('ToolsMenu', None, _('Tools')), ('Titler', None, _('Titler'), None, None, lambda a: titler.show_titler()), ('AudioMix', None, _('Audio Mixer'), None, None, lambda a: audiomonitoring.show_audio_monitor()), ('MediaLink', None, _('Media Relinker'), None, None, lambda a: medialinker.display_linker()), ('HelpMenu', None, _('_Help')), ('QuickReference', None, _('Contents'), None, None, lambda a: menuactions.quick_reference()), ('Environment', None, _('Runtime Environment'), None, None, lambda a: menuactions.environment()), ('KeyboardShortcuts', None, _('Keyboard Shortcuts'), None, None, lambda a: dialogs.keyboard_shortcuts_dialog(self.window)), ('About', None, _('About'), None, None, lambda a: menuactions.about()), ('InsertMode', None, None, '1', None, lambda a: _this_is_not_used()), ('OverMode', None, None, '2', None, lambda a: _this_is_not_used()), ('OneRollMode', None, None, '3', None, lambda a: _this_is_not_used()), ('TwoRollMode', None, None, '4', None, lambda a: _this_is_not_used()), ('SlideMode', None, None, '5', None, lambda a: _this_is_not_used()), ('MultiMode', None, None, '6', None, lambda a: _this_is_not_used()) ] menu_string = """<ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> <menu action='OpenRecent'/> <menuitem action='Save'/> <menuitem action='Save As'/> <menuitem action='SaveSnapshot'/> <separator/> <menu action='ExportMenu'> <menuitem action='ExportMeltXML'/> <menuitem action='ExportScreenshot'/> </menu> <separator/> <menuitem action='Close'/> <menuitem action='Quit'/> </menu> <menu action='EditMenu'> <menuitem action='Undo'/> <menuitem action='Redo'/> <separator/> <menu action='AddFromMonitor'> <menuitem action='AppendClip'/> <menuitem action='InsertClip'/> <menuitem action='ThreepointOverWriteClip'/> <menuitem action='RangeOverWriteClip'/> </menu> <separator/> <menuitem action='CutClip'/> <separator/> <menuitem action='SpliceOutClip'/> <menuitem action='DeleteClip'/> <menuitem action='ResyncSelected'/> <menuitem action='ClearFilters'/> <separator/> <menuitem action='AddTransition'/> <menuitem action='AddFade'/> <separator/> <menuitem action='ChangeSequenceTracks'/> <menuitem action='Watermark'/> <separator/> <menuitem action='ProfilesManager'/> <menuitem action='Preferences'/> </menu> <menu action='ViewMenu'> </menu> <menu action='ProjectMenu'> <menuitem action='AddMediaClip'/> <menuitem action='AddImageSequence'/> <separator/> <menuitem action='CreateColorClip'/> <menu action='PatternProducersMenu'> <menuitem action='CreateNoiseClip'/> <menuitem action='CreateColorPulseClip'/> <menuitem action='CreateIsingClip'/> <menuitem action='CreateBarsClip'/> </menu> <separator/> <menuitem action='LogClipRange'/> <separator/> <menuitem action='RecreateMediaIcons'/> <menuitem action='RemoveUnusedMedia'/> <separator/> <menuitem action='ProxyManager'/> </menu> <menu action='RenderMenu'> <menuitem action='AddToQueue'/> <menuitem action='BatchRender'/> <separator/> <menuitem action='Render'/> </menu> <menu action='ToolsMenu'> <menuitem action='Titler'/> <menuitem action='AudioMix'/> <separator/> <menuitem action='MediaLink'/> </menu> <menu action='HelpMenu'> <menuitem action='QuickReference'/> <menuitem action='KeyboardShortcuts'/> <menuitem action='Environment'/> <separator/> <menuitem action='About'/> </menu> </menubar> </ui>""" # Create global action group action_group = gtk.ActionGroup('WindowActions') action_group.add_actions(menu_actions, user_data=None) # Create UIManager and add accelators to window ui = gtk.UIManager() ui.insert_action_group(action_group, 0) ui.add_ui_from_string(menu_string) accel_group = ui.get_accel_group() self.window.add_accel_group(accel_group) # Get menu bar self.menubar = ui.get_widget('/MenuBar') # Set reference to UI manager and acclegroup self.uimanager = ui self.accel_group = accel_group # Add recent projects to menu editorpersistance.fill_recents_menu_widget( ui.get_widget('/MenuBar/FileMenu/OpenRecent'), projectaction.open_recent_project) # Disable audio mixer if not available if editorstate.audio_monitoring_available == False: ui.get_widget('/MenuBar/ToolsMenu/AudioMix').set_sensitive(False) # Menu box menu_vbox = gtk.VBox(False, 0) menu_vbox.pack_start(self.menubar, False, True, 0) # Media manager self.bin_list_view = guicomponents.BinListView( projectaction.bin_selection_changed, projectaction.bin_name_edited) dnd.connect_bin_tree_view(self.bin_list_view.treeview, projectaction.move_files_to_bin) self.bin_list_view.set_property("can-focus", True) bins_panel = panels.get_bins_panel( self.bin_list_view, lambda w, e: projectaction.add_new_bin(), lambda w, e: projectaction.delete_selected_bin()) bins_panel.set_size_request(MEDIA_MANAGER_WIDTH, BINS_HEIGHT) self.media_list_view = guicomponents.MediaPanel( projectaction.media_file_menu_item_selected, updater.set_and_display_monitor_media_file) self.media_scroll_window = gtk.ScrolledWindow() self.media_scroll_window.add_with_viewport(self.media_list_view.widget) self.media_scroll_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.media_scroll_window.set_size_request( guicomponents.MEDIA_OBJECT_WIDGET_WIDTH * 2 + 70, guicomponents.MEDIA_OBJECT_WIDGET_HEIGHT) self.media_scroll_window.show_all() media_panel = panels.get_media_files_panel( self.media_scroll_window, lambda w, e: projectaction.add_media_files(), lambda w, e: projectaction.delete_media_files(), lambda a: self.media_list_view.columns_changed(a), lambda w, e: proxyediting.create_proxy_files_pressed(), projectaction.media_filtering_select_pressed) self.mm_paned = gtk.HPaned() self.mm_paned.pack1(bins_panel, resize=True, shrink=True) self.mm_paned.pack2(media_panel, resize=True, shrink=False) mm_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) mm_panel.set_padding(2, 2, 6, 2) mm_panel.add(self.mm_paned) # Effects self.effect_select_list_view = guicomponents.FilterListView() self.effect_select_combo_box = gtk.combo_box_new_text() self.effect_select_list_view.treeview.connect( "row-activated", clipeffectseditor.effect_select_row_double_clicked) dnd.connect_effects_select_tree_view( self.effect_select_list_view.treeview) clip_editor_panel = clipeffectseditor.get_clip_effects_editor_panel( self.effect_select_combo_box, self.effect_select_list_view) clipeffectseditor.widgets.effect_stack_view.treeview.connect( "button-press-event", clipeffectseditor.filter_stack_button_press) effects_editor_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) effects_editor_panel.set_padding(0, 0, 4, 0) effects_editor_panel.add(clipeffectseditor.widgets.value_edit_frame) effects_hbox = gtk.HBox() effects_hbox.set_border_width(5) effects_hbox.pack_start(clip_editor_panel, False, False, 0) effects_hbox.pack_start(effects_editor_panel, True, True, 0) self.effects_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) self.effects_panel.set_padding(2, 2, 2, 2) self.effects_panel.add(effects_hbox) # Compositors compositor_clip_panel = compositeeditor.get_compositor_clip_panel() compositor_editor_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) compositor_editor_panel.set_padding(0, 0, 4, 0) compositor_editor_panel.add(compositeeditor.widgets.value_edit_frame) compositors_hbox = gtk.HBox() compositors_hbox.set_border_width(5) compositors_hbox.pack_start(compositor_clip_panel, False, False, 0) compositors_hbox.pack_start(compositor_editor_panel, True, True, 0) self.compositors_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) self.compositors_panel.set_padding(0, 0, 0, 0) self.compositors_panel.add(compositors_hbox) # Render normal_height = True if appconsts.TOP_ROW_HEIGHT < 500: # small screens have no space to display this normal_height = False add_audio_desc = True if editorstate.SCREEN_HEIGHT < 863: add_audio_desc = False try: render.create_widgets(normal_height) render_panel_left = rendergui.get_render_panel_left( render.widgets, add_audio_desc, normal_height) except IndexError: print "No rendering options found" render_panel_left = None # 'None' here means that no possible rendering options were available # and creating panel failed. Inform user of this and hide render GUI if render_panel_left == None: render_hbox = gtk.VBox(False, 5) render_hbox.pack_start(gtk.Label("Rendering disabled."), False, False, 0) render_hbox.pack_start( gtk.Label("No available rendering options found."), False, False, 0) render_hbox.pack_start( gtk.Label( "See Help->Environment->Render Options for details."), False, False, 0) render_hbox.pack_start( gtk.Label("Install codecs to make rendering available."), False, False, 0) render_hbox.pack_start(gtk.Label(" "), True, True, 0) else: # all is good render_panel_right = rendergui.get_render_panel_right( render.widgets, lambda w, e: projectaction.do_rendering(), lambda w, e: projectaction.add_to_render_queue()) render_hbox = gtk.HBox(True, 5) render_hbox.pack_start(render_panel_left, True, True, 0) render_hbox.pack_start(render_panel_right, True, True, 0) render_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) render_panel.set_padding(2, 6, 8, 6) render_panel.add(render_hbox) # Media log events List media_log_events_list_view = medialog.get_media_log_list_view() events_panel = medialog.get_media_log_events_panel( media_log_events_list_view) media_log_vbox = gtk.HBox() media_log_vbox.pack_start(events_panel, True, True, 0) media_log_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) media_log_panel.set_padding(6, 6, 6, 6) media_log_panel.add(media_log_vbox) self.media_log_events_list_view = media_log_events_list_view # Sequence list self.sequence_list_view = guicomponents.SequenceListView( projectaction.sequence_name_edited) seq_panel = panels.get_sequences_panel( self.sequence_list_view, lambda w, e: projectaction.change_edit_sequence(), lambda w, e: projectaction.add_new_sequence(), lambda w, e: projectaction.delete_selected_sequence()) # Project info project_info_panel = projectinfogui.get_project_info_panel() # Project vbox and panel project_vbox = gtk.HBox() project_vbox.pack_start(project_info_panel, False, True, 0) project_vbox.pack_start(seq_panel, True, True, 0) project_panel = gtk.Alignment(0.5, 0.5, 1.0, 1.0) project_panel.set_padding(0, 2, 6, 2) project_panel.add(project_vbox) # Notebook self.notebook = gtk.Notebook() self.notebook.set_size_request(appconsts.NOTEBOOK_WIDTH, appconsts.TOP_ROW_HEIGHT) self.notebook.append_page(mm_panel, gtk.Label(_("Media"))) self.notebook.append_page(media_log_panel, gtk.Label(_("Range Log"))) self.notebook.append_page(self.effects_panel, gtk.Label(_("Filters"))) self.notebook.append_page(self.compositors_panel, gtk.Label(_("Compositors"))) self.notebook.append_page(project_panel, gtk.Label(_("Project"))) self.notebook.append_page(render_panel, gtk.Label(_("Render"))) self.notebook.set_tab_pos(gtk.POS_BOTTOM) # Right notebook, used for Widescreen and Two row layouts self.right_notebook = gtk.Notebook() self.right_notebook.set_tab_pos(gtk.POS_BOTTOM) # Position bar and decorative frame for it self.pos_bar = PositionBar() pos_bar_frame = gtk.Frame() pos_bar_frame.add(self.pos_bar.widget) pos_bar_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN) # Positionbar vbox pos_bar_vbox = gtk.VBox(False, 1) pos_bar_vbox.pack_start(guiutils.get_pad_label(5, 2), False, True, 0) pos_bar_vbox.pack_start(pos_bar_frame, False, True, 0) # Play buttons row self._create_monitor_row_widgets() self.player_buttons = glassbuttons.PlayerButtons() self.player_buttons.widget.set_tooltip_text( _("Prev Frame - Arrow Left\nNext Frame - Arrow Right\nPlay - Space\nStop - Space\nMark In - I\nMark Out - O\nClear Marks\nTo Mark In\nTo Mark Out" )) self.monitor_source.modify_font(pango.FontDescription("sans bold 8")) player_buttons_row = gtk.HBox(False, 0) player_buttons_row.pack_start(self.player_buttons.widget, False, True, 0) player_buttons_row.pack_start(self.monitor_source, True, True, 0) # Creates monitor switch buttons self._create_monitor_buttons() # Switch button box switch_hbox = gtk.HBox(True, 1) switch_hbox.pack_start(self.sequence_editor_b, False, False, 0) switch_hbox.pack_start(self.clip_editor_b, False, False, 0) # Switch button box V, for centered buttons switch_vbox = gtk.VBox(False, 1) switch_vbox.pack_start(guiutils.get_pad_label(5, 2), False, True, 0) switch_vbox.pack_start(switch_hbox, False, True, 0) # Switch / pos bar row self.view_mode_select = guicomponents.get_monitor_view_select_combo( lambda w, e: tlineaction.view_mode_menu_lauched(w, e)) sw_pos_hbox = gtk.HBox(False, 1) sw_pos_hbox.pack_start(switch_vbox, False, True, 0) sw_pos_hbox.pack_start(pos_bar_vbox, True, True, 0) sw_pos_hbox.pack_start(self.view_mode_select.widget, False, False, 0) # Video display black_box = gtk.EventBox() black_box.add(gtk.Label()) bg_color = gtk.gdk.Color(red=0.0, green=0.0, blue=0.0) black_box.modify_bg(gtk.STATE_NORMAL, bg_color) self.tline_display = black_box # This can be any GTK+ widget (that is not "windowless"), only its XWindow draw rect # is used to position and scale SDL overlay that actually displays video. dnd.connect_video_monitor(self.tline_display) # Monitor monitor_vbox = gtk.VBox(False, 1) monitor_vbox.pack_start(self.tline_display, True, True, 0) monitor_vbox.pack_start(sw_pos_hbox, False, True, 0) monitor_vbox.pack_start(player_buttons_row, False, True, 0) monitor_align = gtk.Alignment(xalign=0.0, yalign=0.0, xscale=1.0, yscale=1.0) monitor_align.add(monitor_vbox) monitor_align.set_padding(3, 0, 3, 3) monitor_frame = gtk.Frame() monitor_frame.add(monitor_align) monitor_frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT) monitor_frame.set_size_request(MONITOR_AREA_WIDTH, appconsts.TOP_ROW_HEIGHT) # Notebook panel notebook_vbox = gtk.VBox(False, 1) notebook_vbox.pack_start(self.notebook, True, True) # Top row paned self.top_paned = gtk.HPaned() self.top_paned.pack1(notebook_vbox, resize=False, shrink=False) self.top_paned.pack2(monitor_frame, resize=True, shrink=False) # Top row self.top_row_hbox = gtk.HBox(False, 0) self.top_row_hbox.pack_start(self.top_paned, True, True, 0) self._update_top_row() # Edit buttons rows self.edit_buttons_row = self._get_edit_buttons_row() self.edit_buttons_frame = gtk.Frame() self.edit_buttons_frame.add(self.edit_buttons_row) self.edit_buttons_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN) # Timeline scale self.tline_scale = tlinewidgets.TimeLineFrameScale( editevent.insert_move_mode_pressed, updater.mouse_scroll_zoom) # Timecode display self.tline_info = gtk.HBox() info_contents = gtk.Label() self.tline_info.add(info_contents) self.tline_info.info_contents = info_contents # this switched and sacved as member of its container info_h = gtk.HBox() info_h.pack_start(self.tline_info, False, False, 0) info_h.pack_start(gtk.Label(), True, True, 0) info_h.set_size_request( tlinewidgets.COLUMN_WIDTH - 22 - 22, # - 22, # room for 2 menu launch buttons tlinewidgets.SCALE_HEIGHT) marker_pixbuf = gtk.gdk.pixbuf_new_from_file(respaths.IMAGE_PATH + "marker.png") markers_launcher = guicomponents.get_markers_menu_launcher( tlineaction.marker_menu_lauch_pressed, marker_pixbuf) tracks_launcher_pixbuf = gtk.gdk.pixbuf_new_from_file( respaths.IMAGE_PATH + "track_menu_launch.png") tracks_launcher = guicomponents.PressLaunch( trackaction.all_tracks_menu_launch_pressed, tracks_launcher_pixbuf) # Timeline top row tline_hbox_1 = gtk.HBox() tline_hbox_1.pack_start(info_h, False, False, 0) tline_hbox_1.pack_start(tracks_launcher.widget, False, False, 0) tline_hbox_1.pack_start(markers_launcher.widget, False, False, 0) tline_hbox_1.pack_start(self.tline_scale.widget, True, True, 0) # Timeline column self.tline_column = tlinewidgets.TimeLineColumn( trackaction.track_active_switch_pressed, trackaction.track_center_pressed) # Timeline editpanel self.tline_canvas = tlinewidgets.TimeLineCanvas( editevent.tline_canvas_mouse_pressed, editevent.tline_canvas_mouse_moved, editevent.tline_canvas_mouse_released, editevent.tline_canvas_double_click, updater.mouse_scroll_zoom, self.tline_cursor_leave, self.tline_cursor_enter) dnd.connect_tline(self.tline_canvas.widget, editevent.tline_effect_drop, editevent.tline_media_drop) # Timeline middle row tline_hbox_2 = gtk.HBox() tline_hbox_2.pack_start(self.tline_column.widget, False, False, 0) tline_hbox_2.pack_start(self.tline_canvas.widget, True, True, 0) # Bottom row filler self.left_corner = guicomponents.TimeLineLeftBottom() self.left_corner.widget.set_size_request(tlinewidgets.COLUMN_WIDTH, 20) # Timeline scroller self.tline_scroller = tlinewidgets.TimeLineScroller( updater.tline_scrolled) # Timeline bottom row tline_hbox_3 = gtk.HBox() tline_hbox_3.pack_start(self.left_corner.widget, False, False, 0) tline_hbox_3.pack_start(self.tline_scroller, True, True, 0) # Timeline hbox tline_vbox = gtk.VBox() tline_vbox.pack_start(tline_hbox_1, False, False, 0) tline_vbox.pack_start(tline_hbox_2, True, True, 0) tline_vbox.pack_start(tline_hbox_3, False, False, 0) # Timeline box self.tline_box = gtk.HBox() self.tline_box.pack_start(tline_vbox, True, True, 0) # Timeline pane tline_pane = gtk.VBox(False, 1) tline_pane.pack_start(self.edit_buttons_frame, False, True, 0) tline_pane.pack_start(self.tline_box, True, True, 0) # VPaned top row / timeline self.app_v_paned = gtk.VPaned() self.app_v_paned.pack1(self.top_row_hbox, resize=False, shrink=False) self.app_v_paned.pack2(tline_pane, resize=True, shrink=False) # Pane pane = gtk.VBox(False, 1) pane.pack_start(menu_vbox, False, True, 0) pane.pack_start(self.app_v_paned, True, True, 0) # Tooltips self._add_tool_tips() # GUI preferences self._init_gui_to_prefs() # Viewmenu initial state self._init_view_menu(ui.get_widget('/MenuBar/ViewMenu')) # Set pane and show window self.window.add(pane) self.window.set_title("Flowblade") # Maximize if it seems that we exited maximized, else set size w, h = editorpersistance.prefs.exit_allocation if w != 0: # non-existing prefs file causes w and h to be 0 if (float(w) / editorstate.SCREEN_WIDTH > 0.95) and (float(h) / editorstate.SCREEN_HEIGHT > 0.95): self.window.maximize() print "maximize" else: self.window.resize(w, h) self.window.set_position(gtk.WIN_POS_CENTER) else: self.window.set_position(gtk.WIN_POS_CENTER) # Show window and all of its components self.window.show_all() # Set paned positions self.mm_paned.set_position(editorpersistance.prefs.mm_paned_position) self.top_paned.set_position(editorpersistance.prefs.top_paned_position) self.app_v_paned.set_position( editorpersistance.prefs.app_v_paned_position)
def _handle_tline_key_event(event): """ This is called when timeline widgets have focus and key is pressed. Returns True for handled key presses to stop those keyevents from going forward. """ # I if event.keyval == gtk.keysyms.i: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == gtk.keysyms.I: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == gtk.keysyms.o: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == gtk.keysyms.O: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == gtk.keysyms.space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == gtk.keysyms.Tab: updater.switch_monitor_display() return True # M if event.keyval == gtk.keysyms.m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == gtk.keysyms._1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._3: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == gtk.keysyms.x: tlineaction.cut_pressed() return True # G if event.keyval == gtk.keysyms.g: medialog.log_range_clicked() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode( ) or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == gtk.keysyms.Up: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) return True else: monitorevent.up_arrow_seek_on_monitor_clip() # DOWN ARROW, prev cut if event.keyval == gtk.keysyms.Down: if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # LEFT ARROW, prev frame if event.keyval == gtk.keysyms.Left: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == gtk.keysyms.Right: PLAYER().seek_delta(1) return True # T if event.keyval == gtk.keysyms.t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == gtk.keysyms.y: if not (event.state & gtk.gdk.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == gtk.keysyms.u: tlineaction.append_button_pressed() return True # J if event.keyval == gtk.keysyms.j: monitorevent.j_pressed() return True # K if event.keyval == gtk.keysyms.k: monitorevent.k_pressed() return True # L if event.keyval == gtk.keysyms.l: if (event.state & gtk.gdk.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # CTRL+C if event.keyval == gtk.keysyms.c: if (event.state & gtk.gdk.CONTROL_MASK): tlineaction.do_timeline_objects_copy() return True # CTRL+V if event.keyval == gtk.keysyms.v: if (event.state & gtk.gdk.CONTROL_MASK): tlineaction.do_timeline_objects_paste() return True # DELETE if event.keyval == gtk.keysyms.Delete: # Clip selection and compositor selection are mutually exclusive, # so max one one these will actually delete something tlineaction.splice_out_button_pressed() compositormodes.delete_current_selection() # HOME if event.keyval == gtk.keysyms.Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True else: # HOME if event.keyval == gtk.keysyms.Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) return True return False