From 64089dca388f5a9a8235a94b4372763875132219 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 2 Feb 2000 14:01:15 +0000 Subject: Passage en Zinc --- Python/Zinc.py | 116 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'Python') diff --git a/Python/Zinc.py b/Python/Zinc.py index d8705af..1420d8a 100644 --- a/Python/Zinc.py +++ b/Python/Zinc.py @@ -1,5 +1,5 @@ # -# Radar.py -- Python interface to the tkradar widget. +# Zinc.py -- Python interface to the tkzinc widget. # # Authors : Frederic Lepied, Patrick Lecoanet # Created Date : Thu Jul 22 09:36:04 1999 @@ -31,25 +31,25 @@ import types from Tkinter import * from Tkinter import _cnfmerge, _flatten -RADAR_NO_PART=-1 -RADAR_CURRENT_POSITION=-2 -RADAR_SPEED_VECTOR=-3 -RADAR_LEADER=-4 -RADAR_CONNECTION=-5 +ZINC_NO_PART=-1 +ZINC_CURRENT_POSITION=-2 +ZINC_SPEED_VECTOR=-3 +ZINC_LEADER=-4 +ZINC_CONNECTION=-5 -def havetkradar(window): +def havetkzinc(window): try: - window.tk.call('load', 'tkradar3.1.so') + window.tk.call('load', 'tkzinc3.1.so') # Call a function from the package to autoload it # and verify that all is OK. - window.tk.call('radar') + window.tk.call('zinc') except TclError: return 0 return 1 -class Radar(Widget): +class Zinc(Widget): def __init__(self, master=None, cnf={}, **kw): - Widget.__init__(self, master, 'radar', cnf, kw) + Widget.__init__(self, master, 'zinc', cnf, kw) self.items = {} def add(self, itemType, *args, **kw): @@ -258,11 +258,11 @@ class Radar(Widget): return self._do('type', (tagOrId,)) -class RadarItem: - def __init__(self, radar, itemType, *args, **kw): - self.radar = radar - self.id = apply(radar.add, (itemType,) + args, kw) - radar.items[self.id] = self +class ZincItem: + def __init__(self, zinc, itemType, *args, **kw): + self.zinc = zinc + self.id = apply(zinc.add, (itemType,) + args, kw) + zinc.items[self.id] = self def __str__(self): return str(self.id) @@ -271,19 +271,19 @@ class RadarItem: return str(self.id) def delete(self): - del self.radar.items[self.id] - self.radar.delete(self.id) + del self.zinc.items[self.id] + self.zinc.delete(self.id) def __getitem__(self, key): - return self.radar.itemcget(self.id, key) + return self.zinc.itemcget(self.id, key) def __setitem__(self, key, value): - self.radar.itemconfig(self.id, {key: value}) + self.zinc.itemconfig(self.id, {key: value}) def keys(self): if not hasattr(self, '_keys'): self._keys = {} - config=self.radar.itemconfig(self.id) + config=self.zinc.itemconfig(self.id) for x in config.keys(): self._keys[x] = config[x][1] return self._keys @@ -292,57 +292,57 @@ class RadarItem: return key in self.keys() def bind(self, sequence=None, command=None, add=None): - self.radar.bind_tag(self.id, sequence, command, add) + self.zinc.bind_tag(self.id, sequence, command, add) def cget(self, attr): - return self.radar.itemcget(self.id, attr) + return self.zinc.itemcget(self.id, attr) def fieldcget(self, field, attr): - return self.radar.itemfieldcget(self.id, field, attr) + return self.zinc.itemfieldcget(self.id, field, attr) -class Arc(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'arc') + args, kw) +class Arc(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'arc') + args, kw) -class Group(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'group') + args, kw) +class Group(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'group') + args, kw) -class Icon(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'icon') + args, kw) +class Icon(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'icon') + args, kw) -class Map(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'map') + args, kw) +class Map(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'map') + args, kw) -class Curve(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'curve') + args, kw) +class Curve(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'curve') + args, kw) -class Rectangle(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'rectangle') + args, kw) +class Rectangle(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'rectangle') + args, kw) -class Reticle(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'reticle') + args, kw) +class Reticle(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'reticle') + args, kw) -class Tabular(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'tabular') + args, kw) +class Tabular(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'tabular') + args, kw) -class Text(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'text') + args, kw) +class Text(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'text') + args, kw) -class Track(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'track') + args, kw) +class Track(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'track') + args, kw) -class WayPoint(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'waypoint') + args, kw) +class WayPoint(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'waypoint') + args, kw) # Class to hold mapinfos used by the Map Item class @@ -375,4 +375,4 @@ class Videomap (Mapinfo): print args apply(self.tk.call, ('videomap', 'load') + args + (self,)) -# Radar.py ends here +# Zinc.py ends here -- cgit v1.1