editors/Viewer.py
changeset 1250 7e6de17c687a
parent 1249 b956c924cbbd
child 1251 d9ed42e44a50
equal deleted inserted replaced
1249:b956c924cbbd 1250:7e6de17c687a
  2338             self.RefreshVisibleElements()
  2338             self.RefreshVisibleElements()
  2339             powerrail.Refresh()
  2339             powerrail.Refresh()
  2340         dialog.Destroy()
  2340         dialog.Destroy()
  2341 
  2341 
  2342     def AddNewStep(self, bbox, initial = False):
  2342     def AddNewStep(self, bbox, initial = False):
  2343         dialog = SFCStepDialog(self.ParentWindow, self.Controler, initial)
  2343         dialog = SFCStepDialog(self.ParentWindow, self.Controler, self.TagName, initial)
  2344         dialog.SetPreviewFont(self.GetFont())
  2344         dialog.SetPreviewFont(self.GetFont())
  2345         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
  2345         dialog.SetMinElementSize((bbox.width, bbox.height))
  2346         dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
       
  2347         dialog.SetStepNames([block.GetName() for block in self.Blocks.itervalues() if isinstance(block, SFC_Step)])
       
  2348         dialog.SetMinStepSize((bbox.width, bbox.height))
       
  2349         if dialog.ShowModal() == wx.ID_OK:
  2346         if dialog.ShowModal() == wx.ID_OK:
  2350             id = self.GetNewId()
  2347             id = self.GetNewId()
  2351             values = dialog.GetValues()
  2348             values = dialog.GetValues()
  2352             step = SFC_Step(self, values["name"], initial, id)
  2349             step = SFC_Step(self, values["name"], initial, id)
  2353             if values["input"]:
  2350             if values["input"]:
  2623             self.RefreshVisibleElements()
  2620             self.RefreshVisibleElements()
  2624             powerrail.Refresh(rect)
  2621             powerrail.Refresh(rect)
  2625         dialog.Destroy()
  2622         dialog.Destroy()
  2626 
  2623 
  2627     def EditStepContent(self, step):
  2624     def EditStepContent(self, step):
  2628         dialog = SFCStepDialog(self.ParentWindow, self.Controler, step.GetInitial())
  2625         dialog = SFCStepDialog(self.ParentWindow, self.Controler, self.TagName, step.GetInitial())
  2629         dialog.SetPreviewFont(self.GetFont())
  2626         dialog.SetPreviewFont(self.GetFont())
  2630         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
  2627         dialog.SetMinElementSize(step.GetSize())
  2631         dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
       
  2632         dialog.SetStepNames([block.GetName() for block in self.Blocks.itervalues() if isinstance(block, SFC_Step) and block.GetName() != step.GetName()])
       
  2633         dialog.SetMinStepSize(step.GetSize())
       
  2634         values = {"name" : step.GetName()}
       
  2635         connectors = step.GetConnectors()
  2628         connectors = step.GetConnectors()
  2636         values["input"] = len(connectors["inputs"]) > 0
  2629         dialog.SetValues({
  2637         values["output"] = len(connectors["outputs"]) > 0
  2630             "name" : step.GetName(),
  2638         values["action"] = step.GetActionConnector() != None
  2631             "input": len(connectors["inputs"]) > 0,
  2639         dialog.SetValues(values)
  2632             "output": len(connectors["outputs"]) > 0,
       
  2633             "action": step.GetActionConnector() != None})
  2640         if dialog.ShowModal() == wx.ID_OK:
  2634         if dialog.ShowModal() == wx.ID_OK:
  2641             values = dialog.GetValues()
  2635             values = dialog.GetValues()
  2642             rect = step.GetRedrawRect(1, 1)
  2636             rect = step.GetRedrawRect(1, 1)
  2643             step.SetName(values["name"])
  2637             step.SetName(values["name"])
  2644             if values["input"]:
  2638             if values["input"]: