]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/ide/activegrid/tool/DebuggerService.py
Applied patch [ 1212020 ] MediaCtrl DirectShow drawing and sample
[wxWidgets.git] / wxPython / samples / ide / activegrid / tool / DebuggerService.py
index ef4a37a8796d665abe9f12587f880d10fc65ed02..79e78e04663926cdbb79b9863ae05e104557221c 100644 (file)
@@ -31,7 +31,6 @@ import SimpleXMLRPCServer
 import xmlrpclib
 import os
 import threading
-import process
 import Queue
 import SocketServer
 import ProjectEditor
@@ -43,10 +42,18 @@ import DebuggerHarness
 import traceback
 import StringIO
 if wx.Platform == '__WXMSW__':
-    import win32api
+    try:
+        import win32api
+        _PYWIN32_INSTALLED = True
+    except ImportError:
+        _PYWIN32_INSTALLED = False
     _WINDOWS = True
 else:
     _WINDOWS = False
+
+if not _WINDOWS or _PYWIN32_INSTALLED:
+    import process
+
 _ = wx.GetTranslation
 
 _VERBOSE = False
@@ -96,6 +103,8 @@ class OutputReaderThread(threading.Thread):
                         self._keepGoing = False
                     start = time.time()
                     output = "" 
+            except TypeError:
+                pass
             except:
                 tp, val, tb = sys.exc_info()
                 print "Exception in OutputReaderThread.run():", tp, val
@@ -156,6 +165,7 @@ class Executor:
         self._stdOutReader = None
         self._stdErrReader = None
         self._process = None
+        DebuggerService.executors.append(self)
         
     def OutCall(self, text):
         evt = UpdateTextEvent(value = text)
@@ -190,6 +200,7 @@ class Executor:
             self._stdOutReader.AskToStop()
         if(self._stdErrReader != None):
             self._stdErrReader.AskToStop()
+        DebuggerService.executors.remove(self)
         
 class RunCommandUI(wx.Panel):
     
@@ -364,10 +375,10 @@ class DebugCommandUI(wx.Panel):
     
     def ShutdownAllDebuggers():
         for debugger in DebugCommandUI.debuggers:
-            debugger.StopExecution()
+            debugger.StopExecution(None)
             
     ShutdownAllDebuggers = staticmethod(ShutdownAllDebuggers)
-
+    
     def GetAvailablePort():
         for index in range( 0, len(DebugCommandUI.debuggerPortList)):               
             port = DebugCommandUI.debuggerPortList[index]
@@ -421,7 +432,6 @@ class DebugCommandUI(wx.Panel):
         
         self._parentNoteBook = parent
         self._command = command
-        self._textCtrl = None
         self._service = service
         self._executor = None
         self.STEP_ID = wx.NewId()
@@ -483,18 +493,10 @@ class DebugCommandUI(wx.Panel):
         tb.AddSimpleTool(self.CLEAR_ID, clear_bmp, _("Clear output pane"))
         wx.EVT_TOOL(self, self.CLEAR_ID, self.OnClearOutput)
         
-        tb.Realize()
         self.framesTab = None
         self.DisableWhileDebuggerRunning()
