equal
deleted
inserted
replaced
357 #------------------------------------------------------------------------------- |
357 #------------------------------------------------------------------------------- |
358 # Adding element functions |
358 # Adding element functions |
359 #------------------------------------------------------------------------------- |
359 #------------------------------------------------------------------------------- |
360 |
360 |
361 def AddInitialStep(self, pos): |
361 def AddInitialStep(self, pos): |
362 dialog = StepNameDialog(self.ParentWindow, "Please enter step name", "Add a new initial step", "", wx.OK|wx.CANCEL) |
362 dialog = StepNameDialog(self.ParentWindow, _("Please enter step name"), _("Add a new initial step"), "", wx.OK|wx.CANCEL) |
363 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
363 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
364 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
364 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
365 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)]) |
365 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)]) |
366 if dialog.ShowModal() == wx.ID_OK: |
366 if dialog.ShowModal() == wx.ID_OK: |
367 id = self.GetNewId() |
367 id = self.GetNewId() |
379 self.Refresh(False) |
379 self.Refresh(False) |
380 dialog.Destroy() |
380 dialog.Destroy() |
381 |
381 |
382 def AddStep(self): |
382 def AddStep(self): |
383 if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, SFC_Step): |
383 if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, SFC_Step): |
384 dialog = StepNameDialog(self.ParentWindow, "Add a new step", "Please enter step name", "", wx.OK|wx.CANCEL) |
384 dialog = StepNameDialog(self.ParentWindow, _("Add a new step"), _("Please enter step name"), "", wx.OK|wx.CANCEL) |
385 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
385 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
386 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
386 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
387 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)]) |
387 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)]) |
388 if dialog.ShowModal() == wx.ID_OK: |
388 if dialog.ShowModal() == wx.ID_OK: |
389 name = dialog.GetValue() |
389 name = dialog.GetValue() |
693 if isinstance(self.SelectedElement, SFC_Step) and not self.SelectedElement.Output: |
693 if isinstance(self.SelectedElement, SFC_Step) and not self.SelectedElement.Output: |
694 choices = [] |
694 choices = [] |
695 for block in self.Blocks: |
695 for block in self.Blocks: |
696 if isinstance(block, SFC_Step): |
696 if isinstance(block, SFC_Step): |
697 choices.append(block.GetName()) |
697 choices.append(block.GetName()) |
698 dialog = wx.SingleChoiceDialog(self.ParentWindow, "Add a new jump", "Please choose a target", choices, wx.OK|wx.CANCEL) |
698 dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Add a new jump"), _("Please choose a target"), choices, wx.OK|wx.CANCEL) |
699 if dialog.ShowModal() == wx.ID_OK: |
699 if dialog.ShowModal() == wx.ID_OK: |
700 value = dialog.GetStringSelection() |
700 value = dialog.GetStringSelection() |
701 self.SelectedElement.AddOutput() |
701 self.SelectedElement.AddOutput() |
702 self.RefreshStepModel(self.SelectedElement) |
702 self.RefreshStepModel(self.SelectedElement) |
703 step_connectors = self.SelectedElement.GetConnectors() |
703 step_connectors = self.SelectedElement.GetConnectors() |
721 |
721 |
722 def EditStepContent(self, step): |
722 def EditStepContent(self, step): |
723 if self.GetDrawingMode() == FREEDRAWING_MODE: |
723 if self.GetDrawingMode() == FREEDRAWING_MODE: |
724 Viewer.EditStepContent(self, step) |
724 Viewer.EditStepContent(self, step) |
725 else: |
725 else: |
726 dialog = StepNameDialog(self.ParentWindow, "Edit step name", "Please enter step name", step.GetName(), wx.OK|wx.CANCEL) |
726 dialog = StepNameDialog(self.ParentWindow, _("Edit step name"), _("Please enter step name"), step.GetName(), wx.OK|wx.CANCEL) |
727 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
727 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
728 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
728 dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)) |
729 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()]) |
729 dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()]) |
730 if dialog.ShowModal() == wx.ID_OK: |
730 if dialog.ShowModal() == wx.ID_OK: |
731 value = dialog.GetValue() |
731 value = dialog.GetValue() |