editors/TextViewer.py
changeset 1768 691083b5682a
parent 1766 c1e5b9f19483
child 1773 38fde37c3766
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
    83             else:
    83             else:
    84                 event(self, function)
    84                 event(self, function)
    85 
    85 
    86     def _init_Editor(self, prnt):
    86     def _init_Editor(self, prnt):
    87         self.Editor = CustomStyledTextCtrl(id=ID_TEXTVIEWERTEXTCTRL,
    87         self.Editor = CustomStyledTextCtrl(id=ID_TEXTVIEWERTEXTCTRL,
    88                 parent=prnt, name="TextViewer", size=wx.Size(0, 0), style=0)
    88                                            parent=prnt, name="TextViewer", size=wx.Size(0, 0), style=0)
    89         self.Editor.ParentWindow = self
    89         self.Editor.ParentWindow = self
    90 
    90 
    91         self.Editor.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)
    91         self.Editor.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)
    92         self.Editor.CmdKeyAssign(ord('-'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMOUT)
    92         self.Editor.CmdKeyAssign(ord('-'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMOUT)
    93 
    93 
   302                     elif var_name.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
   302                     elif var_name.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
   303                         message = _("\"%s\" element for this pou already exists!") % var_name
   303                         message = _("\"%s\" element for this pou already exists!") % var_name
   304                     else:
   304                     else:
   305                         location = values[0]
   305                         location = values[0]
   306                         if not location.startswith("%"):
   306                         if not location.startswith("%"):
   307                             dialog = wx.SingleChoiceDialog(self.ParentWindow,
   307                             dialog = wx.SingleChoiceDialog(
   308                                   _("Select a variable class:"), _("Variable class"),
   308                                 self.ParentWindow,
   309                                   [_("Input"), _("Output"), _("Memory")],
   309                                 _("Select a variable class:"),
   310                                   wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
   310                                 _("Variable class"),
       
   311                                 [_("Input"), _("Output"), _("Memory")],
       
   312                                 wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
   311                             if dialog.ShowModal() == wx.ID_OK:
   313                             if dialog.ShowModal() == wx.ID_OK:
   312                                 selected = dialog.GetSelection()
   314                                 selected = dialog.GetSelection()
   313                             else:
   315                             else:
   314                                 selected = None
   316                                 selected = None
   315                             dialog.Destroy()
   317                             dialog.Destroy()
   324                                 location = "%M" + location
   326                                 location = "%M" + location
   325                         if values[2] is not None:
   327                         if values[2] is not None:
   326                             var_type = values[2]
   328                             var_type = values[2]
   327                         else:
   329                         else:
   328                             var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0]
   330                             var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0]
   329                         self.Controler.AddEditedElementPouVar(self.TagName,
   331                         self.Controler.AddEditedElementPouVar(
       
   332                             self.TagName,
   330                             var_type, var_name,
   333                             var_type, var_name,
   331                             location=location, description=values[4])
   334                             location=location, description=values[4])
   332                         self.RefreshVariablePanel()
   335                         self.RefreshVariablePanel()
   333                         self.RefreshVariableTree()
   336                         self.RefreshVariableTree()
   334                         event.SetDragText(var_name)
   337                         event.SetDragText(var_name)