-        self._notebook = wx.Notebook(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT, "Debugger")
-        sizer.Add(self._notebook, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
-        self.consoleTab = self.MakeConsoleTab(self._notebook, wx.NewId(), None)
-        self.framesTab = self.MakeFramesTab(self._notebook, wx.NewId(), None)
-        self.breakPointsTab = self.MakeBreakPointsTab(self._notebook, wx.NewId(), None)
-        self._notebook.AddPage(self.consoleTab, "Output")
-        self._notebook.AddPage(self.framesTab, "Frames")
-        self._notebook.AddPage(self.breakPointsTab, "Break Points")
-        
+        self.framesTab = self.MakeFramesUI(self, wx.NewId(), None)
+        sizer.Add(self.framesTab, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
         self._statusBar = wx.StatusBar( self, -1)
         self._statusBar.SetFieldsCount(1)
         sizer.Add(self._statusBar, 0, wx.EXPAND |wx.ALIGN_LEFT|wx.ALL, 1)
@@ -502,6 +504,7 @@ class DebugCommandUI(wx.Panel):
         self.SetStatusText("Starting debug...")
         
         self.SetSizer(sizer)
+        tb.Realize()
         sizer.Fit(self)
         config = wx.ConfigBase_Get()
         self._debuggerHost = self._guiHost = config.Read("DebuggerHostName", DEFAULT_HOST)
@@ -543,14 +546,12 @@ class DebugCommandUI(wx.Panel):
     def BreakPointChange(self):
         if not self._stopped:
             self._callback.pushBreakpoints()
-        self.breakPointsTab.PopulateBPList()
+        self.framesTab.PopulateBPList()
         
     def __del__(self):
         if self in DebugCommandUI.debuggers:
             DebugCommandUI.debuggers.remove(self)
         
-    def SwitchToOutputTab(self):
-        self._notebook.SetSelection(0)
         
     def DisableWhileDebuggerRunning(self):
         self._tb.EnableTool(self.STEP_ID, False)
@@ -566,7 +567,6 @@ class DebugCommandUI(wx.Panel):
                 openDoc.GetFirstView().GetCtrl().ClearCurrentLineMarkers() 
         if self.framesTab:   
             self.framesTab.ClearWhileRunning()
-        #wx.GetApp().ProcessPendingEvents() #Yield(True)
         
     def EnableWhileDebuggerStopped(self):
         self._tb.EnableTool(self.STEP_ID, True)
@@ -576,8 +576,6 @@ class DebugCommandUI(wx.Panel):
         if _WATCHES_ON:
             self._tb.EnableTool(self.ADD_WATCH_ID, True)
         self._tb.EnableTool(self.BREAK_INTO_DEBUGGER_ID, False)
-        #if _WINDOWS:
-        #    wx.GetApp().GetTopWindow().RequestUserAttention()
  
     def ExecutorFinished(self):          
         if _VERBOSE: print "In ExectorFinished"
@@ -680,62 +678,27 @@ class DebugCommandUI(wx.Panel):
             DebugCommandUI.debuggers.remove(self)
         index = self._parentNoteBook.GetSelection()
         self._parentNoteBook.GetPage(index).Show(False)
-        self._parentNoteBook.RemovePage(index)
-
-    def GetConsoleTextControl(self):
-        return self._textCtrl
-        
-    def OnClearOutput(self, event):
-        self._textCtrl.SetReadOnly(False)
-        self._textCtrl.ClearAll()  
-        self._textCtrl.SetReadOnly(True)
+        self._parentNoteBook.RemovePage(index)       
 
     def OnAddWatch(self, event):
         if self.framesTab:
             self.framesTab.OnWatch(event)
-                  
-    def MakeConsoleTab(self, parent, id, debugger):
-        panel = wx.Panel(parent, id)
-        sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self._textCtrl = STCTextEditor.TextCtrl(panel, wx.NewId())
-        sizer.Add(self._textCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
-        self._textCtrl.SetViewLineNumbers(False)
-        self._textCtrl.SetReadOnly(True)
-        if wx.Platform == '__WXMSW__':
-            font = "Courier New"
-        else:
-            font = "Courier"
-        self._textCtrl.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = font))
-        self._textCtrl.SetFontColor(wx.BLACK)
-        self._textCtrl.StyleClearAll()
-        panel.SetSizer(sizer)
-        sizer.Fit(panel)
-
-        return panel
-        
-    def MakeFramesTab(self, parent, id, debugger):
+                        
+    def MakeFramesUI(self, parent, id, debugger):
         panel = FramesUI(parent, id, self)
         return panel
         
-    def MakeBreakPointsTab(self, parent, id, debugger):
-        panel = BreakpointsUI(parent, id, self)
-        return panel
-        
     def AppendText(self, event):
-        self._textCtrl.SetReadOnly(False)
-        self._textCtrl.AddText(event.value)
-        self._textCtrl.ScrollToLine(self._textCtrl.GetLineCount())
-        self._textCtrl.SetReadOnly(True)
+        self.framesTab.AppendText(event.value)
         
     def AppendErrorText(self, event):
-        self._textCtrl.SetReadOnly(False)
-        self._textCtrl.SetFontColor(wx.RED)   
-        self._textCtrl.StyleClearAll()
-        self._textCtrl.AddText(event.value)
-        self._textCtrl.ScrollToLine(self._textCtrl.GetLineCount())
-        self._textCtrl.SetFontColor(wx.BLACK)   
-        self._textCtrl.StyleClearAll()
-        self._textCtrl.SetReadOnly(True)
+        self.framesTab.AppendErrorText(event.value)
+        
+    def OnClearOutput(self, event):
+        self.framesTab.ClearOutput()
+
+    def SwitchToOutputTab(self):
+        self.framesTab.SwitchToOutputTab()
         
 class BreakpointsUI(wx.Panel):
     def __init__(self, parent, id, ui):
@@ -746,7 +709,6 @@ class BreakpointsUI(wx.Panel):
         self.Bind(wx.EVT_MENU, self.ClearBreakPoint, id=self.clearBPID)
         self.syncLineID = wx.NewId()
         self.Bind(wx.EVT_MENU, self.SyncBPLine, id=self.syncLineID)
-
         sizer = wx.BoxSizer(wx.VERTICAL)
         p1 = self
         self._bpListCtrl = wx.ListCtrl(p1, -1, pos=wx.DefaultPosition, size=(1000,1000), style=wx.LC_REPORT)
@@ -760,6 +722,11 @@ class BreakpointsUI(wx.Panel):
         self._bpListCtrl.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnListRightClick)
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.ListItemSelected, self._bpListCtrl)
         self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.ListItemDeselected, self._bpListCtrl)
+        
+        def OnLeftDoubleClick(event):
+            self.SyncBPLine(event)
+            
+        wx.EVT_LEFT_DCLICK(self._bpListCtrl, OnLeftDoubleClick)
 
         self.PopulateBPList()
 
@@ -896,25 +863,24 @@ class FramesUI(wx.SplitterWindow):
     def __init__(self, parent, id, ui):
         wx.SplitterWindow.__init__(self, parent, id, style = wx.SP_3D)
         self._ui = ui
-        sizer = wx.BoxSizer(wx.VERTICAL)
         self._p1 = p1 = wx.ScrolledWindow(self, -1)
-        p1.Bind(wx.EVT_SIZE, self.OnSize)
 
-        self._framesListCtrl = wx.ListCtrl(p1, -1, pos=wx.DefaultPosition, size=(250,150), style=wx.LC_REPORT)
-        sizer.Add(self._framesListCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
-        self._framesListCtrl.InsertColumn(0, "Frame")   
-        self._framesListCtrl.SetColumnWidth(0, 250)
-        self._framesListCtrl.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnListRightClick)
-        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.ListItemSelected, self._framesListCtrl)
-        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.ListItemDeselected, self._framesListCtrl)
+        sizer = wx.BoxSizer(wx.HORIZONTAL)
+        framesLabel = wx.StaticText(self, -1, "Stack Frame:")
+        sizer.Add(framesLabel, 0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.LEFT, border=2)
+                               
+        self._framesChoiceCtrl = wx.Choice(p1, -1, choices=["                                           "])
+        sizer.Add(self._framesChoiceCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
+        self._framesChoiceCtrl.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnListRightClick)
+        self.Bind(wx.EVT_CHOICE, self.ListItemSelected, self._framesChoiceCtrl)
 
         sizer2 = wx.BoxSizer(wx.VERTICAL)
