aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvidon2005-10-02 20:33:38 +0000
committervidon2005-10-02 20:33:38 +0000
commit05fd5a2423c1c1b0a7fcc302a1cc556fe40d66cb (patch)
treea733a356ccb850241d9c241f5c7ed69ff988d862
parent960cdf29197bc3f5922110cf26627aa9709ac79b (diff)
downloadtkzinc-bogue40.zip
tkzinc-bogue40.tar.gz
tkzinc-bogue40.tar.bz2
tkzinc-bogue40.tar.xz
Patch 14 de D. Pavet bogue #40bogue40
-rw-r--r--Python/library/Zinc.py.in57
1 files changed, 45 insertions, 12 deletions
diff --git a/Python/library/Zinc.py.in b/Python/library/Zinc.py.in
index 33ffdd8..ca08bb2 100644
--- a/Python/library/Zinc.py.in
+++ b/Python/library/Zinc.py.in
@@ -32,7 +32,6 @@ ZINC_LEADER=-4
ZINC_CONNECTION=-5
_LIBLOADED=0
_VERSION=""
-ZINC_NO_PART = ""
# current part dictionnary
ZINC_DPART = { 'position' : ZINC_CURRENT_POSITION,
@@ -80,8 +79,11 @@ class Zinc(Widget):
return("Zinc instance")
def __init__(self, master=None, cnf={}, **kw):
if kw.has_key('backward_compatibility'):
+ print "Zinc in backward_compatibility mode"
self.currentpart=self.__oldcurrentpart
self.configure=self.__oldconfigure
+ self.scale=self.__oldscale
+ self.translate=self.__oldtranslate
del kw['backward_compatibility']
if master :
self.version=havetkzinc(master)
@@ -280,7 +282,7 @@ class Zinc(Widget):
"""
return self.tk.call(self._w,'coords', *args)
- def __oldcurrentpart(self):
+ def __buggyoldcurrentpart(self):
'''
return a string (result from zinc current part function) and an
integer representing either the number of the field either
@@ -301,6 +303,37 @@ class Zinc(Widget):
# string to integer succeeded
scurrentp = "field"
return(scurrentp,rvalue)
+
+ def __oldcurrentpart(self):
+ '''return a string and an integer ;
+the string is among "field", "position", "speedvector", "leader", "connection", "",
+the number is the number of the part , or the field number in case of "field";
+ex:
+no part return '', ZINC_NO_PART
+'''
+ scurrentp = self.tk.call(self._w,'currentpart')
+ print "Zinc::__oldcurrentpart scurrentp = [%s]" % scurrentp
+ # warning : read this first :
+ # return a string among 'position', 'speedvector', 'leader', 'connection' ,''
+ # or an int representing the number of a field label
+ #
+ # print "Zinc::currentpart cp=%s ,type(cp)=%s" % (scurrentp,type(scurrentp))
+ if scurrentp == "":
+ rvalue = ZINC_NO_PART
+ elif type(scurrentp) == type(1):
+ # meaning a field
+ # the subtil thing is here ! warning !
+ rvalue = scurrentp
+ scurrentp = "field"
+ else:
+ # scurrentp is a string different from ""
+ try:
+ rvalue = ZINC_DPART[scurrentp]
+ except:
+ print "Zinc::currentpart unknown item part"
+ rvalue = ZINC_NO_PART
+
+ return scurrentp, rvalue
def currentpart(self):
'''
@@ -569,9 +602,9 @@ class Zinc(Widget):
return self.tk.getdouble(self.tk.call('scale'))
else:
if tagOrId == None:
- self.tk.call(self._w,'scale', (xFactor, yFactor))
+ self.tk.call(self._w,'scale', xFactor, yFactor)
else:
- self.tk.call(self._w,'scale', (tagOrId, xFactor, yFactor))
+ self.tk.call(self._w,'scale', tagOrId, xFactor, yFactor)
def scale(self, *args):
"""
@@ -725,14 +758,14 @@ class Zinc(Widget):
return self._getdoubles(self.tk.call(self._w, 'transform', *args))
#ANCIENNE IMPLEMENTATION
-# def translate(self, dx=None, dy=None, tagOrId=None):
-# if dx == None:
-# return self._getints(self.tk.call('translate'))
-# else:
-# if tagOrId == None:
-# self.tk.call('translate', (dx, dy))
-# else:
-# self.tk.call('translate', (tagOrId, dx, dy))
+ def __oldtranslate(self, dx=None, dy=None, tagOrId=None):
+ if dx == None:
+ return self._getints(self.tk.call('translate'))
+ else:
+ if tagOrId == None:
+ self.tk.call(self._w, 'translate', dx, dy )
+ else:
+ self.tk.call(self._w, 'translate', tagOrId, dx, dy)
def translate(self, *args):
"""