juliagtk / gtkutilities.jl Goto Github PK
View Code? Open in Web Editor NEWInteractive utilities for the Gtk toolkit (Julia)
License: Other
Interactive utilities for the Gtk toolkit (Julia)
License: Other
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
Hi,
At the moment I am using Gtk to build a gui, and would like to add GtkUtilities for its added interactivity functions. I'm running into issues whenever I try to incorporate anything from GtkUtilities, however.
A very simple draw function (like below) works fine.
using Gtk.ShortNames, Images, GtkUtilities
filepath = "image.tiff"
win = Window("image")
c = Canvas()
push!(win, c)
A = Images.load(filepath)
@guarded draw(c) do widget
copy!(widget, A)
end
showall(win)
Adding, for example, guidata[c, :xview]
into the draw function in any form, crashes julia. E.g.:
@guarded draw(c) do widget
xview, yview = guidata[widget, :xview], guidata[widget, :yview]
println(xview, yview)
copy!(widget, A)
end
breaks the code.
Since guidata
is critical for panzoom and other operations, I'm not able to use GtkUtilities the way I would like/it was meant to be used.
Is there something I'm obviously doing wrong here? I've tried following the julia_gui example as well as @timholy's youtube tutorial from a couple of years back about how to use panzoom, and haven't been able to improve my results.
I actually thought Immerse did not support pan/zoom until I saw Tim's YouTube video.
The problem is that GtkUtilities.jl is not properly masking for modifier keys that are considered "significant".
I had to replace:
keymatch(event, keydesc) = event.keyval == keydesc[1] && event.state == UInt32(keydesc[2])
With the following:
function gtk_accelerator_get_default_mod_mask()
ccall((:gtk_accelerator_get_default_mod_mask,Gtk.libgtk),Cint,())
end
keymatch(event, keydesc) = event.keyval == keydesc[1] &&
(event.state>k_accelerator_get_default_mod_mask()) == UInt32(keydesc[2])
Now, I can zoom even if my NumLock key is on... but similar masking would also be necessary on the mouse operations.
Comments
accelerator_get_default_mod_mask()
should be in Gtk.jl - and someone that better understands the Gtk.jl naming convention should probably be adding it.gtk_accelerator_set_default_mod_mask()
is only supposed to be set at "application startup" - which I believe means it could potentially be stored as a const
while "loading" Gtk.jl (Not sure how this would work out, though).I've just realized that you've created a new release in February and changed the Project.toml afterwards to support v0.22 of Images.jl but haven't released a version since then.
Do you mind to release v1.0.4 for this? ๐
I am using Gtk.Shortnames and GtkUtilties in my gui, and this very simple example code doesn't work:
using Gtk.ShortNames, Images, TestImages, GtkUtilities
A = testimage("lighthouse")
win = Window("image")
c = Canvas()
g = Grid(visible = true)
g[1,1] = c
push!(win, g)
@guarded draw(c) do widget
copy!(widget, A)
end
showall(win)
This returns a blank window. If instead I remove mention of the grid and simply copy!
to the canvas, then this returns what I expect (but doesn't allow me to populate a grid with various items). Is the problem with placing the image in the grid in the first place? Is there a way to do this successfully while still being able to use GtkUtilities's canvas-specific functions?
If i understand the setting in the demo correctly, this should enable
But somehow i miss panning with mouse (pointer)?
Moving this over from timholy/ProfileView.jl#43:
julia> FATAL ERROR: Gtk state corrupted by error thrown in a callback:
ERROR: Direction 3 not recognized
in scrollpm at /Users/kfischer/.julia/v0.5/GtkUtilities/src/panzoom.jl:385
in anonymous at /Users/kfischer/.julia/v0.5/GtkUtilities/src/panzoom.jl:354
in mousescroll_cb at /Users/kfischer/.julia/v0.5/Gtk/src/events.jl:193
in anonymous at /Users/kfischer/.julia/v0.5/Gtk/src/events.jl:2
in g_sigatom at /Users/kfischer/.julia/v0.5/Gtk/src/GLib/signals.jl:166
in gtk_main at /Users/kfischer/.julia/v0.5/Gtk/src/events.jl:1
This happens on a macbook with two-finger swipe.
I'm trying to use ProfileView on 0.5:
julia> using ProfileView
INFO: Precompiling module ProfileViewGtk...
ERROR: LoadError: LoadError: syntax: unexpected )
in include_from_node1(::String) at ./loading.jl:426 (repeats 2 times)
in macro expansion; at ./none:2 [inlined]
in anonymous at ./<missing>:?
in eval(::Module, ::Any) at ./boot.jl:234
in process_options(::Base.JLOptions) at ./client.jl:239
in _start() at ./client.jl:318
while loading /home/mauro/.julia/v0.5/GtkUtilities/src/panzoom.jl, in expression starting on line 61
while loading /home/mauro/.julia/v0.5/GtkUtilities/src/GtkUtilities.jl, in expression starting on line 43
ERROR: LoadError: Failed to precompile GtkUtilities to /home/mauro/.julia/lib/v0.5/GtkUtilities.ji
in compilecache(::String) at ./loading.jl:505
I'll try and fix it...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.