From 88962f10a5661f0de646ecbc7ccc53ae92b33f43 Mon Sep 17 00:00:00 2001 From: Jared Wahlstrand Date: Mon, 29 Apr 2024 07:22:18 -0400 Subject: [PATCH] add save to file and copy to clipboard to context menu (#303) --- .github/workflows/CI.yml | 10 +++++----- Project.toml | 4 ++-- README.md | 2 +- src/ImageView.jl | 30 ++++++++++++++++++++++++++---- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f009f8f..2f9326a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - version: ['1.6', '1', 'nightly'] + version: ['1.6', '1'] arch: [x64, x86] include: - os: ubuntu-latest @@ -23,7 +23,7 @@ jobs: arch: x86 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} @@ -37,11 +37,11 @@ jobs: ${{ runner.os }}-test-${{ env.cache-name }}- ${{ runner.os }}-test- ${{ runner.os }}- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-runtest@latest with: prefix: ${{ matrix.prefix }} - - uses: julia-actions/julia-processcoverage@v1 + - uses: julia-actions/julia-processcoverage@latest - uses: codecov/codecov-action@v3 with: file: lcov.info diff --git a/Project.toml b/Project.toml index 595343b..5266e89 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ImageView" uuid = "86fae568-95e7-573e-a6b2-d8a6b900c9ef" author = ["Tim Holy + + + + Contrast... + canvas.contrast_gui + + + Save to file... + canvas.save + + + Copy to clipboard + canvas.copy + + + +""" + function create_contrast_popup(canvas, enabled, hists, clim) - popupmenu = GtkPopover() + b = GtkBuilder(menuxml, -1) + menumodel = b["context_menu"]::Gtk4.GLib.GMenuLeaf + popupmenu = GtkPopoverMenu(menumodel) Gtk4.parent(popupmenu, widget(canvas)) - contrast = GtkButton("Contrast...") - popupmenu[] = contrast push!(canvas.preserved, on(canvas.mouse.buttonpress) do btn if btn.button == 3 && btn.clicktype == BUTTON_PRESS x,y = GtkObservables.convertunits(DeviceUnit, canvas, btn.position.x, btn.position.y) @@ -708,7 +728,9 @@ function create_contrast_popup(canvas, enabled, hists, clim) popup(popupmenu) end end) - signal_connect(contrast, :clicked) do widget + contrast_gui_action = Gtk4.GLib.GSimpleAction("contrast_gui", Nothing) + push!(Gtk4.GLib.GActionMap(canvas.action_group), Gtk4.GLib.GAction(contrast_gui_action)) # replaces the old one if it exists + signal_connect(contrast_gui_action, :activate) do a, par enabled[] = true @idle_add contrast_gui(enabled, hists, clim) end