editors/SFCViewer.py
changeset 1847 6198190bc121
parent 1828 396da88d7b5c
child 1853 47a3f39bead0
equal deleted inserted replaced
1846:14b40afccd69 1847:6198190bc121
   577                     previous_block.RefreshOutputPosition()
   577                     previous_block.RefreshOutputPosition()
   578                     wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
   578                     wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
   579                     self.AddBlock(divergence)
   579                     self.AddBlock(divergence)
   580                     self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"])
   580                     self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"])
   581                     self.RefreshDivergenceModel(divergence)
   581                     self.RefreshDivergenceModel(divergence)
   582                     for index, connector in enumerate(divergence_connectors["outputs"]):
   582                     for _index, connector in enumerate(divergence_connectors["outputs"]):
   583                         if next:
   583                         if next:
   584                             wire = self.ConnectConnectors(next, connector)
   584                             wire = self.ConnectConnectors(next, connector)
   585                             pos = connector.GetPosition(False)
   585                             pos = connector.GetPosition(False)
   586                             next_pos = next.GetPosition(False)
   586                             next_pos = next.GetPosition(False)
   587                             next_block = next.GetParentBlock()
   587                             next_block = next.GetParentBlock()
   591                             next_block.RefreshModel()
   591                             next_block.RefreshModel()
   592                             next = None
   592                             next = None
   593                         else:
   593                         else:
   594                             transition = self.CreateTransition(connector)
   594                             transition = self.CreateTransition(connector)
   595                             transition_connectors = transition.GetConnectors()
   595                             transition_connectors = transition.GetConnectors()
   596                             step = self.CreateStep("Step", transition_connectors["output"])
   596                             _step = self.CreateStep("Step", transition_connectors["output"])
   597                 elif value["type"] == SIMULTANEOUS_DIVERGENCE:
   597                 elif value["type"] == SIMULTANEOUS_DIVERGENCE:
   598                     if self.SelectedElement in self.Wires and isinstance(self.SelectedElement.EndConnected.GetParentBlock(), SFC_Transition):
   598                     if self.SelectedElement in self.Wires and isinstance(self.SelectedElement.EndConnected.GetParentBlock(), SFC_Transition):
   599                         self.SelectedElement.SetSelectedSegment(None)
   599                         self.SelectedElement.SetSelectedSegment(None)
   600                         previous = self.SelectedElement.EndConnected
   600                         previous = self.SelectedElement.EndConnected
   601                         next = self.SelectedElement.StartConnected
   601                         next = self.SelectedElement.StartConnected
   635                     previous_block.RefreshOutputPosition()
   635                     previous_block.RefreshOutputPosition()
   636                     wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
   636                     wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
   637                     self.AddBlock(divergence)
   637                     self.AddBlock(divergence)
   638                     self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"])
   638                     self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"])
   639                     self.RefreshDivergenceModel(divergence)
   639                     self.RefreshDivergenceModel(divergence)
   640                     for index, connector in enumerate(divergence_connectors["outputs"]):
   640                     for _index, connector in enumerate(divergence_connectors["outputs"]):
   641                         if next:
   641                         if next:
   642                             wire = self.ConnectConnectors(next, connector)
   642                             wire = self.ConnectConnectors(next, connector)
   643                             pos = connector.GetPosition(False)
   643                             pos = connector.GetPosition(False)
   644                             next_pos = next.GetPosition(False)
   644                             next_pos = next.GetPosition(False)
   645                             next_block = next.GetParentBlock()
   645                             next_block = next.GetParentBlock()
   647                             divergence.RefreshConnectedPosition(connector)
   647                             divergence.RefreshConnectedPosition(connector)
   648                             wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
   648                             wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
   649                             next_block.RefreshModel()
   649                             next_block.RefreshModel()
   650                             next = None
   650                             next = None
   651                         else:
   651                         else:
   652                             step = self.CreateStep("Step", connector)
   652                             _step = self.CreateStep("Step", connector)
   653                 elif isinstance(self.SelectedElement, Graphic_Group) and len(self.SelectedElement.GetElements()) > 1:
   653                 elif isinstance(self.SelectedElement, Graphic_Group) and len(self.SelectedElement.GetElements()) > 1:
   654                     next = None
   654                     next = None
   655                     for element in self.SelectedElement.GetElements():
   655                     for element in self.SelectedElement.GetElements():
   656                         connectors = element.GetConnectors()
   656                         connectors = element.GetConnectors()
   657                         if not isinstance(element, SFC_Step) or connectors["output"] and next:
   657                         if not isinstance(element, SFC_Step) or connectors["output"] and next:
   744                         transition = self.CreateTransition(divergence_connectors["outputs"][-1])
   744                         transition = self.CreateTransition(divergence_connectors["outputs"][-1])
   745                         transition_connectors = transition.GetConnectors()
   745                         transition_connectors = transition.GetConnectors()
   746                         previous = transition_connectors["output"]
   746                         previous = transition_connectors["output"]
   747                     else:
   747                     else:
   748                         previous = divergence_connectors["outputs"][-1]
   748                         previous = divergence_connectors["outputs"][-1]
   749                     step = self.CreateStep("Step", previous)
   749                     _step = self.CreateStep("Step", previous)
   750             self.RefreshBuffer()
   750             self.RefreshBuffer()
   751             self.RefreshScrollBars()
   751             self.RefreshScrollBars()
   752             self.Refresh(False)
   752             self.Refresh(False)
   753 
   753 
   754     def RemoveDivergenceBranch(self, divergence):
   754     def RemoveDivergenceBranch(self, divergence):