--- a/graphics/FBD_Objects.py Tue Aug 07 17:37:38 2007 +0200
+++ b/graphics/FBD_Objects.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from GraphicCommons import *
@@ -69,7 +68,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the block bounding box
@@ -85,7 +84,7 @@
else:
bbx_y = self.Pos.y
bbx_height = self.Size[1]
- self.BoundingBox = wxRect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
+ self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Refresh the positions of the block connectors
def RefreshConnectors(self):
@@ -95,12 +94,12 @@
# Update inputs positions
position = BLOCK_LINE_SIZE + linesize / 2
for input in self.Inputs:
- input.SetPosition(wxPoint(0, position))
+ input.SetPosition(wx.Point(0, position))
position += linesize
# Update outputs positions
position = BLOCK_LINE_SIZE + linesize / 2
for output in self.Outputs:
- output.SetPosition(wxPoint(self.Size[0], position))
+ output.SetPosition(wx.Point(self.Size[0], position))
position += linesize
self.RefreshConnected()
@@ -158,7 +157,7 @@
if type != self.Type or self.Extension != extension:
if type != self.Type:
self.Type = type
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.TypeSize = dc.GetTextExtent(self.Type)
self.Extension = extension
# Find the block definition from type given and create the corresponding
@@ -178,7 +177,7 @@
# Extract the inputs properties and create the corresponding connector
self.Inputs = []
for input_name, input_type, input_modifier in inputs:
- connector = Connector(self, input_name, input_type, wxPoint(0, 0), WEST, onlyone = True)
+ connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
if input_modifier == "negated":
connector.SetNegated(True)
elif input_modifier != "none":
@@ -187,7 +186,7 @@
# Extract the outputs properties and create the corresponding connector
self.Outputs = []
for output_name, output_type, output_modifier in outputs:
- connector = Connector(self, output_name, output_type, wxPoint(0, 0), EAST)
+ connector = Connector(self, output_name, output_type, wx.Point(0, 0), EAST)
if output_modifier == "negated":
connector.SetNegated(True)
elif output_modifier != "none":
@@ -278,8 +277,8 @@
# Draws block
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the block size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw block name and block type
@@ -335,7 +334,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the variable bounding box
@@ -348,14 +347,14 @@
bbx_width = self.Size[0] + 2 * CONNECTOR_SIZE
else:
bbx_width = self.Size[0] + CONNECTOR_SIZE
- self.BoundingBox = wxRect(bbx_x, self.Pos.y, bbx_width + 1, self.Size[1] + 1)
+ self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width + 1, self.Size[1] + 1)
# Refresh the position of the variable connector
def RefreshConnectors(self):
if self.Input:
- self.Input.SetPosition(wxPoint(0, self.Size[1] / 2))
+ self.Input.SetPosition(wx.Point(0, self.Size[1] / 2))
if self.Output:
- self.Output.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2))
+ self.Output.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of wires connected to connector
@@ -414,9 +413,9 @@
self.Output = None
# Create an input or output connector according to variable type
if self.Type != INPUT:
- self.Input = Connector(self, "", value_type, wxPoint(0, 0), WEST, onlyone = True)
+ self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone = True)
if self.Type != OUTPUT:
- self.Output = Connector(self, "", value_type, wxPoint(0, 0), EAST)
+ self.Output = Connector(self, "", value_type, wx.Point(0, 0), EAST)
self.RefreshConnectors()
elif value_type != self.ValueType:
if self.Input:
@@ -469,8 +468,8 @@
# Draws variable
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the variable size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw variable name
@@ -500,13 +499,13 @@
self.Type = type
self.Name = name
self.Id = id
- self.Pos = wxPoint(0, 0)
- self.Size = wxSize(0, 0)
+ self.Pos = wx.Point(0, 0)
+ self.Size = wx.Size(0, 0)
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), WEST, onlyone = True)
- else:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), EAST)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
+ else:
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
self.RefreshNameSize()
@@ -525,7 +524,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the connection bounding box
@@ -535,14 +534,14 @@
else:
bbx_x = self.Pos.x
bbx_width = self.Size[0] + CONNECTOR_SIZE
- self.BoundingBox = wxRect(bbx_x, self.Pos.y, bbx_width, self.Size[1])
+ self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width, self.Size[1])
# Refresh the position of the connection connector
def RefreshConnectors(self):
if self.Type == CONNECTOR:
- self.Connector.SetPosition(wxPoint(0, self.Size[1] / 2))
- else:
- self.Connector.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2))
+ self.Connector.SetPosition(wx.Point(0, self.Size[1] / 2))
+ else:
+ self.Connector.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of wires connected to connector
@@ -567,9 +566,9 @@
self.Clean()
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), WEST, onlyone = True)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
else:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), EAST)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
# Returns the connection type
@@ -613,8 +612,8 @@
# Draws connection
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the connection size with arrows in
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
arrowsize = min(self.Size[1] / 2, (self.Size[0] - self.NameSize[0] - 10) / 2)