From 1e5112442572c2bf8102737e809aeacb28937773 Mon Sep 17 00:00:00 2001 From: Jared Wahlstrand Date: Thu, 23 Nov 2023 10:14:39 -0500 Subject: [PATCH] tweak examples --- README.md | 4 ++++ examples/README.md | 4 ++-- examples/canvas.jl | 2 +- examples/canvas_cairomakie.jl | 2 +- examples/columnview.jl | 2 +- examples/filteredlistview.jl | 2 +- examples/listbox.jl | 2 +- src/Gtk4.jl | 2 +- src/basic_exports.jl | 1 + 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ea50bd4c..7c3b1ae1 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ For auto-generated code, Gtk4.jl relies on GObject introspection data generated Note that this package uses binaries for the GTK library and its dependencies that are built and packaged using [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl). On Linux it does **not** use the binaries that are packaged with your distribution. The build scripts for the binaries used by Gtk4.jl, including the library versions currently being used, can be found by perusing [Yggdrasil.jl](https://github.com/JuliaPackaging/Yggdrasil.jl). +### Known incompatibilities + +Gtk4.jl interferes with some other packages, including [PyPlot.jl](https://github.com/JuliaPy/PyPlot.jl) and [GLMakie.jl](https://github.com/MakieOrg/Makie.jl). To use Gtk4 based packages with Makie, you can use [Gtk4Makie.jl](https://github.com/JuliaGtk/Gtk4Makie.jl). + ## Enabling GTK4's EGL backend (Linux) On Wayland, a Cairo-based fallback backend will be used unless you tell `libglvnd_jll` where to find libEGL. This can be done by setting the environment variable __EGL_VENDOR_LIBRARY_DIRS. See [here](https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/master/src/EGL/icd_enumeration.md) for details. diff --git a/examples/README.md b/examples/README.md index 73ce3089..402c561f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,8 +6,8 @@ - `dialogs.jl` demonstrates various types of dialogs. ## Drawing -- `canvas.jl` demonstrates use of `GtkCanvas`, which allows drawing with Cairo. Also shows how to change the cursor when it's over a certain widget. -- `canvas_cairomakie.jl` shows how to draw a CairoMakie plot into a `GtkCanvas`. +- `canvas.jl` demonstrates use of `GtkCanvas`, which allows drawing with [Cairo](https://github.com/JuliaGraphics/Cairo.jl). Also shows how to change the cursor when it's over a certain widget. +- `canvas_cairomakie.jl` shows how to draw a [CairoMakie](https://github.com/MakieOrg/Makie.jl) plot into a `GtkCanvas`. - `glarea.jl` shows how to use the `GtkGLArea` widget to draw using OpenGL. ## Lists diff --git a/examples/canvas.jl b/examples/canvas.jl index df7bcb10..de5861c1 100644 --- a/examples/canvas.jl +++ b/examples/canvas.jl @@ -26,7 +26,7 @@ end cursor(c, "crosshair") # add the canvas to a window -win = GtkWindow("Canvas") +win = GtkWindow("Canvas", 300, 300) win[] = c # add an event controller to handle mouse clicks diff --git a/examples/canvas_cairomakie.jl b/examples/canvas_cairomakie.jl index 18ee4e52..1f7a7e23 100644 --- a/examples/canvas_cairomakie.jl +++ b/examples/canvas_cairomakie.jl @@ -7,7 +7,7 @@ t_range = 0.0:0.1:10.0 x = rand(length(t_range)) arr() = sin.(t_range) .* Gtk4.value(s) .+ x -canvas = GtkCanvas(; vexpand=true, hexpand=true) +canvas = GtkCanvas(400, 200; vexpand=true, hexpand=true) b = push!(GtkBox(:v),canvas) w = GtkWindow(b,"CairoMakie example") s = GtkScale(:h,-5:5; draw_value = true) diff --git a/examples/columnview.jl b/examples/columnview.jl index 68c2fb1d..f2c14111 100644 --- a/examples/columnview.jl +++ b/examples/columnview.jl @@ -83,7 +83,7 @@ end list = GtkColumnView(GtkSelectionModel(GtkSingleSelection(GListModel(filteredModel))); vexpand=true) factory1 = GtkSignalListItemFactory(setup_cb, bind_cb) -col1 = GtkColumnViewColumn("name", factory1) +col1 = GtkColumnViewColumn("name", factory1; expand=true) push!(list, col1) factory2 = GtkSignalListItemFactory(setup_cb, bind2_cb) diff --git a/examples/filteredlistview.jl b/examples/filteredlistview.jl index a753b926..6acdcb5d 100644 --- a/examples/filteredlistview.jl +++ b/examples/filteredlistview.jl @@ -1,6 +1,6 @@ using Gtk4 -win = GtkWindow("Listview demo with filter") +win = GtkWindow("Listview demo with filter", 300, 800) box = GtkBox(:v) entry = GtkSearchEntry() sw = GtkScrolledWindow() diff --git a/examples/listbox.jl b/examples/listbox.jl index 683cb011..008d9f9f 100644 --- a/examples/listbox.jl +++ b/examples/listbox.jl @@ -1,6 +1,6 @@ using Gtk4 -win = GtkWindow("ListBox demo with filter") +win = GtkWindow("ListBox demo with filter", 300, 800) box = GtkBox(:v) entry = GtkSearchEntry() sw = GtkScrolledWindow() diff --git a/src/Gtk4.jl b/src/Gtk4.jl index 6dd8316a..eba173fb 100644 --- a/src/Gtk4.jl +++ b/src/Gtk4.jl @@ -66,7 +66,7 @@ end import .GLib: set_gtk_property!, get_gtk_property, run, signal_handler_is_connected, signalnames, - GListModel + GListModel, start_main_loop, stop_main_loop # define accessor methods in Gtk4 diff --git a/src/basic_exports.jl b/src/basic_exports.jl index d14e423d..9933e863 100644 --- a/src/basic_exports.jl +++ b/src/basic_exports.jl @@ -31,6 +31,7 @@ export signal_connect, signal_handler_disconnect, signal_handler_block, signal_handler_unblock, signal_handler_is_connected, signal_emit, g_timeout_add, g_idle_add export @guarded, @idle_add +export start_main_loop, stop_main_loop # Gtk-specific event handling export signal_emit,