How hard is it to build a completely new standalone GUI?

More
27 Jan 2019 11:37 #124956 by rodw
There might be other examples but I would recommend that you install the Gmoccappy plasma siim and review the plasma.py and plasma.glade files that make it all work... For simple edits, I played with the glade xml in a text editor but when I added more features to the GUI, i used the GLade ediitor.

Please Log in or Create an account to join the conversation.

More
27 Jan 2019 15:56 - 27 Jan 2019 15:57 #124976 by KevKim
tnx, all gmoccapy sims are already installed and there are simply too many, and most of them have very long codes, another confusion.

BTW, I guess I am getting into the secrets a little bit further.

I am trying to understand hal file and their signal flow,
so I made a draft ui which independently work without axis.gui.
It launched with no error.
I am tyring to turn on and off just one led by clicking the button.

I launched halmeter together, which seems helpful to monitor what is not working.
As you can see, when my_gui.hal_power shows <true>, led doesn't work.



I added just one line in postgui.hal as follows;

net my_gui.hal_led_power <= my_gui.hal_power

And in glade editor, this LED's signal handler is set to "on_hal_led_power_pin_changed"

As the result showed already, I did something wrong and I wish to know which one was wrong.
Probably not just one, and not even correct syntax.

Anyone to save me please?

Kevin
Attachments:
Last edit: 27 Jan 2019 15:57 by KevKim.

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 01:48 #124999 by cmorley
It would be easier to help you if you included the relevant files.

Net works like this:
connect: this signal between , this driver pin, and this/these driven pins

or:
connect: This signal, to this pin

It will also make the signal if it is not already present.
(The driver and driven pins can be in a different order)

so:
net my_gui.hal_led_power <= my_gui.hal_power

made a signal named: my_gui.hal_led_power and connected it to my_gui.hal_power

try this:
net power-signal my_gui.hal_led_power my_gui.hal_power

I like your button images by the way.
Chris M

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 02:20 #125002 by KevKim
Hello Chris,

Thanks for your response.
It didn't work either.
This should be a very simple issue which is hard enough for a noob like me to sort out.

Attached all files with all images + extra images which are in sub-folder, I don't need to sort them out lol
.ini file is from another sample configuration and modified a little bit.
postgui.hal also from gmoccapy folder, trying this and that...

And you will need my modified led.py to be copied to pyshared/gladevcp to show my led design properly. It actually contains 2 more blocks for horizontal/vertical slim leds, allocated to 3 & 4.as belows;
(I wanna know how to set system path variable not to copy this modified led.py into a system folder. A'way, it is easy to replace it back to original)

tnx again,
Kevin
ps. images are all preliminary atm, I am not good at 2d software, so designed in solidworks with hardware realview --> screen captured --> cut/resized to png file in inkscape
==================
# horizontal led
elif self.led_shape == 3:
self.set_size_request(self._dia*5+5, self._dia+5)
w = self.allocation.width
h = self.allocation.height
cr.translate(w/2, h/2)
cr.rectangle(-self._dia*5/2, -self._dia/2, self._dia*5, self._dia)
cr.stroke_preserve()
cr.set_source_rgba(color.red/65535., color.green/65535., color.blue/65535., alpha)
#cr.fill()
cr.fill_preserve()

# now make it shiny
if self.led_shiny:
#cr.rectangle(0, 0, w, h)
lg = cairo.LinearGradient(0, -self._dia, 0, self._dia)
lg.add_color_stop_rgba(0, color.red/65535., color.green/65535., color.blue/65535., alpha)
lg.add_color_stop_rgba(.4, 1, 1, 1, .75)
lg.add_color_stop_rgba(.6, color.red/65535., color.green/65535., color.blue/65535., alpha)
lg.add_color_stop_rgba(1, .6, .6, .6, .5)
cr.set_source(lg)
cr.fill()

# vertical led
elif self.led_shape == 4:
self.set_size_request(self._dia+5, self._dia*5+5)
w = self.allocation.width
h = self.allocation.height
cr.translate(w/2, h/2)
cr.rectangle(-self._dia/2, -self._dia*5/2, self._dia, self._dia*5)
cr.stroke_preserve()
cr.set_source_rgba(color.red/65535., color.green/65535., color.blue/65535., alpha)
#cr.fill()
cr.fill_preserve()

# now make it shiny
if self.led_shiny:
#cr.rectangle(0, 0, w, h)
lg = cairo.LinearGradient(0, -self._dia, 0, self._dia)
lg.add_color_stop_rgba(0, color.red/65535., color.green/65535., color.blue/65535., alpha)
lg.add_color_stop_rgba(.3, 1, 1, 1, .75)
lg.add_color_stop_rgba(.7, color.red/65535., color.green/65535., color.blue/65535., alpha)
lg.add_color_stop_rgba(1, .6, .6, .6, .5)
cr.set_source(lg)
cr.fill()
============================
Attachments:

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 02:38 #125003 by cmorley
Have you confirmed that the LED actually works since your modification?

if you load your GUI, try setting the unconnected LED pins manually.
You can do this by opening another terminal setting the environment and use halcmd;

halcmd setp PINNAME 1

Chris M

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 03:01 - 28 Jan 2019 03:01 #125004 by cmorley
I tried your files and when I connected the pins manually it worked so now i wonder if you spelled something wrong or connected the wrong pins?
In a separate terminal I used these commands:

halcmd net w my_gui.hal_led_power
halcmd net w my_gui.hal_power
Last edit: 28 Jan 2019 03:01 by cmorley.

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 03:02 #125006 by cmorley
I also assume you have linuxcnc running when you are testing this?

Chris M

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 03:08 #125008 by KevKim
oh,

that halcmd setp worked, so I assume pin names are correct but connection has problem.
I didn't load axis.gui as my final destination is to make this one as an independent panel like gmoccapy. is that the reason? I see hal-pins are there when I run halmeter, doesn't that mean LCNC internal modules are working?

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 03:11 #125009 by cmorley
I also assume that the postgui HAL did get called - can you check that the pins really are connected?

Finally unrelated to this problem - setting a signal in the GLADE file requires a handler file to be present.

looking in your postgui HAL file line line is wrong:

net led_power my_gui.hal_led_power.hal-pin-changed <= my_gui.hal_power

should be:
net led power my_gui.hal_led_power my_gui.hal_power

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 03:16 #125010 by KevKim
Alright,

Instead of launching LCNC from my own .ini file, I tried sim.axis first and then executed my_gui.py, I got lots of error messages as belows, which didnt show up when I launched my_gui.ini only.
It simply reveals how much I don't understand what is going on inside.
I lack the understanding of basic configuration/relationship between glade-ini-hal-py files.
Many files related each other and I still didn't catchup correct build-up sequence. shame..

====================================
self.builder.add_from_file("my_gui.glade")
./my_gui.py:22: RuntimeWarning: missing handler 'on_hal_led_power_hal_pin_changed'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_hal_togglebutton3_toggled'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_hal_power_toggled'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_hal_togglebutton1_toggled'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_hal_button1_activate'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_vcp_action_run1_notify'
self.builder.connect_signals(self)
./my_gui.py:22: RuntimeWarning: missing handler 'on_vcp_action_run1_activate'
self.builder.connect_signals(self)
Issuing ESTOP RESET
Issuing ON
1 2
Issuing OFF
Issuing ON

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.110 seconds
Powered by Kunena Forum