Native GUI suggestion for Linux

Amazing, I am working on the same stuff. I’ve built a custom guitar with True Temperament neck and hexaphonic pickups. I’ve put there Schaller Hannes bridge with hexaphonic piezo pickup in addition to magnetic pickups. It’s hard to tweak tuning if you have single output pickup for all strings. Are you aware of any methods to separate them from single output?

You can address issue 1. with EverTune bridge - very clever mechanism that compensates pitch change mechanically.

Great resource is page larips.com. I have also some materials that cannot be easily searched in web, this is very niche topic. My idea now is to find new, undiscovered yet tone systems using dissonance curves but it is mathematical optimization problem with crazy number of dimensions.

2 Likes

Sorry to un-derail this otherwise reverberating discussion, but it would be really useful to demonstrate these steps:

but decouple them from a specifically audio source, making it more general. So that the source could be video/image data, as mentioned before by @Zach_Christensen. It might be possible to package it, as some sort of AbstractOnlineControl.jl or just as a blog post. In any case, I too am looking forward to see what you come up with @Tamas_Papp!

1 Like

No, I agree it is important to focus on the original question. Coding up YIN etc took me about an afternoon, but I find the Gtk part very difficult. I hope to have something enough for an MWE at some point soon.

2 Likes

I also used Glade for that, and found it pretty ok. But it seems pretty hefty for a couple of sliders. My dream setup is to actually have something minimal that would work on smaller hardware, like a Raspberry Pi… I’m gonna try TextUserInterfaces.jl…!

An alternative to Glade is to use |>, with a bit of indentation it doesn’t look so bad, e.g. :

main_window |>
    ((mainVbox = GtkBox(:v)) |>
        menubar |>
        (topBarBox = GtkBox(:h) |>
            (sidePanelButton = GtkButton("F1")) |>
                pathCBox   |>
            (editorButton = GtkButton("F2"))
        ) |>
        (global sidePan = GtkPaned(:h)) |>
        statusBar
    )

You can have several blocks like that, for example I have a similar one pushing more stuff into sidePan (if you have too many levels it becomes a bit hard to read and change).

3 Likes

The UI is made using Glade with some small exceptions where I do things in code. There was some learning curve in using Glade but nowadays I find it pretty intuitive. Note that my UI does not consist of monolithic glade file but of several smaller which I bind together in the Julia side.

Plotting is done with Winston. This is so simple. You just create the Gtk canvas and draw into its Cairo surface. If you need an example, I can prepare that.
For the colorized drawing of images I use the Cairo canvas directly. Also works smooth this way.

1 Like

These are orthogonal things. Gtk is for layout and widgets. 2D/3D drawing should be done using an appropriate 2D/3D API, e.g. Cairo or OpenGL. In my case its all 2D and you can draw custom, with Winston, with Gadfly, or with whatever supports Cairo. I once heard that Makie is also supposed to work with Cairo, in that case this would also work.

I know that Simon likes it more to also do the entire widget machinery in OpenGL but my opinion here is that one has a hard time writing an entire UI toolkit from scratch. Gtk is certainly not perfect but it offers a lot. IMHO the API is nicely designed and being a C API makes it easy to use it from Julia. There are some downsides but what is currently lacking most is some manpower on the Julia Gtk package.

To give you an initial feeling how a very simple Gtk app with a slider and a plot looks like, here is an example that I coded up quickly:

using Gtk.ShortNames
using Winston

w = Window("Simple Gtk App",800,600)
vbox = Box(:v)
scale = Scale(false,1:10)
canvas = Canvas()
push!(vbox,scale)
push!(vbox,canvas)
set_gtk_property!(vbox,:expand,canvas,true)
push!(w, vbox)
Gtk.showall(w)

adj = G_.adjustment(scale) # get the adjustment from the slider

signal_connect(adj, "value_changed") do w
    freq = get_gtk_property(adj, :value, Int64)
    p = Winston.plot(sin.(2*pi*range(0,1,length=300).*freq), "b-",linewidth=5)
    Winston.ylabel("u / V")
    Winston.xlabel("t / s")
    display(canvas, p)
end
4 Likes

AFAIK, as far as web-based goes, there is a clear path forward for Makie + UI. With the WebGL backend and the new JSServe it’s already reasonably easy to make a julia web-based (browser or electron) app with interactivity (sliders, dropdowns, checkboxes, file pickers and stuff) and interactive plots. For native apps, on the other hand, without the shortcut of using HTML widgets, it’s definitely not as simple.

Makie uses OpenGL as its default backend, so if you’re point is that the Julia API that binds OpenGL is immature then it basically has the same problem you mentioned with GTK (“currently lacking most is some manpower on the Julia Gtk package”).

These are only orthogonal if you know with absolute certainty that the visual display and user interface are strictly separated. Once the user is actively interacting with and manipulating visuals it may not be a matter of building a layout with buttons.

Thanks for the example. I meant that they are difficult for me personally, because I have little or no experience coding things with event loops and callbacks. All the stuff I do is writing libraries on top of libraries which eventually culminate in a few top level calls at the REPL, so this world is alien to me.

Can you recommend an introductory resource about these things? Does not have to be in Julia.

1 Like

The Python Gtk tutorial is well written The Python GTK+ 3 Tutorial — Python GTK+ 3 Tutorial 3.4 documentation

2 Likes

No that is not my point. The OpenGL bindings are mature as far as I know. The point is that binding Gtk is much less effort than reimplementing a GUI toolkit in Julia. By the way: Gtk.jl state is ok. Its just that it could be even better.

For me these are still orthogonal things. You can of course also manipulate visuals with Gtk/Cairo. Just have a look at applications like Inkscape where this is intensively done. Or in my application shown in the screenshot above you can click into the image an the 4D image is appropriately sliced.
What you can’t do is putting widgets into the graphic context, that is true. This is something which is usually done when developing games or other highly specialized software.

But I actually don’t want to say anything bad about any effort to implement a widget library in Julia. Just go for it, if it matures I would be very happy to test it. The only point I wanted to make is that Gtk+Julia already are a nice thing for implementing small user interfaces for interacting with scientific data and its not so bad relying on a toolkit that most Linux users are using anyway on their desktop.

4 Likes

Good point. I didn’t even think about things like Inkscape.

FWIW, you may also be interested in CImGui.jl + Redux.jl, which is an alternative way to build small GUI tools for developers. You can build tools like the one in the following png as long as you know how OpenGL basically works.

png-ref:

8 Likes

QML.jl does need some work to install currently, unfortunately. Work is underway to make it work with the new JLL system.

5 Likes

One disadvantage of Gtk.jl at the moment is that it is a pain on Windows and officially not recommended. In the REPL on Windows everything becomes very sluggish after using Gtk

This thread ist about Linux and the focus is adressing tamas needs.

Apologies, by the time I read the whole thread I forgotten that he had specified he was using Linux.
I can remove previous comment if that is appropriate.

No worries, I am pretty much settled on Gtk.jl for the moment.