aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorsaal2007-02-19 10:00:56 +0000
committersaal2007-02-19 10:00:56 +0000
commit76df41b5d4a2333bb233841fc01d8fd4e902da26 (patch)
tree08118b4578018cf6bf1f771d084914a34d402448 /Python
parent18d39f4903c1e19d11c8d7a2f8ddd756f9e4616b (diff)
downloadtkzinc-76df41b5d4a2333bb233841fc01d8fd4e902da26.zip
tkzinc-76df41b5d4a2333bb233841fc01d8fd4e902da26.tar.gz
tkzinc-76df41b5d4a2333bb233841fc01d8fd4e902da26.tar.bz2
tkzinc-76df41b5d4a2333bb233841fc01d8fd4e902da26.tar.xz
add method clone and __init__ in ZincItem class and modification of method clone of Zinc class
now the magicLens example in python should work fine
Diffstat (limited to 'Python')
-rw-r--r--Python/library/Zinc.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/Python/library/Zinc.py b/Python/library/Zinc.py
index 965a5f6..f9cb22d 100644
--- a/Python/library/Zinc.py
+++ b/Python/library/Zinc.py
@@ -233,7 +233,7 @@ class Zinc( Widget ):
def cget( self, option ):
"""
- val = zinc.cgetz(option)
+ val = zinc.cget(option)
"""
return self.tk.call( self._w, 'cget', '-' + option )
@@ -243,12 +243,12 @@ class Zinc( Widget ):
"""
self.tk.call( self._w, 'chggroup', *args )
- def clone( self, *args ):
+ def clone( self, *args, **kw):
"""
id = zinc.clone(tagOrId, **attributs)
"""
- return self.tk.call( self._w, 'clone', *args )
-
+ args = list( args ) + list( self._options( kw ) )
+ return self.tk.call( self._w, 'clone', *args)
def __oldconfigure( self, **kw ):
return Widget.configure( self, **kw )
@@ -900,9 +900,18 @@ class ZincItem:
translate = kw['translate']
del kw['translate']
+ if kw.has_key( 'cloneid' ):
+ cloneid = kw['cloneid']
+ del kw['cloneid']
+ else:
+ cloneid = 0
group = str( group )
- sys.stdout.flush()
- self.id = zinc.add( itemType, group, *args, **kw )
+ # sys.stdout.flush()
+ if cloneid == 0 :
+ self.id = zinc.add( itemType, group, *args, **kw )
+ else :
+ self.id = self.zinc.clone(cloneid, *args, **kw)
+
zinc.items[self.id] = self
texture = None
if fillpatern:
@@ -922,6 +931,19 @@ class ZincItem:
def bbox( self, *args ):
return self.zinc.bbox( self.id, *args )
+ def clone( self, *args, **kw):
+ '''id = zincitem.clone(*args,**kw) '''
+ # print "ZincItem::clone"
+ # on cherche tagOrId
+ # nidcloned = self.find_above(tagOrId)
+ sclonedtype = self.type()
+ sclonedgroupid = self.zinc.group(self.id)
+
+ # ajout cle 'cloneid' (voir ZincItem::__init__)
+ kw['cloneid'] = self.id
+ # on cree un nouveau ZincItem meme type,
+ return(ZincItem(self.zinc, sclonedtype, sclonedgroupid, **kw ))
+
def delete( self ):
del self.zinc.items[self.id]
try: