hazzy - Another touchscreen GUI

20 Aug 2017 17:23 #97790 by sqmathlete
Good question, I have been asking myself that a lot lately. If you can get past the set-up ( see the ethercat-hal driver thread), ethercat allows the use of CANopen protocol which means you can use pretty much any servo amp, simplified wiring, and all of the complicated motion and homing is handled by the servo amp not LinuxCNC. Plus the cycle time is incredibly fast. There are those that know way more about it than me over on the other thread that could explain it better.

As for the tool changer, wish I had a duplomatic, much simpler. Mine is hydraulic that requires a lot of ladder logic...

02 Oct 2017 16:12 #99771 by Roguish
Is this still in development? looked good.
02 Oct 2017 18:55 #99778 by kcj
Replied by kcj on topic hazzy - Another touchscreen GUI
Yes and no.

Out with the old
When I originally wrote the GUI I intended it for my own personal use, on a specific machine, with a specific screen, so there were a lot of things that were hard coded that really should never have been. A lot of this I could have fixed, but it would have required essentially a complete rewrite, and making the screen and background graphics scale-able, while still looking decent, seemed like it was going to be a real challenge. And after all that work, it would basically be the same thing, not very customizable, using a dated toolkit etc. It short, it seemed like a very short sighted approach.

In with the new
So, what I decided do to was start completely from scratch, using the GTK+ 3 toolkit (which has native touchscreen support!), and try to make a highly customizable "widget" based interface that can be rearranged on the fly via Drag and Drop. It is almost like integrating the Glade editor into the interface itself. The idea is to build up a "library" of widgets, where each widget serves a singe distinct purpose. So instead of having "hazzy-mill", "hazzy-plasma", "hazzy-waterjet" you simply drag 'n drop the widgets you need, and if the widget you need has not been made yet, it is very simple to make a custom one.

Currently the following widgets are more or less working:
  • Dro
  • Basic Controls (Power ON, ESTOP, ENABLE, state indicators)
  • File Chooser/Manager
  • Terminal Emulator
  • Camera Viewer
  • Gcode Editor
  • Tool Table Editor

Still a long way to go, but I hope to have something usable in the next week or so.

Here is a short video to give you a little better of an idea:

Let me know what you all think about this. I am always open to constructive criticism!


P.S. I apologize for being so remiss in keeping this thread updated :dry:
02 Oct 2017 20:13 #99780 by Roguish
thanks for the status.
i could debug a bit if you need.
The following user(s) said Thank You: kcj
02 Oct 2017 20:16 - 02 Oct 2017 20:19 #99781 by kcj
Replied by kcj on topic hazzy - Another touchscreen GUI
That would be great! I will let you know when it is stable enough.

I forgot to mention that the current dev branch is GTK3, if anybody wants to take a look.
Last edit: 02 Oct 2017 20:19 by kcj. Reason: add link
24 Oct 2017 22:35 #100760 by sqmathlete
Quick question. Is this new version going to work with a lathe as well? Lazzy perhaps?

Nice Work!

25 Oct 2017 03:05 #100777 by cmorley
There is a branch of linuxcnc that has gtk3 widgets.
I was converting gladeVCP from gtk2 to gtk3 untill I couldn't find a substitute for gremlin.

or you could work on qtvcp with me :)

Chris M
25 Oct 2017 04:39 #100780 by kcj
Replied by kcj on topic hazzy - Another touchscreen GUI
Dan, I am certainly planning for Hazzy to support lathes, and in fact the rewrite was stimulated by massimodamassa's request for a lathe mode in the original version. He has had a long wait, but hopefully some day his wish will be fulfilled :)

Chris, Gremlin has been a big hold up for me as well. I made a few not very determined attempts to port it to GTK3. TurBoss attempted starting from scratch using VTK and made a good bit of progress for but got discouraged. He then spent a little while trying to port Gremlin, he got a lot farther than I did but not far enough.

As I recall Rene Hopf said he would be willing to port Gremlin if somebody could provide a minimal GTK3 based interface that used it. It does not look like it will be all that difficult, I think mostly switching to the GtkGLArea and changing over to the new API, which is very similar to the old one. I keep meaning to contact him and see if he is still up for that. It would be straight forward for me to make minimal GTK3 interface for testing, or maybe just use Hazzy which already has a loadable (but non functional, of course) Gremlin widget.

I have a bit of experience porting GTK2 to GTK3, and I would be glad to help with the `gladevcp_gtk3` branch. What is left besides Gremlin? I know Glade has changed, so how do the GTK3 widgets work, is the usage more or less the same as before? I am not a big fan of glade, but I like GTK, so I dream of making our very own screen designer. Hazzy might be a start, it saves the layout to GtkBuilder-ish XML that is then parsed and used to recreate the layout on start up.

OK, bed time here!

25 Oct 2017 08:57 #100783 by cmorley
Well Gscreen which uses gladeVCP is exactly (well I think) what you are trying to build.
Building more widgets that contain pre-made chunks would get it closer to what you are thinking ( at least i think).

If gladevcp gets converted to GTK3 then I will convert Gscreen to GTK3.
But the fact is it's the GLADE editor thats the maintenance problem, GTK2 widgets will be around for quite awhile yet.

Gremlin is the big stumbling block for GTK3 conversion. there was some issue with embedding and I hadn't actually converted to the newest GLADE version.

QTvcp was built because i could get around the gremlin issue by embedding gremlin into QT (can't do that with GTK2 and GTK3) I'm stuck with pyQT4 as pyQT5 is just about as broken as GLADE/GTK3.

I feel rather then building yet another Screen infrastructure using the same widget kit, I think it would be far more constructive to further develop gscreen/gladeVCP. The gremlin widget is the big stumbling block. It could be built with GTK3 or QT in python or c or c++

I have qtvcp moving along nicely, it mostly just need more widgets built. QT's designer program is better then GTK's GLADE program. QT seems much more stable an API then GTK has been. Also i have learned a lot developing GLadeVCP and I'm trying incorporate the best practices.

If you could get a GTK3 preview graphics built that would be great!

Chris M
25 Oct 2017 16:28 #100800 by kcj
Replied by kcj on topic hazzy - Another touchscreen GUI
I really appreciate the work that has gone into Gscreen (and its derivatives like Gmoccapy), but my feeling is that it is more of a set of building blocks that a developer can use to build a new screen, rather than a complete interface that can be quickly and easily customized and configured by the typical LinuxCNC user.

I have spent a good bit of time building custom interfaces with gladeVCP, and the problem is it is not low level enough for developers, and it is not high level enough for users. For developers gladeVCP is a pain because you are stuck using a specific version of Glade, there is no way to import the widgets directly (that I know of), and the widgets are not very customizable. For users it is not ideal because they have to fiddle with installing the right version of Glade, getting it to find the gladeVCP widgets, and in the end they essentially have to become developers since you can't do much with gladeVCP without writing code.

What I am trying to do with Hazzy is overcome both of these shortcomings. My goal is to make it very easy for somebody with no programing experience to create a custom screen layout by Drag 'n Drop, and be able to do so on the fly, while LinuxCNC is running, and with out the need for any third party software. At the same time I am working on a library of GTK widgets which will make it easy for a developer or anybody with basic python knowledge to make a new or custom Hazzy widget (with out having to use Glade!!!)

For example, to make a basic XYZ DRO widget you would create an `example_dro.py` file containing
#!/usr/bin/env python

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

from widget_factory.dros import DroEntry, DroType

class ExampleDro(Gtk.Box):
    def __init__(self, widget_window):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        for axis in 'xyz':
            dro = DroEntry(axis, DroType.REL)
            self.pack_start(dro, False, False, 2)

Then put this in a folder with the following `__init__.py` file
from example_dro import ExampleDro as Widget

That's it. If the folder is placed in the machine config dir or one of the standard Hazzy widget dirs our ExampleDro widget will show up in the Hazzy widget chooser ready for use.

This is what it looks like:

Sorry Chris, I got on a roll :)
Time to create page: 0.104 seconds
Powered by Kunena Forum