I hope I understood correctly what is this: it's automatically changed by the build...
[guess.git] / scripts / animhighlight.py
blob2af9fda667c4549accfa012be966fabe9ff6d60e
1 import java
3 class animhighlight(java.lang.Object):
5 # so we can "unhighlight" nodes
6 _toFix = {}
8 def __init__(self):
9 # add the listeners
10 graphevents.mouseEnterNode = self.mouseEnter
11 graphevents.mouseLeaveNode = self.mouseLeave
12 graphevents.clickNode = self.mouseClick
14 # remove default behaviors
15 vf.defaultNodeHighlights(false)
16 vf.defaultNodeZooming(false)
18 def mouseEnter(self,_node):
19 self._toFix[_node] = _node.color
20 StatusBar.setStatus(str(_node))
21 _node.color = yellow
23 for _e in _node.getOutEdges():
24 if not (_e in self._toFix.keys()):
25 self._toFix[_e] = _e.color
26 _e.color = orange
27 _e.animate("arrows")
29 for _e in _node.getInEdges():
30 if not (_e in self._toFix.keys()):
31 self._toFix[_e] = _e.color
32 _e.color = green
33 _e.animate("arrows")
35 for _n in _node.getPredecessors():
36 if (_n != _node):
37 self._toFix[_n] = _n.color
38 _n.color = green
39 _n.animate("pulse")
41 for _n in _node.getSuccessors():
42 if (_n != _node):
43 self._toFix[_n] = _n.color
44 _n.color = red
45 _n.animate("pulse")
49 def mouseLeave(self,_node):
50 # put back all the original colors
51 # and stop animations
52 for _elem in self._toFix.keys():
53 _elem.color = self._toFix[_elem]
54 _elem.animationStopAll()
55 self._toFix.clear();
57 def mouseClick(self,_node):
58 # zoom to the node AND its neighbors
59 _toCenter = [_node]
60 _toCenter += _node.getNeighbors()
61 center(_toCenter)
63 animhighlight()