2195 width = round(float(width) / float(self.Scaling[0]) + 0.4) * self.Scaling[0] |
2195 width = round(float(width) / float(self.Scaling[0]) + 0.4) * self.Scaling[0] |
2196 height = round(float(height) / float(self.Scaling[1]) + 0.4) * self.Scaling[1] |
2196 height = round(float(height) / float(self.Scaling[1]) + 0.4) * self.Scaling[1] |
2197 return width, height |
2197 return width, height |
2198 |
2198 |
2199 def AddNewBlock(self, bbox): |
2199 def AddNewBlock(self, bbox): |
2200 dialog = FBDBlockDialog(self.ParentWindow, self.Controler) |
2200 dialog = FBDBlockDialog(self.ParentWindow, self.Controler, self.TagName) |
2201 dialog.SetPreviewFont(self.GetFont()) |
2201 dialog.SetPreviewFont(self.GetFont()) |
2202 dialog.SetBlockList(self.Controler.GetBlockTypes(self.TagName, self.Debug)) |
|
2203 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
|
2204 dialog.SetPouElementNames(self.Controler.GetEditedElementVariables(self.TagName, self.Debug)) |
|
2205 dialog.SetMinBlockSize((bbox.width, bbox.height)) |
2202 dialog.SetMinBlockSize((bbox.width, bbox.height)) |
2206 if dialog.ShowModal() == wx.ID_OK: |
2203 if dialog.ShowModal() == wx.ID_OK: |
2207 id = self.GetNewId() |
2204 id = self.GetNewId() |
2208 values = dialog.GetValues() |
2205 values = dialog.GetValues() |
2209 values.setdefault("name", "") |
2206 values.setdefault("name", "") |
2499 #------------------------------------------------------------------------------- |
2496 #------------------------------------------------------------------------------- |
2500 # Edit element content functions |
2497 # Edit element content functions |
2501 #------------------------------------------------------------------------------- |
2498 #------------------------------------------------------------------------------- |
2502 |
2499 |
2503 def EditBlockContent(self, block): |
2500 def EditBlockContent(self, block): |
2504 dialog = FBDBlockDialog(self.ParentWindow, self.Controler) |
2501 dialog = FBDBlockDialog(self.ParentWindow, self.Controler, self.TagName) |
2505 dialog.SetPreviewFont(self.GetFont()) |
2502 dialog.SetPreviewFont(self.GetFont()) |
2506 dialog.SetBlockList(self.Controler.GetBlockTypes(self.TagName, self.Debug)) |
|
2507 dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug)) |
|
2508 variable_names = self.Controler.GetEditedElementVariables(self.TagName, self.Debug) |
|
2509 if block.GetName() != "": |
|
2510 variable_names.remove(block.GetName()) |
|
2511 dialog.SetPouElementNames(variable_names) |
|
2512 dialog.SetMinBlockSize(block.GetSize()) |
2503 dialog.SetMinBlockSize(block.GetSize()) |
2513 old_values = {"name" : block.GetName(), |
2504 old_values = {"name" : block.GetName(), |
2514 "type" : block.GetType(), |
2505 "type" : block.GetType(), |
2515 "extension" : block.GetExtension(), |
2506 "extension" : block.GetExtension(), |
2516 "inputs" : block.GetInputTypes(), |
2507 "inputs" : block.GetInputTypes(), |