-        self._p2 = p2 = wx.ScrolledWindow(self, -1)
-        p2.Bind(wx.EVT_SIZE, self.OnSize)
-
-        self._treeCtrl = wx.gizmos.TreeListCtrl(p2, -1, size=(530,250), style=wx.TR_DEFAULT_STYLE| wx.TR_FULL_ROW_HIGHLIGHT)
+        p1.SetSizer(sizer2)
+        
+        self._treeCtrl = wx.gizmos.TreeListCtrl(p1, -1, style=wx.TR_DEFAULT_STYLE| wx.TR_FULL_ROW_HIGHLIGHT)
         self._treeCtrl.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClick)
-        sizer2.Add(self._framesListCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
+        sizer2.Add(sizer, 0, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
+        sizer2.Add(self._treeCtrl,1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
         tree = self._treeCtrl                           
         tree.AddColumn("Thing")
         tree.AddColumn("Value")
@@ -923,11 +889,80 @@ class FramesUI(wx.SplitterWindow):
         tree.SetColumnWidth(1, 355)
         self._root = tree.AddRoot("Frame")
         tree.SetItemText(self._root, "", 1)
+        tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.IntrospectCallback)
+
+        self._p2 = p2 = wx.Window(self, -1)
+        sizer3 = wx.BoxSizer(wx.HORIZONTAL)
+        p2.SetSizer(sizer3)
+        p2.Bind(wx.EVT_SIZE, self.OnSize)
+        self._notebook = wx.Notebook(p2, -1, size=(20,20))
+        self._notebook.Hide()
+        sizer3.Add(self._notebook, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 1)
+        self.consoleTab = self.MakeConsoleTab(self._notebook, wx.NewId())
+        #self.inspectConsoleTab = self.MakeInspectConsoleTab(self._notebook, wx.NewId())
+        self.breakPointsTab = self.MakeBreakPointsTab(self._notebook, wx.NewId())
+        self._notebook.AddPage(self.consoleTab, "Output")
+        #self._notebook.AddPage(self.inspectConsoleTab, "Interact")
+        self._notebook.AddPage(self.breakPointsTab, "Break Points")
 
         self.SetMinimumPaneSize(20)
-        self.SplitVertically(p1, p2, 250)
+        self.SplitVertically(p1, p2, 550)
         self.currentItem = None
-        self.Layout()
+        self._notebook.Show(True)
+   
+    def PopulateBPList(self):
+        self.breakPointsTab.PopulateBPList()
+        
+    def OnSize(self, event):
+        self._notebook.SetSize(self._p2.GetSize())
+             
+    def MakeConsoleTab(self, parent, id):
+        panel = wx.Panel(parent, id)
+        sizer = wx.BoxSizer(wx.HORIZONTAL)
+        self._textCtrl = STCTextEditor.TextCtrl(panel, wx.NewId())
+        sizer.Add(self._textCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 2)
+        self._textCtrl.SetViewLineNumbers(False)
+        self._textCtrl.SetReadOnly(True)
+        if wx.Platform == '__WXMSW__':
+            font = "Courier New"
+        else:
+            font = "Courier"
+        self._textCtrl.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = font))
+        self._textCtrl.SetFontColor(wx.BLACK)
+        self._textCtrl.StyleClearAll()
+        panel.SetSizer(sizer)
+        #sizer.Fit(panel)
+
+        return panel
+        
+    def MakeInspectConsoleTab(self, parent, id):
+        def OnEnterPressed(event):
+            print "Enter text was %s" % event.GetString()
+        def OnText(event):
+            print "Command was %s" % event.GetString()
+            
+        panel = wx.Panel(parent, id)
+        try:
+            sizer = wx.BoxSizer(wx.HORIZONTAL)
+            self._ictextCtrl = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_MULTILINE|wx.TE_RICH|wx.HSCROLL)
+            sizer.Add(self._ictextCtrl, 1, wx.ALIGN_LEFT|wx.ALL|wx.EXPAND, 2)
+            self._ictextCtrl.Bind(wx.EVT_TEXT_ENTER, OnEnterPressed)
+            self._ictextCtrl.Bind(wx.EVT_TEXT, OnText)
+            if wx.Platform == '__WXMSW__':
+                font = "Courier New"
+            else:
+                font = "Courier"
+            self._ictextCtrl.SetDefaultStyle(wx.TextAttr(font=wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = font)))
+            panel.SetSizer(sizer)
+        except:
+            tp, val, tb = sys.exc_info()
+            traceback.print_exception(tp, val, tb)   
+            
+        return panel 
+               
+    def MakeBreakPointsTab(self, parent, id):
+        panel = BreakpointsUI(parent, id, self._ui)
+        return panel
      
     def OnRightClick(self, event):
         #Refactor this...
@@ -937,13 +972,6 @@ class FramesUI(wx.SplitterWindow):
         if not _WATCHES_ON and watchOnly:
             return
         menu = wx.Menu()
-        if not watchOnly:
-            if not hasattr(self, "introspectID"):
-                self.introspectID = wx.NewId()
-                self.Bind(wx.EVT_MENU, self.OnIntrospect, id=self.introspectID)
-            item = wx.MenuItem(menu, self.introspectID, "Attempt Introspection")
-            menu.AppendItem(item)
-            menu.AppendSeparator()
         if _WATCHES_ON:
             if not hasattr(self, "watchID"):
                 self.watchID = wx.NewId()
@@ -1009,13 +1037,13 @@ class FramesUI(wx.SplitterWindow):
         wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
 
         try:
-            list = self._framesListCtrl
+            list = self._framesChoiceCtrl
             frameNode = self._stack[int(self.currentItem)]
             message = frameNode.getAttribute("message") 
             binType = self._ui._callback._debuggerServer.attempt_introspection(message, self._parentChain)
             xmldoc = bz2.decompress(binType.data)
-               
             domDoc = parseString(xmldoc)
+            #wx.MessageBox(xmldoc, "result of introspection")
             nodeList = domDoc.getElementsByTagName('replacement')
             replacementNode = nodeList.item(0)
             if len(replacementNode.childNodes):
@@ -1023,6 +1051,7 @@ class FramesUI(wx.SplitterWindow):
                 tree = self._treeCtrl
                 parent = tree.GetItemParent(self._introspectItem)
                 treeNode = self.AppendSubTreeFromNode(thingToWalk, thingToWalk.getAttribute('name'), parent, insertBefore=self._introspectItem)
