graphics/SFC_Objects.py
branchpython3
changeset 3759 f713566d5d01
parent 3752 9f6f46dbe3ae
equal deleted inserted replaced
3758:bc71b19b45ff 3759:f713566d5d01
    21 # You should have received a copy of the GNU General Public License
    21 # You should have received a copy of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
       
    26 from functools import cmp_to_key
       
    27 from operator import eq
    26 import wx
    28 import wx
    27 
    29 
    28 from graphics.GraphicCommons import *
    30 from graphics.GraphicCommons import *
    29 from graphics.DebugDataConsumer import DebugDataConsumer
    31 from graphics.DebugDataConsumer import DebugDataConsumer
    30 from plcopen.structures import *
    32 from plcopen.structures import *
  1237                 input_pos = input.GetRelPosition()
  1239                 input_pos = input.GetRelPosition()
  1238                 input.SetPosition(wx.Point(input_pos.x - minx, input_pos.y))
  1240                 input.SetPosition(wx.Point(input_pos.x - minx, input_pos.y))
  1239             for output in self.Outputs:
  1241             for output in self.Outputs:
  1240                 output_pos = output.GetRelPosition()
  1242                 output_pos = output.GetRelPosition()
  1241                 output.SetPosition(wx.Point(output_pos.x - minx, output_pos.y))
  1243                 output.SetPosition(wx.Point(output_pos.x - minx, output_pos.y))
  1242         self.Inputs.sort(lambda x, y: cmp(x.Pos.x, y.Pos.x))
  1244         self.Inputs.sort(key=cmp_to_key(lambda x, y: eq(x.Pos.y, y.Pos.y)))
  1243         self.Outputs.sort(lambda x, y: cmp(x.Pos.x, y.Pos.x))
  1245         self.Outputs.sort(key=cmp_to_key(lambda x, y: eq(x.Pos.y, y.Pos.y)))
  1244         self.Pos.x += minx
  1246         self.Pos.x += minx
  1245         self.Size[0] = maxx - minx
  1247         self.Size[0] = maxx - minx
  1246         connector.MoveConnected()
  1248         connector.MoveConnected()
  1247         self.RefreshBoundingBox()
  1249         self.RefreshBoundingBox()
  1248 
  1250