GUI Modification Plasma

28 Nov 2016 21:05 #83403 by islander261
islander261 created the topic: GUI Modification Plasma

I am trying to modify the Gmoccapy plasma gui to support my custom desires. I have very limited understanding of object oriented programming and Python in particular. I have had some luck with adding a user tab that doesn't actually do anything, I'm stuck on the Python part. I have modified the signals tab ( and signals.hal) to add more leds with mixed success ( still quite shaky on directions for HAL pins). I am also puzzled by the fact that the most reliable modifications are when I change connections in the plasma.hal file and not the signals.hal file.I have modified the plasma tab (, and plasma.hal) with mixed success. I have tried modifying the file but even seemingly minor changes cause it to not work. Is there a special compiler I need to use for this file? The biggest success so far is getting the arc voltage as measured with the THCad card to display as the actual plasma voltage.

I am also trying to find the base Glade files that build the stock Gmoccapy screen so I can follow parts of it as examples but can't find it. I want to have a feed override frame on my main plasma screen and want to use the one from Gmoccapy if I can find it. Where should I look for them?

29 Nov 2016 13:41 #83429 by andypugh
andypugh replied the topic: GUI Modification Plasma
Are you editing the GUI in the Glade editor?

Depending on what you want to do, you may not need any Python.
You should be able to add (for example) a hal-led control to the GUI, and the corresponding HAL pin to drive it will appear with no further intervention once the GUI has loaded.
29 Nov 2016 15:34 #83435 by islander261
islander261 replied the topic: GUI Modification Plasma

Thank you. I have used the Glade editor. I haven't been able to start it from the terminal but right clicking on the file from the file browser and selecting edit with Glade works. I am running LMDE-2 and using lcnc 2.8.0 pre. I down loaded and built Glade 3.5.8 several months ago following instructions I found on the forum.

I have been able to do simple changes to the and plasma.hal files to get simple leds connected to signals and Glade hal-button wiget objects for action. I am still not sure why I get better (higher percentage of working after fewest trys) by using the plasma.hal file for the connect vs using the signals.hal file. I will post all files some time in the next few days when I get a little more done.

29 Nov 2016 15:42 #83437 by andypugh
andypugh replied the topic: GUI Modification Plasma
Does your own-build Glade include the specific LinuxCNC widgets?
29 Nov 2016 20:09 #83449 by islander261
islander261 replied the topic: GUI Modification Plasma

I am not sure if my build of Glade contains the LinuxCNC widgets. I do get the HAL widgets in a pane on the left side and they do work. This could be the reason I can't find the speed control widget. A correction I am actually using Glade 3.8.5 as recommended on in other forum posts

29 Nov 2016 20:39 #83453 by andypugh
andypugh replied the topic: GUI Modification Plasma
If you have the HAL widgets then they should work (for simple things like LEDs)

Is the problem that the GUI elements (and so their HAL pins) do not exist at the time that the HAL files are run?

Do you have a POSTGUI_HALFILE?

Are you editing Gmoccapy or embedding GladeVCP tabs in it?
29 Nov 2016 21:03 #83457 by islander261
islander261 replied the topic: GUI Modification Plasma

Thank you for the pointers.

I am embedding tabs into Gmoccapy as I understand the instructions in the documentation. I started with the plasma version of Gmoccapy and followed what was done there. I have attached screen shots of my present progress. Notes:

