qtvcp issues

More
8 years 1 week ago #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.

  • auto-mation-assist
  • Offline
  • Platinum Member
  • Platinum Member
More
8 years 1 week ago #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
8 years 1 week ago - 8 years 1 week ago #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) :
Code:
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:
Code:
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: 8 years 1 week ago by cmorley.

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

  • auto-mation-assist
  • Offline
  • Platinum Member
  • Platinum Member
More
8 years 1 week ago #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.

More
8 years 1 week ago #119381 by cmorley
Replied by cmorley on topic qtvcp issues
Action buttons can be anywhere and they should work fine.
If an action button isn't doing the action then I would check that you selected an action in the property editor. In earlier stages the action button defaulted to estop action - now it defaults to no action.

Also if you want to see it toggle you must set it checkable in the properties editor.

I'll need to add some more docs to help with these problems - it's good to iron them out - thanks!

Chris M
The following user(s) said Thank You: auto-mation-assist

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

  • auto-mation-assist
  • Offline
  • Platinum Member
  • Platinum Member
More
8 years 6 days ago #119417 by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
I have attached a information file that I wrote up in LibreOffice Writer on how to make manual changes or additions to a XML .ui file manually for items that are either already linked to the gui's handler or for those that need to be added.

I wrote this because when dealing with more complex layouts the qt designer turned out to be not so user friendly. Perhaps this info will help others in some way.

I have the file available as edit_xml_file.odt if any one wants to edit it and make additions or changes.
Attachments:
The following user(s) said Thank You: tommylight, KCJ

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

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