PLCControler.py
changeset 1780 c52d1460cea8
parent 1779 6cf16e5bfbf9
child 1782 5b6ad7a7fd9d
equal deleted inserted replaced
1779:6cf16e5bfbf9 1780:c52d1460cea8
  1011         '''
  1011         '''
  1012         Adds the POU defined by 'pou_xml' to the current project with type 'pou_type'
  1012         Adds the POU defined by 'pou_xml' to the current project with type 'pou_type'
  1013         '''
  1013         '''
  1014         try:
  1014         try:
  1015             new_pou, error = LoadPou(pou_xml)
  1015             new_pou, error = LoadPou(pou_xml)
  1016         except:
  1016         except Exception:
  1017             error = ""
  1017             error = ""
  1018         if error is not None:
  1018         if error is not None:
  1019             return _("Couldn't paste non-POU object.")
  1019             return _("Couldn't paste non-POU object.")
  1020 
  1020 
  1021         name = new_pou.getname()
  1021         name = new_pou.getname()
  2405             used_id = dict([(instance.getlocalId(), True) for instance in element.getinstances()])
  2405             used_id = dict([(instance.getlocalId(), True) for instance in element.getinstances()])
  2406             new_id = {}
  2406             new_id = {}
  2407 
  2407 
  2408             try:
  2408             try:
  2409                 instances, error = LoadPouInstances(text, bodytype)
  2409                 instances, error = LoadPouInstances(text, bodytype)
  2410             except:
  2410             except Exception:
  2411                 instances, error = [], ""
  2411                 instances, error = [], ""
  2412             if error is not None or len(instances) == 0:
  2412             if error is not None or len(instances) == 0:
  2413                 return _("Invalid plcopen element(s)!!!")
  2413                 return _("Invalid plcopen element(s)!!!")
  2414 
  2414 
  2415             exclude = {}
  2415             exclude = {}