示例#1
0
def _create_buttons(editor_window):
    IMG_PATH = respaths.IMAGE_PATH
    editor_window.big_TC = Gtk.Stack()
    tc_disp = guicomponents.BigTCDisplay()
    tc_entry = guicomponents.BigTCEntry()
    tc_disp.widget.show()
    tc_entry.widget.show()
    editor_window.big_TC.add_named(tc_disp.widget, "BigTCDisplay")
    editor_window.big_TC.add_named(tc_entry.widget, "BigTCEntry")
    editor_window.big_TC.set_visible_child_name("BigTCDisplay")
    gui.big_tc = editor_window.big_TC

    surface = cairo.ImageSurface.create_from_png(IMG_PATH + "workflow.png")
    editor_window.worflow_launch = guicomponents.PressLaunch(
        workflow.workflow_menu_launched, surface, w=22, h=22)

    editor_window.tool_selector = guicomponents.ToolSelector(
        editor_window.mode_selector_pressed, m_pixbufs, 40, 22)

    if editorpersistance.prefs.buttons_style == 2:  # NO_DECORATIONS
        no_decorations = True
    else:
        no_decorations = False

    editor_window.zoom_buttons = glassbuttons.GlassButtonsGroup(
        38, 23, 2, 8, 5)
    editor_window.zoom_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "zoom_in.png"),
        updater.zoom_in)
    editor_window.zoom_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "zoom_out.png"),
        updater.zoom_out)
    editor_window.zoom_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "zoom_length.png"),
        updater.zoom_project_length)
    editor_window.zoom_buttons.widget.set_tooltip_text(
        _("Zoom In - Mouse Middle Scroll\n Zoom Out - Mouse Middle Scroll\n Zoom Length - Mouse Middle Click"
          ))
    editor_window.zoom_buttons.no_decorations = no_decorations

    editor_window.edit_buttons = glassbuttons.GlassButtonsGroup(
        32, 23, 2, 5, 5)
    editor_window.edit_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "dissolve.png"),
        tlineaction.add_transition_pressed)
    editor_window.edit_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "cut.png"),
        tlineaction.cut_pressed)
    editor_window.edit_buttons.widget.set_tooltip_text(
        _("Add Rendered Transition - 2 clips selected\nAdd Rendered Fade - 1 clip selected\nCut - X"
          ))
    editor_window.edit_buttons.no_decorations = no_decorations

    editor_window.edit_buttons_3 = glassbuttons.GlassButtonsGroup(
        46, 23, 2, 3, 5)
    editor_window.edit_buttons_3.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "splice_out.png"),
        tlineaction.splice_out_button_pressed)
    editor_window.edit_buttons_3.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "ripple_delete.png"),
        tlineaction.ripple_delete_button_pressed)
    editor_window.edit_buttons_3.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "lift.png"),
        tlineaction.lift_button_pressed)
    editor_window.edit_buttons_3.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "delete_range.png"),
        tlineaction.delete_range_button_pressed)
    editor_window.edit_buttons_3.widget.set_tooltip_text(
        _("Splice Out - Delete\nRipple Delete\nLift\nDelete Range"))
    editor_window.edit_buttons_3.no_decorations = no_decorations

    editor_window.edit_buttons_2 = glassbuttons.GlassButtonsGroup(
        44, 23, 2, 3, 5)
    editor_window.edit_buttons_2.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "resync.png"),
        tlineaction.resync_button_pressed)
    editor_window.edit_buttons_2.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "split_audio.png"),
        tlineaction.split_audio_button_pressed)
    editor_window.edit_buttons_2.widget.set_tooltip_text(
        _("Resync Selected\nSplit Audio"))
    editor_window.edit_buttons_2.no_decorations = no_decorations

    editor_window.monitor_insert_buttons = glassbuttons.GlassButtonsGroup(
        44, 23, 2, 3, 5)
    editor_window.monitor_insert_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "overwrite_range.png"),
        tlineaction.range_overwrite_pressed)
    editor_window.monitor_insert_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "overwrite_clip.png"),
        tlineaction.three_point_overwrite_pressed)
    editor_window.monitor_insert_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "insert_clip.png"),
        tlineaction.insert_button_pressed)
    editor_window.monitor_insert_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "append_clip.png"),
        tlineaction.append_button_pressed)
    editor_window.monitor_insert_buttons.widget.set_tooltip_text(
        _("Overwrite Range\nOverwrite Clip - T\nInsert Clip - Y\nAppend Clip - U"
          ))
    editor_window.monitor_insert_buttons.no_decorations = no_decorations

    editor_window.undo_redo = glassbuttons.GlassButtonsGroup(28, 23, 2, 2, 7)
    editor_window.undo_redo.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "undo.png"),
        undo.do_undo_and_repaint)
    editor_window.undo_redo.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "redo.png"),
        undo.do_redo_and_repaint)
    editor_window.undo_redo.widget.set_tooltip_text(
        _("Undo - Ctrl + Z\nRedo - Ctrl + Y"))
    editor_window.undo_redo.no_decorations = no_decorations

    editor_window.tools_buttons = glassbuttons.GlassButtonsGroup(
        30, 23, 2, 14, 7)
    editor_window.tools_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "open_mixer.png"),
        audiomonitoring.show_audio_monitor)
    editor_window.tools_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "open_titler.png"),
        titler.show_titler)
    editor_window.tools_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "open_gmic.png"),
        gmic.launch_gmic)
    editor_window.tools_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "open_natron.png"),
        toolnatron.launch_natron_animations_tool)
    editor_window.tools_buttons.add_button(
        cairo.ImageSurface.create_from_png(IMG_PATH + "open_renderqueue.png"),
        lambda: batchrendering.launch_batch_rendering())
    editor_window.tools_buttons.widget.set_tooltip_text(
        _("Audio Mixer\nTitler\nG'Mic Effects\nNatron Animations\nBatch Render Queue"
          ))
    editor_window.tools_buttons.no_decorations = True

    if editorstate.audio_monitoring_available == False:
        editor_window.tools_buttons.sensitive[0] = False
        editor_window.tools_buttons.widget.set_tooltip_text(
            _("Audio Mixer(not available)\nTitler"))
