--- a/Viewer.py Tue Feb 26 15:34:38 2008 +0100
+++ b/Viewer.py Tue Feb 26 15:41:18 2008 +0100
@@ -1081,22 +1081,23 @@
connector = None
if self.DrawingWire:
self.DrawingWire = False
- if connector:
- event.Dragging = lambda : True
- self.SelectedElement.OnMotion(event, self.GetLogicalDC(), self.Scaling)
- if self.SelectedElement.EndConnected is not None:
- self.SelectedElement.ResetPoints()
- self.SelectedElement.GeneratePoints()
- self.SelectedElement.RefreshModel()
- self.SelectedElement.SetSelected(True)
- element = self.SelectedElement
- self.RefreshBuffer()
- else:
- rect = self.SelectedElement.GetRedrawRect()
- self.SelectedElement.Delete()
- self.SelectedElement = None
- element = None
- self.RefreshRect(self.GetScrolledRect(rect), False)
+ if self.SelectedElement is not None:
+ if connector:
+ event.Dragging = lambda : True
+ self.SelectedElement.OnMotion(event, self.GetLogicalDC(), self.Scaling)
+ if self.SelectedElement.EndConnected is not None:
+ self.SelectedElement.ResetPoints()
+ self.SelectedElement.GeneratePoints()
+ self.SelectedElement.RefreshModel()
+ self.SelectedElement.SetSelected(True)
+ element = self.SelectedElement
+ self.RefreshBuffer()
+ else:
+ rect = self.SelectedElement.GetRedrawRect()
+ self.SelectedElement.Delete()
+ self.SelectedElement = None
+ element = None
+ self.RefreshRect(self.GetScrolledRect(rect), False)
elif connector:
self.DrawingWire = True
pos = GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling)