aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorlecoanet2000-01-12 13:56:04 +0000
committerlecoanet2000-01-12 13:56:04 +0000
commitdec60589aef2842b89e968759f702744bbefe06a (patch)
tree3697324b936bc2d7c1b53d026fad5f69f3558ffa /Python
parent2313c60a002d7d6550477aa2cdcf5ae30e1d10f7 (diff)
downloadtkzinc-dec60589aef2842b89e968759f702744bbefe06a.zip
tkzinc-dec60589aef2842b89e968759f702744bbefe06a.tar.gz
tkzinc-dec60589aef2842b89e968759f702744bbefe06a.tar.bz2
tkzinc-dec60589aef2842b89e968759f702744bbefe06a.tar.xz
Mise jour des commandes
Diffstat (limited to 'Python')
-rw-r--r--Python/Zinc.py307
1 files changed, 191 insertions, 116 deletions
diff --git a/Python/Zinc.py b/Python/Zinc.py
index 7f51cf7..d8705af 100644
--- a/Python/Zinc.py
+++ b/Python/Zinc.py
@@ -1,12 +1,29 @@
-#---------------------------------------------------------------
-# Project : SALSA
-# Module : xradar
-# File : Radar.py
-# Version : $Id$
-# Author : Frederic Lepied
-# Created On : Thu Jul 22 09:36:04 1999
-# Purpose : Python interface to the tkradar TCL package
-#---------------------------------------------------------------
+#
+# Radar.py -- Python interface to the tkradar widget.
+#
+# Authors : Frederic Lepied, Patrick Lecoanet
+# Created Date : Thu Jul 22 09:36:04 1999
+#
+# $Id$
+#
+#
+# Copyright (c) 1999 CENA --
+#
+# 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
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
__version__ = "$Revision$"
@@ -22,7 +39,7 @@ RADAR_CONNECTION=-5
def havetkradar(window):
try:
- window.tk.call('load', 'tkradar3.0.so')
+ window.tk.call('load', 'tkradar3.1.so')
# Call a function from the package to autoload it
# and verify that all is OK.
window.tk.call('radar')
@@ -50,48 +67,6 @@ class Radar(Widget):
(self._w, 'add', itemType)
+ args + self._options(cnf, kw)))
- def itemcget(self, tagOrId, option):
- return self._do('itemcget', (tagOrId, '-'+option))
-
- def itemfieldcget(self, tagOrId, field, option):
- return self._do('itemcget', (tagOrId, field, '-'+option))
-
- def itemconfigure(self, tagOrId, field=None, **kw):
- if not kw:
- cnf = {}
- for x in self.tk.split(
- field != None and self._do('itemconfigure', (tagOrId, field)) or
- self._do('itemconfigure', (tagOrId,))):
- #print x
- cnf[x[0][1:]] = (x[0][1:],) + x[1:]
- return cnf
- #print self._options({}, kw)
- if field != None:
- self._do('itemconfigure', (tagOrId, str(field),)
- + self._options({}, kw))
- else:
- self._do('itemconfigure', (tagOrId,)
- + self._options({}, kw))
- itemconfig = itemconfigure
-
- def translate(self, dx=None, dy=None, tagOrId=None):
- if dx == None:
- return self._getints(self._do('translate'))
- else:
- if tagOrId == None:
- self._do('translate', (dx, dy))
- else:
- self._do('translate', (tagOrId, dx, dy))
-
- def scale(self, xFactor=None, yFactor=None, tagOrId=None):
- if yFactor == None:
- return self.tk.getdouble(self._do('scale'))
- else:
- if tagOrId == None:
- self._do('scale', (xFactor, yFactor))
- else:
- self._do('scale', (tagOrId, xFactor, yFactor))
-
def addtag(self, *args):
self._do('addtag', args)
@@ -101,12 +76,15 @@ class Radar(Widget):
def addtag_all(self, newtag):
self.addtag(newtag, 'all')
+ def addtag_atpoint(self, newtag, x, y, halo=None, start=None):
+ self.addtag(newtag, 'atpoint', x, y, halo, start)
+
+ def addtag_atpriority(self, newtag, pri):
+ self.addtag(newtag, 'atpriority', pri)
+
def addtag_below(self, newtag, tagOrId):
self.addtag(newtag, 'below', tagOrId)
- def addtag_closest(self, newtag, x, y, halo=None, start=None):
- self.addtag(newtag, 'closest', x, y, halo, start)
-
def addtag_enclosed(self, newtag, x1, y1, x2, y2):
self.addtag(newtag, 'enclosed', x1, y1, x2, y2)
@@ -116,8 +94,39 @@ class Radar(Widget):
def addtag_withtag(self, newtag, tagOrId):
self.addtag(newtag, 'withtag', tagOrId)
- def classof(self, tagOrId):
- return self._do('class', (tagOrId,))
+ def addtag_withtype(self, newtag, type):
+ self.addtag(newtag, 'withtype', type)
+
+ def anchorxy(self, *args):
+ self._do('anchorxy', args)
+
+ def bbox(self, *args):
+ self._do('bbox', args)
+
+ def becomes(self, *args):
+ self._do('becomes', args)
+
+# def bind(self):
+# pass
+
+ def bind_tag(self, tagOrId, sequence=None, func=None, add=None):
+ return self._bind((self._w, 'bind', tagOrId),
+ sequence, func, add)
+
+# def cget(self):
+# pass
+
+ def chggroup(self, *args):
+ self._do('chggroup', args)
+
+ def clone(self, *args):
+ self._do('clone', args)
+
+# def configure(self):
+# pass
+
+ def coords(self, *args):
+ self._do('coords', args)
def currentpart(self):
return self.tk.getint(self._do('currentpart'))
@@ -134,12 +143,15 @@ class Radar(Widget):
def find_all(self):
return self.find('all')
+ def find_atpoint(self, x, y, halo=None, start=None):
+ return self.find('atpoint', x, y, halo, start)
+
+ def find_atpriority(self, pri):
+ return self.find('atpriority', pri)
+
def find_below(self, tagOrId):
return self.find('below', tagOrId)
- def find_closest(self, x, y, halo=None, start=None):
- return self.find('closest', x, y, halo, start)
-
def find_enclosed(self, x1, y1, x2, y2):
return self.find('enclosed', x1, y1, x2, y2)
@@ -149,49 +161,102 @@ class Radar(Widget):
def find_withtag(self, tagOrId):
return self.find('withtag', tagOrId)
+ def find_withtype(self, type):
+ return self.find('withtag', type)
+
def gettags(self, *args):
return self.tk.splitlist(self._do('gettags', args))
+ def group(self, *args):
+ self._do('group', args)
+
+ def hasanchors(self, *args):
+ self._do('hasanchors', args)
+
+ def hasfields(self, *args):
+ self._do('hasanchors', args)
+
+ def hasparts(self, *args):
+ self._do('hasanchors', args)
+
+# def hastag(self):
+# pass
+
+ def itemcget(self, tagOrId, option):
+ return self._do('itemcget', (tagOrId, '-'+option))
+
+ def itemfieldcget(self, tagOrId, field, option):
+ return self._do('itemcget', (tagOrId, field, '-'+option))
+
+ def itemconfigure(self, tagOrId, field=None, **kw):
+ if not kw:
+ cnf = {}
+ for x in self.tk.split(
+ field != None and self._do('itemconfigure', (tagOrId, field)) or
+ self._do('itemconfigure', (tagOrId,))):
+ #print x
+ cnf[x[0][1:]] = (x[0][1:],) + x[1:]
+ return cnf
+ #print self._options({}, kw)
+ if field != None:
+ self._do('itemconfigure', (tagOrId, str(field),)
+ + self._options({}, kw))
+ else:
+ self._do('itemconfigure', (tagOrId,)
+ + self._options({}, kw))
+ itemconfig = itemconfigure
+
+ def loweritem(self, *args):
+ self._do('lower', args)
+
+ def monitor(self, *args):
+ self._do('monitor', args)
+
+ def raiseitem(self, *args):
+ self._do('raise', args)
+
def remove(self, *args):
self._do('remove', args)
- def tag_bind(self, tagOrId, sequence=None, func=None, add=None):
- return self._bind((self._w, 'bind', tagOrId),
- sequence, func, add)
+ def rotate(self, *args):
+ self._do('rotate', args)
+
+ def scale(self, xFactor=None, yFactor=None, tagOrId=None):
+ if yFactor == None:
+ return self.tk.getdouble(self._do('scale'))
+ else:
+ if tagOrId == None:
+ self._do('scale', (xFactor, yFactor))
+ else:
+ self._do('scale', (tagOrId, xFactor, yFactor))
- def worldcoords(self, *args):
- return self._getints(self._do('worldcoords', args))
+ def tdelete(self, *args):
+ self._do('tdelete', args)
+
+ def transform(self, *args):
+ self._getints(self._do('transform', args))
+
+ def translate(self, dx=None, dy=None, tagOrId=None):
+ if dx == None:
+ return self._getints(self._do('translate'))
+ else:
+ if tagOrId == None:
+ self._do('translate', (dx, dy))
+ else:
+ self._do('translate', (tagOrId, dx, dy))
+
+ def treset(self, *args):
+ self._do('treset', args)
+
+ def trestore(self, *args):
+ self._do('trestore', args)
+
+ def tsave(self, *args):
+ self._do('tsave', args)
+
+ def type(self, tagOrId):
+ return self._do('type', (tagOrId,))
-# def addtag(self):
-# pass
-#
-# def bind(self):
-# pass
-#
-#
-# def cget(self):
-# pass
-#
-# def configure(self):
-# pass
-#
-# def dtag(self):
-# pass
-#
-# def find(self):
-# pass
-#
-# def gettags(self):
-# pass
-#
-# def hasfields(self):
-# pass
-#
-# def hastag(self):
-# pass
-#
-# def remove(self):
-# pass
class RadarItem:
def __init__(self, radar, itemType, *args, **kw):
@@ -226,49 +291,59 @@ class RadarItem:
def has_key(self, key):
return key in self.keys()
- def config(self, field=None, **kw):
- return apply(self.radar.itemconfig, (self.id, field), kw)
-
+ def bind(self, sequence=None, command=None, add=None):
+ self.radar.bind_tag(self.id, sequence, command, add)
+
def cget(self, attr):
return self.radar.itemcget(self.id, attr)
def fieldcget(self, field, attr):
return self.radar.itemfieldcget(self.id, field, attr)
- def bind(self, sequence=None, command=None, add=None):
- self.radar.tag_bind(self.id, sequence, command, add)
-
-class Track(RadarItem):
+class Arc(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'track') + args, kw)
-
-class WayPoint(RadarItem):
+ apply(RadarItem.__init__, (self, radar, 'arc') + args, kw)
+
+class Group(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'waypoint') + args, kw)
-
-class Macro(RadarItem):
+ apply(RadarItem.__init__, (self, radar, 'group') + args, kw)
+
+class Icon(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'macro') + args, kw)
-
+ apply(RadarItem.__init__, (self, radar, 'icon') + args, kw)
+
class Map(RadarItem):
def __init__(self, radar, *args, **kw):
apply(RadarItem.__init__, (self, radar, 'map') + args, kw)
-class MiniStrip(RadarItem):
+class Curve(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'ministrip') + args, kw)
+ apply(RadarItem.__init__, (self, radar, 'curve') + args, kw)
class Rectangle(RadarItem):
def __init__(self, radar, *args, **kw):
apply(RadarItem.__init__, (self, radar, 'rectangle') + args, kw)
-class Arc(RadarItem):
+class Reticle(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'arc') + args, kw)
+ apply(RadarItem.__init__, (self, radar, 'reticle') + args, kw)
-class Multipoint(RadarItem):
+class Tabular(RadarItem):
def __init__(self, radar, *args, **kw):
- apply(RadarItem.__init__, (self, radar, 'multipoint') + args, kw)
+ apply(RadarItem.__init__, (self, radar, 'tabular') + args, kw)
+
+class Text(RadarItem):
+ def __init__(self, radar, *args, **kw):
+ apply(RadarItem.__init__, (self, radar, 'text') + args, kw)
+
+class Track(RadarItem):
+ def __init__(self, radar, *args, **kw):
+ apply(RadarItem.__init__, (self, radar, 'track') + args, kw)
+
+class WayPoint(RadarItem):
+ def __init__(self, radar, *args, **kw):
+ apply(RadarItem.__init__, (self, radar, 'waypoint') + args, kw)
+
# Class to hold mapinfos used by the Map Item class
class Mapinfo: