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) ed_marker.StackMarker().RegisterWithStc(self) # Other markers errmk = ed_marker.ErrorMarker() errsty = self.GetItemByName('error_style') rgb = eclib.HexToRGB(errsty.GetBack()[1:]) errmk.Background = wx.Colour(*rgb) rgb = eclib.HexToRGB(errsty.GetFore()[1:]) errmk.Foreground = wx.Colour(*rgb) errmk.RegisterWithStc(self) # Lint Marker ed_marker.LintMarker().RegisterWithStc(self) ed_marker.LintMarkerWarning().RegisterWithStc(self) ed_marker.LintMarkerError().RegisterWithStc(self)
def _PopulateRows(self, data): """Populate the list with the data @param data: LintData object """ typeText = _("Type") errorText = _("Error") minLType = max(self.GetTextExtent(typeText)[0], self.GetColumnWidth(0)) minLText = max( self.GetTextExtent(errorText)[0], self.GetColumnWidth(2)) tmap = dict(Error=0, Warning=1) self.itemDataMap.clear() for idx, row in enumerate(data.GetOrderedData()): assert len(row) == 3 mtype = row[0] dspmsg = LintData.GetDisplayString(mtype) minLType = max(minLType, self.GetTextExtent(dspmsg)[0]) minLText = max(minLText, self.GetTextExtent(row[2])[0]) row[0] = dspmsg self.Append(row) # Column Sorter self.itemDataMap[idx] = row self.SetItemData(self.ItemCount - 1, idx) # End Column Sorter img = tmap.get(mtype.strip(), 2) self.SetItemImage(self.ItemCount - 1, img) if self.editor: try: if mtype == 'Error': mark = ed_marker.LintMarkerError() elif mtype == 'Warning': mark = ed_marker.LintMarkerWarning() else: mark = ed_marker.LintMarker() # TODO: store handles self.editor.AddMarker(mark, int(row[1]) - 1) except ValueError: pass self.SetColumnWidth(0, minLType) self.SetColumnWidth(2, minLText)
def DeleteEditorMarkers(editor): """Remove lint markers from the given editor""" editor.RemoveAllMarkers(ed_marker.LintMarker()) editor.RemoveAllMarkers(ed_marker.LintMarkerError()) editor.RemoveAllMarkers(ed_marker.LintMarkerWarning())