Ejemplo n.º 1
0
 def SetAllEdgesColor(self,
                      color,
                      animator,
                      display,
                      leaveColor=None,
                      graph=None,
                      edges=None):
     self._check_animator_set(animator, display)
     if graph:
         edges = graph.Edges()
     if edges:
         animation = AnimationHistory.AnimationCommand(
             animator.SetAllEdgesColor, (color, ), (),
             kwargs={
                 'edges': edges,
                 'leaveColors': leaveColor
             },
             canUndo=False)
     else:
         animation = AnimationHistory.AnimationCommand(
             animator.SetAllEdgesColor, (color, ), (),
             kwargs={'leaveColors': leaveColor},
             canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 2
0
 def SetEdgesColor(self, edges, color, animator, display):
     self._check_animator_set(animator, display)
     for head, tail in edges:
         animation = AnimationHistory.AnimationCommand(
             animator.SetEdgeColor, (tail, head), (color, ), canUndo=False)
         animation.Do()
         self.append(animation, display)
Ejemplo n.º 3
0
 def HidePath(self, pathID, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.HidePath,
                                                   (pathID, ), (),
                                                   canUndo=False)
     result = animation.Do()
     self.append(animation, display)
Ejemplo n.º 4
0
 def SetVertexFrameWidth(self, v, val, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.SetVertexFrameWidth, (v, ), (val, ),
         undo_args=(animator.GetVertexFrameWidth(v), ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 5
0
 def BlinkEdge(self, tail, head, animator, display, color=None):
     self._check_animator_set(animator, display)
     tail, head = animator.G.Edge(tail, head)
     animation = AnimationHistory.AnimationCommand(animator.BlinkEdge,
                                                   (tail, head), (color, ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 6
0
 def GrowMoat(self, moat_id, radius, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.GrowMoat,
                                                   (moat_id, ), (radius, ),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 7
0
 def DeleteBubble(self, vertex_nums, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.DeleteBubble,
                                                   (), (vertex_nums, ),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 8
0
 def ResizeBubble(self, vertex_nums, new_radius, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.ResizeBubble, (), (vertex_nums, new_radius),
         canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 9
0
 def SetVertexColor(self, v, color, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.SetVertexColor, (v, ), (color, ),
         undo_args=(animator.GetVertexColor(v), ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 10
0
 def AddEdge(self, tail, head, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.AddEdge,
                                                   (tail, head), (),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 11
0
 def CreateBubble(self, vertex_nums, offset_value, color, animator,
                  display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.CreateBubble, (), (vertex_nums, offset_value, color),
         canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 12
0
 def SetEdgeColor(self, tail, head, color, animator, display):
     self._check_animator_set(animator, display)
     tail, head = animator.G.Edge(tail, head)
     animation = AnimationHistory.AnimationCommand(
         animator.SetEdgeColor, (tail, head), (color, ),
         undo_args=(animator.GetEdgeColor(tail, head), ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 13
0
 def AddVertex(self, x, y, animator, display, v=None):
     self._check_animator_set(animator, display)
     if v:
         animation = AnimationHistory.AnimationCommand(animator.AddVertex,
                                                       (x, y), (v, ),
                                                       canUndo=False)
     else:
         animation = AnimationHistory.AnimationCommand(animator.AddVertex,
                                                       (x, y), (),
                                                       canUndo=False)
     result = animation.Do()
     if not v and result:
         animation = AnimationHistory.AnimationCommand(animator.AddVertex,
                                                       (x, y), (result, ),
                                                       canUndo=False)
     self.append(animation, display)
     return result
Ejemplo n.º 14
0
 def DeleteEdge(self, tail, head, animator, display, repaint=1):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.DeleteEdge,
                                                   (tail, head),
                                                   (repaint, ),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 15
0
 def HighlightPath(self, path, color, animator, display, closed=0):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.HighlightPath,
                                                   (path, ),
                                                   (color, closed),
                                                   canUndo=False)
     result = animation.Do()
     self.append(animation, display)
     return result
Ejemplo n.º 16
0
 def SetAllVerticesColor(self,
                         color,
                         animator,
                         display,
                         graph=None,
                         vertices=None):
     self._check_animator_set(animator, display)
     if graph:
         vertices = graph.Vertices()
     if vertices:
         animation = AnimationHistory.AnimationCommand(
             animator.SetAllVerticesColor, (color, ), (),
             kwargs={'vertices': vertices},
             canUndo=False)
     else:
         animation = AnimationHistory.AnimationCommand(
             animator.SetAllVerticesColor, (color, ), (), canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 17
0
 def SetVertexAnnotation(self,
                         v,
                         annotation,
                         animator,
                         display,
                         color="black"):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.SetVertexAnnotation, (v, ), (annotation, ),
         undo_args=(animator.GetVertexAnnotation(v), ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 18
0
 def DeleteVertex(self, v, animator, display):
     self._check_animator_set(animator, display)
     #Delete all edges containing v
     #Call deletevertex command
     for d in animator.drawEdges.keys():
         if d[0] == v or d[1] == v:
             self.DeleteEdge(d[0], d[1], animator, display)
     animation = AnimationHistory.AnimationCommand(animator.DeleteVertex,
                                                   (v, ), (),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 19
0
 def BlinkVertex(self, v, animator, display, color=None):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.BlinkVertex,
                                                   (v, ), (color, ))
     animation.Do()
     self.append(animation, display)
Ejemplo n.º 20
0
 def UpdateVertexInfo(self, v, info, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(
         animator.UpdateVertexInfo, (v, ), (info, ))
     self.append(animation, display)
Ejemplo n.º 21
0
 def UpdateEdgeInfo(self, tail, head, info, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.UpdateEdgeInfo,
                                                   (tail, head), (info, ))
     self.append(animation, display)
Ejemplo n.º 22
0
 def Wait(self, animator, display):
     self._check_animator_set(animator, display)
     animation = AnimationHistory.AnimationCommand(animator.Wait, (), (),
                                                   canUndo=False)
     animation.Do()
     self.append(animation, display)