def _group_action_pressed(widget, event): actions_menu = actions_popup_menu guiutils.remove_children(actions_menu) actions_menu.add(guiutils.get_menu_item(_("New Group..."), _actions_callback, "new")) actions_menu.add(guiutils.get_menu_item(_("New Group From Selected..."), _actions_callback, "newfromselected")) guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Rename Current Group..."), _actions_callback, "rename") _unsensitive_for_all_view(item) actions_menu.add(item) guiutils.add_separetor(actions_menu) move_menu_item = Gtk.MenuItem(_("Move Selected Items To Group").encode('utf-8')) move_menu = Gtk.Menu() if len(PROJECT().media_log_groups) == 0: move_menu.add(guiutils.get_menu_item(_("No Groups").encode('utf-8'), _actions_callback, "dummy", False)) else: index = 0 for group in PROJECT().media_log_groups: name, items = group move_menu.add(guiutils.get_menu_item(name, _actions_callback, str(index))) index = index + 1 move_menu_item.set_submenu(move_menu) actions_menu.add(move_menu_item) move_menu_item.show() guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Delete Current Group"), _actions_callback, "delete") _unsensitive_for_all_view(item) actions_menu.add(item) actions_menu.popup(None, None, None, None, event.button, event.time)
def _show_oor_before_menu(self, widget, event): menu = oor_before_menu guiutils.remove_children(menu) before_kfs = len(self.get_out_of_range_before_kfs()) if before_kfs == 0: # hit detection is active even if the kf icon is not displayed return if before_kfs > 1: menu.add( self._get_menu_item( _("Delete all but first Keyframe before Clip Range"), self._oor_menu_item_activated, "delete_all_before")) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) if len(self.keyframes) > 1: menu.add( self._get_menu_item( _("Set Keyframe at Frame 0 to value of next Keyframe"), self._oor_menu_item_activated, "zero_next")) elif before_kfs == 1: item = self._get_menu_item( _("No Edit Actions currently available"), self._oor_menu_item_activated, "noop") item.set_sensitive(False) menu.add(item) menu.popup(None, None, None, None, event.button, event.time)
def _menu_action_pressed(widget, event): menu = _hamburger_menu guiutils.remove_children(menu) menu.add( guiutils.get_menu_item(_("Cancel Selected Render"), _hamburger_item_activated, "cancel_selected")) menu.add( guiutils.get_menu_item(_("Cancel All Renders"), _hamburger_item_activated, "cancel_all")) guiutils.add_separetor(menu) """ Not settable for 2.6, let's see later sequential_render_item = Gtk.CheckMenuItem() sequential_render_item.set_label(_("Render All Jobs Sequentially")) sequential_render_item.set_active(editorpersistance.prefs.render_jobs_sequentially) sequential_render_item.connect("activate", _hamburger_item_activated, "sequential_render") menu.add(sequential_render_item) """ open_on_add_item = Gtk.CheckMenuItem() open_on_add_item.set_label(_("Show Jobs Panel on Adding New Job")) open_on_add_item.set_active(editorpersistance.prefs.open_jobs_panel_on_add) open_on_add_item.connect("activate", _hamburger_item_activated, "open_on_add") menu.add(open_on_add_item) menu.show_all() menu.popup(None, None, None, None, event.button, event.time)
def display_strip_context_menu(event, hit_segment): global strip_popup_menu guiutils.remove_children(strip_popup_menu) sensitive = ((hit_segment != None) and (get_tline_rendering_mode() == appconsts.TLINE_RENDERING_REQUEST)) item = guiutils.get_menu_item(_("Render Segment"), _strip_menu_item_callback, ("render_segment", hit_segment), sensitive) strip_popup_menu.append(item) sensitive = (len(get_renderer().segments) > 0) item = guiutils.get_menu_item(_("Delete All Segments"), _strip_menu_item_callback, ("delete_all", None), sensitive) strip_popup_menu.append(item) sensitive = (hit_segment != None) item = guiutils.get_menu_item(_("Delete Segment"), _strip_menu_item_callback, ("delete_segment", hit_segment), sensitive) strip_popup_menu.append(item) strip_popup_menu.popup(None, None, None, None, event.button, event.time)
def corner_mode_menu_launched(widget, event): guiutils.remove_children(tlinerender_mode_menu) render_off = guiutils.get_image_menu_item(_("Timeline Render Off"), "tline_render_off", _set_new_render_mode) render_auto = guiutils.get_image_menu_item(_("Timeline Render Auto"), "tline_render_auto", _set_new_render_mode) render_request = guiutils.get_image_menu_item( _("Timeline Render On Request"), "tline_render_request", _set_new_render_mode) render_off.connect( "activate", lambda w: _set_new_render_mode(appconsts.TLINE_RENDERING_OFF)) render_auto.connect( "activate", lambda w: _set_new_render_mode(appconsts.TLINE_RENDERING_AUTO)) render_request.connect( "activate", lambda w: _set_new_render_mode(appconsts.TLINE_RENDERING_REQUEST)) tlinerender_mode_menu.add(render_off) tlinerender_mode_menu.add(render_auto) tlinerender_mode_menu.add(render_request) tlinerender_mode_menu.popup(None, None, None, None, event.button, event.time)
def hamburger_launch_pressed(self, widget, event): menu = _hamburger_menu guiutils.remove_children(menu) menu.add( guiutils.get_menu_item(_("Load Render Args from a text file"), self.hamburger_item_activated, "load_from_file")) menu.add( guiutils.get_menu_item(_("Save Render Args into a text file"), self.hamburger_item_activated, "save_to_from_file")) guiutils.add_separetor(menu) menu.add( guiutils.get_menu_item(_("Load Render Args from Current Encoding"), self.hamburger_item_activated, "load_from_selection")) guiutils.add_separetor(menu) menu.add( guiutils.get_menu_item(_("Reset all Render Options to Defaults"), self.hamburger_item_activated, "reset_all")) menu.show_all() menu.popup(None, None, None, None, event.button, event.time)
def _show_actions_menu(self, widget, event): menu = actions_menu guiutils.remove_children(menu) menu.add(self._get_menu_item(_("Reset Geometry"), self.editor_parent.menu_item_activated, "reset" )) menu.add(self._get_menu_item(_("Geometry to Original Aspect Ratio"), self.editor_parent.menu_item_activated, "ratio" )) menu.add(self._get_menu_item(_("Center Horizontal"), self.editor_parent.menu_item_activated, "hcenter" )) menu.add(self._get_menu_item(_("Center Vertical"), self.editor_parent.menu_item_activated, "vcenter" )) menu.popup(None, None, None, None, event.button, event.time)
def display_render_item_popup_menu(callback, event): menu = render_item_menu guiutils.remove_children(menu) menu.add(_get_menu_item(_("Save Item Project As..."), callback,"saveas")) menu.add(_get_menu_item(_("Render Properties"), callback,"renderinfo")) _add_separetor(menu) menu.add(_get_menu_item(_("Delete"), callback,"delete")) menu.popup(None, None, None, None, event.button, event.time)
def hamburger_launch_pressed(self, widget, event): menu = _hamburger_menu guiutils.remove_children(menu) menu.add(_get_menu_item(_("Load Clip") + "...", _hamburger_menu_callback, "load" )) menu.add(_get_menu_item(_("G'Mic Webpage"), _hamburger_menu_callback, "docs" )) _add_separetor(menu) menu.add(_get_menu_item(_("Close"), _hamburger_menu_callback, "close" )) menu.popup(None, None, None, None, event.button, event.time)
def _hamburger_launch_pressed(widget, event): menu = _hamburger_menu guiutils.remove_children(menu) menu.add(_get_menu_item(_("Load Animation") + "...", _hamburger_menu_callback, "load" )) menu.add(_get_menu_item(_("Save Animation") + "...", _hamburger_menu_callback, "save" )) _add_separetor(menu) menu.add(_get_menu_item(_("Natron Webpage"), _hamburger_menu_callback, "web" )) _add_separetor(menu) menu.add(_get_menu_item(_("Close"), _hamburger_menu_callback, "close" )) menu.popup(None, None, None, None, event.button, event.time)
def _show_hamburger_menu(self, widget, event): menu = hamburger_menu guiutils.remove_children(menu) if edit_data["track"].type == appconsts.VIDEO: if edit_data["clip"].media_type == appconsts.VIDEO: edit_volume = self._get_menu_item(_("Edit Volume Keyframes"), self._oor_menu_item_activated, "edit_volume" ) if self.edit_type == VOLUME_KF_EDIT: edit_volume.set_sensitive(False) menu.add(edit_volume) edit_brightness = self._get_menu_item(_("Edit Brightness Keyframes"), self._oor_menu_item_activated, "edit_brightness" ) if self.edit_type == BRIGHTNESS_KF_EDIT: edit_brightness.set_sensitive(False) menu.add(edit_brightness) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) leading_menu_item = Gtk.MenuItem(_("Leading Keyframes")) leading_menu = Gtk.Menu() self._build_oor_before_menu(leading_menu) leading_menu_item.set_submenu(leading_menu) leading_menu_item.show_all() menu.add(leading_menu_item) trailing_menu_item = Gtk.MenuItem(_("Trailing Keyframes")) trailing_menu = Gtk.Menu() self._build_oor_after_menu(trailing_menu) trailing_menu_item.set_submenu(trailing_menu) trailing_menu_item.show_all() menu.add(trailing_menu_item) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) playhead_follow_item = Gtk.CheckMenuItem() playhead_follow_item.set_label(_("Playhead Follows Dragged Keyframe")) playhead_follow_item.set_active(_playhead_follow_kf) playhead_follow_item.connect("activate", self._oor_menu_item_activated, "playhead_follows") playhead_follow_item.show() menu.add(playhead_follow_item) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) menu.add(self._get_menu_item(_("Exit Edit"), self._oor_menu_item_activated, "exit" )) menu.popup(None, None, None, None, event.button, event.time)
def _show_oor_after_menu(self, widget, event): menu = oor_before_menu guiutils.remove_children(menu) after_kfs = self.get_out_of_range_after_kfs() if after_kfs == 0: # hit detection is active even if the kf icon is not displayed return menu.add( self._get_menu_item(_("Delete all Keyframes after Clip Range"), self._oor_menu_item_activated, "delete_all_after")) menu.popup(None, None, None, None, event.button, event.time)
def display_strip_context_menu(event, hit_segment): global strip_popup_menu guiutils.remove_children(strip_popup_menu) sensitive = (len(get_renderer().segments) > 0) item = guiutils.get_menu_item(_("Delete All Segments"), _strip_menu_item_callback, ("delete_all", None), sensitive) strip_popup_menu.append(item) if hit_segment != None: item = guiutils.get_menu_item(_("Delete Segment"), _strip_menu_item_callback, ("delete_segment", hit_segment), True) strip_popup_menu.append(item) strip_popup_menu.popup(None, None, None, None, event.button, event.time)
def _build_oor_before_menu(self, menu): guiutils.remove_children(menu) before_kfs = len(self.get_out_of_range_before_kfs()) if before_kfs == 0: item = self._get_menu_item(_("No Edit Actions currently available"), self._oor_menu_item_activated, "noop" ) item.set_sensitive(False) menu.add(item) if before_kfs > 1: menu.add(self._get_menu_item(_("Delete all but first Keyframe before Clip Range"), self._oor_menu_item_activated, "delete_all_before" )) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) if len(self.keyframes) > 1 and before_kfs > 0: menu.add(self._get_menu_item(_("Set Keyframe at Frame 0 to value of next Keyframe"), self._oor_menu_item_activated, "zero_next" ))
def _build_oor_before_menu(self, menu): guiutils.remove_children(menu) before_kfs = len(self.get_out_of_range_before_kfs()) if before_kfs == 0 or (before_kfs == 1 and len(self.keyframes) == 1): item = self._get_menu_item(_("No Edit Actions currently available"), self._oor_menu_item_activated, "noop" ) item.set_sensitive(False) menu.add(item) if before_kfs > 1: menu.add(self._get_menu_item(_("Delete all but first Keyframe before Clip Range"), self._oor_menu_item_activated, "delete_all_before" )) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) if len(self.keyframes) > 1 and before_kfs > 0: menu.add(self._get_menu_item(_("Set Keyframe at Frame 0 to value of next Keyframe"), self._oor_menu_item_activated, "zero_next" ))
def _show_hamburger_menu(self, widget, event): menu = hamburger_menu guiutils.remove_children(menu) menu.add( self._get_menu_item( _("ccccc all but first Keyframe before Clip Range"), self._oor_menu_item_activated, "fgffsg")) sep = Gtk.SeparatorMenuItem() sep.show() menu.add(sep) menu.add( self._get_menu_item( _("Seccccccct Keyframe at Frame 0 to value of next Keyframe"), self._oor_menu_item_activated, "fgfgf")) menu.popup(None, None, None, None, event.button, event.time)
def _build_oor_after_menu(self, menu): guiutils.remove_children(menu) after_kfs = len(self.get_out_of_range_after_kfs()) if after_kfs == 0: item = self._get_menu_item(_("No Edit Actions currently available"), self._oor_menu_item_activated, "noop" ) item.set_sensitive(False) menu.add(item) return if self.edit_type == BRIGHTNESS_KF_EDIT: menu.add(self._get_menu_item(_("Delete all Keyframes after Clip Range"), self._oor_menu_item_activated, "delete_all_after" )) elif self.edit_type == VOLUME_KF_EDIT: if after_kfs > 1: menu.add(self._get_menu_item(_("Delete all but last Keyframe after Clip Range"), self._oor_menu_item_activated, "delete_all_but_last_after" )) else: item = self._get_menu_item(_("No Edit Actions currently available"), self._oor_menu_item_activated, "noop" ) item.set_sensitive(False) menu.add(item)
def get_tline_tool_popup_menu(launcher, event, callback): menu = _tools_menu guiutils.remove_children(menu) menu.set_accel_group(gui.editor_window.accel_group) menu.set_take_focus(False) menu_items = [] kb_shortcut_number = 1 for tool_id in editorpersistance.prefs.active_tools: tool_name, tool_icon_file = _TOOLS_DATA[tool_id] menu_item = _get_image_menu_item(tool_icon_file, tool_name, callback, tool_id) accel_path = "<Actions>/WindowActions/TOOL_ACTION_KEY_" + str(kb_shortcut_number) menu_item.set_accel_path(accel_path) menu.add(menu_item) menu_items.append(menu_item) kb_shortcut_number = kb_shortcut_number + 1 menu.connect("hide", lambda w : _tools_menu_hidden(w, menu_items)) menu.show_all() menu.popup(None, None, None, None, event.button, event.time)
def _group_action_pressed(widget, event): actions_menu = actions_popup_menu guiutils.remove_children(actions_menu) actions_menu.add( guiutils.get_menu_item(_("New Group..."), _actions_callback, "new")) actions_menu.add( guiutils.get_menu_item(_("New Group From Selected..."), _actions_callback, "newfromselected")) guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Rename Current Group..."), _actions_callback, "rename") _unsensitive_for_all_view(item) actions_menu.add(item) guiutils.add_separetor(actions_menu) move_menu_item = Gtk.MenuItem(_("Move Selected Items To Group")) move_menu = Gtk.Menu() if len(PROJECT().media_log_groups) == 0: move_menu.add( guiutils.get_menu_item(_("No Groups"), _actions_callback, "dummy", False)) else: index = 0 for group in PROJECT().media_log_groups: name, items = group move_menu.add( guiutils.get_menu_item(name, _actions_callback, str(index))) index = index + 1 move_menu_item.set_submenu(move_menu) actions_menu.add(move_menu_item) move_menu_item.show() guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Delete Current Group"), _actions_callback, "delete") _unsensitive_for_all_view(item) actions_menu.add(item) guiutils.add_separetor(actions_menu) comments_item = Gtk.CheckMenuItem.new_with_label( label=_("Use Comments as Clip Names")) comments_item.set_active(_use_comments_for_name) comments_item.connect("toggled", _use_comments_toggled) comments_item.show() actions_menu.add(comments_item) guiutils.add_separetor(actions_menu) sort_item = Gtk.MenuItem(_("Sort by")) sort_menu = Gtk.Menu() time_item = Gtk.RadioMenuItem() time_item.set_label(_("Time")) time_item.set_active(True) time_item.show() time_item.connect("activate", lambda w: _sorting_changed("time")) sort_menu.append(time_item) name_item = Gtk.RadioMenuItem.new_with_label([time_item], _("File Name")) name_item.connect("activate", lambda w: _sorting_changed("name")) name_item.show() sort_menu.append(name_item) comment_item = Gtk.RadioMenuItem.new_with_label([time_item], _("Comment")) comment_item.connect("activate", lambda w: _sorting_changed("comment")) comment_item.show() sort_menu.append(comment_item) global sorting_order if sorting_order == TIME_SORT: time_item.set_active(True) elif sorting_order == NAME_SORT: name_item.set_active(True) else: # "comment" comment_item.set_active(True) sort_item.set_submenu(sort_menu) sort_item.show() actions_menu.add(sort_item) actions_menu.popup(None, None, None, None, event.button, event.time)
def workflow_menu_launched(widget, event): guiutils.remove_children(_workflow_menu) # ---- preset presets_item = Gtk.MenuItem.new_with_label(_("Workflow Presets")) presets_item.show() presets_menu = Gtk.Menu() standard = guiutils.get_menu_item(_("Standard"), _workflow_menu_callback, (None, "preset standard")) standard.show() presets_menu.add(standard) film_style = guiutils.get_menu_item(_("Film Style"), _workflow_menu_callback, (None, "preset filmstyle")) film_style.show() presets_menu.add(film_style) presets_item.set_submenu(presets_menu) _workflow_menu.add(presets_item) # --- behaviours guiutils.add_separetor(_workflow_menu) behaviours_item = Gtk.MenuItem.new_with_label(_("Behaviours")) behaviours_item.show() behaviours_menu = Gtk.Menu() # Delete item not currently used delete_item = Gtk.MenuItem.new_with_label(_("Default Delete Action")) delete_item.show() delete_menu = Gtk.Menu() labels = [_("Lift"), _("Splice Out")] msgs = ["delete lift", "delete splice"] _build_radio_menu_items_group(delete_menu, labels, msgs, _workflow_menu_callback, 0) delete_item.set_submenu(delete_menu) dnd_item = Gtk.MenuItem.new_with_label(_("Drag'n'Drop Action")) dnd_item.show() dnd_menu = Gtk.Menu() labels = [ _("Always Overwrite Blanks"), _("Overwrite Blanks on non-V1 Tracks"), _("Always Insert") ] msgs = ["always overwrite", "overwrite nonV1", "always insert"] active_index = editorpersistance.prefs.dnd_action # appconsts values correspond with order here. _build_radio_menu_items_group(dnd_menu, labels, msgs, _workflow_menu_callback, active_index) dnd_item.set_submenu(dnd_menu) behaviours_menu.add(dnd_item) default_compositing_item = Gtk.MenuItem.new_with_label( _("New Sequence Default Compositing Mode")) default_compositing_item.show() default_compositing_menu = Gtk.Menu() labels = [ _("Top Down Free Move"), _("Top Down Auto Follow"), _("Standard Auto Follow") ] msgs = ["top down", "top down auto", "standard auto"] active_index = editorpersistance.prefs.default_compositing_mode # appconsts values correspond with order here. _build_radio_menu_items_group(default_compositing_menu, labels, msgs, _workflow_menu_callback, active_index) default_compositing_item.set_submenu(default_compositing_menu) behaviours_menu.add(default_compositing_item) show_tooltips_item = Gtk.CheckMenuItem() show_tooltips_item.set_label(_("Show Tooltips for Tools")) show_tooltips_item.set_active(editorpersistance.prefs.show_tool_tooltips) show_tooltips_item.connect("activate", _workflow_menu_callback, (None, "tooltips")) show_tooltips_item.show() behaviours_menu.append(show_tooltips_item) behaviours_item.set_submenu(behaviours_menu) _workflow_menu.add(behaviours_item) # --- tools guiutils.add_separetor(_workflow_menu) # Active tools non_active_tools = list(range(1, 12)) # we have 11 tools currently for i in range(0, len( editorpersistance.prefs.active_tools)): # tool_id in _TOOLS_DATA: tool_id = editorpersistance.prefs.active_tools[i] tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add( _get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, i + 1)) try: # needed to prevent crashes when manually changing preset tools during dev non_active_tools.remove(tool_id) except: pass guiutils.add_separetor(_workflow_menu) # Non-active tools for tool_id in non_active_tools: tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add( _get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, -1)) _workflow_menu.popup(None, None, None, None, event.button, event.time)
def workflow_menu_launched(widget, event): guiutils.remove_children(_workflow_menu) # ---- preset presets_item = Gtk.MenuItem.new_with_label(_("Workflow Presets")) presets_item.show() presets_menu = Gtk.Menu() standard = guiutils.get_menu_item(_("Standard"), _workflow_menu_callback, (None, "preset standard")) standard.show() presets_menu.add(standard) film_style = guiutils.get_menu_item(_("Film Style"), _workflow_menu_callback, (None, "preset filmstyle")) film_style.show() presets_menu.add(film_style) presets_item.set_submenu(presets_menu) _workflow_menu.add(presets_item) # --- behaviours guiutils.add_separetor(_workflow_menu) behaviours_item = Gtk.MenuItem.new_with_label(_("Behaviours")) behaviours_item.show() behaviours_menu = Gtk.Menu() delete_item = Gtk.MenuItem.new_with_label(_("Default Delete Action")) delete_item.show() delete_menu = Gtk.Menu() labels = [_("Lift"), _("Splice Out")] msgs = ["delete lift", "delete splice"] _build_radio_menu_items_group(delete_menu, labels, msgs, _workflow_menu_callback, 0) delete_item.set_submenu(delete_menu) #behaviours_menu.add(delete_item) dnd_item = Gtk.MenuItem.new_with_label(_("Drag'n'Drop Action")) dnd_item.show() dnd_menu = Gtk.Menu() labels = [_("Always Overwrite Blanks"), _("Overwrite Blanks on non-V1 Tracks"), _("Always Insert")] msgs = ["always overwrite", "overwrite nonV1", "always insert"] active_index = editorpersistance.prefs.dnd_action #appconsts values corrspond with order here _build_radio_menu_items_group(dnd_menu, labels, msgs, _workflow_menu_callback, active_index) dnd_item.set_submenu(dnd_menu) behaviours_menu.add(dnd_item) autofollow_item = Gtk.CheckMenuItem() autofollow_item.set_label(_("Compositors Auto Follow")) autofollow_item.set_active(editorstate.auto_follow_active()) autofollow_item.connect("activate", _workflow_menu_callback, (None, "autofollow")) autofollow_item.show() behaviours_menu.append(autofollow_item) show_tooltips_item = Gtk.CheckMenuItem() show_tooltips_item.set_label(_("Show Tooltips for Tools")) show_tooltips_item.set_active(editorpersistance.prefs.show_tool_tooltips) show_tooltips_item.connect("activate", _workflow_menu_callback, (None, "tooltips")) show_tooltips_item.show() behaviours_menu.append(show_tooltips_item) behaviours_item.set_submenu(behaviours_menu) _workflow_menu.add(behaviours_item) # --- tools guiutils.add_separetor(_workflow_menu) # Active tools non_active_tools = range(1, 12) # we have 11 tools currently for i in range(0, len(editorpersistance.prefs.active_tools)):# tool_id in _TOOLS_DATA: tool_id = editorpersistance.prefs.active_tools[i] tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add(_get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, i+1)) try: # needed to prevent crashes when manually changing preset tools during dev, remove when those are decided upon non_active_tools.remove(tool_id) except: pass guiutils.add_separetor(_workflow_menu) # Non-active tools for tool_id in non_active_tools: tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add(_get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, -1)) _workflow_menu.popup(None, None, None, None, event.button, event.time)
def _group_action_pressed(widget, event): actions_menu = actions_popup_menu guiutils.remove_children(actions_menu) actions_menu.add(guiutils.get_menu_item(_("New Group..."), _actions_callback, "new")) actions_menu.add(guiutils.get_menu_item(_("New Group From Selected..."), _actions_callback, "newfromselected")) guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Rename Current Group..."), _actions_callback, "rename") _unsensitive_for_all_view(item) actions_menu.add(item) guiutils.add_separetor(actions_menu) move_menu_item = Gtk.MenuItem(_("Move Selected Items To Group").encode('utf-8')) move_menu = Gtk.Menu() if len(PROJECT().media_log_groups) == 0: move_menu.add(guiutils.get_menu_item(_("No Groups").encode('utf-8'), _actions_callback, "dummy", False)) else: index = 0 for group in PROJECT().media_log_groups: name, items = group move_menu.add(guiutils.get_menu_item(name, _actions_callback, str(index))) index = index + 1 move_menu_item.set_submenu(move_menu) actions_menu.add(move_menu_item) move_menu_item.show() guiutils.add_separetor(actions_menu) item = guiutils.get_menu_item(_("Delete Current Group"), _actions_callback, "delete") _unsensitive_for_all_view(item) actions_menu.add(item) guiutils.add_separetor(actions_menu) sort_item = Gtk.MenuItem(_("Sort by").encode('utf-8')) sort_menu = Gtk.Menu() time_item = Gtk.RadioMenuItem() time_item.set_label(_("Time").encode('utf-8')) time_item.set_active(True) time_item.show() time_item.connect("activate", lambda w: _sorting_changed("time")) sort_menu.append(time_item) name_item = Gtk.RadioMenuItem.new_with_label([time_item], _("File Name").encode('utf-8')) name_item.connect("activate", lambda w: _sorting_changed("name")) name_item.show() sort_menu.append(name_item) comment_item = Gtk.RadioMenuItem.new_with_label([time_item], _("Comment").encode('utf-8')) comment_item.connect("activate", lambda w: _sorting_changed("comment")) comment_item.show() sort_menu.append(comment_item) global sorting_order if sorting_order == TIME_SORT: time_item.set_active(True) elif sorting_order == NAME_SORT: name_item.set_active(True) else:# "comment" comment_item.set_active(True) """ if editorpersistance.prefs.midbar_tc_left == True: tc_left.set_active(True) else: tc_middle.set_active(True) """ sort_item.set_submenu(sort_menu) sort_item.show() actions_menu.add(sort_item) actions_menu.popup(None, None, None, None, event.button, event.time)
def workflow_menu_launched(widget, event): guiutils.remove_children(_workflow_menu) # ---- preset presets_item = Gtk.MenuItem.new_with_label(_("Workflow Presets")) presets_item.show() presets_menu = Gtk.Menu() simplified = guiutils.get_menu_item(_("Simplified"), _workflow_menu_callback, (None, "preset simplified")) simplified.show() presets_menu.add(simplified) standart = guiutils.get_menu_item(_("Standard"), _workflow_menu_callback, (None, "preset standart")) standart.show() presets_menu.add(standart) standart = guiutils.get_menu_item(_("Film Style"), _workflow_menu_callback, (None, "preset filmstyle")) standart.show() presets_menu.add(standart) presets_item.set_submenu(presets_menu) _workflow_menu.add(presets_item) # --- behaviours guiutils.add_separetor(_workflow_menu) behaviours_item = Gtk.MenuItem.new_with_label(_("Behaviours")) behaviours_item.show() behaviours_menu = Gtk.Menu() delete_item = Gtk.MenuItem.new_with_label(_("Default Delete Action")) delete_item.show() delete_menu = Gtk.Menu() labels = [_("Lift"), _("Splice Out")] msgs = ["delete lift", "delete splice"] guiutils.get_radio_menu_items_group(delete_menu, labels, msgs, _workflow_menu_callback, 0) delete_item.set_submenu(delete_menu) behaviours_menu.add(delete_item) dnd_item = Gtk.MenuItem.new_with_label(_("Drag'n'Drop Action")) dnd_item.show() dnd_menu = Gtk.Menu() labels = [ _("Always Overwrite"), _("Overwrite on non-V1"), _("Always Insert") ] msgs = ["always overwrite", "verwrite nonV1", "always insert"] guiutils.get_radio_menu_items_group(dnd_menu, labels, msgs, _workflow_menu_callback, 0) dnd_item.set_submenu(dnd_menu) behaviours_menu.add(dnd_item) behaviours_item.set_submenu(behaviours_menu) _workflow_menu.add(behaviours_item) # --- tools guiutils.add_separetor(_workflow_menu) # Active tools non_active_tools = range(1, 8) # we have 7 tools currently for i in range(0, len( editorpersistance.prefs.active_tools)): # tool_id in _TOOLS_DATA: tool_id = editorpersistance.prefs.active_tools[i] tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add( _get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, i + 1)) non_active_tools.remove(tool_id) guiutils.add_separetor(_workflow_menu) # Non-active tools for tool_id in non_active_tools: tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add( _get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, -1)) _workflow_menu.popup(None, None, None, None, event.button, event.time)
def workflow_menu_launched(widget, event): guiutils.remove_children(_workflow_menu) # ---- preset presets_item = Gtk.MenuItem.new_with_label(_("Workflow Presets")) presets_item.show() presets_menu = Gtk.Menu() standard = guiutils.get_menu_item(_("Standard"), _workflow_menu_callback, (None, "preset standard")) standard.show() presets_menu.add(standard) film_style = guiutils.get_menu_item(_("Film Style"), _workflow_menu_callback, (None, "preset filmstyle")) film_style.show() presets_menu.add(film_style) presets_item.set_submenu(presets_menu) _workflow_menu.add(presets_item) # --- behaviours guiutils.add_separetor(_workflow_menu) behaviours_item = Gtk.MenuItem.new_with_label(_("Behaviours")) behaviours_item.show() behaviours_menu = Gtk.Menu() delete_item = Gtk.MenuItem.new_with_label(_("Default Delete Action")) delete_item.show() delete_menu = Gtk.Menu() labels = [_("Lift"), _("Splice Out")] msgs = ["delete lift", "delete splice"] _build_radio_menu_items_group(delete_menu, labels, msgs, _workflow_menu_callback, 0) delete_item.set_submenu(delete_menu) behaviours_menu.add(delete_item) dnd_item = Gtk.MenuItem.new_with_label(_("Drag'n'Drop Action")) dnd_item.show() dnd_menu = Gtk.Menu() labels = [_("Always Overwrite Blanks"), _("Overwrite Blanks on non-V1 Tracks"), _("Always Insert")] msgs = ["always overwrite", "overwrite nonV1", "always insert"] active_index = editorpersistance.prefs.dnd_action #appconsts values corrspond with order here _build_radio_menu_items_group(dnd_menu, labels, msgs, _workflow_menu_callback, active_index) dnd_item.set_submenu(dnd_menu) behaviours_menu.add(dnd_item) autofollow_item = Gtk.CheckMenuItem() autofollow_item.set_label(_("Compositors Auto Follow")) autofollow_item.set_active(editorstate.auto_follow_active()) autofollow_item.connect("activate", _workflow_menu_callback, (None, "autofollow")) autofollow_item.show() behaviours_menu.append(autofollow_item) behaviours_item.set_submenu(behaviours_menu) _workflow_menu.add(behaviours_item) # --- tools guiutils.add_separetor(_workflow_menu) # Active tools non_active_tools = range(1, 11) # we have 10 tools currently for i in range(0, len(editorpersistance.prefs.active_tools)):# tool_id in _TOOLS_DATA: tool_id = editorpersistance.prefs.active_tools[i] tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add(_get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, i+1)) try: # needed when manually changing preset tools, remove when those are decided upon non_active_tools.remove(tool_id) except: pass guiutils.add_separetor(_workflow_menu) # Non-active tools for tool_id in non_active_tools: tool_name, tool_icon_file = _TOOLS_DATA[tool_id] _workflow_menu.add(_get_workflow_tool_menu_item(_workflow_menu_callback, tool_id, tool_name, tool_icon_file, -1)) _workflow_menu.popup(None, None, None, None, event.button, event.time)