示例#2
0
def _create_buttons(editor_window):
    # Aug-2019 - SvdB - BB
    prefs = editorpersistance.prefs
    size_adj = 1
    if prefs.double_track_hights:
        size_adj = 2

    editor_window.big_TC = Gtk.Stack()
    tc_disp = guicomponents.BigTCDisplay()
    tc_entry = guicomponents.BigTCEntry()
    tc_disp.widget.show()
    tc_entry.widget.show()
    editor_window.big_TC.add_named(tc_disp.widget, "BigTCDisplay")
    editor_window.big_TC.add_named(tc_entry.widget, "BigTCEntry")
    editor_window.big_TC.set_visible_child_name("BigTCDisplay")
    gui.big_tc = editor_window.big_TC

    surface = guiutils.get_cairo_image("workflow")
    editor_window.worflow_launch = guicomponents.PressLaunch(
        workflow.workflow_menu_launched,
        surface,
        w=22 * size_adj,
        h=22 * size_adj)

    editor_window.tool_selector = guicomponents.ToolSelector(
        editor_window.mode_selector_pressed, m_pixbufs, 40 * size_adj,
        22 * size_adj)

    if editorpersistance.prefs.buttons_style == 2:  # NO_DECORATIONS
        no_decorations = True
    else:
        no_decorations = False

    # Colorized icons
    if prefs.colorized_icons is True:
        icon_color = "_color"
    else:
        icon_color = ""
    # End of Colorized icons

    editor_window.zoom_buttons = glassbuttons.GlassButtonsGroup(
        38 * size_adj, 23 * size_adj, 2 * size_adj, 8 * size_adj, 5 * size_adj)
    editor_window.zoom_buttons.add_button(
        guiutils.get_cairo_image("zoom_in" + icon_color), updater.zoom_in)
    editor_window.zoom_buttons.add_button(
        guiutils.get_cairo_image("zoom_out" + icon_color), updater.zoom_out)
    editor_window.zoom_buttons.add_button(
        guiutils.get_cairo_image("zoom_length" + icon_color),
        updater.zoom_project_length)
    tooltips = [
        _("Zoom In - Mouse Middle Scroll"),
        _("Zoom Out - Mouse Middle Scroll"),
        _("Zoom Length - Mouse Middle Click")
    ]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.zoom_buttons,
                                                tooltips)
    editor_window.zoom_buttons.no_decorations = no_decorations

    editor_window.edit_buttons = glassbuttons.GlassButtonsGroup(
        32 * size_adj, 23 * size_adj, 2 * size_adj, 5 * size_adj, 5 * size_adj)
    editor_window.edit_buttons.add_button(
        guiutils.get_cairo_image("dissolve" + icon_color),
        tlineaction.add_transition_pressed)
    editor_window.edit_buttons.add_button(
        guiutils.get_cairo_image("cut" + icon_color), tlineaction.cut_pressed)
    tooltips = [
        _("Add Rendered Transition - 2 clips selected\nAdd Rendered Fade - 1 clip selected"
          ),
        _("Cut Active Tracks - X\nCut All Tracks - Shift + X")
    ]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.edit_buttons,
                                                tooltips)
    editor_window.edit_buttons.no_decorations = no_decorations

    editor_window.edit_buttons_3 = glassbuttons.GlassButtonsGroup(
        46 * size_adj, 23 * size_adj, 2 * size_adj, 3 * size_adj, 5 * size_adj)
    editor_window.edit_buttons_3.add_button(
        guiutils.get_cairo_image("splice_out" + icon_color),
        tlineaction.splice_out_button_pressed)
    editor_window.edit_buttons_3.add_button(
        guiutils.get_cairo_image("lift" + icon_color),
        tlineaction.lift_button_pressed)
    editor_window.edit_buttons_3.add_button(
        guiutils.get_cairo_image("ripple_delete" + icon_color),
        tlineaction.ripple_delete_button_pressed)
    editor_window.edit_buttons_3.add_button(
        guiutils.get_cairo_image("delete_range" + icon_color),
        tlineaction.delete_range_button_pressed)
    tooltips = [
        _("Splice Out - Delete"),
        _("Lift - Control + Delete"),
        _("Ripple Delete"),
        _("Range Delete")
    ]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.edit_buttons_3,
                                                tooltips)
    editor_window.edit_buttons_3.no_decorations = no_decorations

    editor_window.edit_buttons_2 = glassbuttons.GlassButtonsGroup(
        44 * size_adj, 23 * size_adj, 2 * size_adj, 3 * size_adj, 5 * size_adj)
    editor_window.edit_buttons_2.add_button(
        guiutils.get_cairo_image("resync" + icon_color),
        tlineaction.resync_button_pressed)
    editor_window.edit_buttons_2.add_button(
        guiutils.get_cairo_image("split_audio" + icon_color),
        tlineaction.split_audio_button_pressed)
    tooltips = [_("Resync Selected"), _("Split Audio")]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.edit_buttons_2,
                                                tooltips)
    editor_window.edit_buttons_2.no_decorations = no_decorations

    editor_window.monitor_insert_buttons = glassbuttons.GlassButtonsGroup(
        44 * size_adj, 23 * size_adj, 2 * size_adj, 3 * size_adj, 5 * size_adj)
    editor_window.monitor_insert_buttons.add_button(
        guiutils.get_cairo_image("overwrite_range" + icon_color),
        tlineaction.range_overwrite_pressed)
    editor_window.monitor_insert_buttons.add_button(
        guiutils.get_cairo_image("overwrite_clip" + icon_color),
        tlineaction.three_point_overwrite_pressed)
    editor_window.monitor_insert_buttons.add_button(
        guiutils.get_cairo_image("insert_clip" + icon_color),
        tlineaction.insert_button_pressed)
    editor_window.monitor_insert_buttons.add_button(
        guiutils.get_cairo_image("append_clip" + icon_color),
        tlineaction.append_button_pressed)
    tooltips = [
        _("Overwrite Range"),
        _("Overwrite Clip - T"),
        _("Insert Clip - Y"),
        _("Append Clip - U")
    ]
    tooltip_runner = glassbuttons.TooltipRunner(
        editor_window.monitor_insert_buttons, tooltips)
    editor_window.monitor_insert_buttons.no_decorations = no_decorations

    editor_window.undo_redo = glassbuttons.GlassButtonsGroup(
        28 * size_adj, 23 * size_adj, 2 * size_adj, 2 * size_adj, 7 * size_adj)
    editor_window.undo_redo.add_button(
        guiutils.get_cairo_image("undo" + icon_color),
        undo.do_undo_and_repaint)
    editor_window.undo_redo.add_button(
        guiutils.get_cairo_image("redo" + icon_color),
        undo.do_redo_and_repaint)
    tooltips = [_("Undo - Ctrl + Z"), _("Redo - Ctrl + Y")]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.undo_redo,
                                                tooltips)
    editor_window.undo_redo.no_decorations = no_decorations

    editor_window.tools_buttons = glassbuttons.GlassButtonsGroup(
        30 * size_adj, 23 * size_adj, 2 * size_adj, 14 * size_adj,
        7 * size_adj)
    editor_window.tools_buttons.add_button(
        guiutils.get_cairo_image("open_mixer" + icon_color),
        audiomonitoring.show_audio_monitor)
    editor_window.tools_buttons.add_button(
        guiutils.get_cairo_image("open_titler" + icon_color),
        titler.show_titler)
    editor_window.tools_buttons.add_button(
        guiutils.get_cairo_image("open_gmic" + icon_color), gmic.launch_gmic)
    editor_window.tools_buttons.add_button(
        guiutils.get_cairo_image("open_renderqueue" + icon_color),
        lambda: batchrendering.launch_batch_rendering())
    tooltips = [
        _("Audio Mixer"),
        _("Titler"),
        _("G'Mic Effects"),
        _("Batch Render Queue")
    ]
    tooltip_runner = glassbuttons.TooltipRunner(editor_window.tools_buttons,
                                                tooltips)
    editor_window.tools_buttons.no_decorations = True

    if editorstate.audio_monitoring_available == False:
        editor_window.tools_buttons.sensitive[0] = False
        editor_window.tools_buttons.widget.set_tooltip_text(
            _("Audio Mixer(not available)\nTitler"))