" % (larg[0], larg[0])
+ mytoplevel.add_one_msg(sresult)
+ # lprint("[%s]" % sresult
+ IvySendMsg("goodday %s" % (larg[0]))
+
+def onmsgproc(*larg):
+ sresult = "On msg proc : arg number = %d , arglist = %s" % \
+ (len(larg), string.join(larg,":"))
+ mytoplevel.add_one_msg(sresult)
+
+ # abonnement selectif
+
+def oncmd(*larg):
+ global hellobindingid
+ lprint("hb =%d", hellobindingid)
+ lprint("cmd [%s] larg0=%s", string.join(larg,":"), larg[0])
+ if larg[0] == 'bindhello' :
+ if hellobindingid == -1 :
+ hellobindingid = IvyBindMsg(onhelloproc,"^hello (.*)")
+ lprint("binding hello id = %d ", hellobindingid)
+ elif larg[0] == 'unbindhello' :
+ if hellobindingid != -1 :
+ lprint("unbinding hello id = %d ", hellobindingid)
+ IvyUnBindMsg(hellobindingid)
+ hellobindingid = -1
+ elif larg[0] == 'getlist' :
+ sapplist = IvyGetApplicationList()
+ lprint("app list return %s" , sapplist)
+ for sapp in string.split(sapplist):
+ lprint("app name [%s] host [%s] ",
+ sapp, IvyGetApplicationHost(IvyGetApplication(sapp)))
+ lprint(IvyGetApplication(sapp))
+ elif larg[0] == 'senddie' :
+ sapplist = IvyGetApplicationList()
+ lprint("app list return %s", sapplist)
+ for sapp in string.split(sapplist):
+ lprint("sending die to %s ", sapp)
+ IvySendDieMsg(IvyGetApplication(sapp))
+ elif larg[0] == 'senderror' :
+ sapplist = IvyGetApplicationList()
+ lprint("app list return %s" , sapplist)
+ for sapp in string.split(sapplist):
+ lprint("sending error to %s " , sapp)
+ IvySendError(IvyGetApplication(sapp),0,
+ "error msg to %s from %s" % (sapp,IVYAPPNAME))
+ # print "[%s]" % sresult
+ # IvySendMsg("a recu et renvoi [%s]" % sargs)
+
+def ontick():
+ lprint("ontick")
+ IvySendMsg("testtk_tick")
+
+if __name__ == '__main__':
+ # initializing ivybus and isreadymsg
+ sivybus = ""
+ sisreadymsg = "[%s is ready]" % IVYAPPNAME
+ # getting option
+ try:
+ optlist, left_args = getopt.getopt(sys.argv[1:],'hb:', ['ivybus='])
+ except getopt.GetoptError:
+ # print help information and exit:
+ usage(sys.argv[0])
+ sys.exit(2)
+ for o, a in optlist:
+ if o in ("-h", "--help"):
+ usage(sys.argv[0])
+ sys.exit()
+ elif o in ("-b", "--ivybus"):
+ sivybus= a
+ if sivybus != "" :
+ sechoivybus = sivybus
+ elif os.environ.has_key("IVYBUS"):
+ sechoivybus = os.environ["IVYBUS"]
+ else:
+ sechoivybus = "ivydefault"
+ lprint("Ivy will broadcast on %s " , sechoivybus)
+
+ mytoplevel = TopLevel("%s top window" % IVYAPPNAME)
+ # myinterface = SocketInt(mytoplevel, delay = 2.0, iter = 5)
+ sisreadymsg = "%s is ready" % IVYAPPNAME
+ lprint("IvyApplicationConnected is %s " , IvyApplicationConnected)
+ lprint("IvyApplicationDisconnected is %s " , IvyApplicationDisconnected)
+ IvyInit(IVYAPPNAME, sisreadymsg, 1 , oncxproc, ondieproc )
+ IvyStart(sivybus)
+ bindingid = IvyBindMsg(onmsgproc, "([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) (.*)") # "(.*)")
+ # lprint("IvyBindMsg retourne %d" , bindingid )
+ bindingid = IvyBindMsg(oncmd, "^\.(.*)") # "(.*)")
+ # lprint("IvyBindMsg retourne %d", bindingid)
+
+ # timerid = IvyTimerRepeatAfter(10,1000,ontick)
+ # print("IvyTimerRepeatAfter retourne %d" % timerid
+ mytoplevel.after(1000,mytoplevel.ontick)
+
+ lprint("tk mainloop")
+ mytoplevel.mainloop()
+
diff --git a/docs/examples/vl_isa.py b/docs/examples/vl_isa.py
new file mode 100755
index 0000000..89c70fa
--- /dev/null
+++ b/docs/examples/vl_isa.py
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+""" very light isa hmi mockup
+prog de test infrastructure ivy + mini ihm type isa """
+
+import traceback, time, os, sys, string, getopt
+from Tkinter import *
+from ivycpy import *
+
+APPNAME = "vl_isa"
+
+def lprint(fmt,*arg):
+ print APPNAME + ": " + fmt % arg
+
+def usage(scmd):
+ lpathitem = string.split(scmd,'/')
+ fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] [-n APPNAME | --name=APPNAME]
+where
+\t-h provides the usage message;
+\t-n APPNAME | --name=APPNAME
+\t-b IVYBUS | --ivybus=IVYBUS allow to provide the IVYBUS string in the form
+\t adresse:port eg. 127.255.255.255:2010
+'''
+ print fmt % lpathitem[-1]
+
+def oncxproc(connected):
+ if connected == IvyApplicationDisconnected :
+ lprint("an IvyApplication was Disconnected")
+ else:
+ lprint("an IvyApplication was Connected")
+
+def ondieproc(id):
+ lprint("we ask me to die with id [%d]", id )
+
+class TopLevel(Tk) :
+ __single = 0
+ def __init__(self,appname = "TopLevel"):
+ if TopLevel.__single != 0 :
+ lprint("TopLevel is singleton")
+ sys.exit(1)
+ __single = 1
+ # the object is tk_root
+ Tk.__init__(self)
+ self.appname = appname
+ self.title(self.appname)
+ # Frame contenant heure et bouton quit
+ self.tkFheadpanel = Frame(self)
+ # Label hour
+ self.tkLhour = Label(self.tkFheadpanel,text="hh:mm:ss")
+ self.tkLhour.pack(padx=4 , pady=4 , side = LEFT)
+ # dummy button
+## self.tkBdummy = Button(self.tkFheadpanel,
+## text="dummy", bg='pink')
+## self.tkBdummy.pack(padx=4 , pady=4, side = RIGHT)
+
+ # button quit
+ self.tkBquit = Button(self.tkFheadpanel,
+ text="QUIT", bg='pink', command=self.quit)
+ self.tkBquit.pack(padx=4 , pady=4, side = RIGHT)
+ self.tkFheadpanel.pack(side=TOP)
+
+ # Frame contenant un Label, un Text et un Scroller
+ self.tkFreceive_msg = Frame(self)
+ # label
+ self.tkLreceive_msg = Label(self.tkFreceive_msg, text="flyingonthebus")
+ self.tkLreceive_msg.pack(padx=4 , pady=4,
+ side=TOP, fill = BOTH, expand = YES)
+ # Text
+ self.tkTreceive_msg = Text(self.tkFreceive_msg, height=26, width=50)
+ # Scrollbar
+ self.tkSBreceive_scroller = Scrollbar(
+ self.tkFreceive_msg,
+ command = self.tkTreceive_msg.yview)
+ self.tkTreceive_msg.configure(
+ yscrollcommand = self.tkSBreceive_scroller.set)
+
+ self.tkTreceive_msg.pack(padx=4 , pady=4,
+ side=LEFT, fill = BOTH, expand = YES)
+ self.tkSBreceive_scroller.pack(side=RIGHT, fill = Y)
+ self.tkFreceive_msg.pack(side=BOTTOM, fill = BOTH, expand = YES)
+
+ def add_one_msg(self, smsg) :
+ self.tkTreceive_msg.insert(END, "%s\n" % smsg )
+
+ def onmsgproc(self,*arg) :
+ self.add_one_msg(string.join(arg,""))
+
+ def quit(self):
+ # cleanup action before detroying tk_root
+ lprint("doing IvyStop")
+ IvyStop()
+ lprint("doing destroy" )
+ self.destroy()
+ lprint("after destroy")
+ lprint("done.")
+
+## def ontick(self):
+## lprint("on tick method")
+## IvySendMsg("testtk_tick")
+## self.after(1000,self.ontick)
+
+# main prog
+if __name__ == '__main__':
+ # setting some main variable
+ sivybus = ""
+
+ # getting option
+ try:
+ optlist, left_args = getopt.getopt(sys.argv[1:],'hb:n:', ['ivybus=','name'])
+ except getopt.GetoptError:
+ # print help information and exit:
+ usage(sys.argv[0])
+ sys.exit(2)
+ for o, a in optlist:
+ if o in ("-h", "--help"):
+ usage(sys.argv[0])
+ sys.exit()
+ elif o in ("-b", "--ivybus"):
+ sivybus = a
+ elif o in ("-n","--name"):
+ APPNAME = a
+ if sivybus != "" :
+ sechoivybus = sivybus
+ elif os.environ.has_key("IVYBUS"):
+ sechoivybus = os.environ["IVYBUS"]
+ else:
+ sechoivybus = "ivydefault"
+ lprint("Ivy will broadcast on %s " , sechoivybus)
+
+ # initializing ivy : isreadymsg
+ sisreadymsg = "[%s is ready]" % APPNAME
+ IvyInit(APPNAME, sisreadymsg, 1 , oncxproc, ondieproc )
+ IvyStart(sivybus)
+
+ # initializing top hmi part
+ mytoplevel = TopLevel("%s top window" % APPNAME)
+
+ # doing suited binding
+ IvyBindMsg(mytoplevel.onmsgproc , "(.*)")
+
+ mytoplevel.mainloop()
diff --git a/docs/html/.cvsignore b/docs/html/.cvsignore
new file mode 100644
index 0000000..64233a9
--- /dev/null
+++ b/docs/html/.cvsignore
@@ -0,0 +1 @@
+index.html
\ No newline at end of file
diff --git a/docs/html/index_tpl.html b/docs/html/index_tpl.html
new file mode 100644
index 0000000..1c96948
--- /dev/null
+++ b/docs/html/index_tpl.html
@@ -0,0 +1,65 @@
+
+
+Ivycpy - a wrapper around ivy-c to get a Python stub to Ivy
+
+
+
+
+ivycpy - a wrapper around ivy-c to get a Python stub to Ivy
+
+Current version is _VERSION_.
+
+ivycpy library procures a way to connect Python/Python-Tkinter application
+on an Ivy bus.
+
+
+This current source version allows to link ivycpy with locally
+installed version of [tcl/tk, adapted version of
+[Python/Tkinter]]. ivycpy requires still some patches on _tkinter.c
+(see dev docs for further information). As a
+consequence, ivycpy is not presented as debian package any more. The
+source package allows to install the software as an OPTional package.
+
+This version is strictly compatible with ivy-c [3.2 .. 3.6] and can be
+dynamically linked to a new version of ivy-c, if ivy-c api is unchanged which is
+quite unlikely.
+
+So provided that, you installed compatible version of tcl/tk and
+Python/Tkinter (adapted by yourself), ivy-c and ivy-c-dev, it should be easy to
+rebuilt a new version of ivycpy adapted to the needs. See for building instructions
+
+A former version ivycpy213sa has been delivered as a debian package
+tightly linked with woody 3.0 set of package , ie.:
+
+ - ivyc library (3.4)
+
- tcl/tk 8.3
+
- Python 2.1.3
+
+but it was clearly immatured and awkward !
+
+
+
+ivycpy is not a native python language binding to Ivy but, a wrapper around C
+level functions. ivycpy was made with swig
+(Scripting Wrapper Interface Generator). For a high level view of the python
+api, have a look to ivycpy_wrap.html. For a hands on experience, see, next section.
+
+
+To have a clear view of how to use this library, please, have a look at the
+examples normally accessible at examples.
+
+
+See Ivy home page at
+www.tls.cena.fr/products/ivy to obtain detailed information about ivy.
+
+
+Didier Pavet <pavet@cena.fr>
+
+This software is free software under Library GNU Public License; see ./copyright for detail and references.
+
+
+
+Last modified: Thu Sep 9 16:14:00 CEST 2004
+
+
diff --git a/docs/html/ivycpy_wrap.html b/docs/html/ivycpy_wrap.html
new file mode 100644
index 0000000..82052ea
--- /dev/null
+++ b/docs/html/ivycpy_wrap.html
@@ -0,0 +1,93 @@
+
+
+
+ivycpy_wrap.c
+
+ivycpy_wrap.c
+[ Python Module : ivycpy ]
+
+IvyApplicationConnected = IvyApplicationConnected
+
[ Constant: int ]
+
+
+IvyApplicationDisconnected = IvyApplicationDisconnected
+
[ Constant: int ]
+
+
+IvyInit(AppName,ready,loopmode,PyFuncOnCx,PyFuncOnDie)
+
[ returns void ]
+
void *die_data ); user data
+
+
+IvyBindMsg(PyFunc,msg)
+
[ returns int ]
+
+
+IvyUnBindMsg(binding_id)
+
[ returns void ]
+
+
+IvyStart(char *)
+
[ returns void ]
+
+
+IvyStop()
+
[ returns void ]
+
+
+IvySendMsg(message)
+
[ returns int ]
+
+
+IvyMainLoop()
+
[ returns void ]
+
+
+IvyGetApplicationList()
+
[ returns char * ]
+
+
+IvyGetApplication(name)
+
[ returns IvyClientPtr ]
+
+
+IvyGetApplicationName(app)
+
[ returns char * ]
+
+
+IvyGetApplicationHost(app)
+
[ returns char * ]
+
emission d'un message d'erreur
+
+
+IvySendError(app,id,message)
+
[ returns void ]
+
+
+IvySendDieMsg(app)
+
[ returns void ]
+
+
+IvySendDirectMsg(app,id,msg)
+
[ returns void ]
+
+
+IvyBindDirectMsg(PyFunc)
+
[ returns void ]
+
+
+IvyTimerRepeatAfter(count,time,PyFunc)
+
[ returns int ]
+
+
+IvyTimerModify(timerid,time)
+
[ returns void ]
+
+
+IvyTimerRemove(timerid)
+
[ returns void ]
+
+
+
+
+
--
cgit v1.1