Receiving GStat messages in GladeVCPs

More
19 Sep 2024 07:49 - 19 Sep 2024 07:51 #310427 by HansU
I want to use some GStat messages in a Glade VCP (in gmoccapy), but it seems that not all messages seem to work there.

If I take the example from linuxcnc.org/docs/2.9/html/gui/gstat.htm...tension_code_pattern everything works as expected.
Then I added
    GSTAT.connect("file-loaded", self.file_loaded)

    def file_loaded(self, obj, data):
        print("FILE LOADED:", data)

The result is that I only get the message resp. signal when a new file is loaded, not on a reload.
But if I add this signal in the gmoccapy code directly, I get an event on every reload.

Furthermore the signal "graphics-gcode-properties" works fine inside gmoccapy, but in a VCP I don't get the message at all?

Any ideas about this behaviour?
Last edit: 19 Sep 2024 07:51 by HansU.

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

More
28 Sep 2024 09:07 #310950 by andypugh
This sounds like a question for Chris, and might do better on the dev mailing list.

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

More
28 Sep 2024 12:58 #310975 by cmorley
From hal_glib.py:
        # file changed
        file_old = old.get('file', None)
        file_new = self.old['file']
        if file_new != file_old:
            # if interpreter is reading or waiting, the new file
            # is a remap procedure, with the following test we
            # partly avoid emitting a signal in that case, which would cause
            # a reload of the preview and sourceview widgets.  A signal could
            # still be emitted if aborting a program shortly after it ran an
            # external file subroutine, but that is fixed by not updating the
            # file name if call level != 0 in the merge() function above.
            # do avoid that a signal is emitted in that case, causing
            # a reload of the preview and sourceview widgets
            if self.stat.interp_state == linuxcnc.INTERP_IDLE:
                self.emit('file-loaded', file_new)

Specifically ignores loading with the same filename (reloading)
I'll have to dig a bit to comment about gcode-properties - just off to work :)

Chris

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

More
28 Sep 2024 14:20 #310979 by cmorley
Thinking more about it...
If your gladevcp panel does not have gremlin object in it, you will not get gcode properties generated in that pythons context.

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

More
30 Sep 2024 02:33 #311051 by cmorley
This stems from the short coming of linuxcnc's status process or maybe better a lack of development of GUI communication process.

Gstat is an intermediate communication process between linuxcnc status and the GUi, that is easily modified/extended for the GUI needs.

If a single Gstat instance could be used/communicated to by all GUIs - that would be much better. You can kind of do this by using ZMQ etc to broadcast some data. I don't know if using ZMQ for all linuxcnc status would be fast enough. I was toying with adding it to HALUI as a test but again only some messages.

Or if linuxcnc's status was more easily extended and allowed GUIs to send messages that would be better too.

Chris
This is mostly beyond my programming skills.
The following user(s) said Thank You: tommylight

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

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