author | lbessard |
Wed, 01 Oct 2008 17:49:02 +0200 | |
changeset 280 | 9ca192486f2f |
parent 269 | 34eff05909b0 |
child 283 | c4199b88cf60 |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
|
5 |
#based on the plcopen standard. |
|
6 |
# |
|
58 | 7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
0 | 8 |
# |
9 |
#See COPYING file for copyrights details. |
|
10 |
# |
|
11 |
#This library is free software; you can redistribute it and/or |
|
5 | 12 |
#modify it under the terms of the GNU General Public |
0 | 13 |
#License as published by the Free Software Foundation; either |
14 |
#version 2.1 of the License, or (at your option) any later version. |
|
15 |
# |
|
16 |
#This library is distributed in the hope that it will be useful, |
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
58 | 19 |
#General Public License for more details. |
0 | 20 |
# |
5 | 21 |
#You should have received a copy of the GNU General Public |
0 | 22 |
#License along with this library; if not, write to the Free Software |
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 |
||
25 |
import wx |
|
26 |
||
27 |
from GraphicCommons import * |
|
28 |
from plcopen.structures import * |
|
29 |
||
30 |
#------------------------------------------------------------------------------- |
|
31 |
# Function Block Diagram Block |
|
32 |
#------------------------------------------------------------------------------- |
|
33 |
||
34 |
""" |
|
35 |
Class that implements the graphic representation of a function block |
|
36 |
""" |
|
37 |
||
38 |
class FBD_Block(Graphic_Element): |
|
39 |
||
40 |
# Create a new block |
|
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
41 |
def __init__(self, parent, type, name, id = None, extension = 0, inputs = None, connectors = {}, executionControl = False, executionOrder = 0): |
0 | 42 |
Graphic_Element.__init__(self, parent) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
43 |
self.Type = None |
27 | 44 |
self.Extension = None |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
45 |
self.ExecutionControl = False |
0 | 46 |
self.Id = id |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
47 |
self.SetName(name) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
48 |
self.SetExecutionOrder(executionOrder) |
2 | 49 |
self.Inputs = [] |
50 |
self.Outputs = [] |
|
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
51 |
self.Colour = wx.BLACK |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
52 |
self.Pen = wx.BLACK_PEN |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
53 |
self.SetType(type, extension, inputs, connectors, executionControl) |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
54 |
self.Errors = {} |
0 | 55 |
|
112 | 56 |
# Make a clone of this FBD_Block |
162 | 57 |
def Clone(self, parent, id = None, name = "", pos = None): |
144 | 58 |
if self.Name != "" and name == "": |
59 |
name = self.Name |
|
162 | 60 |
block = FBD_Block(parent, self.Type, name, id, self.Extension) |
112 | 61 |
block.SetSize(self.Size[0], self.Size[1]) |
62 |
if pos is not None: |
|
63 |
block.SetPosition(pos.x, pos.y) |
|
64 |
block.Inputs = [input.Clone(block) for input in self.Inputs] |
|
65 |
block.Outputs = [output.Clone(block) for output in self.Outputs] |
|
66 |
return block |
|
67 |
||
249 | 68 |
def Flush(self): |
69 |
for input in self.Inputs: |
|
70 |
input.Flush() |
|
0 | 71 |
self.Inputs = [] |
249 | 72 |
for output in self.Outputs: |
73 |
output.Flush() |
|
0 | 74 |
self.Outputs = [] |
75 |
||
144 | 76 |
# Returns the RedrawRect |
77 |
def GetRedrawRect(self, movex = 0, movey = 0): |
|
78 |
rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
|
79 |
if movex != 0 or movey != 0: |
|
80 |
for input in self.Inputs: |
|
81 |
if input.IsConnected(): |
|
82 |
rect = rect.Union(input.GetConnectedRedrawRect(movex, movey)) |
|
83 |
for output in self.Outputs: |
|
84 |
if output.IsConnected(): |
|
85 |
rect = rect.Union(output.GetConnectedRedrawRect(movex, movey)) |
|
86 |
return rect |
|
87 |
||
0 | 88 |
# Delete this block by calling the appropriate method |
89 |
def Delete(self): |
|
90 |
self.Parent.DeleteBlock(self) |
|
91 |
||
92 |
# Unconnect all inputs and outputs |
|
93 |
def Clean(self): |
|
94 |
for input in self.Inputs: |
|
2 | 95 |
input.UnConnect(delete = True) |
96 |
for output in self.Outputs: |
|
97 |
output.UnConnect(delete = True) |
|
0 | 98 |
|
42 | 99 |
# Refresh the size of text for name |
100 |
def RefreshNameSize(self): |
|
165 | 101 |
self.NameSize = self.Parent.GetTextExtent(self.Name) |
42 | 102 |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
103 |
# Refresh the size of text for execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
104 |
def RefreshExecutionOrderSize(self): |
165 | 105 |
self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder)) |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
106 |
|
0 | 107 |
# Refresh the block bounding box |
108 |
def RefreshBoundingBox(self): |
|
109 |
# Calculate the size of the name outside the block |
|
42 | 110 |
text_width, text_height = self.NameSize |
0 | 111 |
# Calculate the bounding box size |
112 |
bbx_x = self.Pos.x - max(min(1, len(self.Inputs)) * CONNECTOR_SIZE, (text_width - self.Size[0]) / 2) |
|
113 |
bbx_width = self.Size[0] + 1 + (min(1, len(self.Inputs)) + min(1, len(self.Outputs))) * CONNECTOR_SIZE |
|
114 |
if self.Name != "": |
|
115 |
bbx_y = self.Pos.y - (text_height + 2) |
|
116 |
bbx_height = self.Size[1] + (text_height + 2) |
|
117 |
else: |
|
118 |
bbx_y = self.Pos.y |
|
119 |
bbx_height = self.Size[1] |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
120 |
if self.ExecutionOrder != 0: |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
121 |
bbx_x = min(bbx_x, self.Pos.x + self.Size[0] - self.ExecutionOrderSize[0]) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
122 |
bbx_width = max(bbx_width, bbx_width + self.Pos.x + self.ExecutionOrderSize[0] - bbx_x - self.Size[0]) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
123 |
bbx_height = bbx_height + (self.ExecutionOrderSize[1] + 2) |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
124 |
self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1) |
0 | 125 |
|
126 |
# Refresh the positions of the block connectors |
|
127 |
def RefreshConnectors(self): |
|
145 | 128 |
scaling = self.Parent.GetScaling() |
0 | 129 |
# Calculate the size for the connector lines |
130 |
lines = max(len(self.Inputs), len(self.Outputs)) |
|
103 | 131 |
if lines > 0: |
132 |
linesize = max((self.Size[1] - BLOCK_LINE_SIZE) / lines, BLOCK_LINE_SIZE) |
|
145 | 133 |
# Update inputs and outputs positions |
103 | 134 |
position = BLOCK_LINE_SIZE + linesize / 2 |
145 | 135 |
for i in xrange(lines): |
136 |
if scaling is not None: |
|
137 |
ypos = round(float(self.Pos.y + position) / float(scaling[1])) * scaling[1] - self.Pos.y |
|
138 |
else: |
|
139 |
ypos = position |
|
140 |
if i < len(self.Inputs): |
|
141 |
self.Inputs[i].SetPosition(wx.Point(0, ypos)) |
|
142 |
if i < len(self.Outputs): |
|
143 |
self.Outputs[i].SetPosition(wx.Point(self.Size[0], ypos)) |
|
103 | 144 |
position += linesize |
0 | 145 |
self.RefreshConnected() |
146 |
||
147 |
# Refresh the positions of wires connected to inputs and outputs |
|
148 |
def RefreshConnected(self, exclude = []): |
|
149 |
for input in self.Inputs: |
|
150 |
input.MoveConnected(exclude) |
|
151 |
for output in self.Outputs: |
|
152 |
output.MoveConnected(exclude) |
|
153 |
||
154 |
# Returns the block connector that starts with the point given if it exists |
|
27 | 155 |
def GetConnector(self, position, name = None): |
156 |
# if a name is given |
|
157 |
if name: |
|
158 |
# Test each input and output connector |
|
159 |
for input in self.Inputs: |
|
160 |
if name == input.GetName(): |
|
161 |
return input |
|
162 |
for output in self.Outputs: |
|
163 |
if name == output.GetName(): |
|
164 |
return output |
|
0 | 165 |
# Test each input connector |
166 |
for input in self.Inputs: |
|
167 |
input_pos = input.GetRelPosition() |
|
168 |
if position.x == self.Pos.x + input_pos.x and position.y == self.Pos.y + input_pos.y: |
|
169 |
return input |
|
170 |
# Test each output connector |
|
171 |
for output in self.Outputs: |
|
172 |
output_pos = output.GetRelPosition() |
|
173 |
if position.x == self.Pos.x + output_pos.x and position.y == self.Pos.y + output_pos.y: |
|
174 |
return output |
|
175 |
return None |
|
176 |
||
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
177 |
def GetInputTypes(self): |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
178 |
return tuple([input.GetType(True) for input in self.Inputs if input.GetName() != "EN"]) |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
179 |
|
102
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
180 |
def SetOutputValues(self, values): |
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
181 |
for output in self.Outputs: |
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
182 |
output.SetValue(values.get(ouput.getName(), None)) |
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
183 |
|
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
184 |
def GetConnectionResultType(self, connector, connectortype): |
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
185 |
resulttype = connectortype |
99
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
186 |
for input in self.Inputs: |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
187 |
name = input.GetName() |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
188 |
if input != connector and (name.startswith("IN") or name in ["MN", "MX"]): |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
189 |
inputtype = input.GetConnectedType() |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
190 |
if resulttype is None or inputtype is not None and self.IsOfType(inputtype, resulttype): |
99
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
191 |
resulttype = inputtype |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
192 |
for output in self.Outputs: |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
193 |
name = output.GetName() |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
194 |
if output != connector and name == "OUT" and not self.IsEndType(output.GetType()): |
99
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
195 |
outputtype = output.GetConnectedType() |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
196 |
if resulttype is None or outputtype is not None and self.IsOfType(outputtype, resulttype): |
99
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
197 |
resulttype = outputtype |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
198 |
return resulttype |
2b18a72dcaf0
Added support for standard functions type compatibility check
lbessard
parents:
90
diff
changeset
|
199 |
|
145 | 200 |
# Returns all the block connectors |
0 | 201 |
def GetConnectors(self): |
202 |
return {"inputs" : self.Inputs, "outputs" : self.Outputs} |
|
203 |
||
204 |
# Test if point given is on one of the block connectors |
|
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
205 |
def TestConnector(self, pt, direction = None, exclude = True): |
0 | 206 |
# Test each input connector |
207 |
for input in self.Inputs: |
|
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
208 |
if input.TestPoint(pt, direction, exclude): |
0 | 209 |
return input |
210 |
# Test each output connector |
|
211 |
for output in self.Outputs: |
|
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
212 |
if output.TestPoint(pt, direction, exclude): |
0 | 213 |
return output |
214 |
return None |
|
215 |
||
2 | 216 |
# Changes the block type |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
217 |
def SetType(self, type, extension, inputs = None, connectors = {}, executionControl = False): |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
218 |
if type != self.Type or self.Extension != extension or executionControl != self.ExecutionControl: |
42 | 219 |
if type != self.Type: |
220 |
self.Type = type |
|
165 | 221 |
self.TypeSize = self.Parent.GetTextExtent(self.Type) |
27 | 222 |
self.Extension = extension |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
223 |
self.ExecutionControl = executionControl |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
224 |
# Find the block definition from type given and create the corresponding |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
225 |
# inputs and outputs |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
226 |
blocktype = self.Parent.GetBlockType(type, inputs) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
227 |
if blocktype: |
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
228 |
self.Colour = wx.BLACK |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
229 |
inputs = [input for input in blocktype["inputs"]] |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
230 |
outputs = [output for output in blocktype["outputs"]] |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
231 |
if blocktype["extensible"]: |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
232 |
start = int(inputs[-1][0].replace("IN", "")) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
233 |
for i in xrange(self.Extension - len(blocktype["inputs"])): |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
234 |
start += 1 |
27 | 235 |
inputs.append(("IN%d"%start, inputs[-1][1], inputs[-1][2])) |
16 | 236 |
else: |
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
237 |
self.Colour = wx.RED |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
238 |
if "inputs" in connectors: |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
239 |
inputs = connectors["inputs"] |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
240 |
else: |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
241 |
inputs = [] |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
242 |
if "outputs" in connectors: |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
243 |
outputs = connectors["outputs"] |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
244 |
else: |
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
245 |
outputs = [] |
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
246 |
if self.ExecutionControl: |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
247 |
inputs.insert(0, ("EN","BOOL","none")) |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
248 |
outputs.insert(0, ("ENO","BOOL","none")) |
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
249 |
self.Pen = wx.Pen(self.Colour) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
250 |
self.Clean() |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
251 |
# Extract the inputs properties and create the corresponding connector |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
252 |
self.Inputs = [] |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
253 |
for input_name, input_type, input_modifier in inputs: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
254 |
connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
255 |
if input_modifier == "negated": |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
256 |
connector.SetNegated(True) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
257 |
elif input_modifier != "none": |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
258 |
connector.SetEdge(input_modifier) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
259 |
self.Inputs.append(connector) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
260 |
# Extract the outputs properties and create the corresponding connector |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
261 |
self.Outputs = [] |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
262 |
for output_name, output_type, output_modifier in outputs: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
263 |
connector = Connector(self, output_name, output_type, wx.Point(0, 0), EAST) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
264 |
if output_modifier == "negated": |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
265 |
connector.SetNegated(True) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
266 |
elif output_modifier != "none": |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
267 |
connector.SetEdge(output_modifier) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
268 |
self.Outputs.append(connector) |
42 | 269 |
self.RefreshMinSize() |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
270 |
self.RefreshConnectors() |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
271 |
self.RefreshBoundingBox() |
2 | 272 |
|
0 | 273 |
# Returns the block type |
274 |
def GetType(self): |
|
275 |
return self.Type |
|
276 |
||
277 |
# Changes the block name |
|
278 |
def SetName(self, name): |
|
279 |
self.Name = name |
|
42 | 280 |
self.RefreshNameSize() |
0 | 281 |
|
282 |
# Returs the block name |
|
283 |
def GetName(self): |
|
284 |
return self.Name |
|
285 |
||
2 | 286 |
# Changes the extension name |
287 |
def SetExtension(self, extension): |
|
288 |
self.Extension = extension |
|
289 |
||
290 |
# Returs the extension name |
|
291 |
def GetExtension(self): |
|
292 |
return self.Extension |
|
293 |
||
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
294 |
# Changes the execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
295 |
def SetExecutionOrder(self, executionOrder): |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
296 |
self.ExecutionOrder = executionOrder |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
297 |
self.RefreshExecutionOrderSize() |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
298 |
|
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
299 |
# Returs the execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
300 |
def GetExecutionOrder(self): |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
301 |
return self.ExecutionOrder |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
302 |
|
269
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
303 |
# Returs the execution order |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
304 |
def GetExecutionControl(self): |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
305 |
return self.ExecutionControl |
34eff05909b0
Adding support for EN/ENO variables (temporarily disabled, waiting for matiec support)
lbessard
parents:
249
diff
changeset
|
306 |
|
42 | 307 |
# Refresh the block minimum size |
308 |
def RefreshMinSize(self): |
|
0 | 309 |
# Calculate the inputs maximum width |
310 |
max_input = 0 |
|
311 |
for input in self.Inputs: |
|
42 | 312 |
w, h = input.GetNameSize() |
0 | 313 |
max_input = max(max_input, w) |
314 |
# Calculate the outputs maximum width |
|
315 |
max_output = 0 |
|
316 |
for output in self.Outputs: |
|
42 | 317 |
w, h = output.GetNameSize() |
0 | 318 |
max_output = max(max_output, w) |
42 | 319 |
width = max(self.TypeSize[0] + 10, max_input + max_output + 15) |
0 | 320 |
height = (max(len(self.Inputs), len(self.Outputs)) + 1) * BLOCK_LINE_SIZE |
42 | 321 |
self.MinSize = width, height |
322 |
||
323 |
# Returns the block minimum size |
|
324 |
def GetMinSize(self): |
|
325 |
return self.MinSize |
|
0 | 326 |
|
327 |
# Changes the negated property of the connector handled |
|
328 |
def SetConnectorNegated(self, negated): |
|
329 |
handle_type, handle = self.Handle |
|
330 |
if handle_type == HANDLE_CONNECTOR: |
|
331 |
handle.SetNegated(negated) |
|
332 |
self.RefreshModel(False) |
|
333 |
||
334 |
# Changes the edge property of the connector handled |
|
335 |
def SetConnectorEdge(self, edge): |
|
336 |
handle_type, handle = self.Handle |
|
337 |
if handle_type == HANDLE_CONNECTOR: |
|
338 |
handle.SetEdge(edge) |
|
339 |
self.RefreshModel(False) |
|
340 |
||
2 | 341 |
# Method called when a LeftDClick event have been generated |
27 | 342 |
def OnLeftDClick(self, event, dc, scaling): |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
343 |
# Edit the block properties |
2 | 344 |
self.Parent.EditBlockContent(self) |
345 |
||
0 | 346 |
# Method called when a RightUp event have been generated |
27 | 347 |
def OnRightUp(self, event, dc, scaling): |
348 |
pos = GetScaledEventPosition(event, dc, scaling) |
|
0 | 349 |
# Popup the menu with special items for a block and a connector if one is handled |
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
350 |
connector = self.TestConnector(pos, exclude=False) |
0 | 351 |
if connector: |
352 |
self.Handle = (HANDLE_CONNECTOR, connector) |
|
353 |
self.Parent.PopupBlockMenu(connector) |
|
354 |
else: |
|
355 |
self.Parent.PopupBlockMenu() |
|
356 |
||
357 |
# Refreshes the block model |
|
358 |
def RefreshModel(self, move=True): |
|
359 |
self.Parent.RefreshBlockModel(self) |
|
360 |
# If block has moved, refresh the model of wires connected to outputs |
|
361 |
if move: |
|
362 |
for output in self.Outputs: |
|
363 |
output.RefreshWires() |
|
364 |
||
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
365 |
def AddError(self, infos, start, end): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
366 |
if infos[0] in ["type", "name"] and start[0] == 0 and end[0] == 0: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
367 |
self.Errors[infos[0]] = (start, end) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
368 |
elif infos[0] == "input" and infos[1] < len(self.Inputs): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
369 |
self.Inputs[infos[1]].AddError(infos[2:], start, end) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
370 |
elif infos[0] == "output" and infos[1] < len(self.Outputs): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
371 |
self.Outputs[infos[1]].AddError(infos[2:], start, end) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
372 |
|
0 | 373 |
# Draws block |
374 |
def Draw(self, dc): |
|
144 | 375 |
Graphic_Element.Draw(self, dc) |
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
376 |
dc.SetPen(self.Pen) |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
377 |
dc.SetBrush(wx.WHITE_BRUSH) |
90
2245e8776086
Adding support support for using PLCOpenEditor with Beremiz
lbessard
parents:
64
diff
changeset
|
378 |
dc.SetTextForeground(self.Colour) |
213 | 379 |
|
380 |
if getattr(dc, "printing", False): |
|
381 |
name_size = dc.GetTextExtent(self.Name) |
|
382 |
type_size = dc.GetTextExtent(self.Type) |
|
383 |
executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder)) |
|
384 |
else: |
|
385 |
name_size = self.NameSize |
|
386 |
type_size = self.TypeSize |
|
387 |
executionorder_size = self.ExecutionOrderSize |
|
388 |
||
0 | 389 |
# Draw a rectangle with the block size |
390 |
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
|
391 |
# Draw block name and block type |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
392 |
name_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2, |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
393 |
self.Pos.y - (name_size[1] + 2)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
394 |
type_pos = (self.Pos.x + (self.Size[0] - type_size[0]) / 2, |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
395 |
self.Pos.y + 5) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
396 |
dc.DrawText(self.Name, name_pos[0], name_pos[1]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
397 |
dc.DrawText(self.Type, type_pos[0], type_pos[1]) |
0 | 398 |
# Draw inputs and outputs connectors |
399 |
for input in self.Inputs: |
|
400 |
input.Draw(dc) |
|
401 |
for output in self.Outputs: |
|
402 |
output.Draw(dc) |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
403 |
if self.ExecutionOrder != 0: |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
404 |
# Draw block execution order |
213 | 405 |
dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0], |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
406 |
self.Pos.y + self.Size[1] + 2) |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
407 |
if "name" in self.Errors: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
408 |
HighlightErrorZone(dc, name_pos[0], name_pos[1], name_size[0], name_size[1]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
409 |
if "type" in self.Errors: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
410 |
HighlightErrorZone(dc, type_pos[0], type_pos[1], type_size[0], type_size[1]) |
140
06d28f03f6f4
Adding highlighting on group or element when mouse is over
lbessard
parents:
118
diff
changeset
|
411 |
dc.SetTextForeground(wx.BLACK) |
06d28f03f6f4
Adding highlighting on group or element when mouse is over
lbessard
parents:
118
diff
changeset
|
412 |
|
0 | 413 |
|
414 |
#------------------------------------------------------------------------------- |
|
415 |
# Function Block Diagram Variable |
|
416 |
#------------------------------------------------------------------------------- |
|
417 |
||
418 |
""" |
|
419 |
Class that implements the graphic representation of a variable |
|
420 |
""" |
|
421 |
||
422 |
class FBD_Variable(Graphic_Element): |
|
423 |
||
424 |
# Create a new variable |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
425 |
def __init__(self, parent, type, name, value_type, id = None, executionOrder = 0): |
0 | 426 |
Graphic_Element.__init__(self, parent) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
427 |
self.Type = None |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
428 |
self.ValueType = None |
0 | 429 |
self.Id = id |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
430 |
self.SetName(name) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
431 |
self.SetExecutionOrder(executionOrder) |
0 | 432 |
self.Input = None |
433 |
self.Output = None |
|
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
434 |
self.SetType(type, value_type) |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
435 |
self.Errors = [] |
0 | 436 |
|
112 | 437 |
# Make a clone of this FBD_Variable |
162 | 438 |
def Clone(self, parent, id = None, pos = None): |
439 |
variable = FBD_Variable(parent, self.Type, self.Name, self.ValueType, id) |
|
112 | 440 |
variable.SetSize(self.Size[0], self.Size[1]) |
441 |
if pos is not None: |
|
442 |
variable.SetPosition(pos.x, pos.y) |
|
144 | 443 |
if self.Input: |
444 |
variable.Input = self.Input.Clone(variable) |
|
445 |
if self.Output: |
|
446 |
variable.Output = self.Output.Clone(variable) |
|
112 | 447 |
return variable |
448 |
||
249 | 449 |
def Flush(self): |
450 |
if self.Input is not None: |
|
451 |
self.Input.Flush() |
|
452 |
self.Input = None |
|
453 |
if self.Output is not None: |
|
454 |
self.Output.Flush() |
|
455 |
self.Output = None |
|
0 | 456 |
|
144 | 457 |
# Returns the RedrawRect |
458 |
def GetRedrawRect(self, movex = 0, movey = 0): |
|
459 |
rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
|
460 |
if movex != 0 or movey != 0: |
|
461 |
if self.Input and self.Input.IsConnected(): |
|
462 |
rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey)) |
|
463 |
if self.Output and self.Output.IsConnected(): |
|
464 |
rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey)) |
|
465 |
return rect |
|
466 |
||
0 | 467 |
# Unconnect connector |
468 |
def Clean(self): |
|
469 |
if self.Input: |
|
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
470 |
self.Input.UnConnect(delete = True) |
0 | 471 |
if self.Output: |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
472 |
self.Output.UnConnect(delete = True) |
0 | 473 |
|
474 |
# Delete this variable by calling the appropriate method |
|
475 |
def Delete(self): |
|
476 |
self.Parent.DeleteVariable(self) |
|
477 |
||
42 | 478 |
# Refresh the size of text for name |
479 |
def RefreshNameSize(self): |
|
165 | 480 |
self.NameSize = self.Parent.GetTextExtent(self.Name) |
42 | 481 |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
482 |
# Refresh the size of text for execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
483 |
def RefreshExecutionOrderSize(self): |
165 | 484 |
self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder)) |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
485 |
|
0 | 486 |
# Refresh the variable bounding box |
487 |
def RefreshBoundingBox(self): |
|
488 |
if self.Type in (OUTPUT, INOUT): |
|
489 |
bbx_x = self.Pos.x - CONNECTOR_SIZE |
|
490 |
else: |
|
491 |
bbx_x = self.Pos.x |
|
492 |
if self.Type == INOUT: |
|
493 |
bbx_width = self.Size[0] + 2 * CONNECTOR_SIZE |
|
494 |
else: |
|
495 |
bbx_width = self.Size[0] + CONNECTOR_SIZE |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
496 |
bbx_height = self.Size[1] |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
497 |
if self.ExecutionOrder != 0: |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
498 |
bbx_x = min(bbx_x, self.Pos.x + self.Size[0] - self.ExecutionOrderSize[0]) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
499 |
bbx_width = max(bbx_width, bbx_width + self.Pos.x + self.ExecutionOrderSize[0] - bbx_x - self.Size[0]) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
500 |
bbx_height = bbx_height + (self.ExecutionOrderSize[1] + 2) |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
501 |
self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width + 1, bbx_height + 1) |
0 | 502 |
|
503 |
# Refresh the position of the variable connector |
|
504 |
def RefreshConnectors(self): |
|
145 | 505 |
scaling = self.Parent.GetScaling() |
506 |
if scaling is not None: |
|
507 |
position = round(float(self.Pos.y + self.Size[1] / 2) / float(scaling[1])) * scaling[1] - self.Pos.y |
|
508 |
else: |
|
509 |
position = self.Size[1] / 2 |
|
0 | 510 |
if self.Input: |
145 | 511 |
self.Input.SetPosition(wx.Point(0, position)) |
0 | 512 |
if self.Output: |
145 | 513 |
self.Output.SetPosition(wx.Point(self.Size[0], position)) |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
514 |
self.RefreshConnected() |
0 | 515 |
|
516 |
# Refresh the position of wires connected to connector |
|
517 |
def RefreshConnected(self, exclude = []): |
|
518 |
if self.Input: |
|
519 |
self.Input.MoveConnected(exclude) |
|
520 |
if self.Output: |
|
521 |
self.Output.MoveConnected(exclude) |
|
522 |
||
523 |
# Test if point given is on the variable connector |
|
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
524 |
def TestConnector(self, pt, direction = None, exclude=True): |
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
525 |
if self.Input and self.Input.TestPoint(pt, direction, exclude): |
0 | 526 |
return self.Input |
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
527 |
if self.Output and self.Output.TestPoint(pt, direction, exclude): |
0 | 528 |
return self.Output |
529 |
return None |
|
530 |
||
531 |
# Returns the block connector that starts with the point given if it exists |
|
27 | 532 |
def GetConnector(self, position, name = None): |
533 |
# if a name is given |
|
534 |
if name: |
|
535 |
# Test input and output connector if they exists |
|
536 |
if self.Input and name == self.Input.GetName(): |
|
537 |
return self.Input |
|
538 |
if self.Output and name == self.Output.GetName(): |
|
539 |
return self.Output |
|
0 | 540 |
# Test input connector if it exists |
541 |
if self.Input: |
|
542 |
input_pos = self.Input.GetRelPosition() |
|
543 |
if position.x == self.Pos.x + input_pos.x and position.y == self.Pos.y + input_pos.y: |
|
544 |
return self.Input |
|
545 |
# Test output connector if it exists |
|
546 |
if self.Output: |
|
547 |
output_pos = self.Output.GetRelPosition() |
|
548 |
if position.x == self.Pos.x + output_pos.x and position.y == self.Pos.y + output_pos.y: |
|
549 |
return self.Output |
|
550 |
return None |
|
551 |
||
552 |
# Returns all the block connectors |
|
553 |
def GetConnectors(self): |
|
554 |
return {"input" : self.Input, "output" : self.Output} |
|
555 |
||
556 |
# Changes the negated property of the variable connector if handled |
|
557 |
def SetConnectorNegated(self, negated): |
|
558 |
handle_type, handle = self.Handle |
|
559 |
if handle_type == HANDLE_CONNECTOR: |
|
560 |
handle.SetNegated(negated) |
|
561 |
self.RefreshModel(False) |
|
562 |
||
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
563 |
# Changes the variable type |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
564 |
def SetType(self, type, value_type): |
32
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
565 |
if type != self.Type: |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
566 |
self.Type = type |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
567 |
self.Clean() |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
568 |
self.Input = None |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
569 |
self.Output = None |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
570 |
# Create an input or output connector according to variable type |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
571 |
if self.Type != INPUT: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
572 |
self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone = True) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
573 |
if self.Type != OUTPUT: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
574 |
self.Output = Connector(self, "", value_type, wx.Point(0, 0), EAST) |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
575 |
self.RefreshConnectors() |
32
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
576 |
elif value_type != self.ValueType: |
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
577 |
if self.Input: |
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
578 |
self.Input.SetType(value_type) |
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
579 |
if self.Output: |
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
580 |
self.Output.SetType(value_type) |
cf9efccff009
FBD_Variable don't remove wire when just expression changed
lbessard
parents:
28
diff
changeset
|
581 |
self.RefreshConnectors() |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
582 |
|
0 | 583 |
# Returns the variable type |
584 |
def GetType(self): |
|
585 |
return self.Type |
|
586 |
||
587 |
# Changes the variable name |
|
588 |
def SetName(self, name): |
|
589 |
self.Name = name |
|
42 | 590 |
self.RefreshNameSize() |
0 | 591 |
|
592 |
# Returns the variable name |
|
593 |
def GetName(self): |
|
594 |
return self.Name |
|
595 |
||
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
596 |
# Changes the execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
597 |
def SetExecutionOrder(self, executionOrder): |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
598 |
self.ExecutionOrder = executionOrder |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
599 |
self.RefreshExecutionOrderSize() |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
600 |
|
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
601 |
# Returs the execution order |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
602 |
def GetExecutionOrder(self): |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
603 |
return self.ExecutionOrder |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
604 |
|
0 | 605 |
# Returns the variable minimum size |
606 |
def GetMinSize(self): |
|
42 | 607 |
return self.NameSize[0] + 10, self.NameSize[1] + 10 |
0 | 608 |
|
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
609 |
# Method called when a LeftDClick event have been generated |
27 | 610 |
def OnLeftDClick(self, event, dc, scaling): |
3
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
611 |
# Edit the variable properties |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
612 |
self.Parent.EditVariableContent(self) |
86ccc89d7b0b
FBD Blocks and Variables can now be modified and wires can't be unconnected on both sides
lbessard
parents:
2
diff
changeset
|
613 |
|
0 | 614 |
# Method called when a RightUp event have been generated |
27 | 615 |
def OnRightUp(self, event, dc, scaling): |
102
85875dcb7754
Adding edit user's POU by double click on block instance
lbessard
parents:
99
diff
changeset
|
616 |
self.Parent.PopupDefaultMenu() |
0 | 617 |
|
618 |
# Refreshes the variable model |
|
619 |
def RefreshModel(self, move=True): |
|
620 |
self.Parent.RefreshVariableModel(self) |
|
621 |
# If variable has moved and variable is not of type OUTPUT, refresh the model |
|
622 |
# of wires connected to output connector |
|
623 |
if move and self.Type != OUTPUT: |
|
624 |
if self.Output: |
|
625 |
self.Output.RefreshWires() |
|
626 |
||
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
627 |
def AddError(self, infos, start, end): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
628 |
if infos[0] == "expression" and start[0] == 0 and end[0] == 0: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
629 |
self.Errors.append((start[1], end[1])) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
630 |
|
0 | 631 |
# Draws variable |
632 |
def Draw(self, dc): |
|
144 | 633 |
Graphic_Element.Draw(self, dc) |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
634 |
dc.SetPen(wx.BLACK_PEN) |
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
635 |
dc.SetBrush(wx.WHITE_BRUSH) |
213 | 636 |
|
637 |
if getattr(dc, "printing", False): |
|
638 |
name_size = dc.GetTextExtent(self.Name) |
|
639 |
executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder)) |
|
640 |
else: |
|
641 |
name_size = self.NameSize |
|
642 |
executionorder_size = self.ExecutionOrderSize |
|
643 |
||
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
644 |
text_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2, |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
645 |
self.Pos.y + (self.Size[1] - name_size[1]) / 2) |
0 | 646 |
# Draw a rectangle with the variable size |
647 |
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
|
648 |
# Draw variable name |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
649 |
dc.DrawText(self.Name, text_pos[0], text_pos[1]) |
0 | 650 |
# Draw connectors |
651 |
if self.Input: |
|
652 |
self.Input.Draw(dc) |
|
653 |
if self.Output: |
|
654 |
self.Output.Draw(dc) |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
655 |
if self.ExecutionOrder != 0: |
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
656 |
# Draw variable execution order |
213 | 657 |
dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0], |
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
658 |
self.Pos.y + self.Size[1] + 2) |
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
659 |
for start, end in self.Errors: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
660 |
offset = dc.GetTextExtent(self.Name[:start]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
661 |
size = dc.GetTextExtent(self.Name[start:end + 1]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
213
diff
changeset
|
662 |
HighlightErrorZone(dc, text_pos[0] + offset[0], text_pos[1], size[0], size[1]) |
0 | 663 |
|
664 |
#------------------------------------------------------------------------------- |
|
665 |
# Function Block Diagram Connector |
|
666 |
#------------------------------------------------------------------------------- |
|
667 |
||
668 |
""" |
|
669 |
Class that implements the graphic representation of a connection |
|
670 |
""" |
|
671 |
||
672 |
class FBD_Connector(Graphic_Element): |
|
673 |
||
674 |
# Create a new connection |
|
675 |
def __init__(self, parent, type, name, id = None): |
|
676 |
Graphic_Element.__init__(self, parent) |
|
677 |
self.Type = type |
|
678 |
self.Id = id |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
679 |
self.SetName(name) |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
680 |
self.Pos = wx.Point(0, 0) |
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
681 |
self.Size = wx.Size(0, 0) |
0 | 682 |
# Create an input or output connector according to connection type |
683 |
if self.Type == CONNECTOR: |
|
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
684 |
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True) |
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
685 |
else: |
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
686 |
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST) |
0 | 687 |
self.RefreshConnectors() |
42 | 688 |
self.RefreshNameSize() |
0 | 689 |
|
249 | 690 |
def Flush(self): |
691 |
if self.Connector: |
|
692 |
self.Connector.Flush() |
|
693 |
self.Connector = None |
|
0 | 694 |
|
144 | 695 |
# Returns the RedrawRect |
696 |
def GetRedrawRect(self, movex = 0, movey = 0): |
|
697 |
rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
|
698 |
if movex != 0 or movey != 0: |
|
699 |
if self.Connector and self.Connector.IsConnected(): |
|
700 |
rect = rect.Union(self.Connector.GetConnectedRedrawRect(movex, movey)) |
|
701 |
return rect |
|
702 |
||
112 | 703 |
# Make a clone of this FBD_Connector |
162 | 704 |
def Clone(self, parent, id = None, pos = None): |
705 |
connection = FBD_Connector(parent, self.Type, self.Name, id) |
|
112 | 706 |
connection.SetSize(self.Size[0], self.Size[1]) |
707 |
if pos is not None: |
|
708 |
connection.SetPosition(pos.x, pos.y) |
|
709 |
connection.Connector = self.Connector.Clone(connection) |
|
710 |
return connection |
|
711 |
||
0 | 712 |
# Unconnect connector |
713 |
def Clean(self): |
|
714 |
if self.Connector: |
|
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
715 |
self.Connector.UnConnect(delete = True) |
0 | 716 |
|
717 |
# Delete this connection by calling the appropriate method |
|
718 |
def Delete(self): |
|
719 |
self.Parent.DeleteConnection(self) |
|
720 |
||
42 | 721 |
# Refresh the size of text for name |
722 |
def RefreshNameSize(self): |
|
165 | 723 |
self.NameSize = self.Parent.GetTextExtent(self.Name) |
42 | 724 |
|
0 | 725 |
# Refresh the connection bounding box |
726 |
def RefreshBoundingBox(self): |
|
727 |
if self.Type == CONNECTOR: |
|
728 |
bbx_x = self.Pos.x - CONNECTOR_SIZE |
|
729 |
else: |
|
730 |
bbx_x = self.Pos.x |
|
731 |
bbx_width = self.Size[0] + CONNECTOR_SIZE |
|
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
732 |
self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width, self.Size[1]) |
0 | 733 |
|
734 |
# Refresh the position of the connection connector |
|
735 |
def RefreshConnectors(self): |
|
145 | 736 |
scaling = self.Parent.GetScaling() |
737 |
if scaling is not None: |
|
738 |
position = round(float(self.Pos.y + self.Size[1] / 2) / float(scaling[1])) * scaling[1] - self.Pos.y |
|
739 |
else: |
|
740 |
position = self.Size[1] / 2 |
|
0 | 741 |
if self.Type == CONNECTOR: |
145 | 742 |
self.Connector.SetPosition(wx.Point(0, position)) |
743 |
else: |
|
744 |
self.Connector.SetPosition(wx.Point(self.Size[0], position)) |
|
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
745 |
self.RefreshConnected() |
0 | 746 |
|
747 |
# Refresh the position of wires connected to connector |
|
748 |
def RefreshConnected(self, exclude = []): |
|
749 |
if self.Connector: |
|
750 |
self.Connector.MoveConnected(exclude) |
|
751 |
||
752 |
# Test if point given is on the connection connector |
|
243
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
753 |
def TestConnector(self, pt, direction = None, exclude=True): |
c5da8b706cde
Adding support for allowing connections only between an input and an output connector
lbessard
parents:
231
diff
changeset
|
754 |
if self.Connector and self.Connector.TestPoint(pt, direction, exclude): |
0 | 755 |
return self.Connector |
756 |
return None |
|
757 |
||
758 |
# Returns the connection connector |
|
27 | 759 |
def GetConnector(self, position = None, name = None): |
0 | 760 |
return self.Connector |
761 |
||
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
762 |
# Changes the variable type |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
763 |
def SetType(self, type): |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
764 |
if type != self.Type: |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
765 |
self.Type = type |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
766 |
self.Clean() |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
767 |
# Create an input or output connector according to connection type |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
768 |
if self.Type == CONNECTOR: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
769 |
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True) |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
770 |
else: |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
771 |
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST) |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
772 |
self.RefreshConnectors() |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
773 |
|
0 | 774 |
# Returns the connection type |
775 |
def GetType(self): |
|
776 |
return self.Type |
|
777 |
||
145 | 778 |
def GetConnectionResultType(self, connector, connectortype): |
779 |
return connectortype |
|
780 |
||
0 | 781 |
# Changes the connection name |
782 |
def SetName(self, name): |
|
783 |
self.Name = name |
|
42 | 784 |
self.RefreshNameSize() |
0 | 785 |
|
786 |
# Returns the connection name |
|
787 |
def GetName(self): |
|
788 |
return self.Name |
|
789 |
||
790 |
# Returns the connection minimum size |
|
791 |
def GetMinSize(self): |
|
42 | 792 |
text_width, text_height = self.NameSize |
0 | 793 |
if text_height % 2 == 1: |
794 |
text_height += 1 |
|
795 |
return text_width + text_height + 20, text_height + 10 |
|
796 |
||
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
797 |
# Method called when a LeftDClick event have been generated |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
798 |
def OnLeftDClick(self, event, dc, scaling): |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
799 |
# Edit the connection properties |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
800 |
self.Parent.EditConnectionContent(self) |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
801 |
|
0 | 802 |
# Method called when a RightUp event have been generated |
27 | 803 |
def OnRightUp(self, event, dc, scaling): |
0 | 804 |
# Popup the default menu |
805 |
self.Parent.PopupDefaultMenu() |
|
806 |
||
807 |
# Refreshes the connection model |
|
808 |
def RefreshModel(self, move=True): |
|
809 |
self.Parent.RefreshConnectionModel(self) |
|
810 |
# If connection has moved and connection is of type CONTINUATION, refresh |
|
811 |
# the model of wires connected to connector |
|
812 |
if move and self.Type == CONTINUATION: |
|
813 |
if self.Connector: |
|
814 |
self.Connector.RefreshWires() |
|
815 |
||
816 |
# Draws connection |
|
817 |
def Draw(self, dc): |
|
144 | 818 |
Graphic_Element.Draw(self, dc) |
64
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
819 |
dc.SetPen(wx.BLACK_PEN) |
dd6f693e46a1
Cleaning code for using only wxPython 2.6 class naming
lbessard
parents:
58
diff
changeset
|
820 |
dc.SetBrush(wx.WHITE_BRUSH) |
213 | 821 |
|
822 |
if getattr(dc, "printing", False): |
|
823 |
name_size = dc.GetTextExtent(self.Name) |
|
824 |
else: |
|
825 |
name_size = self.NameSize |
|
826 |
||
0 | 827 |
# Draw a rectangle with the connection size with arrows in |
828 |
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
|
213 | 829 |
arrowsize = min(self.Size[1] / 2, (self.Size[0] - name_size[0] - 10) / 2) |
0 | 830 |
dc.DrawLine(self.Pos.x, self.Pos.y, self.Pos.x + arrowsize, |
831 |
self.Pos.y + self.Size[1] / 2) |
|
832 |
dc.DrawLine(self.Pos.x + arrowsize, self.Pos.y + self.Size[1] / 2, |
|
833 |
self.Pos.x, self.Pos.y + self.Size[1]) |
|
834 |
dc.DrawLine(self.Pos.x + self.Size[0] - arrowsize, self.Pos.y, |
|
835 |
self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] / 2) |
|
836 |
dc.DrawLine(self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] / 2, |
|
837 |
self.Pos.x + self.Size[0] - arrowsize, self.Pos.y + self.Size[1]) |
|
118
0c53d6a36013
Add support for defining execution order in FBD networks (related ST code not generated yet)
lbessard
parents:
112
diff
changeset
|
838 |
# Draw connection name |
213 | 839 |
dc.DrawText(self.Name, self.Pos.x + (self.Size[0] - name_size[0]) / 2, |
840 |
self.Pos.y + (self.Size[1] - name_size[1]) / 2) |
|
0 | 841 |
# Draw connector |
842 |
if self.Connector: |
|
843 |
self.Connector.Draw(dc) |
|
140
06d28f03f6f4
Adding highlighting on group or element when mouse is over
lbessard
parents:
118
diff
changeset
|
844 |