[pywin32-checkins] pywin32/Pythonwin/pywin/debugger debugger.py,1.14,1.15
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-03-05 03:24:23
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19393/pywin/debugger Modified Files: debugger.py Log Message: Hopefully a final fix for "[ 944506 ] PythonWin Menus don't work" and many other bugs relating to the registry filling up with toolbar registry entries. The problem was the fact that the debugging package dynamically created docable toolbars. When pythonwin started for the first time, references to these debugging toolbars caused MFC to get upset, and left the "stale" entries for those toolbars in the list. Later, when a debugging session started, these toolbars again got new entries which were written to the registry along with the old ones. Next startup, the cycle started again (but this time creating even more new ones, ignoring even more stale ones) Also incorporates [ 1101347 ] Docking toolbar AV at shut down from Greg Chapman, which was also reflected in other bugs relating to the task-bar icon remaining and the MRU menus not updating in Python 2.4. Index: debugger.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** debugger.py 9 Oct 2004 05:53:33 -0000 1.14 --- debugger.py 5 Mar 2005 03:24:12 -0000 1.15 *************** *** 127,135 **** class HierListDebugger(hierlist.HierListWithItems): """ Hier List of stack frames, breakpoints, whatever """ ! def __init__(self, debugger): ! self.debugger = debugger hierlist.HierListWithItems.__init__(self, None, win32ui.IDB_DEBUGGER_HIER, None, win32api.RGB(255,0,0)) ! def Setup(self): ! root = HierStackRoot(self.debugger) self.AcceptRoot(root) # def Refresh(self): --- 127,134 ---- class HierListDebugger(hierlist.HierListWithItems): """ Hier List of stack frames, breakpoints, whatever """ ! def __init__(self): hierlist.HierListWithItems.__init__(self, None, win32ui.IDB_DEBUGGER_HIER, None, win32api.RGB(255,0,0)) ! def Setup(self, debugger): ! root = HierStackRoot(debugger) self.AcceptRoot(root) # def Refresh(self): *************** *** 137,140 **** --- 136,146 ---- class DebuggerWindow(window.Wnd): + def __init__(self, ob): + window.Wnd.__init__(self, ob) + self.debugger = None + + def Init(self, debugger): + self.debugger = debugger + def GetDefRect(self): defRect = app.LoadWindowSize("Debugger Windows\\" + self.title) *************** *** 172,179 **** class DebuggerStackWindow(DebuggerWindow): title = "Stack" ! def __init__(self, debugger): DebuggerWindow.__init__(self, win32ui.CreateTreeCtrl()) ! self.list = HierListDebugger(debugger) ! self.listOK = 1 def SaveState(self): self.list.DeleteAllItems() --- 178,185 ---- class DebuggerStackWindow(DebuggerWindow): title = "Stack" ! def __init__(self): DebuggerWindow.__init__(self, win32ui.CreateTreeCtrl()) ! self.list = HierListDebugger() ! self.listOK = 0 def SaveState(self): self.list.DeleteAllItems() *************** *** 185,194 **** self.HookMessage(self.OnKeyDown, win32con.WM_SYSKEYDOWN) self.list.HierInit (parent, self) ! self.list.Setup() def RespondDebuggerState(self, state): if not self.listOK: self.listOK = 1 ! self.list.Setup() else: self.list.Refresh() --- 191,202 ---- self.HookMessage(self.OnKeyDown, win32con.WM_SYSKEYDOWN) self.list.HierInit (parent, self) ! self.listOK = 0 # delayed setup ! #self.list.Setup() def RespondDebuggerState(self, state): + assert self.debugger is not None, "Init not called" if not self.listOK: self.listOK = 1 ! self.list.Setup(self.debugger) else: self.list.Refresh() *************** *** 212,218 **** class DebuggerListViewWindow(DebuggerWindow): ! def __init__(self, debugger): DebuggerWindow.__init__(self, win32ui.CreateListCtrl()) - self.debugger = debugger def CreateWindow(self, parent): list = self --- 220,225 ---- class DebuggerListViewWindow(DebuggerWindow): ! def __init__(self): DebuggerWindow.__init__(self, win32ui.CreateListCtrl()) def CreateWindow(self, parent): list = self *************** *** 396,401 **** self.SetItemText(i, 1, val) ! def CreateDebuggerDialog(parent, klass, debugger): ! control = klass(debugger) control.CreateWindow(parent) return control --- 403,408 ---- self.SetItemText(i, 1, val) ! def CreateDebuggerDialog(parent, klass): ! control = klass() control.CreateWindow(parent) return control *************** *** 407,410 **** --- 414,450 ---- ) + # Prepare all the "control bars" for this package. + # If control bars are not all loaded when the toolbar-state functions are + # called, things go horribly wrong. + def PrepareControlBars(frame): + style = win32con.WS_CHILD | afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY + tbd = win32ui.CreateToolBar (frame, style, win32ui.ID_VIEW_TOOLBAR_DBG) + tbd.ModifyStyle(0, commctrl.TBSTYLE_FLAT) + tbd.LoadToolBar(win32ui.IDR_DEBUGGER) + tbd.EnableDocking(afxres.CBRS_ALIGN_ANY) + tbd.SetWindowText("Debugger") + frame.DockControlBar(tbd) + + # and the other windows. + for id, klass, float in DebuggerDialogInfos: + try: + frame.GetControlBar(id) + exists=1 + except win32ui.error: + exists=0 + if exists: continue + bar = pywin.docking.DockingBar.DockingBar() + style=win32con.WS_CHILD | afxres.CBRS_LEFT # don't create visible. + bar.CreateWindow(frame, CreateDebuggerDialog, klass.title, id, style, childCreatorArgs=(klass,)) + bar.SetBarStyle( bar.GetBarStyle()|afxres.CBRS_TOOLTIPS|afxres.CBRS_FLYBY|afxres.CBRS_SIZE_DYNAMIC) + bar.EnableDocking(afxres.CBRS_ALIGN_ANY) + if float is None: + frame.DockControlBar(bar) + else: + frame.FloatControlBar(bar, float, afxres.CBRS_ALIGN_ANY) + + frame.ShowControlBar(bar, 0, 1) + + SKIP_NONE=0 SKIP_STEP=1 *************** *** 459,467 **** frame = win32ui.GetMainFrame() ! # See bug [ 944506 ] PythonWin Menus don't work ! # This relieves most of the symptoms, but I'd love ! # to know what is going on. Sounds alot like ! # Q151446, but that is for MFC4, and doesn't fix it. ! # frame.SaveBarState("ToolbarDebugging") # Hide the debuger toolbars (as they wont normally form part of the main toolbar state. for id, klass, float in DebuggerDialogInfos: --- 499,503 ---- frame = win32ui.GetMainFrame() ! frame.SaveBarState("ToolbarDebugging") # Hide the debuger toolbars (as they wont normally form part of the main toolbar state. for id, klass, float in DebuggerDialogInfos: *************** *** 745,764 **** frame = win32ui.GetMainFrame() ! # And the other dockable debugger dialogs. for id, klass, float in DebuggerDialogInfos: ! try: ! frame.GetControlBar(id) ! exists=1 ! except win32ui.error: ! exists=0 ! if exists: continue ! bar = pywin.docking.DockingBar.DockingBar() ! bar.CreateWindow(win32ui.GetMainFrame(), CreateDebuggerDialog, klass.title, id, childCreatorArgs=(klass, self)) ! bar.SetBarStyle( bar.GetBarStyle()|afxres.CBRS_TOOLTIPS|afxres.CBRS_FLYBY|afxres.CBRS_SIZE_DYNAMIC) ! bar.EnableDocking(afxres.CBRS_ALIGN_ANY) ! if float is None: ! frame.DockControlBar(bar) ! else: ! frame.FloatControlBar(bar, float, afxres.CBRS_ALIGN_ANY) try: frame.LoadBarState("ToolbarDebugging") --- 781,789 ---- frame = win32ui.GetMainFrame() ! # Ensure the debugger windows are attached to the debugger. for id, klass, float in DebuggerDialogInfos: ! w = frame.GetControlBar(id).dialog ! w.Init(self) ! try: frame.LoadBarState("ToolbarDebugging") |