From a5803c3a3e49d5d10e017a70c9e94d0545d59a09 Mon Sep 17 00:00:00 2001 From: pavet Date: Thu, 9 Sep 2004 15:33:37 +0000 Subject: Initial revision --- docs/copyright | 31 +++++++ docs/dev/BUGS | 2 + docs/dev/TODO | 32 +++++++ docs/dev/TODO_SITEIVY | 80 ++++++++++++++++++ docs/dev/how2build.html | 29 +++++++ docs/dev/maintainer_notes.txt | 104 +++++++++++++++++++++++ docs/examples/.cvsignore | 1 + docs/examples/pyhello.py | 94 +++++++++++++++++++++ docs/examples/testtk.py | 192 ++++++++++++++++++++++++++++++++++++++++++ docs/examples/vl_isa.py | 140 ++++++++++++++++++++++++++++++ docs/html/.cvsignore | 1 + docs/html/index_tpl.html | 65 ++++++++++++++ docs/html/ivycpy_wrap.html | 93 ++++++++++++++++++++ 13 files changed, 864 insertions(+) create mode 100644 docs/copyright create mode 100644 docs/dev/BUGS create mode 100644 docs/dev/TODO create mode 100644 docs/dev/TODO_SITEIVY create mode 100644 docs/dev/how2build.html create mode 100644 docs/dev/maintainer_notes.txt create mode 100644 docs/examples/.cvsignore create mode 100755 docs/examples/pyhello.py create mode 100755 docs/examples/testtk.py create mode 100755 docs/examples/vl_isa.py create mode 100644 docs/html/.cvsignore create mode 100644 docs/html/index_tpl.html create mode 100644 docs/html/ivycpy_wrap.html (limited to 'docs') diff --git a/docs/copyright b/docs/copyright new file mode 100644 index 0000000..5998bd1 --- /dev/null +++ b/docs/copyright @@ -0,0 +1,31 @@ +This package is maintained by Didier Pavet . + +It was probably downloaded from Cvs data base : Cena/Pii: /projet/ivy/cvsroot + +Copyright: + + Copyright (c) 2003,2004 CENA, Didier Pavet -- + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This code 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this code; if not, write to the Free + Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + +Note : + +- Ivy (http://www.tls.cena.fr/products/ivy/) is proposed under LGPL license. + +- Python and Tkinter 2.1 and older are now proposed under the BEOPEN PYTHON OPEN +SOURCE LICENSE AGREEMENT VERSION 1 by the Python Software Foundation. +See http://www.python.org/psf/ for more information about the PSF. + diff --git a/docs/dev/BUGS b/docs/dev/BUGS new file mode 100644 index 0000000..181ec3d --- /dev/null +++ b/docs/dev/BUGS @@ -0,0 +1,2 @@ +None reported up-to-now ; + diff --git a/docs/dev/TODO b/docs/dev/TODO new file mode 100644 index 0000000..0ef6a7f --- /dev/null +++ b/docs/dev/TODO @@ -0,0 +1,32 @@ +evolutions du mode de fabrication de la librairie ivycpy.so : +clarifier avec Martin les besoins en macro m4 ; + + +préparer une version 0.4 ayant ces caractéristiques : +------------------------------------------------------------ +o0 : ajouter les dépendances d'outils de fabrication +install +swig +ivy test include +python test include + +les dépendances de header (include) + +o1 : faciliter le cablage adhoc avec les librairies "dépendances" +(dont ivycpy dépend): +- libivy.so , libtclivy.so +- _tkinter.so (et donc python) +- libtcl + +o2 : faciliter la realisation à la fois : +- installation adhoc (a partir des sources) avec une target +- paquet debian + +o3 : nettoyer le paquet des anciens modes de travail + +o4 : ajouter bindirect dans l'interface et ds les exemples; + +o5 : faire une version 0.4 source et debian ; + +préparer une version beta 0.5 indépendante de python +------------------------------------------------------------ \ No newline at end of file diff --git a/docs/dev/TODO_SITEIVY b/docs/dev/TODO_SITEIVY new file mode 100644 index 0000000..6622824 --- /dev/null +++ b/docs/dev/TODO_SITEIVY @@ -0,0 +1,80 @@ +From: Marcellin Buisson , +To: François-Régis Colin , + Yannick Jestin , + Christophe Mertz , + Didier PAVET , + pascal.brisset@recherche.enac.fr, + Stéphane Chatty , + Sébastien Maury , + alexandre bustico , + Philippe Truillet , + Alexandre Lemort , Eric Blond , +Cc: Marcellin Buisson , + Gwenael BOTHOREL , +Subject: Ivy, web, sources, binaires et compagnie...., +Date: Mon, 14 Jun 2004 18:17:28 +0200, +Mcnf-Status: ok +Mcnf-Date: Mon Jun 14 18:19:40 2004 +Mcnf-Att: "/pcnfs/usagers/pavet/.amcnf/msg-1622-1.txt" + + Bonjour à tous, + + C'est en tant qu'auteurs ou empaqueteurs usuels des différentes +portages ivy que je sollicite votre aide et vous offre la lecture qui +suit :o) + + Comme vous avez pu le constater par vous même (ou comme vous le voyez +en vous rendant sur +http://www.tls.cena.fr/products/ivy/download/index.html), les sources +et les binaires des différents portages d'ivy qui sont distribuées sur +le site web datent un peu..ou sont incomplets.. bref c'est un peu le +bazar... + + En tant que mainteneur du site web ivy (et donc responsable de +l'obsolescence du code mis en ligne) , je me trouve confronté à +plusieurs problèmes : + + - quand mettre à jour les sources d'un portage ? + (notion de version d'ivy par exemple, pour environ 10 langages +supportés différents, à des états d'avancement différents ) + + - comment gérer les différents empaquetages ? + (pour 5 ou 6 architectures, et quelques unes exotiques) + + - comment respecter la LGPL dans notre distribution ? + (actuellement par exemple le texte de la LGPL, ou une reference à +celle-ci n'est pas présent dans tous les sources disponibles : +http://www.gnu.org/copyleft/lesser.txt) + + En l'absence pour le moment d'un espace de collaboration en ligne type +wiki, d'un accès anonyme la la base CVS ivy du CENA, ainsi que de +méthodes éprouvées pour *livrer* une version d'ivy, je vous propose la +chose suivante (si vous voyez une autre façon de faire, n'hésitez pas à +la proposer ! ) : + + Pour le source non disponible actuellement sur la base cvs du CENA +(c'est-à-dire tout sauf ivy-ada, ivy-c, ivy-c++, ivy-java, ivy-perl), +les auteurs des différents ports pourraient-ils m'envoyer une version +actualisée et respectant la LGPL du source (tar.gz par exemple) +estampillée "ivy-port-juin-2004" et que vous m'autoriseriez à mettre +dans la base cvs du CENA ? (je pense notamment à ivy-csharp, +ivy-python, ivy-metacard, ivy-caml, ivy-flash, ivy-com) + + Pour le source déjà disponible dans la base cvs, pourriez-vous m'aider +à inclure les fichiers de licences corrects et à vérifier qu'il est en +état (c'est à dire compile par exemple, avec des makefile corrects) + + Ce sera une première étape. + + La seconde étape, c'est de livrer un certain nombre de paquets +correspondants à cette livraison de sources. J'aurais alors besoin de +votre aide pour empaqueter sous windows, Mandrake 10.0, debian woody et +sarge, ipaq, macos X etc etc). Ce qui devrait me permettre ensuite de +mettre à jour les pages web ivy et donc de contribuer à son +rayonnement, son expansion..sa prolifération et ainsi de suite... + + J'attends vos idées, réactions, et surtout votre aide !! + +Viva ivy et bonne soirée, + +Marcellin. diff --git a/docs/dev/how2build.html b/docs/dev/how2build.html new file mode 100644 index 0000000..738bf8e --- /dev/null +++ b/docs/dev/how2build.html @@ -0,0 +1,29 @@ + + +Ivycpy - buiding instructions + + + +

Ivycpy - buiding instructions

+

First of all ivycpy is building process is managed by autoconf.

+

You should have to do the following actions: +

    +
  • say to configure where is ivy-c lib and include files (LD_LIBRARY_PATH , CPPFAGS) +
  • say to configure where is your version of Python (LD_LIBRARY_PATH , +CPPFAGS) (Note: a specific version is required exporting some MACRO def) +
  • launching configure with the suited location of tcl/tk configuration file tclConfig.sh and your target + destination:
    + ./configure --prefix=/opt/ivycpy-dp --with-tcl=/opt/tcltk-8.4.5/lib/
    + verify that every test is ok; normally if all is ok, you should be capable to compile and install + without any problems. +
  • make +
  • make install +
+

+ + +
+ +Last modified: Mon May 24 16:43:51 CEST 2004 + + diff --git a/docs/dev/maintainer_notes.txt b/docs/dev/maintainer_notes.txt new file mode 100644 index 0000000..54a6147 --- /dev/null +++ b/docs/dev/maintainer_notes.txt @@ -0,0 +1,104 @@ +Echanges avec Martin Loewis concerant les évolutions de Python et Tkinter +liés au wrapper python <-> ivy + + + +Date: Sun, 13 Jul 2003 18:49:35 +0200 +From: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.4) Gecko/20030624 +X-Accept-Language: de, en-us, en +To: Didier PAVET +Subject: Re: a request / tkinter (ENTER_TCL ENTER_PYTHON macro) +In-Reply-To: <200307100715.JAA18790@basilic.dev.ath.cena.fr> +Content-Type: text/plain; charset=us-ascii; format=flowed +X-Seen: false +X-ID: rfGYOMZcgeZyNlhDQlB5laNXLu1X06U3wOOZDJ0mi2oMCVtqUb+aQc@t-dialin.net + +Didier PAVET wrote: + +> Have you allready heard some request in that sens ? + +Dear Didier, + +Yes, this is a SourceForge feature request, see + +http://python.org/sf/539907 + +> Does it stand sensible that this patch could be integrated in Python/Tkinter +> distribution and are you the right man to do that ? + +In some form, yes, certainly. Merely copying the macros into a header +file is not sufficient though: the code has been become much more +complex since 2.1, as we now also need to support multi-threaded Tcl +installations. + +Also, in general, you cannot access C variables across different +Python extension modules. Instead, you need to expose a CObject of some +kind. Instead of having that C object refer to the Tcl lock, I'd rather +provide access to some higher-level function pointers which can take +into account the various Tcl installations. + +I'd encourage you to work on this for Python 2.4. Please make either +Python 2.3 or the Python CVS your starting point, and please submit +unified diffs to sf.net/projects/python when you are done. + +If you have any questions about this approach, don#t hesitate to ask. + +Regards, +Martin + + +Date: 10 Jul 2003 09:07:08 +0200 +From: Didier PAVET +To: martin@v.loewis.de +Subject: a request / tkinter (ENTER_TCL ENTER_PYTHON macro) + +Martin, + +First of all, thank you for the job to maintain and upgrade python's stuff. +My organisation (french R&D center for air navigation) currently benefits from +python , tkinter material to build prototype, mock-up and so all. + +I have a request concerning _tkinter.h and _tkinter.c . In fact, in order to +build a python wrapper to an in-house middleware library built in C, I have +faced a problem with macro which aim at protecting interaction between tcl/tk +mainloop, thread and so on . I mean these macro ; +ENTER_TCL +LEAVE_TCL +ENTER_PYTHON +LEAVE_PYTHON + +For the moment, these macros are private to _tkinter module and so defined in +_tkinter.c. My need is to be capable from an external python module (in fact +my wrapper) to use (and so to share the data) these macros. + +I have allready carried out a solution patching Python 2.1.3 distribution and +packing my library to verify that it works . The solution is to externalize +and put the macros definition in the header _tkinter.h and allow external +access to lock as tcl_lock, tcl_state . + +2 requests : + +Have you allready heard some request in that sens ? +Does it stand sensible that this patch could be integrated in Python/Tkinter +distribution and are you the right man to do that ? + +Many thanks in advance for your help; it is clear for me that a positive +answer would avoid me to deliver my wrapper with a patched version of +Tkinter (solution which is pretty not handy). + +I just attached as a tar file my version of _tkinter.h and _tkinter.c derived +from Python 2.1.3 (debian woody stable version). + +Didier +-- +Didier PAVET Centre d'Etudes de La Navigation Aerienne / (Chef division ICS) +Office location Phone: (33 1) 69 57 68 89 - Fax: (33 1) 69 57 68 52 +B1608 b025 ou 01 69 57 68 89 ou 01 69 57 68 52 +E-mail: pavet@ath.cena.fr WWW: http://www.ath.cena.fr/~pavet + +Note : the middleware, target of my wrapper is Ivy; +have a look at +http://www.tls.cena.fr/products/ivy/ or +http://freshmeat.net/projects/ivy/ + diff --git a/docs/examples/.cvsignore b/docs/examples/.cvsignore new file mode 100644 index 0000000..93baa45 --- /dev/null +++ b/docs/examples/.cvsignore @@ -0,0 +1 @@ +env.sh \ No newline at end of file diff --git a/docs/examples/pyhello.py b/docs/examples/pyhello.py new file mode 100755 index 0000000..e0db498 --- /dev/null +++ b/docs/examples/pyhello.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +""" pyhello.py : very simple hello world python program using ivycpy +with a local main loop +""" +import traceback, time, string, os, sys, getopt +# importing ivycpy +from ivycpy import * + +IVYAPPNAME = "pyhello" + +def lprint(fmt,*arg): + print IVYAPPNAME + ": " + fmt % arg + +def usage(scmd): + lpathitem = string.split(scmd,'/') + fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] +where +\t-h provides the usage message; +\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 Ivy application was disconnected ") + else: + lprint( "An Ivy application was connected") + lprint("currents Ivy application are [%s]", IvyGetApplicationList()) + +def ondieproc(id): + lprint( "received the order to die with id = %d", id) + +def onmsgproc(*larg): + lprint( "%s received [%s] ", IVYAPPNAME , larg[0]) + +def onhello(*larg): + sreply = "goodday %s to=%s from=%s " % (larg[0], larg[1],IVYAPPNAME) + lprint( "on hello , %s reply [%s]", IVYAPPNAME, sreply) + IvySendMsg(sreply) + +def ontick(): + lprint( "%s send a tick", IVYAPPNAME) + IvySendMsg("%s_tick" % IVYAPPNAME) + +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) + + # initialising the bus + IvyInit(IVYAPPNAME, # application name for Ivy + sisreadymsg , # ready message + 0, # main loop is local (ie. using IvyMainloop) + oncxproc, # handler called on connection/deconnection + ondieproc # handler called when a diemessage is received + ) + # starting the bus + # Note: env variable IVYBUS will be used if no parameter or empty string + # is given ; this is performed by IvyStart (C) + IvyStart(sivybus) + # binding to every message + IvyBindMsg(onmsgproc, "(.*)") + # binding on dedicated message : starting with "hello ..." + IvyBindMsg(onhello, "^hello=([^ ]*) from=([^ ]*)") + # creating a infinite timer + timerid = IvyTimerRepeatAfter(0, # number of time to be called + 1000, # delay in ms between calls + ontick # handler to call + ) + lprint( "IvyTimerRepeatAfter id is %d", timerid) + + lprint( "%s doing IvyMainLoop", IVYAPPNAME) + IvyMainLoop() diff --git a/docs/examples/testtk.py b/docs/examples/testtk.py new file mode 100755 index 0000000..13bb1f9 --- /dev/null +++ b/docs/examples/testtk.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python +""" programme de test de ivycpy en mode boucle tk """ + +import traceback, time, os, sys, string, getopt +from Tkinter import * +from ivycpy import * + +IVYAPPNAME = "pytesttk" + +def lprint(fmt,*arg): + print IVYAPPNAME + ": " + fmt % arg + +def usage(scmd): + lpathitem = string.split(scmd,'/') + fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] +where +\t-h provides the usage message; +\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] + +global hellobindingid +hellobindingid = -1 + +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 Text et un Scroller + self.tkFreceive_msg = Frame(self) + # 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 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) + +def oncxproc(connected): + if connected == IvyApplicationDisconnected : + lprint("an IvyApplication was Disconnected") + else: + lprint("an IvyApplication was Connected") + +def ondieproc(id): + lprint("On die proc id=%d", id ) + +def onhelloproc(*larg): + sargs = string.join(larg,":") + sresult = "On , i reply " % (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 + + + +

NAME

+ivycpy - a wrapper around ivy-c to get a Python stub to Ivy +

VERSION

+

Current version is _VERSION_.

+

SYNOPSIS

+

ivycpy library procures a way to connect Python/Python-Tkinter application +on an Ivy bus. +

WARNING

+ +

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 ! +

+

DESCRIPTION

+ +

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.

+ +

EXAMPLES

+

To have a clear view of how to use this library, please, have a look at the +examples normally accessible at examples.

+ +

SEE ALSO

+See Ivy home page at +www.tls.cena.fr/products/ivy to obtain detailed information about ivy. + +

AUTHORS

+Didier Pavet <pavet@cena.fr> +

COPYRIGHT

+

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