Viewer.py
changeset 70 0e48629c1e6d
parent 67 3a1b0afdaf84
child 71 0578bc212c20
equal deleted inserted replaced
69:8fbff50141f8 70:0e48629c1e6d
   991 #-------------------------------------------------------------------------------
   991 #-------------------------------------------------------------------------------
   992 
   992 
   993     def AddNewBlock(self, bbox):
   993     def AddNewBlock(self, bbox):
   994         dialog = BlockPropertiesDialog(self.Parent)
   994         dialog = BlockPropertiesDialog(self.Parent)
   995         dialog.SetBlockList(self.Controler.GetBlockTypes())
   995         dialog.SetBlockList(self.Controler.GetBlockTypes())
       
   996         dialog.SetPouNames(self.Controler.GetProjectPouNames())
       
   997         dialog.SetPouElementNames(self.Controler.GetCurrentElementEditingVariables())
   996         dialog.SetMinBlockSize((bbox.width, bbox.height))
   998         dialog.SetMinBlockSize((bbox.width, bbox.height))
   997         if dialog.ShowModal() == wx.ID_OK:
   999         if dialog.ShowModal() == wx.ID_OK:
   998             id = self.GetNewId()
  1000             id = self.GetNewId()
   999             values = dialog.GetValues()
  1001             values = dialog.GetValues()
  1000             if "name" in values:
  1002             if "name" in values:
  1017         dialog.SetMinVariableSize((bbox.width, bbox.height))
  1019         dialog.SetMinVariableSize((bbox.width, bbox.height))
  1018         varlist = []
  1020         varlist = []
  1019         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
  1021         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
  1020         if vars:
  1022         if vars:
  1021             for var in vars:
  1023             for var in vars:
  1022                 varlist.append((var["Name"], var["Class"], var["Type"]))
  1024                 if var["Edit"]:
       
  1025                     varlist.append((var["Name"], var["Class"], var["Type"]))
  1023         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
  1026         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
  1024         if returntype:
  1027         if returntype:
  1025             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
  1028             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
  1026         dialog.SetVariables(varlist)
  1029         dialog.SetVariables(varlist)
  1027         if dialog.ShowModal() == wx.ID_OK:
  1030         if dialog.ShowModal() == wx.ID_OK:
  1141             self.RefreshScrollBars()
  1144             self.RefreshScrollBars()
  1142             self.Refresh()
  1145             self.Refresh()
  1143         dialog.Destroy()
  1146         dialog.Destroy()
  1144 
  1147 
  1145     def AddNewTransition(self, bbox):
  1148     def AddNewTransition(self, bbox):
  1146         dialog = TransitionContentDialog(self.Parent)
  1149         dialog = TransitionContentDialog(self.Parent, self.GetDrawingMode() == FREEDRAWING_MODE)
  1147         dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
  1150         dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
  1148         if dialog.ShowModal() == wx.ID_OK:
  1151         if dialog.ShowModal() == wx.ID_OK:
  1149             id = self.GetNewId()
  1152             id = self.GetNewId()
  1150             values = dialog.GetValues()
  1153             values = dialog.GetValues()
  1151             transition = SFC_Transition(self, values["type"], values["value"], id)
  1154             transition = SFC_Transition(self, values["type"], values["value"], id)
  1184 #-------------------------------------------------------------------------------
  1187 #-------------------------------------------------------------------------------
  1185 
  1188 
  1186     def EditBlockContent(self, block):
  1189     def EditBlockContent(self, block):
  1187         dialog = BlockPropertiesDialog(self.Parent)
  1190         dialog = BlockPropertiesDialog(self.Parent)
  1188         dialog.SetBlockList(self.Controler.GetBlockTypes())
  1191         dialog.SetBlockList(self.Controler.GetBlockTypes())
       
  1192         dialog.SetPouNames(self.Controler.GetProjectPouNames())
       
  1193         dialog.SetPouElementNames(self.Controler.GetCurrentElementEditingVariables())
  1189         dialog.SetMinBlockSize(block.GetSize())
  1194         dialog.SetMinBlockSize(block.GetSize())
  1190         values = {"name" : block.GetName(), "type" : block.GetType(), "inputs" : block.GetInputTypes()}
  1195         values = {"name" : block.GetName(), "type" : block.GetType(), "inputs" : block.GetInputTypes()}
  1191         values["extension"] = block.GetExtension()
  1196         values["extension"] = block.GetExtension()
  1192         dialog.SetValues(values)
  1197         dialog.SetValues(values)
  1193         if dialog.ShowModal() == wx.ID_OK:
  1198         if dialog.ShowModal() == wx.ID_OK:
  1207         dialog.SetMinVariableSize(variable.GetSize())
  1212         dialog.SetMinVariableSize(variable.GetSize())
  1208         varlist = []
  1213         varlist = []
  1209         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
  1214         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
  1210         if vars:
  1215         if vars:
  1211             for var in vars:
  1216             for var in vars:
  1212                 varlist.append((var["Name"], var["Class"], var["Type"]))
  1217                 if var["Edit"]:
       
  1218                     varlist.append((var["Name"], var["Class"], var["Type"]))
  1213         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
  1219         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
  1214         if returntype:
  1220         if returntype:
  1215             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
  1221             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
  1216         dialog.SetVariables(varlist)
  1222         dialog.SetVariables(varlist)
  1217         values = {"name" : variable.GetName(), "type" : variable.GetType()}
  1223         values = {"name" : variable.GetName(), "type" : variable.GetType()}