Creating a GUI

More
04 Aug 2012 18:26 #22787 by andypugh
Replied by andypugh on topic Re:Creating a GUI
BigJohnT wrote:

what is the minimum needed to run it stand alone?


That depends on what you want to do.

You can just open the UI from a HAL file with a line like this:

loadusr -Wn jtgui gladevcp -u jtgui.py jtgui.ui

Then "run" the HAL file with

halrun -I -f jtgui.hal

Or was the question "what is the minimum required to actually parse G-code and move a machine"?

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

More
04 Aug 2012 19:47 - 04 Aug 2012 19:49 #22798 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
andypugh wrote:

BigJohnT wrote:

what is the minimum needed to run it stand alone?


That depends on what you want to do.

You can just open the UI from a HAL file with a line like this:

loadusr -Wn jtgui gladevcp -u jtgui.py jtgui.ui

Then "run" the HAL file with

halrun -I -f jtgui.hal

Or was the question "what is the minimum required to actually parse G-code and move a machine"?


Yes, the correct question is number 'B' what is the minimum code to be able to have in the [DISPLAY] section of the ini my custom GUI instead of Axis? I do think that is the next step I need to take from here. I know where to put the glade and python file in the RIP so I have that part figured out when you build the rip.

John
Last edit: 04 Aug 2012 19:49 by BigJohnT.

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

More
04 Aug 2012 19:49 #22799 by cmorley
Replied by cmorley on topic Re:Creating a GUI
ok to run it stand alone:
I assume your using a run-in-place
add you python file into <run-in-place-folder> /bin
make sure it's executable.
and the glade file in <run-in-place-folder /share/linuxcnc

then add some code to your python file so it can find the glade file:
some thing like this (from my gaxis example) :

import sys,os

BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
datadir = os.path.join(BASE, "share", "linuxcnc")
xmlname = os.path.join(datadir,"gaxis.glade")

change these lines to this:

builder.add_from_file(xmlname)

panel = gladevcp.makepins.GladePanel( halcomp, xmlname, builder, None)

note they use the variable xmlname rather then using the actual xml file name now.

the in your INI file change DISPLAY=axis to
DISPLAY=gaxis.py

That should do it

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

More
04 Aug 2012 19:53 #22800 by cmorley
Replied by cmorley on topic Re:Creating a GUI
I also should mention that after you call makepins and after you make any extra HAL pins you want you should call
halcomp.ready() to let HAL know the pins are ready

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

More
04 Aug 2012 20:02 - 04 Aug 2012 20:09 #22803 by cmorley
Replied by cmorley on topic Re:Creating a GUI
the DRO will pan - try the unintuitive button 2 :) press both buttons at the same time then it should pan.
I think the shift key and button 1 will also make it pan.

You can turn the DRO off. I can't remember if you can make it smaller like in AXIS.
The capability is probably there but not brought out to glade controls.

Are you building this in the gscreen branch? gscreen has more options for gremlin and screen controls.
Last edit: 04 Aug 2012 20:09 by cmorley. Reason: I said button 3 but it's button 2

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

More
04 Aug 2012 20:06 #22804 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
Yes, I'm using the gscreen branch to test with.

John

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

More
04 Aug 2012 20:18 #22805 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
Does builder need to be global or should it be self.builder?

John

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

More
04 Aug 2012 20:20 #22806 by cmorley
Replied by cmorley on topic Re:Creating a GUI
I looked at the source double clicking button 3 (which should be the right hand button) will clear the plot of previous moves.
There are methods in gremlin you can call directly to manipulate the screen controls for instance to use a touch screen - which doesn't work well with the standard controls.

For instance If you prefer to have a separate button to pan then connect a button signal to a method that:
calls gremlin.set_mouse_position(0,0)
and calls gremlin.pan(0,5)

this would pan 5 units in the positive Y axis

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

More
04 Aug 2012 20:23 #22807 by cmorley
Replied by cmorley on topic Re:Creating a GUI
builder shouldn.t need to be global or self.builder unless you need it outside of the _ini_ call
It won't hurt to have it self.builder (that what is in gscreen but I am pretty sure it's unnecessary)

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

More
04 Aug 2012 20:33 #22808 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
Ok thanks

John

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

Time to create page: 0.156 seconds
Powered by Kunena Forum