1465 result, error = self.FindBlockConnectorWithError(pos, direction, exclude) |
1465 result, error = self.FindBlockConnectorWithError(pos, direction, exclude) |
1466 return result |
1466 return result |
1467 |
1467 |
1468 def FindBlockConnectorWithError(self, pos, direction = None, exclude = None): |
1468 def FindBlockConnectorWithError(self, pos, direction = None, exclude = None): |
1469 error = False |
1469 error = False |
|
1470 startblock = None |
1470 for block in self.Blocks.itervalues(): |
1471 for block in self.Blocks.itervalues(): |
1471 connector = block.TestConnector(pos, direction, exclude) |
1472 connector = block.TestConnector(pos, direction, exclude) |
1472 if connector: |
1473 if connector: |
|
1474 if self.IsWire(self.SelectedElement): |
|
1475 startblock = self.SelectedElement.StartConnected.GetParentBlock() |
1473 avail, error = connector.ConnectionAvailable(direction, exclude) |
1476 avail, error = connector.ConnectionAvailable(direction, exclude) |
1474 if not avail: |
1477 if not avail or not self.BlockCompatibility(startblock, block, direction): |
1475 connector = None |
1478 connector = None |
|
1479 error = True |
1476 return connector, error |
1480 return connector, error |
1477 return None, error |
1481 return None, error |
1478 |
1482 |
1479 def FindElementById(self, id): |
1483 def FindElementById(self, id): |
1480 block = self.Blocks.get(id, None) |
1484 block = self.Blocks.get(id, None) |
2347 if move_window.x != 0 or move_window.y != 0: |
2351 if move_window.x != 0 or move_window.y != 0: |
2348 self.RefreshVisibleElements(xp = xstart + move_window.x, yp = ystart + move_window.y) |
2352 self.RefreshVisibleElements(xp = xstart + move_window.x, yp = ystart + move_window.y) |
2349 self.Scroll(xstart + move_window.x, ystart + move_window.y) |
2353 self.Scroll(xstart + move_window.x, ystart + move_window.y) |
2350 self.RefreshScrollBars(move_window.x, move_window.y) |
2354 self.RefreshScrollBars(move_window.x, move_window.y) |
2351 |
2355 |
|
2356 def BlockCompatibility(self, startblock=None, endblock=None, direction = None): |
|
2357 return True |
|
2358 |
2352 #------------------------------------------------------------------------------- |
2359 #------------------------------------------------------------------------------- |
2353 # Keyboard event functions |
2360 # Keyboard event functions |
2354 #------------------------------------------------------------------------------- |
2361 #------------------------------------------------------------------------------- |
2355 |
2362 |
2356 ARROW_KEY_MOVE = { |
2363 ARROW_KEY_MOVE = { |