Docview and IDE patch from Morag Hua with fix for bug #1217890

"Closing view crashes Python" plus some new features:

    New feature added to the IDE is 'Extensions'.  Under
    Tools|Options|Extensions, you can add calls to external programs.
    For example you can add a "Notepad" extension (under windows) that
    will exec Notepad on the currently open file.  A new "Notepad"
    menu item will appear under the Tools menu.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2005-06-11 23:18:57 +00:00
parent 94211100ea
commit 2eeaec1909
19 changed files with 1285 additions and 533 deletions

View File

@@ -86,11 +86,15 @@ class CanvasView(wx.lib.docview.View):
def OnFocus(self, event):
self.SetFocus()
self.FocusColorPropertyShape(True)
event.Skip()
def FocusOnClick(self, event):
self.SetFocus()
event.Skip()
def OnKillFocus(self, event):
self.FocusColorPropertyShape(False)
event.Skip()
@@ -129,12 +133,12 @@ class CanvasView(wx.lib.docview.View):
wx.EVT_KEY_DOWN(self._canvas, self.OnKeyPressed)
# need this otherwise mouse clicks don't set focus to this view
wx.EVT_LEFT_DOWN(self._canvas, self.OnFocus)
wx.EVT_LEFT_DCLICK(self._canvas, self.OnFocus)
wx.EVT_RIGHT_DOWN(self._canvas, self.OnFocus)
wx.EVT_RIGHT_DCLICK(self._canvas, self.OnFocus)
wx.EVT_MIDDLE_DOWN(self._canvas, self.OnFocus)
wx.EVT_MIDDLE_DCLICK(self._canvas, self.OnFocus)
wx.EVT_LEFT_DOWN(self._canvas, self.FocusOnClick)
wx.EVT_LEFT_DCLICK(self._canvas, self.FocusOnClick)
wx.EVT_RIGHT_DOWN(self._canvas, self.FocusOnClick)
wx.EVT_RIGHT_DCLICK(self._canvas, self.FocusOnClick)
wx.EVT_MIDDLE_DOWN(self._canvas, self.FocusOnClick)
wx.EVT_MIDDLE_DCLICK(self._canvas, self.FocusOnClick)
wx.EVT_KILL_FOCUS(self._canvas, self.OnKillFocus)
wx.EVT_SET_FOCUS(self._canvas, self.OnFocus)
@@ -397,7 +401,7 @@ class CanvasView(wx.lib.docview.View):
shape.SetBrush(brush)
if text:
shape.AddText(text)
shape.SetShadowMode(ogl.SHADOW_RIGHT)
shape.SetShadowMode(ogl.SHADOW_NONE)
self._diagram.AddShape(shape)
shape.Show(True)
if not eventHandler:
@@ -417,9 +421,28 @@ class CanvasView(wx.lib.docview.View):
if shape:
shape.Select(False)
for line in shape.GetLines():
shape.RemoveLine(line)
self._diagram.RemoveShape(line)
for obj in self._diagram.GetShapeList():
for line in obj.GetLines():
if self.IsShapeContained(shape, line.GetTo()) or self.IsShapeContained(shape, line.GetFrom()):
obj.RemoveLine(line)
self._diagram.RemoveShape(line)
if line == shape:
obj.RemoveLine(line)
shape.RemoveFromCanvas(self._canvas)
self._diagram.RemoveShape(shape)
if isinstance(shape, ogl.CompositeShape):
shape.RemoveFromCanvas(self._canvas)
def IsShapeContained(self, parent, shape):
if parent == shape:
return True
elif shape.GetParent():
return self.IsShapeContained(parent, shape.GetParent())
return False
def UpdateShape(self, model):