editors/SFCViewer.py
changeset 1347 533741e5075c
parent 814 5743cbdff669
child 1567 a4bf874e4949
equal deleted inserted replaced
1346:92efd8fe3120 1347:533741e5075c
   356 #-------------------------------------------------------------------------------
   356 #-------------------------------------------------------------------------------
   357 
   357 
   358     def AddInitialStep(self, pos):
   358     def AddInitialStep(self, pos):
   359         dialog = SFCStepNameDialog(self.ParentWindow, _("Please enter step name"), _("Add a new initial step"), "", wx.OK|wx.CANCEL)
   359         dialog = SFCStepNameDialog(self.ParentWindow, _("Please enter step name"), _("Add a new initial step"), "", wx.OK|wx.CANCEL)
   360         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   360         dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   361         dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
   361         dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
   362         dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
   362         dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
   363         if dialog.ShowModal() == wx.ID_OK:
   363         if dialog.ShowModal() == wx.ID_OK:
   364             id = self.GetNewId()
   364             id = self.GetNewId()
   365             name = dialog.GetValue()
   365             name = dialog.GetValue()
   366             step = SFC_Step(self, name, True, id)
   366             step = SFC_Step(self, name, True, id)
   378 
   378 
   379     def AddStep(self):
   379     def AddStep(self):
   380         if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, SFC_Step):
   380         if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, SFC_Step):
   381             dialog = SFCStepNameDialog(self.ParentWindow, _("Add a new step"), _("Please enter step name"), "", wx.OK|wx.CANCEL)
   381             dialog = SFCStepNameDialog(self.ParentWindow, _("Add a new step"), _("Please enter step name"), "", wx.OK|wx.CANCEL)
   382             dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   382             dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   383             dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
   383             dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
   384             dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
   384             dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
   385             if dialog.ShowModal() == wx.ID_OK:
   385             if dialog.ShowModal() == wx.ID_OK:
   386                 name = dialog.GetValue()
   386                 name = dialog.GetValue()
   387                 if self.IsWire(self.SelectedElement):
   387                 if self.IsWire(self.SelectedElement):
   388                     self.SelectedElement.SetSelectedSegment(None)
   388                     self.SelectedElement.SetSelectedSegment(None)
   435             connectors = self.SelectedElement.GetConnectors()
   435             connectors = self.SelectedElement.GetConnectors()
   436             if not connectors["action"]:
   436             if not connectors["action"]:
   437                 dialog = ActionBlockDialog(self.ParentWindow)
   437                 dialog = ActionBlockDialog(self.ParentWindow)
   438                 dialog.SetQualifierList(self.Controler.GetQualifierTypes())
   438                 dialog.SetQualifierList(self.Controler.GetQualifierTypes())
   439                 dialog.SetActionList(self.Controler.GetEditedElementActions(self.TagName, self.Debug))
   439                 dialog.SetActionList(self.Controler.GetEditedElementActions(self.TagName, self.Debug))
   440                 dialog.SetVariableList(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
   440                 dialog.SetVariableList(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
   441                 if dialog.ShowModal() == wx.ID_OK:
   441                 if dialog.ShowModal() == wx.ID_OK:
   442                     actions = dialog.GetValues()
   442                     actions = dialog.GetValues()
   443                     self.SelectedElement.AddAction()
   443                     self.SelectedElement.AddAction()
   444                     self.RefreshStepModel(self.SelectedElement)
   444                     self.RefreshStepModel(self.SelectedElement)
   445                     connectors = self.SelectedElement.GetConnectors()
   445                     connectors = self.SelectedElement.GetConnectors()
   722         if self.GetDrawingMode() == FREEDRAWING_MODE:
   722         if self.GetDrawingMode() == FREEDRAWING_MODE:
   723             Viewer.EditStepContent(self, step)
   723             Viewer.EditStepContent(self, step)
   724         else:
   724         else:
   725             dialog = SFCStepNameDialog(self.ParentWindow, _("Edit step name"), _("Please enter step name"), step.GetName(), wx.OK|wx.CANCEL)
   725             dialog = SFCStepNameDialog(self.ParentWindow, _("Edit step name"), _("Please enter step name"), step.GetName(), wx.OK|wx.CANCEL)
   726             dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   726             dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
   727             dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug))
   727             dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
   728             dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()])
   728             dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()])
   729             if dialog.ShowModal() == wx.ID_OK:
   729             if dialog.ShowModal() == wx.ID_OK:
   730                 value = dialog.GetValue()
   730                 value = dialog.GetValue()
   731                 step.SetName(value)
   731                 step.SetName(value)
   732                 min_size = step.GetMinSize()
   732                 min_size = step.GetMinSize()