1. Statistics tab is just a screen, no underlying HAL or Python code to support it. I have found JT's timer posts and hope to expand on the code in those.
2. The THC Settings tab works partially. The widgets that used the original ( this is simply a copy of code work. All attempts to add support for new functions/widgets have failed.
3. The plasma section in the main screen is now partially broken. The arc voltage fron the THCad does still work but the buttons for controlling the set point don't work. Again all attempts by me to alter the Python file ( have failed.
4. Most LEDs with HAL connections work. Some LEDs and buttons with external I/O with HAL connections work. I know there is hope because I can toggle relays from the GUI and see field signals displayed in some cases.

30 Nov 2016 11:44 #83481 by andypugh
andypugh replied the topic: GUI Modification Plasma
You are embedding tabs so you need to connect the HAL pins associated with the tabs in the EMBED_TAB_COMMAND line if the INI file.
(also applies to Gmoccapy)

It might be better to only have on HAL file, called by the last-loaded tab, which makes all the HAL connections for all the tabs.

What are you trying to alter in the file?
Having two copies of pretty-much the same tab using pretty-much the same code is likely to lead to trouble.
You should probably comment out one or other of the EMBED_TAB sets in the INI to check that they problem isn't that the tabs are interfering with each other.
Or, at the very least, use the -c switch so that the HAL pins created have unique names.
30 Nov 2016 17:14 - 30 Nov 2016 17:16 #83497 by newbynobi
newbynobi replied the topic: GUI Modification Plasma
Hallo John,

If you do not have experiance in python, it will be very complicated to get a good result with try and error method.

You tabd should be emmbedded with commands like:
EMBED_TAB_NAME = tool_replacement_panel
EMBED_TAB_LOCATION = box_tool_and_code_info
EMBED_TAB_COMMAND = gladevcp -x {XID} -u -H signals.hal
EMBED_TAB_NAME = coolant_spindle_panel
EMBED_TAB_LOCATION = box_coolant_and_spindle
EMBED_TAB_COMMAND = gladevcp -x {XID} -u -H plasma.hal

Each tab has its own python file and its own hal and glade file. So if you change anything, you have to do that exactly in the mentioned file.

If you just want to add a LED to the Plasma part, just add a hal LED to the glade file, edditing the python file is not needed!
I use the python part only for the following reasons:
- Change the layout of the widgets according to the user settings. It is just needed to "be more beautifull"
- Save the widget states for some widgets, to be able to restore the values when the tab is reloaded at next start.
- Do special calculations or modifications to fit my special needs
- Make additional hal pin, or modify them, if it is not possible to realize that with normal hal widgets.

IMHO, you mainly do not need the python part! To begin, just change the emmbedded tab command to not use the python file.
And take care, that all hal connections related to the emmbedded tab, are made in the hal file named in the emmbedded tab command. Otherwise a race condition between postgui.hal and the emmbedded hal file may result in wrong connections or even errors.

Please begin with small example, then post your code, so we can take a look at that and advise you to become a expert.
(or we should on you B)

Last Edit: 30 Nov 2016 17:16 by newbynobi.
30 Nov 2016 18:55 #83503 by islander261
islander261 replied the topic: GUI Modification Plasma
Thank for the tips.

I have removed the extra tabs from the GUI for the present work and will add them later. I found a mistake I made in a variable name and now I can update the voltage set point. I also found where code I removed was preventing the persistent label values from being updated on shut down. I have been copying as close as I can the work done by others on the plasma screen because I certainly don't know what is needed to make the GUI and HAL work and what is not. The Python part is becoming a little clearer but is still mostly black magic to me. My .ini file adds the tabs I want exactly as shown in the Gmoccapy plasma example. Ultimately I want control and display of persistent variables in more than one tab from any tab they are visible in, I am sure this is not a trivial matter.

I now think that I have adding LEDs and buttons then linking them through the HAL to hardware mostly under control.

I still can't find the SpeedControl widget when using the Glade editor, is it possible to add it editing the Glade file with a text editor? The best solution is if someone can point me to instructions for adding it. I am using Glade 3.8.5 and think that I have most of the other HAL widgets.

I have had no luck using the gladevcp -c switch in the EMBED_TAB_COMMAND = line in the .ini file. That switch causes my tabs not to load (or at least not show on the GUI) .

Moderators: newbynobi
Time to create page: 0.159 seconds
Powered by Kunena Forum