Bug on wire Drawing fixed
authorlbessard
Tue, 26 Feb 2008 15:41:18 +0100
changeset 174 97bbbaa54964
parent 173 3f99b76ecfe7
child 175 cc78572dfbbc
Bug on wire Drawing fixed
Viewer.py
--- 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)