Gui Coding

More
06 Aug 2023 16:44 #277122 by jcdammeyer
With reference to your posting from 2013, forum.linuxcnc.org/41-guis/26174-screen-...of-gui-designs#30125

Your screen done with free pascal looks interesting. Are you still using it? I'm interested in the files.

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

More
08 Aug 2023 14:29 #277327 by andypugh

Your screen done with free pascal looks interesting. Are you still using it? I'm interested in the files.
 



Gmoccapy is not written in Pascal, but is based on "Mocca GUI" which was.

It seems to be here: code.google.com/archive/p/moccagui/

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

More
08 Aug 2023 17:07 #277336 by jcdammeyer
Thanks. Just trying to figure out how to add code to a tab in AXIS actually. Thought that might give me a hint.

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

More
09 Aug 2023 12:56 #277432 by andypugh

Thanks. Just trying to figure out how to add code to a tab in AXIS actually. Thought that might give me a hint.


To do that you will need to use GladeVCP or QTVCP.

There is an example here: wiki.linuxcnc.org/cgi-bin/wiki.pl?Hobbing
Download the ZIP file to see the code.
That is a tab in Touchy, but it would work equally well in Axis.
The trick is link events in the UI to code in the handler file.

For example, looking in the UI file we find:
<signal name="clicked" handler="inc_button" object="teeth"/>
(You would set this up in the editor GUI, not by editing the XML, but this is easier to paste)
Then in the Python handler file we have
	def inc_button(self, label, data=None, mystery=None):
		val = float(label.get_text())
		name = gtk.Buildable.get_name(label)
		val = val + increment[name]
		if val > maximum[name]:
			val = maximum[name]
		elif val < minimum[name]:
			val = minimum[name]
		label.set_text(str(val))
		recalc(self, label)

This is a slightly advanced example as this particular handler handles all the increment buttons, each of which passes it the name of the object that generated the event.

The spindle start button handler isn't passed any data (that it uses) but does look for a value in a separate control to get the requested speed.
def spindle_start(self, label, data=None):
		if ok_for_mdi():
			s = float(self.builder.get_object('spindle').get_text())
			c.mode(linuxcnc.MODE_MDI)
			c.wait_complete() # wait until mode switch executed
			if label.get_name() == 'spindle_anti':
				c.mdi('M4S%f'%s)
			else:
				c.mdi('M3S%f'%s)

Hopefully there is enough here to get you started? It basically comes down to specifying a handler file in the "loadusr gladevcp" line, and in the GUI editor associating GUI events with functions in the python code.
The following user(s) said Thank You: jcdammeyer

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

More
09 Aug 2023 13:04 #277436 by andypugh
Here is a screenshot showing where you set up the link between GUI action and code:

 
Attachments:

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

More
09 Aug 2023 16:21 #277445 by jcdammeyer
Thanks Andy,
Just got the Touchy working on the BeagleBone.Black MachineKit. Not sure if I'll continue with the BBB and as yet I haven't finished my Harmonic Drive. Nice to see yours working so well.
BTW. That link in the document just goes to your video page. This is the one to the hobbing now.

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

More
09 Aug 2023 18:04 #277454 by andypugh

BTW. That link in the document just goes to your video page.

I think you are looking at the wrong link. This is the one you should have clicked (just above the screen shot)

wiki.linuxcnc.org/uploads/hobbing.zip

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

Time to create page: 0.105 seconds
Powered by Kunena Forum