qtvcp issues

More
23 Oct 2018 01:19 - 23 Oct 2018 01:19 #119232 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Yes I will supply it as a sample screen when its ready.
Last edit: 23 Oct 2018 01:19 by auto-mation-assist.

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

More
23 Oct 2018 01:39 - 23 Oct 2018 01:42 #119234 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Today I wanted to make a custom widget to test and got my self running around in circles since my widget did not show up in the HAL area of the QT designer no matter what I did. I was able to trace this problem down.

In my system the qtvcp_plugin.py in the below folder is not actually used by the QT designer.

/home/cnc/qt5vcp_py2/lib/python/qtvcp/plugins/qtvcp_plugin.py

Instead it is using:
/usr/lib/x86_64-linux-gnu/qt5/plugins/designer/python/qtvcp_plugin.py, and pulling widgets from:

/home/cnc/qt5vcp_py2/lib/python/qtvcp/widgets

The qtvcp_plugin.py file in /usr/lib/x86_64-linux-gnu/qt5/plugins/designer/python/ is not automatically updated when changes are made.

Perhaps it changed the location when I did a web install of QT some time back but that would be just a guess.
Last edit: 23 Oct 2018 01:42 by auto-mation-assist. Reason: Widgets file location correction

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

More
23 Oct 2018 03:26 #119237 by cmorley
Replied by cmorley on topic qtvcp issues
There should be a _link_ (has a little arrow on the icon) from
/usr/lib/x86_64-linux-gnu/qt5/plugins/designer/python/qtvcp_plugin.py
that points to:
/home/cnc/qt5vcp_py2/lib/python/qtvcp/plugins/qtvcp_plugin.py

Since it's a link, designer will see any updates in the repo.

Chris M

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

More
23 Oct 2018 07:53 #119243 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
I looked and there is is no arrow on the icon.

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

More
23 Oct 2018 08:00 #119244 by cmorley
Replied by cmorley on topic qtvcp issues
That suggest to me that it is not a link but a copy of the qtvcp_plugin file.

To make a link with your file manager, go to:
/home/cnc/qt5vcp_py2/lib/python/qtvcp/plugins/qtvcp_plugin.py
select qtvcp_plugin.py
and under edit should be 'make links' - select that and it will make a link in the folder. (should see the arrow now)
move this link to (sudo required):
/usr/lib/x86_64-linux-gnu/qt5/plugins/designer/python/

That should do it.
I rename the link when i do it but i don't think you need to.

Chris M

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

More
23 Oct 2018 08:04 #119245 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
I got it linked now, had to rename the original that was there first.

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

More
23 Oct 2018 08:07 #119246 by cmorley
Replied by cmorley on topic qtvcp issues
Excellent.

I am close to pushing an upgrade to status label to give live date/time label.
I think you mentioned you wanted that.

Chris M

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

More
24 Oct 2018 22:21 #119367 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Yes I have a spot reserved to display time and date in one label. Right now it is a Qlabel but I can change it.

I have been trying to find a way to simply change states action buttons from within the handler and also if possible from my hal file. Is this possible?

For now I would like to be able to change the state for the power button to "False" when the estop button is toggled to the True condition. As it is now the machine is off but the "on" button still indicates it is on.

Here is the code Im using for these two buttons in my handler file. It changes the machine state but does not set the "on" button to "False"

def abtn_main_estop_toggled(self,pressed):
if pressed:
self.cmnd.state(linuxcnc.STATE_ESTOP)
else:
self.cmnd.state(linuxcnc.STATE_ESTOP_RESET)

def abtn_mainv_power_on_toggled(self,pressed):
if pressed:
self.cmnd.state(linuxcnc.STATE_ON)
else:
self.cmnd.state(linuxcnc.STATE_OFF)

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

More
24 Oct 2018 22:49 - 24 Oct 2018 22:50 #119371 by cmorley
Replied by cmorley on topic qtvcp issues
I'm a little confused about what you are trying to do - it seems you are trying to duplicate what the action button does.

If you are using action buttons for estop and power (as toggle buttons) they will automatically change state based on linuxcnc. they also handle disabling when not available etc.

But if you do want to make your own linuxcnc aware widget (I would use a regular QToggleButton as the base widget.):
To build your own estop button, you must monitor linuxcnc state and update the button based on it. This is what the STATUS library is for.

Something like this (assuming you have imported the Status library and instantiated it globally as STATUS) :
            STATUS.connect('state-estop', lambda w:self.set_estop_button(True))
            STATUS.connect('state-estop-reset', lambda w: self.set_estop_button(False))

Then write a function that it calls:
def set_estop_button(self, data):
    print 'estop state', data 
Having widgets respond to HAL pins requires you to make a HAL pin and register it to be monitored and then it will call a function to update what ever you want to update. simple_widget.py 's LCD widget is the simplest example of a HAL pin controlled widget.
If you wish to do that in a handler file it's quite the same (no class of course, init_hal function code goes in handler's def initialized__ function)

It;s a lot easier to show then describe...

Chris M
Last edit: 24 Oct 2018 22:50 by cmorley.

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

More
25 Oct 2018 04:40 #119378 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Chris,

I’m a little confused also since my intention has been to use action buttons for these functions. As I recall from quite a while back that without the extra items my machine would not turn on. So something is lurking in the dark that is not quite right.

What you see added is what I found in sample code somewhere, but I had to reverse the on off logic or it would just toggle on and off continuously at a slow rate. So this added code allowed me to continue to developing.

Your answer made me think about a potential cause as to why I needed the extra code. The only thing I can think off was that I had placed the estop button into its own frame during early stages to the gui design. So now I’m wondering if it needs to be in the same frame as the, on, manual, mdi and auto buttons to function as it was designed.

Let me add that I appreciate the commands you listed. I'm sure they will come in handy and help clear up some fog about coding such commands.

I'm planning to add a post soon on how I overcame the wiring mess on the designer edit page during the edit signals\slots process for my 1xMill gui.

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

Moderators: cmorley
Time to create page: 0.121 seconds
Powered by Kunena Forum