#
__version__="$Name: $"
-__Id__="$Id: treewidget.py,v 1.26 2005/11/03 09:03:49 eficas Exp $"
+__Id__="$Id: treewidget.py,v 1.29 2005/11/29 17:39:50 eficas Exp $"
#
Fonte_Standard = fontes.standard
self.item = jdc_item
self.scrolledcanvas = scrolledcanvas
self.canvas = self.scrolledcanvas.component('canvas')
- self.id_up=self.canvas.bind("<Key-Prior>", self.page_up)
- self.id_down=self.canvas.bind("<Key-Next>", self.page_down)
- #self.id_uup=self.canvas.bind("<Key-Up>", self.unit_up)
- #self.id_udown=self.canvas.bind("<Key-Down>", self.unit_down)
+ self.id_up=self.canvas.bind("<F11>", self.page_up)
+ self.id_down=self.canvas.bind("<F12>", self.page_down)
self.id_um=self.canvas.bind("<Key-Left>", self.mot_up)
self.id_dm=self.canvas.bind("<Key-Right>", self.mot_down)
self.id_s=self.canvas.bind("<1>", self.canvas_select)
self.canvas.focus_set()
def mot_up_force(self):
- self.node_selected.select_mot_previous()
+ self.node_selected.select_mot_prev()
self.canvas.focus_set()
+ def deplieReplieNode(self):
+ self.node_selected.deplieReplieNode()
+
def build_children(self):
""" Construit la liste des enfants de self """
self.children = []
#print "supprime",self
self.canvas.unbind("<Key-Prior>",self.id_up)
self.canvas.unbind("<Key-Next>",self.id_down)
- self.canvas.unbind("<Key-Up>",self.id_uup)
- self.canvas.unbind("<Key-Down>",self.id_udown)
self.canvas.unbind("<Key-Left>",self.id_um)
self.canvas.unbind("<Key-Right>",self.id_dm)
self.canvas.unbind("<1>",self.id_s)
self.parent = parent
self.item = item
self.connect()
-
self.command = command
self.rmenu=rmenu
self.tree = self.parent.tree
def tag_move_nodes(self,y):
""" Marque pour deplacement tous les noeuds au dela de l'ordonnée y """
+ #print "tag_move_nodes",y
self.canvas.dtag(ALL,'move')
# on marque tous les ids au dela de y
x0, y0, x1, y1 = self.canvas.bbox(ALL)
+ if y > y1: # pas d'objet a deplacer
+ return
self.canvas.addtag_overlapping('move',x0,y,x1,y1)
def move_nodes(self,y,dy):
""" Déplace de l'incrément dy les noeuds au dela de l'ordonnée y """
+ #print "move_nodes",y,dy
self.tag_move_nodes(y)
# on déplace tous les items de dy
self.canvas.move('move',0,dy)
en y et au dela
Retourne la position du premier des noeuds deplaces
"""
+ #print "draw_node",new_node,x,y
self.tag_move_nodes(y)
#if new_node.item.isactif():
#new_node.state = 'expanded'
else :
self.parent.select_next(index)
+ def select_mot_prev(self):
+ index = self.parent.children.index(self) - 1
+ try :
+ if index > -1 :
+ self.parent.children[index].select()
+ if self.parent.children[index].state=="expanded":
+ print len(self.parent.children[index].children)
+ if len(self.parent.children[index].children)!=0 :
+ max=len(self.parent.children[index].children) - 1
+ self.parent.children[index].children[max].select()
+ else :
+ self.parent.children[index].select()
+ else :
+ self.parent.children[index].select()
+ elif self.parent is self.tree:
+ pass
+ else :
+ self.parent.select()
+ except:
+ if self.parent is self.tree:
+ pass
+ else :
+ self.parent.select_previous()
+
+
def select_mot_previous(self):
index = self.parent.children.index(self) - 1
try :
for child in self.children:
child.state='collapsed'
child.collapse_children()
-
+
+ def deplieReplieNode(self):
+ if self.state == 'expanded':
+ self.collapse()
+ else :
+ self.expand_node()
+
def collapse(self,event = None):
""" Collapse self et descendants et retrace self """
nb = self.get_nb_children()