+                self._treeCtrl.Expand(treeNode)
                 tree.Delete(self._introspectItem)
         except:
             tp,val,tb = sys.exc_info()
@@ -1030,16 +1059,15 @@ class FramesUI(wx.SplitterWindow):
             
         wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
         
-    def OnSize(self, event):
-        self._treeCtrl.SetSize(self._p2.GetSize())
-        w,h = self._p1.GetClientSizeTuple()
-        self._framesListCtrl.SetDimensions(0, 0, w, h)
-
     def ClearWhileRunning(self):
-        list = self._framesListCtrl
-        list.DeleteAllItems()
-        tree = self._treeCtrl     
-        tree.Hide()
+        list = self._framesChoiceCtrl
+        list.Clear()
+        list.Enable(False)
+        tree = self._treeCtrl  
+        root = self._root   
+        tree.DeleteChildren(root)
+   
+        #tree.Hide()
         
     def OnListRightClick(self, event):
         if not hasattr(self, "syncFrameID"):
@@ -1052,7 +1080,7 @@ class FramesUI(wx.SplitterWindow):
         menu.Destroy()
 
     def OnSyncFrame(self, event):
-        list = self._framesListCtrl
+        list = self._framesChoiceCtrl
         frameNode = self._stack[int(self.currentItem)]
         file = frameNode.getAttribute("file")
         line = frameNode.getAttribute("line")
@@ -1062,18 +1090,24 @@ class FramesUI(wx.SplitterWindow):
         wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
         try:
             domDoc = parseString(framesXML)
-            list = self._framesListCtrl
-            list.DeleteAllItems()
+            list = self._framesChoiceCtrl
+            list.Clear()
             self._stack = []
             nodeList = domDoc.getElementsByTagName('frame')
             frame_count = -1
             for index in range(0, nodeList.length):
                 frameNode = nodeList.item(index)
                 message = frameNode.getAttribute("message")
-                list.InsertStringItem(index, message)
+                list.Append(message)
                 self._stack.append(frameNode)
                 frame_count += 1
-            list.Select(frame_count) 
+            index = len(self._stack) - 1
+            list.SetSelection(index) 
+            node = self._stack[index]
+            self.currentItem = index
+            self.PopulateTreeFromFrameNode(node)
+            self.OnSyncFrame(None)
+
             self._p1.FitInside()    
             frameNode = nodeList.item(index)
             file = frameNode.getAttribute("file")
@@ -1085,19 +1119,23 @@ class FramesUI(wx.SplitterWindow):
               
         wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
 
-    def ListItemDeselected(self, event):
-        pass
         
     def ListItemSelected(self, event):
-        self.currentItem = event.m_itemIndex
-        frameNode = self._stack[int(self.currentItem)]
-        self.PopulateTreeFromFrameNode(frameNode)
-        # Temporarily doing this to test out automatically swicting to source line.
-        self.OnSyncFrame(None)
-        
+        message = event.GetString()
+        index = 0
+        for node in self._stack:
+            if node.getAttribute("message") == message:
+                self.currentItem = index
+                self.PopulateTreeFromFrameNode(node)
+                self.OnSyncFrame(None)
+                return
+            index = index + 1
+                        
     def PopulateTreeFromFrameNode(self, frameNode):
+        list = self._framesChoiceCtrl
+        list.Enable(True)
         tree = self._treeCtrl 
-        tree.Show(True)
+        #tree.Show(True)
         root = self._root   
         tree.DeleteChildren(root)
         children = frameNode.childNodes
@@ -1110,6 +1148,19 @@ class FramesUI(wx.SplitterWindow):
         tree.Expand(root)
         tree.Expand(firstChild)
         self._p2.FitInside()
+        
+    def IntrospectCallback(self, event):
+        tree = self._treeCtrl 
+        item = event.GetItem()
+        if _VERBOSE:
+            print "In introspectCallback item is %s, pydata is %s" % (event.GetItem(), tree.GetPyData(item))
+        if tree.GetPyData(item) != "Introspect":
+            event.Skip()
+            return
+        self._introspectItem = item
+        self._parentChain = self.GetItemChain(item)
+        self.OnIntrospect(event)
+        event.Skip()
             
     def AppendSubTreeFromNode(self, node, name, parent, insertBefore=None):
         tree = self._treeCtrl 
@@ -1118,7 +1169,12 @@ class FramesUI(wx.SplitterWindow):
         else: 
             treeNode = tree.AppendItem(parent, name)
         children = node.childNodes
-        if children.length == 0:
+        intro = node.getAttribute('intro')
+            
+        if intro == "True":
+            tree.SetItemHasChildren(treeNode, True)
+            tree.SetPyData(treeNode, "Introspect")
+        if node.getAttribute("value"):
             tree.SetItemText(treeNode, self.StripOuterSingleQuotes(node.getAttribute("value")), 1)
         for index in range(0, children.length):
             subNode = children.item(index)
@@ -1129,15 +1185,23 @@ class FramesUI(wx.SplitterWindow):
                 value = self.StripOuterSingleQuotes(subNode.getAttribute("value"))
                 n = tree.AppendItem(treeNode, name)
                 tree.SetItemText(n, value, 1)
+                intro = subNode.getAttribute('intro')
+                if intro == "True":
+                    tree.SetItemHasChildren(n, True)
+                    tree.SetPyData(n, "Introspect")
+
         return treeNode
         
     def StripOuterSingleQuotes(self, string):
         if string.startswith("'") and string.endswith("'"):
-            return string[1:-1]
-        elif type(string) == types.UnicodeType:
-            return string[1:-1]
+            retval =  string[1:-1]
+        elif string.startswith("\"") and string.endswith("\""):
+            retval = string[1:-1]
         else:
-            return string
+            retval = string
+        if retval.startswith("u'") and retval.endswith("'"):
+            retval = retval[1:]
+        return retval
             
     def HasChildren(self, node):
         try:
@@ -1145,7 +1209,31 @@ class FramesUI(wx.SplitterWindow):
         except:
             tp,val,tb=sys.exc_info()
             return False
-                    
+    def AppendText(self, text):
+        self._textCtrl.SetReadOnly(False)
+        self._textCtrl.AddText(text)
+        self._textCtrl.ScrollToLine(self._textCtrl.GetLineCount())
+        self._textCtrl.SetReadOnly(True)
+        
+    def AppendErrorText(self, text):
+        self._textCtrl.SetReadOnly(False)
+        self._textCtrl.SetFontColor(wx.RED)   
+        self._textCtrl.StyleClearAll()
+        self._textCtrl.AddText(text)
+        self._textCtrl.ScrollToLine(self._textCtrl.GetLineCount())
+        self._textCtrl.SetFontColor(wx.BLACK)   
+        self._textCtrl.StyleClearAll()
+        self._textCtrl.SetReadOnly(True)
+        
+    def ClearOutput(self, event):
+        self._textCtrl.SetReadOnly(False)
+        self._textCtrl.ClearAll()  
+        self._textCtrl.SetReadOnly(True)
+
+    def SwitchToOutputTab(self):
+        self._notebook.SetSelection(0) 
+                          
 class DebuggerView(Service.ServiceView):
     
     #----------------------------------------------------------------------------
@@ -1410,6 +1498,7 @@ class DebuggerCallback:
         if _VERBOSE: print "+"*40
         
 class DebuggerService(Service.Service):
+    executors = []
 
     #----------------------------------------------------------------------------
     # Constants
@@ -1418,7 +1507,14 @@ class DebuggerService(Service.Service):
     CLEAR_ALL_BREAKPOINTS = wx.NewId()
     RUN_ID = wx.NewId()
     DEBUG_ID = wx.NewId()
+    DEBUG_WEBSERVER_ID = wx.NewId()
 
+    def KillAllRunningProcesses():
+        execs = DebuggerService.executors
+        for executor in execs:
+            executor.DoStopExecution()
+    KillAllRunningProcesses = staticmethod(KillAllRunningProcesses)
+            
     def ComparePaths(first, second):
         one = DebuggerService.ExpandPath(first)
         two = DebuggerService.ExpandPath(second)
@@ -1493,6 +1589,12 @@ class DebuggerService(Service.Service):
             wx.EVT_MENU(frame, DebuggerService.DEBUG_ID, frame.ProcessEvent)
             wx.EVT_UPDATE_UI(frame, DebuggerService.DEBUG_ID, frame.ProcessUpdateUIEvent)
             
+            if not ACTIVEGRID_BASE_IDE:
+                debuggerMenu.AppendSeparator()
+                debuggerMenu.Append(DebuggerService.DEBUG_WEBSERVER_ID, _("Debug Internal Web Server"), _("Debugs the internal webservier"))
+                wx.EVT_MENU(frame, DebuggerService.DEBUG_WEBSERVER_ID, frame.ProcessEvent)
+                wx.EVT_UPDATE_UI(frame, DebuggerService.DEBUG_WEBSERVER_ID, frame.ProcessUpdateUIEvent)
+            
             debuggerMenu.AppendSeparator()
             
             debuggerMenu.Append(DebuggerService.TOGGLE_BREAKPOINT_ID, _("&Toggle Breakpoint...\tCtrl+B"), _("Toggle a breakpoint"))
@@ -1536,6 +1638,9 @@ class DebuggerService(Service.Service):
         elif an_id == DebuggerService.DEBUG_ID:
             self.OnDebugProject(event)
             return True
+        elif an_id == DebuggerService.DEBUG_WEBSERVER_ID:
+            self.OnDebugWebServer(event)
+            return True
         return False
         
     def ProcessUpdateUIEvent(self, event):
@@ -1550,10 +1655,8 @@ class DebuggerService(Service.Service):
         elif an_id == DebuggerService.CLEAR_ALL_BREAKPOINTS:
             event.Enable(self.HasBreakpointsSet())
             return True
-        elif an_id == DebuggerService.RUN_ID:
-            event.Enable(self.HasAnyFiles())
-            return True
-        elif an_id == DebuggerService.DEBUG_ID:
+        elif (an_id == DebuggerService.RUN_ID
+        or an_id == DebuggerService.DEBUG_ID):
             event.Enable(self.HasAnyFiles())
             return True
         else:
@@ -1564,6 +1667,9 @@ class DebuggerService(Service.Service):
     #----------------------------------------------------------------------------                    
    
     def OnDebugProject(self, event):
+        if _WINDOWS and not _PYWIN32_INSTALLED:
+            wx.MessageBox(_("Python for Windows extensions (pywin32) is required to debug on Windows machines. Please go to http://sourceforge.net/projects/pywin32/, download and install pywin32."))
+            return
         if not Executor.GetPythonExecutablePath():
             return
         if DebugCommandUI.DebuggerRunning():
@@ -1572,7 +1678,10 @@ class DebuggerService(Service.Service):
         self.ShowWindow(True)
         projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
         project = projectService.GetView().GetDocument()
-        dlg = CommandPropertiesDialog(self.GetView().GetFrame(), 'Debug Python File', projectService, None, pythonOnly=True, okButtonName="Debug", debugging=True)
+        try:
+            dlg = CommandPropertiesDialog(self.GetView().GetFrame(), 'Debug Python File', projectService, None, pythonOnly=True, okButtonName="Debug", debugging=True)
+        except:
+            return
         if dlg.ShowModal() == wx.ID_OK:
             fileToDebug, initialArgs, startIn, isPython, environment = dlg.GetSettings()
             dlg.Destroy()
@@ -1586,12 +1695,34 @@ class DebuggerService(Service.Service):
         try:
             page = DebugCommandUI(Service.ServiceView.bottomTab, -1, str(fileToDebug), self)
             count = Service.ServiceView.bottomTab.GetPageCount()
