Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

18
configs/.gitignore vendored Normal file
View File

@@ -0,0 +1,18 @@
*.var
*.var.bak
*/core_*.hal
!/cooltool/core_stepper4.hal
!/hexapod-sim/core_sim_6.hal
!/sim/core_sim_noio.hal
!/sim/core_sim_noiocontrol.hal
!/sim/core_sim_test.hal
*/axis_manualtoolchange.hal
position*.txt
!common/*.hal
*.ini.expanded
hallib
*_cmds.hal
*.pref
mdi-history.dat
resources.py

1
configs/apps/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.save

11
configs/apps/README Normal file
View File

@@ -0,0 +1,11 @@
info: create system information file
Directories:
gladevcp -- demonstration widgets
halrun ---- start halrun in xterm
latency --- apps to investigate latency
parport --- parallel port tests
pyvcp ---- demonstrations
xhc-hbo4 -- test wireless usb pendant

View File

@@ -0,0 +1,16 @@
gladevcp demo apps:
Apps:
glade-manual
gladevcp-test
Directories:
animated-backdrop
by-widget
class-callback
colored-label
complex
helloWorld
mdi-command-examples
simple-callback
templates

View File

@@ -0,0 +1,62 @@
Note on API changes to class handlers and persistence.py:
Class handlers:
===============
The 'panel' parameter was dropped from get_handlers() since it's not needed.
Correspondingly, the handler class __init__() method does not get this
parameter any more as well:
class HandlerClass:
...
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
Widget access in handler classes:
=================================
For a named widget, use:
w = self.builder.get_object("widgetname")
To retrieve a list of all widgets in the UI file, use:
wl = self.builder.get_objects()
This works regardless whether the UI is in libglade or GtkBuilder format.
persistence.py
==============
The handling of the builder parameter has been simplified. It has been dropped
from the save_state and restore_state methods, and added instead to the
IniFile.__init__() method. Therefore, use as follows:
class HandlerClass:
...
def on_destroy(self,obj,data=None):
# note: save_state(<object to fetch attributes from>) only:
self.ini.save_state(self)
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.ini_filename = __name__ + '.ini'
self.defaults = { IniFile.vars: dict(),
IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(), hal_only=False,output_only = True))
}
# note extra self.builder parameter
self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
# note - only the object which gets attributes set is passed:
self.ini.restore_state(self)
All examples and templates have been adapted accordingly.
Michael Haberler Dec 19 2010

View File

@@ -0,0 +1,63 @@
Nota sobre los cambios API de los manejadores de clase y persistence.py:
Handlers de clase:
=====================
El parámetro 'panel' se eliminó de get_handlers() ya que no es necesario.
En consecuencia, el handler del método __init__() no recibe este
parámetro:
class HandlerClass:
...
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
Acceso a widgets en handlers de clases:
==========================================
Para un widget con nombre, use:
w = self.builder.get_object("widgetname")
Para recuperar una lista de todos los widgets en el archivo UI, use:
wl = self.builder.get_objects()
Esto funciona independientemente de si la interfaz de usuario está en formato libglade o GtkBuilder.
persistence.py
==============
El manejo del parámetro builder se ha simplificado. Se elimina
de los métodos save_state y restore_state, y se agrega en su lugar al método
IniFile.__init__(). Por lo tanto, utilicelo de la siguiente manera:
class HandlerClass:
...
def on_destroy(self,obj,data=None):
# note: save_state(<object to fetch attributes from>) only:
self.ini.save_state(self)
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.ini_filename = __name__ + '.ini'
self.defaults = { IniFile.vars: dict(),
IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(), hal_only=False,output_only = True))
}
# notese parámetro extra self.builder
self.ini = IniFile(self.ini_filename, self.defaults, self.builder)
# nota: solo se pasa el objeto que obtiene el conjunto de atributos:
self.ini.restore_state(self)
Todos los ejemplos y plantillas se han adaptado en consecuencia.
Michael Haberler 19 de diciembre de 2010

View File

@@ -0,0 +1,16 @@
This is an example how to set a background bitmap for the gladevcp toplevel
window, and absolute positioning of HAL widgets therein.
you might need to 'apt-get install python-cairo' first
------------------------------------------
To run independently:
gladevcp -u cairodraw.py cairodraw.ui
-psha & mah

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./cairodraw.py ./cairodraw.ui

View File

@@ -0,0 +1,61 @@
import cairo
from math import pi
pngfile = 'vortex.me.png'
class HandlerClass:
def on_draw(self, widget, cr):
print("on_draw")
# Sets the operator to clear which deletes everything below
# where an object is drawn
cr.set_operator(cairo.OPERATOR_CLEAR)
width = widget.get_allocated_width()
height = widget.get_allocated_height()
# Makes the mask fill the entire window
cr.rectangle(0.0, 0.0, width, height)
# Deletes everything in the window (since the compositing
# operator is clear and mask fills the entire window
cr.fill()
# Set the compositing operator back to the default
cr.set_operator(cairo.OPERATOR_OVER)
if self.scale:
w, h = widget.get_allocated_width(), widget.get_allocated_height()
cr.scale(1.0 *w / self.width, 1.0*h/self.height)
cr.set_source_surface(self.img, 0, 0)
cr.paint()
def __init__(self, halcomp,builder,useropts):
self.builder = builder
win = self.builder.get_object("window1")
#win.set_decorated(False)
self.img = cairo.ImageSurface.create_from_png(pngfile)
self.width = self.img.get_width()
self.height = self.img.get_height()
# Makes the window paintable, so we can draw directly on it
win.set_app_paintable(True)
win.set_size_request(self.width, self.height)
# This sets the windows colormap, so it supports transparency.
# This will only work if the wm support alpha channel
screen = win.get_screen()
rgba = screen.get_rgba_visual()
win.set_visual(rgba)
# scaling the bitmap is possible by turning this on
# however the fixed widget does NOT do proportional scaling
self.scale = 1
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<signal name="draw" handler="on_draw" swapped="no"/>
<child>
<object class="GtkFixed" id="fixed1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="hal_led1">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="x">57</property>
<property name="y">41</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">button</property>
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="tooltip-text" translatable="yes">a tooltip</property>
</object>
<packing>
<property name="x">250</property>
<property name="y">22</property>
</packing>
</child>
<child>
<object class="HAL_ToggleButton" id="hal_togglebutton1">
<property name="label" translatable="yes">togglebutton</property>
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="x">29</property>
<property name="y">107</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,6 @@
by-widget
combobox
radiobutton
sourceview
spinbutton

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u combobox.py combobox.ui

View File

@@ -0,0 +1,40 @@
'''
HAL combobox
demo for adding a dynamic list of values
Michael Haberler 12/2010
'''
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
debug = 0
class HandlerClass:
def on_destroy(self,obj,data=None):
print("on_destroy, combobox active=%d" %(self.combo.get_active()))
self.halcomp.exit() # avoid lingering HAL component
Gtk.main_quit()
def on_changed(self, combobox, data=None):
print("on_changed %f %d" % (combobox.hal_pin_f.get(),combobox.hal_pin_s.get()))
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
self.combo = self.builder.get_object('hal_combobox1')
def get_handlers(halcomp,builder,useropts):
global debug
for cmd in useropts:
exec(cmd, globals())
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,17 @@
combobox examples:
combobox
combobox_manual_list
watch this to learn about Glade and ComboBox: http://www.youtube.com/watch?v=Z5_F-rW2cL8
------------------------------------------
To run independently:
$ gladevcp -u combobox.py combobox.ui
combobox_manual_list.* are example files for constructing dropdown lists on the fly.
run as:
$ gladevcp -u combobox_manual_list.py combobox_manual_list.ui
Michael Haberler 12/2010

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name myfloat -->
<column type="gfloat"/>
<!-- column-name description -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0">3.1400001049041748</col>
<col id="1" translatable="yes">Pi </col>
</row>
<row>
<col id="0">2.7182817459106445</col>
<col id="1" translatable="yes">e</col>
</row>
<row>
<col id="0">42</col>
<col id="1" translatable="yes">The Answer</col>
</row>
</data>
</object>
<object class="GtkWindow" id="window1">
<property name="width-request">150</property>
<property name="height-request">50</property>
<property name="can-focus">False</property>
<signal name="destroy" handler="on_destroy" swapped="no"/>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_ComboBox" id="hal_combobox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="model">liststore1</property>
<property name="active">2</property>
<property name="column">0</property>
<signal name="changed" handler="on_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,17 @@
ejemplos de combobox:
combobox
combobox_manual_list
Vea esto para aprender acerca de Glade y ComboBox: http://www.youtube.com/watch?v=Z5_F-rW2cL8
------------------------------------------
Para ejecutar de forma independiente:
$ gladevcp -u combobox.py combobox.ui
combobox_manual_list.* son archivos de ejemplo para construir listas desplegables sobre la marcha.
correr como:
$ gladevcp -u combobox_manual_list.py combobox_manual_list.ui
Michael Haberler 12/2010

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./combobox_manual_list.py ./combobox_manual_list.ui

View File

@@ -0,0 +1,59 @@
'''
HAL combobox
demo for adding a dynamic list of values
Michael Haberler 12/2010
'''
import gi
from gi.repository import Gtk
from gi.repository import GObject
debug = 0
class HandlerClass:
def on_destroy(self,obj,data=None):
print("on_destroy")
self.halcomp.exit() # avoid lingering HAL component
Gtk.main_quit()
def on_changed(self, combobox, data=None):
model = combobox.get_model()
index = combobox.get_active()
if index:
print('index of selected value',index)
return
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
self.combo = self.builder.get_object('hal_combobox1')
self.list_store = Gtk.ListStore(GObject.TYPE_FLOAT)
self.list_store.append([3.14])
self.list_store.append([2.71828])
self.list_store.append([1.67])
self.list_store.append([47.11])
self.list_store.append([42.0])
self.combo.set_model(self.list_store)
self.combo.set_active(0)
cell = Gtk.CellRendererText()
self.combo.pack_start(cell, True)
self.combo.add_attribute(cell, "text", 0)
def get_handlers(halcomp,builder,useropts):
global debug
for cmd in useropts:
exec(cmd, globals())
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<property name="default-width">70</property>
<property name="default-height">30</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_ComboBox" id="hal_combobox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="changed" handler="on_changed" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,89 @@
'''
gladevcp radiobutton example
lifted from http://old.nabble.com/glade-and-radio-buttons.-td28793060.html
Michael Haberler 12/2010
'''
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Pango
debug = 0
class HandlerClass:
def print_radiobutton_state(self, widget):
if widget.get_active():
state = 'active'
if self.builder.get_object('showoutput_btn').get_active():
self.set_color_label(widget.get_label())
else:
self.color_lbl.set_label('Unknown')
else:
state = 'inactive'
print(' %s button toggled - now %s ' % ( widget.get_label(), state))
def on_red_rbtn_toggled(self, widget, data=None):
print('on_red_rbtn_toggled')
self.print_radiobutton_state(widget)
def on_blue_rbtn_toggled(self, widget, data=None):
print('on_blue_rbtn_toggled')
self.print_radiobutton_state(widget)
def on_green_rbtn_toggled(self, widget, data=None):
print('on_green_rbtn_toggled')
self.print_radiobutton_state(widget)
def on_yellow_rbtn_toggled(self, widget, data=None):
print('on_yellow_rbtn_toggled')
self.print_radiobutton_state(widget)
def on_showoutput_btn_toggled(self, widget, data=None):
if widget.get_active():
self.color_lbl.set_sensitive(True)
else:
self.color_lbl.set_sensitive(False)
def set_color_label(self, color):
self.color_lbl.set_label(color)
mycolor = self.color_lookup[color.lower()]
self.color_lbl.modify_fg(Gtk.StateFlags.NORMAL, mycolor)
def on_destroy(self,obj,data=None):
print("on_destroy")
self.halcomp.exit() # avoid lingering HAL component
Gtk.main_quit()
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
self.window = self.builder.get_object('window1')
self.color_lbl = self.builder.get_object('color_lbl')
fontdesc = Pango.FontDescription("Sans 20")
self.color_lbl.modify_font(fontdesc)
self.color_lookup = {
'red': Gdk.color_parse('red'),
'blue': Gdk.color_parse('blue'),
'green': Gdk.color_parse('green'),
'yellow': Gdk.color_parse('yellow')
}
self.on_showoutput_btn_toggled(self.builder.get_object('showoutput_btn'))
def get_handlers(halcomp,builder,useropts):
global debug
for cmd in useropts:
exec(cmd, globals())
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<signal name="destroy" handler="on_destroy" swapped="no"/>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkVButtonBox" id="vbuttonbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">spread</property>
<child>
<object class="GtkRadioButton" id="red_rbtn">
<property name="label" translatable="yes">Red</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="yalign">0.5099999904632568</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_red_rbtn_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="blue_rbtn">
<property name="label" translatable="yes">Blue</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<property name="group">red_rbtn</property>
<signal name="toggled" handler="on_blue_rbtn_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="green_rbtn">
<property name="label" translatable="yes">Green</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<property name="group">red_rbtn</property>
<signal name="toggled" handler="on_green_rbtn_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="yellow_rbtn">
<property name="label" translatable="yes">Yellow</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<property name="group">red_rbtn</property>
<signal name="toggled" handler="on_yellow_rbtn_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
<object class="GtkLabel" id="color_lbl">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Unknown</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkCheckButton" id="showoutput_btn">
<property name="label" translatable="yes">Show Color Choice</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_showoutput_btn_toggled" swapped="no"/>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./radio.py ./radio.ui

View File

@@ -0,0 +1,9 @@
gladevcp radiobutton example
lifted from http://old.nabble.com/glade-and-radio-buttons.-td28793060.html
------------------------------------------
To run independently:
$ gladevcp -u radio.py radio.ui
Michael Haberler 12/2010

View File

@@ -0,0 +1,9 @@
Ejemplo gladevcp radiobutton
Tomado de http://old.nabble.com/glade-and-radio-buttons.-td28793060.html
------------------------------------------
Para correr independientemente:
$ gladevcp -u radio.py radio.ui
Michael Haberler 12/2010

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./sourceview.py ./sourceview.ui

View File

@@ -0,0 +1,60 @@
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GtkSource
class HandlerClass:
def _set_line(self,l):
if not l:
if self.mark:
self.textbuffer.delete_mark(self.mark)
self.mark = None
return
line = self.textbuffer.get_iter_at_line(l-1)
if not self.mark:
self.mark = self.textbuffer.create_source_mark('highlight', 'highlight', line)
self.mark.set_visible(True)
else:
self.textbuffer.move_mark(self.mark, line)
self.sourceview.scroll_to_mark(self.mark, 0, True, 0, 0.5)
def file_set(self,widget,data=None):
filename = widget.get_filename()
print("file_set",filename)
self.textbuffer.set_text(open(filename).read())
self.line = 1
self._set_line(self.line)
def on_down(self,widget,data=None):
self.line += 1
self._set_line(self.line)
def on_up(self,widget,data=None):
self.line -= 1
self._set_line(self.line)
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.line = 1
self.sourceview = builder.get_object('gtksourceview1')
self.textbuffer = GtkSource.Buffer()
self.sourceview.set_buffer(self.textbuffer)
self.sourceview.set_show_line_numbers(True)
self.sourceview.set_show_line_marks(True)
self.sourceview.set_highlight_current_line(True)
att = GtkSource.MarkAttributes()
color = Gdk.RGBA()
color.parse('yellow')
att.set_background(color)
self.sourceview.set_mark_attributes('highlight', att, 1)
self.mark = None
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,9 @@
Example for using the sourceview widget
---------------------------------------
Loading a file, and highlighting a line
------------------------------------------
To run independently:
$ gladevcp -u sourceview.py sourceview.ui

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtksourceview" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="file-set" handler="file_set" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="down">
<property name="label" translatable="yes">Down</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="receives-default">False</property>
<signal name="pressed" handler="on_down" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="up">
<property name="label" translatable="yes">Up</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_up" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;File&lt;/b&gt;</property>
<property name="use-markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="width-request">300</property>
<property name="height-request">400</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="GtkSourceView" id="gtksourceview1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="left-margin">2</property>
<property name="right-margin">2</property>
<property name="show-line-numbers">True</property>
<property name="show-line-marks">True</property>
<property name="tab-width">4</property>
<property name="auto-indent">True</property>
<property name="indent-on-tab">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Sourceview Widget</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,9 @@
Ejemplo para usar el widget sourceview
---------------------------------------
Cargando un archivo, y resaltando una línea
------------------------------------------
Para ejecutar de forma independiente:
$ gladevcp -u sourceview.py sourceview.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u spinbutton.py spinbutton.ui

View File

@@ -0,0 +1,16 @@
'''
HAL spinbutton
demo for Gtk bug workaround
see Gladevcp Manual Section FAQ item 6
'''
class HandlerClass:
def on_spinbutton_realize(self,widget,data=None):
widget.set_value(3.14)
def get_handlers(halcomp,builder,useropts):
return [HandlerClass()]

View File

@@ -0,0 +1,7 @@
spinbutton example
------------------------------------------
To run independently:
$ gladevcp -u spinbutton.py spinbutton.ui
Michael Haberler 06/2012

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment1</property>
<property name="digits">2</property>
<signal name="realize" handler="on_spinbutton_realize" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
ejemplo de botón spin
------------------------------------------
Para ejecutar de forma independiente:
$ gladevcp -u spinbutton.py spinbutton.ui
Michael Haberler 06/2012

View File

@@ -0,0 +1,19 @@
example with callback class methods
-----------------------------------
This shows how to use class methods as callbacks.
Note:
There are two class definitions in this example. Both are instantiated - OtherClass around line 84 during
import, and HandlerClass by the get_handlers() function.
HandlerClass.__init__() shows how to define a hal pin which is not associated to any HAL widget.
Passing the builder enables referring to any widget in the tree (see for instance line 33).
Also, a slow (1-second) timer callback is shown which updates the 'value' HAL pin - this pin is
linked to the hal_hbar Horizontal Bar widget through class_callback.hal.
------------------------------------------
To run independently:
$ gladevcp -u class_callback.py -H class_callback.hal class_callback.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./class_callback.py -H ./class_callback.hal ./class_callback.ui

View File

@@ -0,0 +1 @@
net count class_callback.value => class_callback.hal_hbar1

View File

@@ -0,0 +1,93 @@
import hal
import time
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Pango
from gi.repository import GLib
from inspect import stack
class OtherClass:
'''
methods in this class are not exposed as callback handlers
since the object instance is not passed to gladevcp in get_handlers()
'''
def invisible(selfself):
pass
class HandlerClass:
'''
class with gladevcp callback handlers
'''
def on_button_press(self,widget,data=None):
'''
a callback method
parameters are:
the generating object instance, likte a GtkButton instance
user data passed if any - this is currently unused but
the convention should be retained just in case
'''
self.nhits += 1
laptime = time.time() - self.start
self.builder.get_object('message').set_label("time lap#%d: %.2f seconds" % (self.nhits,laptime))
def _on_timer_tick(self,userdata=None):
'''
the full glib functionality is available if needed.
here's a timer function which will be called periodically
returning True restarts the timer
returning False makes it a one-shot
'''
self.ticks += 1
self.halcomp['value'] = self.ticks
return True
def __init__(self, halcomp,builder,useropts):
'''
Handler classes are instantiated in the following state:
- the widget tree is created, but not yet realized (no toplevel window.show() executed yet)
- the halcomp HAL component is set up and the widhget tree's HAL pins have already been added to it
- it is safe to add more hal pins because halcomp.ready() has not yet been called at this point.
after all handlers are instantiated in command line and get_handlers() order, callbacks will be
connected with connect_signals()/signal_autoconnect()
The builder may be either of libglade or GtkBuilder type depending on the glade file format.
'''
self.halcomp = halcomp
self.builder = builder
self.halcomp.newpin("value", hal.HAL_FLOAT, hal.HAL_OUT)
self.start = time.time()
self.nhits = 0
self.ticks = 0
# demonstrate a slow background timer - granularity is one second
# for a faster timer, use this:
# glib.timeout_add(5000, self._on_timer_tick)
GLib.timeout_add_seconds(1, self._on_timer_tick)
other = OtherClass() # executed at import time
def get_handlers(halcomp,builder,useropts):
'''
this function is called by gladevcp at import time (when this module is passed with '-u <modname>.py')
return a list of object instances whose methods should be connected as callback handlers
any method whose name does not begin with an underscore ('_') is a callback candidate
the 'get_handlers' name is reserved - gladevcp expects it, so do not change
'''
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<property name="default-width">200</property>
<property name="default-height">150</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_Button" id="button">
<property name="label" translatable="yes">Take lap time</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_button_press" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="message">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_HBar" id="hal_hbar1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bg-color">#bebebebebebe</property>
<property name="max">60</property>
<property name="z0-border">0.6000000238418579</property>
<property name="z0-color">#0000ffff0000</property>
<property name="z1-border">0.8000000119209289</property>
<property name="z1-color">#ffffffff0000</property>
<property name="z2-color">#ffff00000000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,23 @@
How to colorize a HAL_Label widget depending on the pin value
-------------------------------------------------------------
Setting the background color of a GtkLabel widget (and HAL_Label is
derived from GtkLabel) is a bit tricky. The GtkLabel widget has no
window object of its own for performance reasons, and only window
objects can have a background color. The solution is to enclose the
Labl in an EventBox container, which has a window but is otherwise
invisible - see the coloredlabel.ui file.
To help with this, the colorize() method tries to detect this
situation and give a warning if the widget is a GtkLabel and the
parent widget is not an GtkEventBox. It can be used to set the colors
of arbitrary widgets, not just GtkLabel.
Also, this example shows how to set a custom text and color label
depending on the HAL pin's value.
------------------------------------------
To run independently:
$ gladevcp -u coloredlabel.py -H coloredlabel.hal coloredlabel.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./coloredlabel.py -H ./coloredlabel.hal ./coloredlabel.ui

View File

@@ -0,0 +1,2 @@
net monitored-value coloredlabel.hal_spinbutton1-s coloredlabel.hal_label1

View File

@@ -0,0 +1,88 @@
#!/usr/bin/env python3
# vim: sts=4 sw=4 et
# This is a component of LinuxCNC
# complex.py Copyright 2011 Michael Haberler
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.''''''
'''
gladevcp colored label example
Michael Haberler 2/2011
'''
import sys
import hal
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
global red,green,white
red = Gdk.color_parse("red")
green = Gdk.color_parse("green")
yellow = Gdk.color_parse("yellow")
# data for a table-driven HAL Label
table = { 0: ("No Fault", green),
1: ("Over Current", red),
2: ("Over Voltage", red),
3: ("Overheat", red),
4: ("Overload", red),
}
# defaults for value not in table
default_text = "unknown value: "
default_color = yellow
class HandlerClass:
def colorize(self, w, state, color):
''' helper method: try to do the right thing when setting the color of a widget.
The GtkLabel, and hence HAL_Label widget doesn't take a color, so
it needs an enclosing Eventbox which can be colorized.'''
if isinstance(w,Gtk.Label):
parent = w.get_parent()
if not isinstance(parent,Gtk.EventBox):
print("warning: the %s Label widget is not enclosed in an EventBox" % w.get_name(), file=sys.stderr)
parent.modify_bg(state, color)
else:
# non-label widgets can be directly colorized
w.modify_bg(state, color) # colorize anyway
def on_label_hal_pin_change(self, hal_widget, data=None):
'''
this is an example of a hal-pin-changed signal handler as set in glade.
The purpose of this callback is to deliver an optional notification to your code beyond
just reacting to the changed HAL pin.
See hal_button1's 'Signals' section in glade to see how it is connected to this handler
'''
value = hal_widget.hal_pin.get()
if value not in table:
text = default_text + str(value)
color = default_color
else:
(text,color) = table[value]
hal_widget.set_label(text)
self.colorize(hal_widget, Gtk.StateFlags.NORMAL, color)
def __init__(self, halcomp,builder,useropts):
self.hal_button1 = builder.get_object('hal_button1')
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step-increment">1</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<property name="default-width">200</property>
<property name="default-height">200</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_Label" id="hal_label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<signal name="hal-pin-changed" handler="on_label_hal_pin_change" swapped="no"/>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,15 @@
complex example with widget and variable persistence
----------------------------------------------------
This demonstrates the use of the gladevcp.util support for persistence,
and shows how to get a callback when hal pins, or hal input widgets change.
The hal_togglebutton1 is linked to hal_led1 through complex.hal
------------------------------------------
To run independently:
$ gladevcp -u complex.py -H complex.hal complex.ui
or to get a lot of debug output what gladevcp and complex.py are doing:
$ gladevcp -d -d -u complex.py -U debug=3 -H complex.hal complex.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./complex.py -H ./complex.hal ./complex.ui

View File

@@ -0,0 +1,9 @@
# a HAL table must be explicitly enabled from 'outside'
# by setting its hal pin to 1
# otherwise, all contained widgets are disabled ('greyed out')
setp complex.hal_table1 1
# led reflects togglebutton
net led complex.hal_togglebutton1 => complex.hal_led1

View File

@@ -0,0 +1,215 @@
#!/usr/bin/env python3
# vim: sts=4 sw=4 et
# This is a component of LinuxCNC
# complex.py Copyright 2010 Michael Haberler
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.''''''
'''
gladevcp complex demo example
Michael Haberler 11/2010
'''
import os,sys
from gladevcp.persistence import IniFile,widget_defaults,set_debug,select_widgets
import hal
import hal_glib
import gtk
import gi
from gi.repository import GLib
debug = 0
class HandlerClass:
'''
class with gladevcp callback handlers
'''
def on_button_press(self,halwidget,data=None):
'''
a callback method
parameters are:
the generating object instance, like a GtkButton instance
user data passed if any - this is currently unused but
the convention should be retained just in case
'''
print("on_button_press()")
self.nhits += 1
halwidget.set_label("hits: %d" % self.nhits)
def on_toggle_button(self,hal_button,data=None):
'''
standard button-pressed callback. Parameter is the widget object instance.
'''
print("on_toggle_button() HAL pin value: %s" %(str(hal_button.hal_pin.get())))
def _on_example_trigger_change(self,hal_pin,data=None):
'''
executed when the 'example-trigger' hal pin value changes
note that this callback will not be exposed as potential callback
handler through gladevcp since the name begins with an underscore (_) .
Parameter is the HAL pin instance.
'''
print("_on_example_trigger_change() - HAL pin value: %s" % (hal_pin.get()))
def on_led_pin_changed(self,hal_led,data=None):
'''
this is an example of a hal-pin-changed signal handler as set in glade.
The purpose of this callback is to deliver an optional notification to your code beyond
just reacting to the changed HAL pin.
the on_led_pin_changed signal is set in the complex.ui hal_led1 signals section
'''
print("on_led_pin_changed() - HAL pin value:",hal_led.hal_pin.get())
def _on_timer_tick(self,userdata=None):
'''
the full glib functionality is available if needed.
here's a timer function which will be called periodically
returning True restarts the timer
returning False makes it a one-shot
'''
self.lifetime_ticks += 1
self.builder.get_object('message').hal_pin.set(self.lifetime_ticks)
return True
def on_unix_signal(self,signum,stack_frame):
print("on_unix_signal(): signal %d received, saving state" % (signum))
self.ini.save_state(self)
gtk.main_quit()
self.halcomp.exit()
def on_destroy(self,obj,data=None):
'''
gladevcp_demo.ui has a destroy callback set in the window1 Gobject
note the widget tree is not safely accessible here any more
'''
print("on_destroy() - saving state)")
self.ini.save_state(self)
def on_restore_defaults(self,button,data=None):
self.ini.create_default_ini()
self.ini.restore_state(self)
self.builder.get_object('hal_button1').set_label("past hits: %d" % self.nhits)
def on_save_settings(self,button,data=None):
print("on_save_settings() - saving state")
self.ini.save_state(self)
def _hal_setup(self,halcomp, builder):
'''
hal related initialisation
'''
# the toplevel window is always named 'window1'. Do not change.
# widgets may be accessed through builder.get_object() and
# builder.get_objects()
self.window1 = self.builder.get_object("window1")
self.led1 = self.builder.get_object("hal_led1")
# standard hal pins not associated with any widget
self.halcomp.newpin("example-out", hal.HAL_BIT, hal.HAL_OUT)
self.halcomp.newpin("example-in", hal.HAL_S32, hal.HAL_IN)
# hal pins with change callback. Also unrelated to any HAL widget.
# When the pin's value changes the callback is executed.
self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.HAL_BIT, hal.HAL_IN))
self.example_trigger.connect('value-changed', self._on_example_trigger_change)
def __init__(self, halcomp,builder,useropts):
'''
Handler classes are instantiated in the following state:
- the widget tree is created, but not yet realized (no toplevel window.show() executed yet)
- the halcomp HAL component is set up and the widhget tree's HAL pins have already been added to it
- it is safe to add more hal pins because halcomp.ready() has not yet been called at this point.
after all handlers are instantiated in command line and get_handlers() order, callbacks will be
connected with connect_signals()/signal_autoconnect()
The builder may be either of libglade or GtkBuilder type depending on the glade file format.
'''
self.halcomp = halcomp
self.builder = builder
(directory,filename) = os.path.split(__file__)
(basename,extension) = os.path.splitext(filename)
self.ini_filename = os.path.join(directory,basename + '.save')
# the dict driving the ini file persistence feature
# a signature checks variable names,types,sections
#
# to see the mechanism at work, do this:
# - run the application, change some values, and exit
# - edit the complex.save file and change a variable name in the widgets or vars section
# for example, rename 'a' to 'z'
# and remove one of the widgets in the widgets section
# - then re-run the application
# during startup, you get a message saying
# "key 'a' in section 'vars' : missing"
# "key 'hal_radiobutton1' in section 'widgets' : missing"
#
# to see how the protection of ini file versus a changed program works,
# change the defaults dict below, for instance remove the 'c' : "a string variable
# then re-run - the signature check at startup should fail, you should get:
# "signature mismatch in ./complex.save - resetting to default"
# and a default ini file is generated
self.defaults = { # these will be saved/restored as method attributes
IniFile.vars: { 'nhits' : 0, 'lifetime_ticks': 0, 'a': 1.67, 'd': True, 'c' : "a string"},
# we're interested restoring state to output HAL widgets only
# NB: this does NOT restore state pf plain gtk objects - set hal_only to False to do this
IniFile.widgets: widget_defaults(select_widgets(self.builder.get_objects(), hal_only=True,output_only = True)),
}
self.ini = IniFile(self.ini_filename,self.defaults, self.builder)
self.ini.restore_state(self)
# at this point it is ok to refer to restored attributes like self.nhits and self.lifetime_ticks:
self.builder.get_object('hal_button1').set_label("past hits: %d" % self.nhits)
self.builder.get_object('message').hal_pin.set(self.lifetime_ticks)
self._hal_setup(halcomp,builder)
# demonstrate a slow background timer - granularity is one second
# for a faster timer, use this:
# GLib.timeout_add(5000, self._on_timer_tick)
GLib.timeout_add_seconds(1, self._on_timer_tick)
def get_handlers(halcomp,builder,useropts):
'''
this function is called by gladevcp at import time (when this module is passed with '-u <modname>.py')
return a list of object instances whose methods should be connected as callback handlers
any method whose name does not begin with an underscore ('_') is a callback candidate
the 'get_handlers' name is reserved - gladevcp expects it, so do not change
'''
# try this at command line:
# -U debug=42 -U "print 'debug=%d' % debug"
global debug
for cmd in useropts:
exec(cmd, globals())
set_debug(debug)
if debug: print("%s.get_handlers() called" % (__name__))
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAction" id="action1"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
<property name="page-size">10</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="HAL_Table" id="hal_table1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="destroy" handler="on_destroy" swapped="no"/>
<child>
<object class="HAL_LED" id="hal_led1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
<signal name="hal-pin-changed" handler="on_led_pin_changed" swapped="no"/>
</object>
</child>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_button_press" swapped="no"/>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_ToggleButton" id="hal_togglebutton1">
<property name="label" translatable="yes">Toggle LED</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="toggled" handler="on_toggle_button" swapped="no"/>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_HScale" id="hal_hscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Restore defaults</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_restore_defaults" swapped="no"/>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">Save settings</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_save_settings" swapped="no"/>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="message">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="text-template">Total runtime: %s seconds</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_RadioButton" id="hal_radiobutton1">
<property name="label" translatable="yes">lemon</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<property name="group">hal_radiobutton2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_RadioButton" id="hal_radiobutton2">
<property name="label" translatable="yes">banana</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_RadioButton" id="hal_radiobutton3">
<property name="label" translatable="yes">chocolate</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<property name="group">hal_radiobutton2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo ./glade-manual.ui

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="HAL_Table">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="hal_led1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
</child>
<child>
<object class="HAL_Label" id="hal_label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="hal_led2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_HScale" id="hal_hscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo ./gladevcp-test.ui

View File

@@ -0,0 +1,357 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
<property name="page-size">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
<property name="page-size">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="upper">1000</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment5">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
<property name="page-size">10</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_Table" id="hal_table1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment3</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_HBox" id="hal_hbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="hal_led1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
<property name="pick-color-off">#00002724ffff</property>
<property name="pick-color-on">#f88096020000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="hal_led2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_VBar" id="hal_vbar1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bg-color">#bebebebebebe</property>
<property name="force-width">30</property>
<property name="invert">True</property>
<property name="min">10</property>
<property name="z0-border">0.699999988079071</property>
<property name="z0-color">#0000ffff0000</property>
<property name="z1-border">0.8000000119209289</property>
<property name="z1-color">#ffffffff0000</property>
<property name="z2-color">#ffff00000000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_VScale" id="hal_vscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="hal_label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label-pin-type">1</property>
<property name="text-template">%.02f</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="hal_label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="HAL_RadioButton" id="hal_radiobutton2">
<property name="label" translatable="yes">radiobutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<property name="group">hal_radiobutton1</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">3</property>
<property name="bottom-attach">4</property>
</packing>
</child>
<child>
<object class="HAL_RadioButton" id="hal_radiobutton1">
<property name="label" translatable="yes">radiobutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="hal_led4">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="hal_led5">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">500</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="right-attach">3</property>
<property name="top-attach">3</property>
<property name="bottom-attach">4</property>
</packing>
</child>
<child>
<object class="HAL_CheckButton" id="hal_checkbutton1">
<property name="label" translatable="yes">checkbutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
</child>
<child>
<object class="HAL_HBar" id="hal_hbar1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bg-color">#bebebebebebe</property>
<property name="force-height">20</property>
<property name="max">50</property>
<property name="z0-border">0.699999988079071</property>
<property name="z0-color">#0000ffff0000</property>
<property name="z1-border">0.8500000238418579</property>
<property name="z1-color">#ffffffff0000</property>
<property name="z2-color">#ffff00000000</property>
</object>
<packing>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_HScale" id="hal_hscale2">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment5</property>
</object>
<packing>
<property name="top-attach">3</property>
<property name="bottom-attach">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_ToggleButton" id="hal_togglebutton1">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="HAL_HScale" id="hal_hscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Scale</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton2">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment4</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="HAL_ProgressBar" id="hal_progressbar1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="scale">180</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,20 @@
a minimal gladevcp example - three HAL widgets
------------------------------------------
To run independently:
$ gladevcp_demo hw.ui
To connect the button HAL pin to the LED, run as:
$ gladevcp_demo -H hw.hal hw.ui
To embed this application as a tab into Axis or Touchy, copy hw.ui and hw.hal to your config directory,
and edit your Axis/Touchy ini file as follows:
[DISPLAY]
EMBED_TAB_NAME = HelloWorld
EMBED_TAB_COMMAND = gladevcp -H hw.hal -x {XID} hw.ui
to edit the user interface:
$ glade hw.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -H ./hw.hal ./hw.ui

View File

@@ -0,0 +1 @@
net button-state hw.hal_togglebutton1 => hw.hal_led1

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<property name="default-width">200</property>
<property name="default-height">150</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="hal_led1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
<property name="led-shape">2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_ToggleButton" id="hal_togglebutton1">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="hal_label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="ypad">7</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo ./owordsub.ui

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step-increment">1</property>
</object>
<object class="EMC_Action_MDI" id="hal_action_mdi1">
<property name="command">O&lt;oword&gt; call [${spin-f}] [${check}] [${toggle}] [${scale}]</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_SpinButton" id="spin">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_CheckButton" id="check">
<property name="label" translatable="yes">checkbutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_ToggleButton" id="toggle">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="HAL_HScale" id="scale">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">run O-word
sub</property>
<property name="related-action">hal_action_mdi1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo ./speed.ui

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="value">42</property>
<property name="step-increment">0.10</property>
</object>
<object class="EMC_Action_MDI" id="hal_action_mdi1">
<property name="command">(MSG, "The speed is: ${speed-f}")</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_SpinButton" id="speed">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment1</property>
<property name="digits">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes"> Pass speed as
parameter in MDI
command</property>
<property name="related-action">hal_action_mdi1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo ./whoareyou.ui

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="EMC_Action_MDI" id="hal_action_mdi1">
<property name="command">(MSG, "Hi, I'm an EMC_Action_MDI")</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Who are you?</property>
<property name="related-action">hal_action_mdi1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,10 @@
example demonstrating a simple user-defined callback
-----------------------------------------------------
callback.py defines as on_button_press() function which is connected to the widget tree as an event handler.
See the glade Signals tab for hal_button1 how it is referred to.
------------------------------------------
To run independently:
$ gladevcp -u simplecallback.py simplecallback.ui

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./simplecallback.py ./simplecallback.ui

View File

@@ -0,0 +1,8 @@
nhits = 0
def on_button_press(gtkobj,data=None):
global nhits
nhits += 1
print ("on_button_press callback")
gtkobj.set_label("hits: %d" % nhits)

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<property name="default-width">200</property>
<property name="default-height">150</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">Press me!</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_button_press" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_HBar" id="hal_hbar1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bg-color">#bebebebebebe</property>
<property name="max">10</property>
<property name="z0-border">0.6000000238418579</property>
<property name="z0-color">#0000ffff0000</property>
<property name="z1-border">0.8000000119209289</property>
<property name="z1-color">#ffffffff0000</property>
<property name="z2-color">#ffff00000000</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,29 @@
These are example gladevcp handler classes to start your own.
------------------------------------------
To run independently:
$ gladevcp -u functionhandler.py button.ui
$ gladevcp -u classhandler.py button.ui
$ gladevcp -u classhandler_persistent.py -U debug=2 -U "print 'debug=%d' % debug" button.ui
NB: button.ui has really no interesting widget state to restore.
have a look at classhandler_persistent.ini to get an
idea how the persistent state is saved. It should look roughly like this:
# generated by gladevcp.util.create_default_ini() on Wed Dec 8 12:27:13 2010
[ini]
version = 1
signature = be44d45a0e07d57cfbe8915d668e8d3b399a4cdb
[vars]
abool = True
afloat = 1.67
anint = 42
astring = sometext
[widgets]
# last update by gladevcp.util.save_state() on Wed Dec 8 12:31:20 2010
-Michael Haberler 12/2010

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">0.10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step-increment">0.10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step-increment">0.10</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="upper">100</property>
<property name="step-increment">0.10</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<signal name="destroy" handler="on_destroy" swapped="no"/>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="HAL_Button" id="hal_button1">
<property name="label" translatable="yes">not much here -
but press me anyway</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="pressed" handler="on_button_press" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_SpinButton" id="hal_spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment1</property>
<property name="digits">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="HAL_HScale" id="hal_hscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="invisible-char">●</property>
<property name="adjustment">adjustment3</property>
<property name="digits">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkHScale" id="hscale1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="adjustment">adjustment4</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton1">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./classhandler.py ./button.ui

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python3
# vim: sts=4 sw=4 et
# This is a component of LinuxCNC
# classhandler.py Copyright 2010 Michael Haberler
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''
example gladevcp handler class to start your own
no persistence support
'''
import gi
from gi.repository import GLib
class HandlerClass:
def on_button_press(self,widget,data=None):
print("on_button_press")
def on_destroy(self,obj,data=None):
print("on_destroy")
def _on_timer_tick(self,userdata=None):
print("timer tick")
return True
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
# demonstrate a slow background timer - granularity is one second
# for a faster timer, use this:
# glib.timeout_add(5000, self._on_timer_tick)
GLib.timeout_add_seconds(1, self._on_timer_tick)
def get_handlers(halcomp,builder,useropts):
for cmd in useropts:
exec(cmd, globals())
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./classhandler_persistent.py -U debug=2 -U "print 'debug=%d' % debug" ./button.ui

View File

@@ -0,0 +1,93 @@
#!/usr/bin/env python3
# vim: sts=4 sw=4 et
# This is a component of LinuxCNC
# classhandler_persistent.py Copyright 2010 Michael Haberler
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''
example gladevcp handler class with widget and attribute persistence support
'''
from gladevcp.persistence import IniFile,widget_defaults,set_debug,select_widgets
debug = 0
class HandlerClass:
def on_button_press(self,widget,data=None):
print("on_button_press")
self.anint += 1
# show retained attributes as inifile and current values
print("attr\tini\tcurrent")
for k in list(self.defaults[IniFile.vars].keys()):
print("%s\t%s\t%s" % (k,self.defaults[IniFile.vars][k],getattr(self,k,None)))
def on_destroy(self,obj,data=None):
'''
save state on application exit
'''
print("on_destroy() - saving state")
self.ini.save_state(self)
def on_restore_defaults(self,button,data=None):
'''
example callback for 'Reset to defaults' button (unused)
'''
print("on_restore_defaults() - setting default state")
self.ini.create_default_ini()
self.ini.restore_state(self)
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
self.useropts = useropts
# use the module basename for the ini file:
self.ini_filename = __name__ + '.save'
# choose widgets and attributes to be retained here:
# this descriptor will not retain any attrbuts,
# but the state of all widgets (HAL widgets and Gtk widgets
# (subject to widget types supported by gladevcp.persistence.accessors())
#self.defaults = { IniFile.vars: dict(),
# IniFile.widgets : widget_defaults(<widgetlist>)
# }
# this descriptor will retain the listed attributes, and only
# HAL widgets state:
self.defaults = { IniFile.vars: { 'afloat' : 1.67, 'anint' : 42, 'abool' : True, 'astring': 'sometext' },
IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(), hal_only=False,output_only = False))
}
self.ini = IniFile(self.ini_filename,self.defaults, self.builder)
# it is OK to use self.panel.widgets (all widgets) here because only
# widgets whose state was saved as per descriptor will be restored
self.ini.restore_state(self)
def get_handlers(halcomp,builder,useropts):
global debug
for cmd in useropts:
exec(cmd, globals())
# get some detail what save/restore etc are doing
set_debug(debug)
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,7 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
cd "$thisdir" || { echo "E: Could not change directory to '$thisdir'"; exit 1; }
gladevcp_demo -u ./functionhandler.py ./button.ui

View File

@@ -0,0 +1,9 @@
def on_button_press(button,data=None):
print ("button pressed")
def on_destroy(object,data=None):
print ("on_destroy")

View File

@@ -0,0 +1,8 @@
halrun:
Start halrun in an xterm
First command 'help' shows commands
Note:
Linuxcnc must not be running
Any other instance of halrun is terminated.

67
configs/apps/halrun/halrun.demo Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
prog=$(basename "$0")
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
HALFILE="$thisdir"/help.hal
# Don't care if cd succeeds. Just so user can use halcmd 'save' to create a file in $HOME
cd || true
function popup () {
msg="$*"
wish <<EOF &
wm withdraw .
tk_messageBox \
-title "$prog" \
-message "$msg" \
-icon error \
-type ok
destroy .
EOF
} ;# popup
[ "$TERM" = "dumb" ] && TERM=xterm
[ -x "$(which "$COLORTERM")" ] && TERM=$COLORTERM
[ -z "$TERM" ] && TERM=xterm
# wip: xterm is well-behaved, some other terminals are not
# for now: force to xterm
TERM=xterm
REALTIME=$(linuxcnc_var REALTIME)
# make sure TERM uses the expected halrun (rip or install)
HALRUN=$(which halrun)
if [ -n "$debug" ] ; then
echo "COLORTERM=$COLORTERM"
echo "TERM=$TERM"
echo "HALRUN=$HALRUN"
echo "REALTIME=$REALTIME"
fi
if $REALTIME status >/dev/null ; then
msg="$prog: LinuxCNC is active"
echo "$msg"
popup "$msg"
exit 1
fi
# terminate any other halrun instance:
$HALRUN -U >/dev/null 2>&1
if [ "$TERM" = "xterm" ] ; then
$TERM -geometry 80x40 \
-sb \
-fg black -bg ivory2 \
-title "halrun (Use Ctrl-L-button, Ctrl_R-button for xterm options)" \
-e "echo Working_Directory=$(pwd);echo; $HALRUN -I $HALFILE"
else
$TERM -e "$HALRUN -I $HALFILE"
fi
# cleanup
halrun -U >/dev/null 2>&1
exit 0

View File

@@ -0,0 +1,5 @@
# help.hal: for use with halrun.demo
# execute help statement to show commands
# before going interactive
help

View File

@@ -0,0 +1,4 @@
nodemocopy
.demo files in this dir will not be copied to user dir.
Los archivos .demo en este directorio no se copiaran al directorio de usuario.

3
configs/apps/info.demo Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
linuxcnc_info

9
configs/apps/info.txt Normal file
View File

@@ -0,0 +1,9 @@
info: Create a file with information about LinuxCNC and important system items.
The file is created in /tmp and is suitable for posting for aid in diagnosing problems.
Filename: /tmp/linuxcnc.info
The editor specified by $VISUAL will be used to open the file.
If $VISUAL is not set, other common editors will be tried.

9
configs/apps/info_es.txt Normal file
View File

@@ -0,0 +1,9 @@
info: crea un archivo con información sobre LinuxCNC y elementos importantes del sistema.
El archivo se crea en /tmp y es adecuado para su publicación como ayuda para diagnosticar problemas.
Nombre de archivo: /tmp/linuxcnc.info
El editor especificado por $VISUAL se utilizará para abrir el archivo.
Si $VISUAL no está establecido, se intentarán otros editores comunes.

View File

@@ -0,0 +1,15 @@
Latency evaluation programs
latency-histogram-1 -- Histogram jitter for a single servo thread
latency-histogram -- Histogram jitter for default base and servo threads
latency-plot -- Plot latencies for default base and servo threads
latency-test -- Standard test for linuxcnc
Note: The latency-plot and latency-histogram programs can be run from a terminal command line with more options, for help use:
latency-plot --help
latency-histogram --help

View File

@@ -0,0 +1,8 @@
#!/bin/bash
latency-histogram \
--nobase \
--show \
--sbinsize 1000 \
--sbins 200 \

View File

@@ -0,0 +1,3 @@
#!/bin/bash
latency-histogram --show

View File

@@ -0,0 +1,3 @@
#!/bin/bash
latency-plot

View File

@@ -0,0 +1,3 @@
#!/bin/bash
latency-test

View File

@@ -0,0 +1,3 @@
nodemocopy
.demo files in this dir will not be copied to user dir.
Los archivos .demo en este directorio no se copiaran al directorio de usuario.

4
configs/apps/nodemocopy Normal file
View File

@@ -0,0 +1,4 @@
nodemocopy
.demo files in this dir will not be copied to user dir.
Los archivos .demo en este directorio no se copiaran al directorio de usuario

View File

@@ -0,0 +1,19 @@
Parport Test using pyvcp
parport_0x278 test port 0x278 < parallel port 1 (not typical)
parport_0x378 test port 0x378 < parallel port 0
To find the onboard parallel port address open a terminal and type in:
cat /proc/ioports | grep parport
usually it will be parport0
0378-037a : parport0
To find out the address of a PCI parallel port type in:
lspci -v
Note: For simulator, a 'root access required' message may be displayed.
Using root is not recommended for running linuxcnc.

View File

@@ -0,0 +1,3 @@
nodemocopy
.demo files in this dir will not be copied to user dir.
Los archivos .demo en este directorio no se copiaran al directorio de usuario.

View File

@@ -0,0 +1,6 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
pyvcp_demo "$thisdir"/parport_test.xml "$thisdir"/parport_0x278.hal PortTest

View File

@@ -0,0 +1,2 @@
loadrt hal_parport cfg="0x278"
source parport_base.hal

View File

@@ -0,0 +1,6 @@
#!/bin/bash
thisfile=$(readlink -f "$0")
thisdir=$(dirname "$thisfile")
pyvcp_demo "$thisdir"/parport_test.xml "$thisdir"/parport_0x378.hal PortTest

View File

@@ -0,0 +1,2 @@
loadrt hal_parport cfg="0x378"
source parport_base.hal

View File

@@ -0,0 +1,28 @@
# adapted from work by J Thornton
loadrt threads name1=porttest period1=1000000
addf parport.0.read porttest
addf parport.0.write porttest
net pin01 PortTest.btn01 parport.0.pin-01-out PortTest.led-01
net pin02 PortTest.btn02 parport.0.pin-02-out PortTest.led-02
net pin03 PortTest.btn03 parport.0.pin-03-out PortTest.led-03
net pin04 PortTest.btn04 parport.0.pin-04-out PortTest.led-04
net pin05 PortTest.btn05 parport.0.pin-05-out PortTest.led-05
net pin06 PortTest.btn06 parport.0.pin-06-out PortTest.led-06
net pin07 PortTest.btn07 parport.0.pin-07-out PortTest.led-07
net pin08 PortTest.btn08 parport.0.pin-08-out PortTest.led-08
net pin09 PortTest.btn09 parport.0.pin-09-out PortTest.led-09
net pin14 PortTest.btn14 parport.0.pin-14-out PortTest.led-14
net pin16 PortTest.btn16 parport.0.pin-16-out PortTest.led-16
net pin17 PortTest.btn17 parport.0.pin-17-out PortTest.led-17
net pin10 parport.0.pin-10-in PortTest.led-10
net pin11 parport.0.pin-11-in PortTest.led-11
net pin12 parport.0.pin-12-in PortTest.led-12
net pin13 parport.0.pin-13-in PortTest.led-13
net pin15 parport.0.pin-15-in PortTest.led-15
start

View File

@@ -0,0 +1,245 @@
<!-- Test panel for the parallel port cfg for out -->
<pyvcp>
<hbox>
<labelframe text="Outputs">
<font>("Helvetica",16)</font>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn01"</halpin>
<text>"Pin 01"</text>
</button>
<led>
<halpin>"led-01"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn02"</halpin>
<text>"Pin 02"</text>
</button>
<led>
<halpin>"led-02"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn03"</halpin>
<text>"Pin 03"</text>
</button>
<led>
<halpin>"led-03"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn04"</halpin>
<text>"Pin 04"</text>
</button>
<led>
<halpin>"led-04"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn05"</halpin>
<text>"Pin 05"</text>
</button>
<led>
<halpin>"led-05"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn06"</halpin>
<text>"Pin 06"</text>
</button>
<led>
<halpin>"led-06"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn07"</halpin>
<text>"Pin 07"</text>
</button>
<led>
<halpin>"led-07"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn08"</halpin>
<text>"Pin 08"</text>
</button>
<led>
<halpin>"led-08"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn09"</halpin>
<text>"Pin 09"</text>
</button>
<led>
<halpin>"led-09"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn14"</halpin>
<text>"Pin 14"</text>
</button>
<led>
<halpin>"led-14"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn16"</halpin>
<text>"Pin 16"</text>
</button>
<led>
<halpin>"led-16"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn17"</halpin>
<text>"Pin 17"</text>
</button>
<led>
<halpin>"led-17"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</labelframe>
<labelframe text="Inputs">
<font>("Helvetica",16)</font>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 10"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-10"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 11"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-11"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 12"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-12"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 13"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-13"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 15"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-15"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</labelframe>
</hbox>
</pyvcp>

View File

@@ -0,0 +1,245 @@
<!-- Test panel for the parallel port cfg for out -->
<pyvcp>
<hbox>
<labelframe text="Salidas">
<font>("Helvetica",16)</font>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn01"</halpin>
<text>"Pin 01"</text>
</button>
<led>
<halpin>"led-01"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn02"</halpin>
<text>"Pin 02"</text>
</button>
<led>
<halpin>"led-02"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn03"</halpin>
<text>"Pin 03"</text>
</button>
<led>
<halpin>"led-03"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn04"</halpin>
<text>"Pin 04"</text>
</button>
<led>
<halpin>"led-04"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn05"</halpin>
<text>"Pin 05"</text>
</button>
<led>
<halpin>"led-05"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn06"</halpin>
<text>"Pin 06"</text>
</button>
<led>
<halpin>"led-06"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn07"</halpin>
<text>"Pin 07"</text>
</button>
<led>
<halpin>"led-07"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn08"</halpin>
<text>"Pin 08"</text>
</button>
<led>
<halpin>"led-08"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn09"</halpin>
<text>"Pin 09"</text>
</button>
<led>
<halpin>"led-09"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn14"</halpin>
<text>"Pin 14"</text>
</button>
<led>
<halpin>"led-14"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<button>
<halpin>"btn16"</halpin>
<text>"Pin 16"</text>
</button>
<led>
<halpin>"led-16"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
<button>
<halpin>"btn17"</halpin>
<text>"Pin 17"</text>
</button>
<led>
<halpin>"led-17"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</labelframe>
<labelframe text="Entradas">
<font>("Helvetica",16)</font>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 10"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-10"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 11"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-11"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 12"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-12"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 13"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-13"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
<hbox>
<relief>RIDGE</relief>
<bd>2</bd>
<label>
<text>"Pin 15"</text>
<font>("Helvetica",14)</font>
</label>
<led>
<halpin>"led-15"</halpin>
<size>25</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</labelframe>
</hbox>
</pyvcp>

Some files were not shown because too many files have changed in this diff Show More