connect signal 'file-loaded' of hal_filechooser

More
16 Jan 2022 13:14 - 16 Jan 2022 13:17 #232012 by HansU
In a VCP I want to connect to the signal 'file-loaded' to get a callback on loading and reloading.

On loading a new file it works fine, that signal is emitted here:
self.emit('file-loaded', file_new)
[github.com/LinuxCNC/linuxcnc/blob/master...hon/hal_glib.py#L468]

But I also want to get a callback when the file is reloaded. I saw that hal_filechooser emits the signal for this case:
if old == filename:
    self.gstat.emit('file-loaded', filename)
[github.com/LinuxCNC/linuxcnc/blob/master..._filechooser.py#L127]
In Gmoccapy which is using hal_filechooser, I can see that this line is executed. But I don't get a callback in this case.
Shouldn't that line emits the signal?
Last edit: 16 Jan 2022 13:17 by HansU.

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

More
16 Jan 2022 21:20 #232065 by cmorley
It's been awhile since working on gladvcp but it has the same problem as any other python program.
The VCP python instance is a different context then Gmoccapy's python instance.
Which means messages from one are not sent to the other.
AFAIK there is no mechanism to exchange info from Gmpccapy internals.

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

More
16 Jan 2022 22:11 #232072 by HansU
I assumed that they are in the same context because:

That leads to another question which is the reason I thought so.

I separated the load() and calculate_gcode_properties() of your qt version of gremlin (qt5_graphics.py) and let me print the min_extents. (By the way: Nice work - thanks for that!)
If I embed that code in a GladeVCP that is integrated in Gmoccapy, I get values for min_extents which considers the machine offsets.
But if I run this standalone while (LinuxCNC is running). I get values independent of the offset. Have you any idea which code line/function is responsible for that?
 

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

More
17 Jan 2022 00:26 #232085 by cmorley
You probably get the filename change in your vcp but not a reload.
Linuxcnc broadcasts the current file name so two python instances can be aware of a program change, but not a reload.

The same problem comes with changing offsets - linuxcnc does not have a message to send that means 'reload your screen'
I would think your standalone vcp would consider the offset - if you reload it manually.

It's a problem we surely could fix by adding a message to linuxcnc proper for this use but doing anything in linuxcnc proper is usually very painful for non expert level devs.

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

More
17 Jan 2022 21:26 - 17 Jan 2022 21:30 #232189 by HansU

You probably get the filename change in your vcp but not a reload.
Linuxcnc broadcasts the current file name so two python instances can be aware of a program change, but not a reload.


Hmm it seems more like a sub-process of the main python process.

The same problem comes with changing offsets - linuxcnc does not have a message to send that means 'reload your screen'
I would think your standalone vcp would consider the offset - if you reload it manually.


While preparing an example, I could answer my question by myself. It was the missing linuxcnc.var file. On early tests I just created a blank one and forgot about that

It's a problem we surely could fix by adding a message to linuxcnc proper for this use but doing anything in linuxcnc proper is usually very painful for non expert level devs.


Hmm that could be difficult. I assume that the interpreter wouldn't even see the reload if the file is not changed.
Attachments:
Last edit: 17 Jan 2022 21:30 by HansU.

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

More
18 Jan 2022 10:10 #232250 by cmorley
python programs get their information from status messages from linuxcnc.
So as long as the information you need is in the status, multiple python instances can stay in sync.
reload of graphics works outside of linuxcnc status so can have these problems.
Error messages is another weak spot of linuxcnc. If any program reads the error status then no other program gets them.

If you put a G10 in your gcode program I'm 90% sure the graphics will not display properly - there will be an offset.

anytime there is a g10 the graphics need to be reloaded. If linuxcnc sent a message out every g10 then this problem would get simpler

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

Moderators: mhaberlerHansU
Time to create page: 0.094 seconds
Powered by Kunena Forum