editors/SFCViewer.py
changeset 1768 691083b5682a
parent 1767 c74815729afd
child 1782 5b6ad7a7fd9d
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
   765             choices = []
   765             choices = []
   766             for block in self.Blocks:
   766             for block in self.Blocks:
   767                 if isinstance(block, SFC_Step):
   767                 if isinstance(block, SFC_Step):
   768                     choices.append(block.GetName())
   768                     choices.append(block.GetName())
   769             dialog = wx.SingleChoiceDialog(self.ParentWindow,
   769             dialog = wx.SingleChoiceDialog(self.ParentWindow,
   770                   _("Add a new jump"), _("Please choose a target"),
   770                                            _("Add a new jump"),
   771                   choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
   771                                            _("Please choose a target"),
       
   772                                            choices,
       
   773                                            wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
   772             if dialog.ShowModal() == wx.ID_OK:
   774             if dialog.ShowModal() == wx.ID_OK:
   773                 value = dialog.GetStringSelection()
   775                 value = dialog.GetStringSelection()
   774                 self.SelectedElement.AddOutput()
   776                 self.SelectedElement.AddOutput()
   775                 self.RefreshStepModel(self.SelectedElement)
   777                 self.RefreshStepModel(self.SelectedElement)
   776                 step_connectors = self.SelectedElement.GetConnectors()
   778                 step_connectors = self.SelectedElement.GetConnectors()
   978                     previous_pos = previous.GetPosition(False)
   980                     previous_pos = previous.GetPosition(False)
   979                     next_pos = next.GetPosition(False)
   981                     next_pos = next.GetPosition(False)
   980                     wire_size = GetWireSize(previous_block)
   982                     wire_size = GetWireSize(previous_block)
   981                     previous_block.RefreshOutputPosition((0, previous_pos.y + wire_size - next_pos.y))
   983                     previous_block.RefreshOutputPosition((0, previous_pos.y + wire_size - next_pos.y))
   982                     wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
   984                     wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
   983                         wx.Point(previous_pos.x, previous_pos.y)])
   985                                     wx.Point(previous_pos.x, previous_pos.y)])
   984                     if isinstance(next_block, SFC_Divergence):
   986                     if isinstance(next_block, SFC_Divergence):
   985                         next_block.RefreshPosition()
   987                         next_block.RefreshPosition()
   986                     previous_block.RefreshOutputModel(True)
   988                     previous_block.RefreshOutputModel(True)
   987             elif divergence.GetBranchNumber() == 1:
   989             elif divergence.GetBranchNumber() == 1:
   988                 wires = connectors["inputs"][0].GetWires()
   990                 wires = connectors["inputs"][0].GetWires()
  1008                 previous_pos = previous.GetPosition(False)
  1010                 previous_pos = previous.GetPosition(False)
  1009                 next_pos = next.GetPosition(False)
  1011                 next_pos = next.GetPosition(False)
  1010                 wire_size = GetWireSize(previous_block)
  1012                 wire_size = GetWireSize(previous_block)
  1011                 previous_block.RefreshOutputPosition((previous_pos.x - next_pos.x, previous_pos.y + wire_size - next_pos.y))
  1013                 previous_block.RefreshOutputPosition((previous_pos.x - next_pos.x, previous_pos.y + wire_size - next_pos.y))
  1012                 wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
  1014                 wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
  1013                     wx.Point(previous_pos.x, previous_pos.y)])
  1015                                 wx.Point(previous_pos.x, previous_pos.y)])
  1014                 if isinstance(next_block, SFC_Divergence):
  1016                 if isinstance(next_block, SFC_Divergence):
  1015                     next_block.RefreshPosition()
  1017                     next_block.RefreshPosition()
  1016                 previous_block.RefreshOutputModel(True)
  1018                 previous_block.RefreshOutputModel(True)
  1017 
  1019 
  1018     def DeleteJump(self, jump):
  1020     def DeleteJump(self, jump):