PLCControler.py
changeset 188 d64037e17075
parent 184 d3e6484ebe85
child 197 8023d02d78ed
equal deleted inserted replaced
187:183486133b96 188:d64037e17075
    32 from plcopen import plcopen
    32 from plcopen import plcopen
    33 from plcopen.structures import *
    33 from plcopen.structures import *
    34 from graphics.GraphicCommons import *
    34 from graphics.GraphicCommons import *
    35 from PLCGenerator import *
    35 from PLCGenerator import *
    36 
    36 
    37 duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:.[0-9]*)?)ms)?")
    37 duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:\.[0-9]*)?)ms)?")
    38 
    38 
    39 ITEMS_EDITABLE = [ITEM_PROJECT,
    39 ITEMS_EDITABLE = [ITEM_PROJECT,
    40                     ITEM_POU,
    40                     ITEM_POU,
    41                     ITEM_VARIABLE,
    41                     ITEM_VARIABLE,
    42                     ITEM_TRANSITION,
    42                     ITEM_TRANSITION,
    64 
    64 
    65 # Length of the buffer
    65 # Length of the buffer
    66 UNDO_BUFFER_LENGTH = 20
    66 UNDO_BUFFER_LENGTH = 20
    67 
    67 
    68 """
    68 """
    69 Class implementing a buffer of changes made on the current editing Object Dictionary
    69 Class implementing a buffer of changes made on the current editing model
    70 """
    70 """
    71 class UndoBuffer:
    71 class UndoBuffer:
    72 
    72 
    73     # Constructor initialising buffer
    73     # Constructor initialising buffer
    74     def __init__(self, currentstate, issaved = False):
    74     def __init__(self, currentstate, issaved = False):
  2356                     for value in result[:-1]:
  2356                     for value in result[:-1]:
  2357                         if value != None:
  2357                         if value != None:
  2358                             values.append(int(value))
  2358                             values.append(int(value))
  2359                         else:
  2359                         else:
  2360                             values.append(0)
  2360                             values.append(0)
  2361                     values.append(int(float(result[-1]) * 1000))
  2361                     if values[-1] is not None:
       
  2362                         values.append(int(float(result[-1]) * 1000))
  2362                     new_task.setinterval(time(*values))
  2363                     new_task.setinterval(time(*values))
  2363                 new_task.setpriority(int(task["Priority"]))
  2364                 new_task.setpriority(int(task["Priority"]))
  2364                 if task["Name"] != "":
  2365                 if task["Name"] != "":
  2365                     task_list[task["Name"]] = new_task
  2366                     task_list[task["Name"]] = new_task
  2366                 resource.appendtask(new_task)
  2367                 resource.appendtask(new_task)