lpcmanager

Issue #2537 : stripped faulty code.

2018-01-26, Edouard Tisserant
c8e3d9ab06a6
Parents 2add17ad71f9
Children 80122593c8c3
Issue #2537 : stripped faulty code.
  • +0 -72
    LPCManager.py
  • --- a/LPCManager.py Fri Jan 26 14:14:05 2018 +0100
    +++ b/LPCManager.py Fri Jan 26 16:21:25 2018 +0100
    @@ -192,81 +192,9 @@
    from IDEFrame import IDEFrame
    from dialogs import SearchInProjectDialog
    from controls import TextCtrlAutoComplete
    -from controls.LocationCellEditor import LocationCellControl, LocationCellEditor
    -from dialogs.BrowseLocationsDialog import BrowseLocationsDialog
    from py_ext import PythonFileCTNMixin
    from plcopen.structures import TestIdentifier, IDENTIFIER_MODEL
    -# start region // change name and location on selected variable
    -def OnBrowseButtonClick(self, event):
    - # pop up the location browser dialog
    - dialog = BrowseLocationsDialog(self, self.VarType, self.Controller)
    - if dialog.ShowModal() == wx.ID_OK:
    - infos = dialog.GetValues()
    - else:
    - infos = None
    - dialog.Destroy()
    -
    - if infos is not None:
    - location = infos["location"]
    - # set the location
    - if not infos["location"].startswith("%"):
    - dialog = wx.SingleChoiceDialog(self,
    - _("Select a variable class:"), _("Variable class"),
    - [_("Input"), _("Output"), _("Memory")],
    - wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
    - if dialog.ShowModal() == wx.ID_OK:
    - selected = dialog.GetSelection()
    - else:
    - selected = None
    - dialog.Destroy()
    - if selected is None:
    - self.Location.SetFocus()
    - return
    - if selected == 0:
    - location = "%I" + location
    - elif selected == 1:
    - location = "%Q" + location
    - else:
    - location = "%M" + location
    -
    - self.Location.SetValue(location)
    - self.VariableName = infos["name"]
    - self.VarType = infos["IEC_type"]
    -
    - self.Location.SetFocus()
    -
    -def GetName(self):
    - if hasattr(self, "VariableName"):
    - self.tmpName = self.VariableName
    - self.position = self.tmpName.find(": ")
    - if self.position != -1:
    - self.position += 2
    - self.tmpName = self.tmpName[self.position:]
    - self.tmpName = self.tmpName.replace(" ", "")
    - if TestIdentifier(self.tmpName):
    - return self.tmpName
    - else:
    - return None
    -
    -LocationCellControl.OnBrowseButtonClick = OnBrowseButtonClick
    -LocationCellControl.GetName = GetName
    -
    -def EndEditInternal(self, row, col, grid, old_loc):
    - loc = self.CellControl.GetValue()
    - changed = loc != old_loc
    - if changed:
    - name = self.CellControl.GetName()
    - if name:
    - self.Table.SetValueByName(row, 'Name', name)
    - self.Table.SetValueByName(row, 'Location', loc)
    - self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
    - self.CellControl.Disable()
    - return changed
    -
    -LocationCellEditor.EndEditInternal = EndEditInternal
    -# end region
    -
    def CTNGenerate_C(self, buildpath, locations):
    # location string for that CTN
    location_str = "_".join(map(lambda x: str(x),