Esempio n. 1
0
	def OnAdd(self, msg, code):
		doc, view = scriptutils.GetActiveEditorDocument()
		if doc is None:
			## Don't do a messagebox, as this could be triggered from the app's
			## idle loop whenever the debug toolbar is visible, giving a never-ending
			## series of dialogs.  This can happen when the OnUpdate handler
			## for the toolbar button IDC_DBG_ADD fails, since MFC falls back to
			## sending a normal command if the UI update command fails.
			## win32ui.MessageBox('There is no active window - no breakpoint can be added')
			warnings.warn('There is no active window - no breakpoint can be added')
			return None
		pathName = doc.GetPathName()
		lineNo = view.LineFromChar(view.GetSel()[0])+1
		# If I have a debugger, then tell it, otherwise just add a marker
		d=self._GetDebugger()
		if d is None:
			import pywin.framework.editor.color.coloreditor
			doc.MarkerToggle(lineNo, pywin.framework.editor.color.coloreditor.MARKER_BREAKPOINT)
		else:
			if d.get_break(pathName, lineNo):
				win32ui.SetStatusText('Clearing breakpoint',1)
				rc = d.clear_break(pathName, lineNo)
			else:
				win32ui.SetStatusText('Setting breakpoint',1)
				rc = d.set_break(pathName, lineNo)
			if rc:
				win32ui.MessageBox(rc)
			d.GUIRespondDebuggerData()
Esempio n. 2
0
	def OnUpdateAddBreakpoints(self, cmdui):
		doc, view = scriptutils.GetActiveEditorDocument()
		if doc is None:
			enabled = 0
		else:
			enabled = 1
			lineNo = view.LineFromChar(view.GetSel()[0])+1
			import pywin.framework.editor.color.coloreditor
			cmdui.SetCheck(doc.MarkerAtLine(lineNo, pywin.framework.editor.color.coloreditor.MARKER_BREAKPOINT) != 0)
		cmdui.Enable(enabled)