graphics/SFC_Objects.py
changeset 138 9c74d00ce93e
parent 127 436268f31dae
child 140 06d28f03f6f4
equal deleted inserted replaced
137:fc7e0b8ed9d3 138:9c74d00ce93e
   367     
   367     
   368     # Refreshes the step state according to move defined and handle selected
   368     # Refreshes the step state according to move defined and handle selected
   369     def ProcessDragging(self, movex, movey):
   369     def ProcessDragging(self, movex, movey):
   370         handle_type, handle = self.Handle
   370         handle_type, handle = self.Handle
   371         if handle_type == HANDLE_MOVE:
   371         if handle_type == HANDLE_MOVE:
       
   372             movex = max(-self.BoundingBox.x, movex)
       
   373             movey = max(-self.BoundingBox.y, movey)
   372             action_block = None
   374             action_block = None
   373             if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
   375             if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
   374                 self.Move(movex, movey)
   376                 self.Move(movex, movey)
   375                 self.RefreshConnected()
   377                 self.RefreshConnected()
   376                 return True, True
   378                 return movex, movey
   377             elif self.Initial:
   379             elif self.Initial:
   378                 self.MoveActionBlock((movex, movey))
   380                 self.MoveActionBlock((movex, movey))
   379                 self.Move(movex, movey, self.Parent.Wires)
   381                 self.Move(movex, movey, self.Parent.Wires)
   380                 self.RefreshOutputPosition((movex, movey))
   382                 self.RefreshOutputPosition((movex, movey))
       
   383                 return movex, movey
   381             else:
   384             else:
   382                 self.MoveActionBlock((movex, 0))
   385                 self.MoveActionBlock((movex, 0))
   383                 self.Move(movex, 0)
   386                 self.Move(movex, 0)
   384                 self.RefreshInputPosition()
   387                 self.RefreshInputPosition()
   385                 self.RefreshOutputPosition()
   388                 self.RefreshOutputPosition()
   386             return True, False
   389                 return movex, 0
   387         else:
   390         else:
   388             return Graphic_Element.ProcessDragging(self, movex, movey)
   391             return Graphic_Element.ProcessDragging(self, movex, movey)
   389     
   392     
   390     # Refresh input element model
   393     # Refresh input element model
   391     def RefreshInputModel(self):
   394     def RefreshInputModel(self):
   717         self.Parent.PopupDefaultMenu()
   720         self.Parent.PopupDefaultMenu()
   718     
   721     
   719     # Refreshes the transition state according to move defined and handle selected
   722     # Refreshes the transition state according to move defined and handle selected
   720     def ProcessDragging(self, movex, movey):
   723     def ProcessDragging(self, movex, movey):
   721         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
   724         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
       
   725             movex = max(-self.BoundingBox.x, movex)
   722             self.Move(movex, 0)
   726             self.Move(movex, 0)
   723             self.RefreshInputPosition()
   727             self.RefreshInputPosition()
   724             self.RefreshOutputPosition()
   728             self.RefreshOutputPosition()
   725             return True, False
   729             return movex, 0
   726         else:
   730         else:
   727             return Graphic_Element.ProcessDragging(self, movex, movey)
   731             return Graphic_Element.ProcessDragging(self, movex, movey)
   728     
   732     
   729     # Refresh input element model
   733     # Refresh input element model
   730     def RefreshInputModel(self):
   734     def RefreshInputModel(self):
  1130     # Refreshes the divergence state according to move defined and handle selected
  1134     # Refreshes the divergence state according to move defined and handle selected
  1131     def ProcessDragging(self, movex, movey):
  1135     def ProcessDragging(self, movex, movey):
  1132         handle_type, handle = self.Handle
  1136         handle_type, handle = self.Handle
  1133         # A connector has been handled
  1137         # A connector has been handled
  1134         if handle_type == HANDLE_CONNECTOR:
  1138         if handle_type == HANDLE_CONNECTOR:
       
  1139             movex = max(-self.BoundingBox.x, movex)
  1135             self.MoveConnector(handle, movex)
  1140             self.MoveConnector(handle, movex)
  1136             if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1141             if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1137                 self.RefreshConnectedPosition(handle)
  1142                 self.RefreshConnectedPosition(handle)
  1138             return True, False
  1143             return movex, 0
  1139         elif self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
  1144         elif self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
  1140             return Graphic_Element.ProcessDragging(self, movex, movey)
  1145             return Graphic_Element.ProcessDragging(self, movex, movey)
  1141         return False, False
  1146         return 0, 0
  1142     
  1147     
  1143     # Refresh output element model
  1148     # Refresh output element model
  1144     def RefreshOutputModel(self, move=False):
  1149     def RefreshOutputModel(self, move=False):
  1145         if move and self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1150         if move and self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1146             for output in self.Outputs:
  1151             for output in self.Outputs:
  1314         self.Parent.PopupDefaultMenu()
  1319         self.Parent.PopupDefaultMenu()
  1315     
  1320     
  1316     # Refreshes the jump state according to move defined and handle selected
  1321     # Refreshes the jump state according to move defined and handle selected
  1317     def ProcessDragging(self, movex, movey):
  1322     def ProcessDragging(self, movex, movey):
  1318         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1323         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
       
  1324             movex = max(-self.BoundingBox.x, movex)
  1319             self.Move(movex, 0)
  1325             self.Move(movex, 0)
  1320             self.RefreshInputPosition()
  1326             self.RefreshInputPosition()
  1321             return True, False
  1327             return movex, 0
  1322         else:
  1328         else:
  1323             return Graphic_Element.ProcessDragging(self, movex, movey)
  1329             return Graphic_Element.ProcessDragging(self, movex, movey)
  1324     
  1330     
  1325     # Refresh input element model
  1331     # Refresh input element model
  1326     def RefreshInputModel(self):
  1332     def RefreshInputModel(self):
  1503     # Refreshes the action block state according to move defined and handle selected
  1509     # Refreshes the action block state according to move defined and handle selected
  1504     def ProcessDragging(self, movex, movey):
  1510     def ProcessDragging(self, movex, movey):
  1505         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1511         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
  1506             handle_type, handle = self.Handle
  1512             handle_type, handle = self.Handle
  1507             if handle_type == HANDLE_MOVE:
  1513             if handle_type == HANDLE_MOVE:
       
  1514                 movex = max(-self.BoundingBox.x, movex)
  1508                 wires = self.Input.GetWires()
  1515                 wires = self.Input.GetWires()
  1509                 if len(wires) == 1:
  1516                 if len(wires) == 1:
  1510                     input_pos = wires[0][0].EndConnected.GetPosition(False)
  1517                     input_pos = wires[0][0].EndConnected.GetPosition(False)
  1511                     if self.Pos.x - input_pos.x + movex >= SFC_WIRE_MIN_SIZE:
  1518                     if self.Pos.x - input_pos.x + movex >= SFC_WIRE_MIN_SIZE:
  1512                         self.Move(movex, 0)
  1519                         self.Move(movex, 0)
  1513                         return True, False
  1520                         return movex, 0
  1514                 return False, False
  1521                 return 0, 0
  1515             else:
  1522             else:
  1516                 return Graphic_Element.ProcessDragging(self, movex, movey)
  1523                 return Graphic_Element.ProcessDragging(self, movex, movey)
  1517         else:
  1524         else:
  1518             return Graphic_Element.ProcessDragging(self, movex, movey)
  1525             return Graphic_Element.ProcessDragging(self, movex, movey)
  1519 
  1526