def DefineMarkers(self): """Defines the folder and bookmark icons for this control @postcondition: all margin markers are defined """ # Get the colours for the various markers style = self.GetItemByName('foldmargin_style') back = style.GetFore() rgb = eclib.HexToRGB(back[1:]) back = wx.Colour(red=rgb[0], green=rgb[1], blue=rgb[2]) fore = style.GetBack() rgb = eclib.HexToRGB(fore[1:]) fore = wx.Colour(red=rgb[0], green=rgb[1], blue=rgb[2]) # Buffer background highlight caret_line = self.GetItemByName('caret_line').GetBack() rgb = eclib.HexToRGB(caret_line[1:]) clback = wx.Colour(*rgb) # Code Folding markers folder = ed_marker.FoldMarker() folder.Foreground = fore folder.Background = back folder.RegisterWithStc(self) # Bookmarks ed_marker.Bookmark().RegisterWithStc(self) # Breakpoints ed_marker.Breakpoint().RegisterWithStc(self) ed_marker.BreakpointDisabled().RegisterWithStc(self) step = ed_marker.BreakpointStep() step.Background = clback step.RegisterWithStc(self)
def SetBreakpoint(self, line=-1, disabled=False): """Set a breakpoint marker on the given line @keyword line: line number @keyword disabled: bool @return: breakpoint handle """ if not disabled: handle = self._SetBreakpoint(ed_marker.Breakpoint(), line) else: handle = self._SetBreakpoint(ed_marker.BreakpointDisabled(), line) return handle
def _SetBreakpoint(self, mobj, line=-1): """Set the breakpoint state @param mtype: Marker object @return: int (-1 if already set) """ handle = -1 if line < 0: line = self.GetCurrentLine() if not mobj.IsSet(self, line): # Clear other set breakpoint marker states on same line ed_marker.Breakpoint().Set(self, line, delete=True) ed_marker.BreakpointDisabled().Set(self, line, delete=True) mobj.Set(self, line, delete=False) handle = mobj.Handle return handle
def __init__(self, parent): super(BreakPointsList, self).__init__(parent) # Setup self.colname_file = _("File") self.colname_line = _("Line") self.colname_expr = _("Expression") self.InsertColumn(BreakPointsList.COL_FILE, self.colname_file) self.InsertColumn(BreakPointsList.COL_LINE, self.colname_line) self.InsertColumn(BreakPointsList.COL_EXPR, self.colname_expr) self.SetCheckedBitmap(ed_marker.Breakpoint().Bitmap) self.SetUnCheckedBitmap(ed_marker.BreakpointDisabled().Bitmap) # Event Handlers self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnItemEdited)
def DeleteBreakpoint(self, line): """Delete the breakpoint from the given line""" ed_marker.Breakpoint().Set(self, line, delete=True) ed_marker.BreakpointDisabled().Set(self, line, delete=True)
def DeleteAllBreakpoints(self): """Delete all the breakpoints in the buffer""" ed_marker.Breakpoint().DeleteAll(self) ed_marker.BreakpointDisabled().DeleteAll(self) ed_marker.BreakpointStep().DeleteAll(self)
def SetBreakpointDisabled(self, line=-1): """Set a disabled breakpoint indicator.""" handle = self._SetBreakpoint(ed_marker.BreakpointDisabled(), line) return handle