-            Service.ServiceView.bottomTab.AddPage(page, "Debugging: " + shortFile)
+            Service.ServiceView.bottomTab.AddPage(page, _("Debugging: ") + shortFile)
             Service.ServiceView.bottomTab.SetSelection(count)
             page.Execute(initialArgs, startIn, environment)
         except:
             pass
-    
+            
+    def OnDebugWebServer(self, event):
+        if _WINDOWS and not _PYWIN32_INSTALLED:
+            wx.MessageBox(_("Python for Windows extensions (pywin32) is required to debug on Windows machines. Please go to http://sourceforge.net/projects/pywin32/, download and install pywin32."))
+            return
+        if not Executor.GetPythonExecutablePath():
+            return
+        if DebugCommandUI.DebuggerRunning():
+            wx.MessageBox(_("A debugger is already running. Please shut down the other debugger first."), _("Debugger Running"))
+            return
+        import WebServerService
+        wsService = wx.GetApp().GetService(WebServerService.WebServerService)
+        fileName, args = wsService.StopAndPrepareToDebug()
+        try:
+            page = DebugCommandUI(Service.ServiceView.bottomTab, -1, str(fileName), self)
+            count = Service.ServiceView.bottomTab.GetPageCount()
+            Service.ServiceView.bottomTab.AddPage(page, _("Debugging: Internal WebServer"))
+            Service.ServiceView.bottomTab.SetSelection(count)
+            page.Execute(args, startIn=os.getcwd(), environment=os.environ)
+        except:
+            pass
+         
+                               
     def HasAnyFiles(self):
         docs = wx.GetApp().GetDocumentManager().GetDocuments()
         return len(docs) > 0
@@ -1609,13 +1740,13 @@ class DebuggerService(Service.Service):
                 yesNoMsg = wx.MessageDialog(frame,
                           _("Files have been modified.\nWould you like to save all files before running?"),
                           _("Run"),
-                          wx.YES_NO
+                          wx.YES_NO|wx.ICON_QUESTION
                           )
             else:              
                 yesNoMsg = wx.MessageDialog(frame,
                           _("Files have been modified.\nWould you like to save all files before debugging?"),
                           _("Debug"),
-                          wx.YES_NO
+                          wx.YES_NO|wx.ICON_QUESTION
                           )
             if yesNoMsg.ShowModal() == wx.ID_YES:
                 docs = wx.GetApp().GetDocumentManager().GetDocuments()
@@ -1626,11 +1757,17 @@ class DebuggerService(Service.Service):
         DebugCommandUI.ShutdownAllDebuggers()
         
     def OnRunProject(self, event):
+        if _WINDOWS and not _PYWIN32_INSTALLED:
+            wx.MessageBox(_("Python for Windows extensions (pywin32) is required to run on Windows machines. Please go to http://sourceforge.net/projects/pywin32/, download and install pywin32."))
+            return
         if not Executor.GetPythonExecutablePath():
             return
         projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
         project = projectService.GetView().GetDocument()
-        dlg = CommandPropertiesDialog(self.GetView().GetFrame(), 'Run', projectService, None)
+        try:
+            dlg = CommandPropertiesDialog(self.GetView().GetFrame(), 'Run', projectService, None)
+        except:
+            return
         if dlg.ShowModal() == wx.ID_OK:
             fileToRun, initialArgs, startIn, isPython, environment = dlg.GetSettings()
             
@@ -1817,10 +1954,6 @@ class DebuggerOptionsPanel(wx.Panel):
 class CommandPropertiesDialog(wx.Dialog):
     
     def __init__(self, parent, title, projectService, currentProjectDocument, pythonOnly=False, okButtonName="Run", debugging=False):
-        if _WINDOWS:
-            wx.Dialog.__init__(self, parent, -1, title)
-        else:
-            wx.Dialog.__init__(self, parent, -1, title, size=(390,270)) 
         self._projService = projectService
         self._pmext = None
         self._pyext = None
@@ -1830,8 +1963,16 @@ class CommandPropertiesDialog(wx.Dialog):
             if template.GetDocumentType() == PythonEditor.PythonDocument:
                 self._pyext = template.GetDefaultExtension()
         self._pythonOnly = pythonOnly
-           
         self._currentProj = currentProjectDocument
+        self._projectNameList, self._projectDocumentList, selectedIndex = self.GetProjectList()
+        if not self._projectNameList:
+            wx.MessageBox(_("To run or debug you must have an open runnable file or project containing runnable files. Use File->Open to open the file you wish to run or debug."), _("Nothing to Run"))
+            raise BadBadBad
+        if _WINDOWS:
+            wx.Dialog.__init__(self, parent, -1, title)
+        else:
+            wx.Dialog.__init__(self, parent, -1, title, size=(390,270)) 
+           
         projStaticText = wx.StaticText(self, -1, _("Project:")) 
         fileStaticText = wx.StaticText(self, -1, _("File:")) 
         argsStaticText = wx.StaticText(self, -1, _("Arguments:")) 
@@ -1839,7 +1980,6 @@ class CommandPropertiesDialog(wx.Dialog):
         pythonPathStaticText = wx.StaticText(self, -1, _("PYTHONPATH:"))
         postpendStaticText = _("Postpend win32api path")
         cpPanelBorderSizer = wx.BoxSizer(wx.VERTICAL)
-        self._projectNameList, self._projectDocumentList, selectedIndex = self.GetProjectList()
         self._projList = wx.Choice(self, -1, (200,-1), choices=self._projectNameList)
         self.Bind(wx.EVT_CHOICE, self.EvtListBox, self._projList)
         HALF_SPACE = 5
@@ -1859,9 +1999,6 @@ class CommandPropertiesDialog(wx.Dialog):
         self._lastArguments = config.Read("LastRunArguments")
         self._argsEntry = wx.TextCtrl(self, -1, str(self._lastArguments))
         self._argsEntry.SetToolTipString(str(self._lastArguments))
