upload:myvcp.xml is my example of a XML file for the beginner. |
upload:mpvcp.xml example of XML file(20jun2011) |
loadusr runs and starts pyvcp loadusr -W means it waits until pyvcp is _started_ then it continues with your hal script (link commands) then after everything is set up, it hits waitusr and waits for pyvcp to exit when you are all done (20 mins later, or whatever), you close pyvcp and the waitusr stops at that point halrun cleans up everything
for a different way to get a large DRO in AXIS, modify the coordinate display font as shown here: http://linuxcnc.org/docs/devel/html/gui_axis.html#r1_11_2
Jepler and Tomp have been busy enhancing pyvcp. At least the following things are new:
code snippets for many widgets can be found here http://linuxcnc.org/docs/2.2/html/hal_vcp.html
Tabs widget by Jepler
There is now a bit of text about pyVCP and some screenshots in the [Integrator Manual]
The pyVCP text from the manual is now also available in HTML format at http://www.linuxcnc.org/docs/2.2/html/hal_vcp.html
Jogwheel is a round thing which reacts to both the mouse-wheel, and dragging with the mouse. It outputs a HAL_FLOAT corresponding to the wheel position. Markup like this:
<jogwheel> [ <cpr>33</cpr> ] (counts per revolution) [ <halpin>"myjogwheel"</halpin> ] [ <size>300</size> ] </jogwheel>
Meter resembles an analog voltmeter, and is used to display the value of a HAL_FLOAT:
<meter> [ <size>300</size> ] [ <halpin>"mymeter"</halpin> ] [ <text>"My Voltage"</text> ] [ <min_>-22</min_> ] [ <max_>123</max_> ] </meter>
For a DRO, you might like really big fonts. The maximum size of a font is predetermined by what X fonts you have installed, the phase of the moon etc. etc.
It looks like a standard font like 'Helvetica' or 'Arial' or 'Roman' wont show as the correct size when trying to size it abouve 40-50 or so.
On the standard Ubuntu 6.06 install which most EMCers use 'courier 10 pitch' seems to be a font that's available in big size. So for a big label or number widget you might specify:
<font>('courier 10 pitch',100)</font>
also see here for how to modify the coordinate display font in AXIS: http://linuxcnc.org/docs/devel/html/gui_axis.html#r1_11_2
<radiobutton> <choices>["one","two","three"]</choices> </radiobutton>will create a radiobutton which sets one of the defined BITs true. The pins in the example will be named
compname.radiobutton.0.one compname.radiobutton.0.two compname.radiobutton.0.three
pyvcp -c halcomp_name myfile.xmland the created hal pins will be named with the prefix halcomp_name, i.e. halcomp_name.led halcomp_name.number etc.
This also means that it's possible to simultaneously open two or more panels if you want to:
pyvcp -c mypanel1 myfile1.xml pyvcp -c mypanel2 myfile2.xmlans so on.
running pyVCP standalone might be useful when developing a new panel (you don't want to start and restart emc every time to see the effect of changes in the XML), or for RT applications where only HAL is required (simple DRO display etc.)
to run standalone enter the command
pyvcp myfile.xmlthat will create a pyvcp panel with the widgets described in myfile.xml
PYVCP = your_pyvcp.xmlin the [DISPLAY] section of the ini file.
You can also run a HAL file after the GUI has started by specifying:
POSTGUI_HALFILE = hookup_pyvcp_pins.halin the [HAL] section of the ini.
This is demonstrated in the sim/lathe config which shows the spindle speed with a pyVCP bar widget. It looks like this:
import vcpparse2 f = Tkinter.Frame(root_window) f.grid(row=0, column=4, rowspan=6) vcpparse2.create_vcp(f, comp)
This way we can get the pyVCP widgets alongside AXIS!:
wiki uploads are still not working for me so I use pastebin:
To see that I am not fooling you, here are the HAL pins generated from the example above:
a first trial at generating Tkinter widgets that are connected to HAL pins:
upload:pyvcp.py is a linbrary of widgets that are basically inherited from Tkinter, but the HAL functionality has been added
upload:pyvcp_test.py is a test program that will generate the screenshot shown above
upload:mpvcp.xml example of XML file(20jun2011)