300 location = values[0] |
300 location = values[0] |
301 if not location.startswith("%"): |
301 if not location.startswith("%"): |
302 dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow, |
302 dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow, |
303 _("Select a variable class:"), _("Variable class"), |
303 _("Select a variable class:"), _("Variable class"), |
304 [_("Input"), _("Output"), _("Memory")], |
304 [_("Input"), _("Output"), _("Memory")], |
305 wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
305 wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL) |
306 if dialog.ShowModal() == wx.ID_OK: |
306 if dialog.ShowModal() == wx.ID_OK: |
307 selected = dialog.GetSelection() |
307 selected = dialog.GetSelection() |
308 else: |
308 else: |
309 selected = None |
309 selected = None |
310 dialog.Destroy() |
310 dialog.Destroy() |
433 def AddVariableFunction(event): |
433 def AddVariableFunction(event): |
434 self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type) |
434 self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type) |
435 return AddVariableFunction |
435 return AddVariableFunction |
436 |
436 |
437 def ShowMessage(self, message): |
437 def ShowMessage(self, message): |
438 message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK|wx.ICON_ERROR) |
438 message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR) |
439 message.ShowModal() |
439 message.ShowModal() |
440 message.Destroy() |
440 message.Destroy() |
441 |
441 |
442 |
442 |
443 class DebugInstanceName(DebugDataConsumer): |
443 class DebugInstanceName(DebugDataConsumer): |
2635 |
2635 |
2636 def AddNewComment(self, bbox): |
2636 def AddNewComment(self, bbox): |
2637 dialog = wx.TextEntryDialog(self.ParentWindow, |
2637 dialog = wx.TextEntryDialog(self.ParentWindow, |
2638 _("Edit comment"), |
2638 _("Edit comment"), |
2639 _("Please enter comment text"), |
2639 _("Please enter comment text"), |
2640 "", wx.OK|wx.CANCEL|wx.TE_MULTILINE) |
2640 "", wx.OK | wx.CANCEL | wx.TE_MULTILINE) |
2641 dialog.SetClientSize(wx.Size(400, 200)) |
2641 dialog.SetClientSize(wx.Size(400, 200)) |
2642 if dialog.ShowModal() == wx.ID_OK: |
2642 if dialog.ShowModal() == wx.ID_OK: |
2643 value = dialog.GetValue() |
2643 value = dialog.GetValue() |
2644 id = self.GetNewId() |
2644 id = self.GetNewId() |
2645 comment = Comment(self, value, id) |
2645 comment = Comment(self, value, id) |
2765 for block in self.Blocks.itervalues(): |
2765 for block in self.Blocks.itervalues(): |
2766 if isinstance(block, SFC_Step): |
2766 if isinstance(block, SFC_Step): |
2767 choices.append(block.GetName()) |
2767 choices.append(block.GetName()) |
2768 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
2768 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
2769 _("Add a new jump"), _("Please choose a target"), |
2769 _("Add a new jump"), _("Please choose a target"), |
2770 choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
2770 choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL) |
2771 if dialog.ShowModal() == wx.ID_OK: |
2771 if dialog.ShowModal() == wx.ID_OK: |
2772 id = self.GetNewId() |
2772 id = self.GetNewId() |
2773 jump = SFC_Jump(self, dialog.GetStringSelection(), id) |
2773 jump = SFC_Jump(self, dialog.GetStringSelection(), id) |
2774 self.Controler.AddEditedElementJump(self.TagName, id) |
2774 self.Controler.AddEditedElementJump(self.TagName, id) |
2775 self.AddNewElement(jump, bbox, wire) |
2775 self.AddNewElement(jump, bbox, wire) |
3031 for block in self.Blocks.itervalues(): |
3031 for block in self.Blocks.itervalues(): |
3032 if isinstance(block, SFC_Step): |
3032 if isinstance(block, SFC_Step): |
3033 choices.append(block.GetName()) |
3033 choices.append(block.GetName()) |
3034 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
3034 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
3035 _("Edit jump target"), _("Please choose a target"), |
3035 _("Edit jump target"), _("Please choose a target"), |
3036 choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
3036 choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL) |
3037 try: |
3037 try: |
3038 indx = choices.index(jump.GetTarget()) |
3038 indx = choices.index(jump.GetTarget()) |
3039 dialog.SetSelection(indx) |
3039 dialog.SetSelection(indx) |
3040 except ValueError: |
3040 except ValueError: |
3041 pass |
3041 pass |
3074 def EditCommentContent(self, comment): |
3074 def EditCommentContent(self, comment): |
3075 dialog = wx.TextEntryDialog(self.ParentWindow, |
3075 dialog = wx.TextEntryDialog(self.ParentWindow, |
3076 _("Edit comment"), |
3076 _("Edit comment"), |
3077 _("Please enter comment text"), |
3077 _("Please enter comment text"), |
3078 comment.GetContent(), |
3078 comment.GetContent(), |
3079 wx.OK|wx.CANCEL|wx.TE_MULTILINE) |
3079 wx.OK | wx.CANCEL | wx.TE_MULTILINE) |
3080 width, height = comment.GetSize() |
3080 width, height = comment.GetSize() |
3081 dialogSize = wx.Size(max(width + 30, 400), max(height + 60, 200)) |
3081 dialogSize = wx.Size(max(width + 30, 400), max(height + 60, 200)) |
3082 dialog.SetClientSize(dialogSize) |
3082 dialog.SetClientSize(dialogSize) |
3083 if dialog.ShowModal() == wx.ID_OK: |
3083 if dialog.ShowModal() == wx.ID_OK: |
3084 value = dialog.GetValue() |
3084 value = dialog.GetValue() |
3436 self.RefreshBuffer() |
3436 self.RefreshBuffer() |
3437 self.RefreshView(selection=result) |
3437 self.RefreshView(selection=result) |
3438 self.RefreshVariablePanel() |
3438 self.RefreshVariablePanel() |
3439 self.ParentWindow.RefreshPouInstanceVariablesPanel() |
3439 self.ParentWindow.RefreshPouInstanceVariablesPanel() |
3440 else: |
3440 else: |
3441 message = wx.MessageDialog(self.Editor, result, "Error", wx.OK|wx.ICON_ERROR) |
3441 message = wx.MessageDialog(self.Editor, result, "Error", wx.OK | wx.ICON_ERROR) |
3442 message.ShowModal() |
3442 message.ShowModal() |
3443 message.Destroy() |
3443 message.Destroy() |
3444 |
3444 |
3445 def CanAddElement(self, block): |
3445 def CanAddElement(self, block): |
3446 if isinstance(block, Graphic_Group): |
3446 if isinstance(block, Graphic_Group): |