-        def TextChanged(event):
-            self._argsEntry.SetToolTipString(event.GetString())
-        self.Bind(wx.EVT_TEXT, TextChanged, self._argsEntry)
 
         flexGridSizer.Add(argsStaticText, 0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT)
         flexGridSizer.Add(self._argsEntry, 1, flag=wx.EXPAND)
@@ -1878,7 +2015,7 @@ class CommandPropertiesDialog(wx.Dialog):
         self.Bind(wx.EVT_TEXT, TextChanged2, self._startEntry)
 
         flexGridSizer.Add(self._startEntry, 1, wx.EXPAND)
-        self._findDir = wx.Button(self, -1, _("Browse..."), size=(60,-1))
+        self._findDir = wx.Button(self, -1, _("Browse..."))
         self.Bind(wx.EVT_BUTTON, self.OnFindDirClick, self._findDir)
         flexGridSizer.Add(self._findDir, 0, wx.RIGHT, 10)
         
@@ -1902,12 +2039,12 @@ class CommandPropertiesDialog(wx.Dialog):
         cpPanelBorderSizer.Add(flexGridSizer, 0, wx.ALL, 10)
         
         box = wx.BoxSizer(wx.HORIZONTAL)
-        self._okButton = wx.Button(self, wx.ID_OK, okButtonName, size=(75,-1))
+        self._okButton = wx.Button(self, wx.ID_OK, okButtonName)
         self._okButton.SetDefault()
         self._okButton.SetHelpText(_("The ") + okButtonName + _(" button completes the dialog"))
         box.Add(self._okButton, 0, wx.ALIGN_RIGHT|wx.ALL, 5)
         self.Bind(wx.EVT_BUTTON, self.OnOKClick, self._okButton)
-        btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"), size=(75,-1))
+        btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
         btn.SetHelpText(_("The Cancel button cancels the dialog."))
         box.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 5)
         cpPanelBorderSizer.Add(box, 0, wx.ALIGN_RIGHT|wx.BOTTOM, 5)
@@ -2049,23 +2186,48 @@ class CommandPropertiesDialog(wx.Dialog):
                     found = True
                     index = count
                 count += 1
+        #Check for open files not in any of these projects and add them to a default project
+        def AlreadyInProject(fileName):
+            for projectDocument in docList:
+                if projectDocument.IsFileInProject(fileName):
+                    return True
+            return False
+            
+        unprojectedFiles = []
+        for document in self._projService.GetDocumentManager().GetDocuments():
+            if not ACTIVEGRID_BASE_IDE and type(document) == ProcessModelEditor.ProcessModelDocument:
+                if not AlreadyInProject(document.GetFilename()):
+                    unprojectedFiles.append(document.GetFilename())
+            if type(document) == PythonEditor.PythonDocument:
+                if not AlreadyInProject(document.GetFilename()):
+                    unprojectedFiles.append(document.GetFilename())
+         
+        if unprojectedFiles:
+            unprojProj = ProjectEditor.ProjectDocument()
+            unprojProj.SetFilename(_("Not in any Project")) 
+            unprojProj.AddFiles(unprojectedFiles)
+            docList.append(unprojProj)
+            nameList.append(_("Not in any Project"))  
+            
         return nameList, docList, index
+        
+
 #----------------------------------------------------------------------
 from wx import ImageFromStream, BitmapFromImage
-from wx import EmptyIcon
 import cStringIO
+
 #----------------------------------------------------------------------
 def getBreakData():
     return \
-'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x11\x08\x06\
-\x00\x00\x00\xd4\xaf,\xc4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
-\x00\x00\x97IDAT8\x8d\xbdSA\x0e\xc3 \x0c\x8b\x13\xfe=\x1e^\xe2\x1dF\xbb\x8c\
-\xd2\x0c\xa9\xda,q\x88\x05\x8e\x1d\x00P\x93;\xd0[\xa7W\x04\xe8\x8d\x0f\xdfxU\
-c%\x02\xbd\xbd\x05HQ+Xv\xb0\xa3VN\xf9\xd4\x01\xbd\x11j\x18\x1d\x00\x10\xa8AD\
-\xa4\xa4\xd6_\x9b\x19\xbb\x03\xd8c|\x8f\x00\xe0\x93\xa8g>\x15 C\xee:\xe7\x8f\
-\x08\xdesj\xcf\xe6\xde(\xddn\xec\x18f0w\xe0m;\x8d\x9b\xe4\xb1\xd4\n\xa6\x0e2\
-\xc4{\x1f\xeb\xdf?\xe5\xff\t\xa8\x1a$\x0cg\xac\xaf\xb0\xf4\x992<\x01\xec\xa0\
-U9V\xf9\x18\xc8\x00\x00\x00\x00IEND\xaeB`\x82' 
+'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x02\
+\x00\x00\x00\x90\x91h6\x00\x00\x00\x03sBIT\x08\x08\x08\xdb\xe1O\xe0\x00\x00\
+\x00\x85IDAT(\x91\xbd\x92A\x16\x03!\x08CI\xdf\xdc\x0b\x8e\xe6\xd1\xe0d\xe9\
+\x82\xd6\xc7(\x9di7\xfd\xab<\x14\x13Q\xb8\xbb\xfc\xc2\xe3\xd3\x82\x99\xb9\
+\xe9\xaeq\xe1`f)HF\xc4\x8dC2\x06\xbf\x8a4\xcf\x1e\x03K\xe5h\x1bH\x02\x98\xc7\
+\x03\x98\xa9z\x07\x00%\xd6\xa9\xd27\x90\xac\xbbk\xe5\x15I\xcdD$\xdc\xa7\xceT\
+5a\xce\xf3\xe4\xa0\xaa\x8bO\x12\x11\xabC\xcb\x9c}\xd57\xef\xb0\xf3\xb7\x86p\
+\x97\xf7\xb5\xaa\xde\xb9\xfa|-O\xbdjN\x9b\xf8\x06A\xcb\x00\x00\x00\x00IEND\
+\xaeB`\x82' 
 
 def getBreakBitmap():
     return BitmapFromImage(getBreakImage())
@@ -2075,9 +2237,7 @@ def getBreakImage():
     return ImageFromStream(stream)
 
 def getBreakIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getBreakBitmap())
-    return icon
+    return wx.IconFromBitmap(getBreakBitmap())
 
 #----------------------------------------------------------------------
 def getClearOutputData():
@@ -2102,21 +2262,23 @@ def getClearOutputImage():
     return ImageFromStream(stream)
 
 def getClearOutputIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getClearOutputBitmap())
-    return icon
+    return wx.IconFromBitmap(getClearOutputBitmap())
 
 #----------------------------------------------------------------------
 def getCloseData():
     return \
-'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x12\x00\x00\x00\x12\x08\x06\
-\x00\x00\x00V\xce\x8eW\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\
-\x00\x86IDAT8\x8d\xed\x90\xb1\r\x80 \x10E_"c\xd80\x02-\x138\x87;8\x8f\x8d\
-\x8b\xb0\x02\xa5\xad\rS\x88\xcd\x11) \x82\xb6\xbe\xea\xf2\xc9\xbd\xfc\x03~\
-\xdeb\x81\xb9\x90\xabJ^%\x00N\x849\x0e\xf0\x85\xbc\x8a\x12YZR2\xc7\x1eIB\xcb\
-\xb2\xcb\x9at\x9d\x95c\xa5Y|\x92\x0c\x0f\xa2\r8e\x1e\x81\x1d8z\xdb8\xee?Ig\
-\xfa\xb7\x92)\xcb\xacd\x01XZ$QD\xba\xf0\xa6\x80\xd5\x18cZ\x1b\x95$?\x1f\xb9\
-\x00\x1d\x94\x1e*e_\x8a~\x00\x00\x00\x00IEND\xaeB`\x82' 
+'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x02\
+\x00\x00\x00\x90\x91h6\x00\x00\x00\x03sBIT\x08\x08\x08\xdb\xe1O\xe0\x00\x00\
+\x00\xedIDAT(\x91\xa5\x90!\xae\x840\x10\x86g_\xd6"*kz\x82j\xb0h\x1c\t\' x\
+\x92Z\xc2\x05\x10\x95\x18\x0e\x00\x02M\x82 \xe1\nMF#jz\x80\xea&+\x9a\x10\x96\
+\xdd}\xfb\xc8\x1b\xd7?\xdf\x97\xfe3\xb7u]\xe1\xca\xfc\\\xa2\xff- \xe24M\xc7\
+\xc49wJ\xee\xc7G]\xd7\x8c1\xc6\x18\xe7\xdc\'B\x08k\xed1y\xfaa\x1cG\xad\xb5\
+\x94\x12\x11\x9dsy\x9e+\xa5\x84\x10;\r\x00\xb7\xd3\x95\x8c1UU\x05A\x00\x00\
+\xd6\xda,\xcb\x92$\xf9\xb8\x03\x00PJ\x85\x10Zk\xa5\xd4+\xfdF\x00\x80\xae\xeb\
+\x08!\x84\x90y\x9e\x11\xf1\x8bP\x96\xa5\xef\xdd\xb6\xad\xb5VJ\xf9\x9b\xe0\
+\xe9\xa6i8\xe7\xbe\xdb\xb6mi\x9a\x0e\xc3\xf0F\x88\xe3\x18\x00\xfa\xbe\x0f\
+\xc3\xd0\'\x9c\xf3eY\xa2(*\x8ab\xc7\x9e\xaed\x8c\xa1\x94\xben\xf5\xb1\xd2W\
+\xfa,\xfce.\x0b\x0f\xb8\x96e\x90gS\xe0v\x00\x00\x00\x00IEND\xaeB`\x82' 
 
 def getCloseBitmap():
     return BitmapFromImage(getCloseImage())
@@ -2126,9 +2288,7 @@ def getCloseImage():
     return ImageFromStream(stream)
 
 def getCloseIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getCloseBitmap())
-    return icon
+    return wx.IconFromBitmap(getCloseBitmap())
 
 #----------------------------------------------------------------------
 def getContinueData():
@@ -2151,9 +2311,7 @@ def getContinueImage():
     return ImageFromStream(stream)
 
 def getContinueIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getContinueBitmap())
-    return icon
+    return wx.IconFromBitmap(getContinueBitmap())
 
 #----------------------------------------------------------------------
 def getNextData():
@@ -2176,9 +2334,7 @@ def getNextImage():
     return ImageFromStream(stream)
 
 def getNextIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getNextBitmap())
-    return icon
+    return wx.IconFromBitmap(getNextBitmap())
 
 #----------------------------------------------------------------------
 def getStepInData():
@@ -2200,9 +2356,7 @@ def getStepInImage():
     return ImageFromStream(stream)
 
 def getStepInIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getStepInBitmap())
-    return icon
+    return wx.IconFromBitmap(getStepInBitmap())
 
 #----------------------------------------------------------------------
 def getStopData():
@@ -2222,9 +2376,7 @@ def getStopImage():
     return ImageFromStream(stream)
 
 def getStopIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getStopBitmap())
-    return icon
+    return wx.IconFromBitmap(getStopBitmap())
 
 #----------------------------------------------------------------------
 def getStepReturnData():
@@ -2247,10 +2399,9 @@ def getStepReturnImage():
     return ImageFromStream(stream)
 
 def getStepReturnIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getStepReturnBitmap())
-    return icon
+    return wx.IconFromBitmap(getStepReturnBitmap())
     
+#----------------------------------------------------------------------
 def getAddWatchData():
     return \
 '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
@@ -2270,6 +2421,4 @@ def getAddWatchImage():
     return ImageFromStream(stream)
 
 def getAddWatchIcon():
-    icon = EmptyIcon()
-    icon.CopyFromBitmap(getAddWatchBitmap())
-    return icon
+    return wx.IconFromBitmap(getAddWatchBitmap())