def __move_cursor(self, textview, *args): global errorGenerator doc = textview.get_buffer() lang = getLanguageName(doc) if errorGenerator.has_key(lang): textview.set_has_tooltip(False) cursorIter = doc.get_iter_at_mark(doc.get_insert()) cursorLine = cursorIter.get_line() for g in errorGenerator[lang]: if g.errorLineMsg.has_key(cursorLine + 1): textview.set_has_tooltip(True) textview.set_tooltip_text(g.errorLineMsg[cursorLine + 1])
def draw_lines(self, doc): # clear s, e = doc.get_bounds() doc.remove_tag(self.errorTag, s, e) #generate error and apply new error tag lang = getLanguageName(doc) if errorGenerator.has_key(lang): errorCount = 0 for g in errorGenerator[lang]: try: for i in g.generateErrorLines(doc.get_uri_for_display()): s, e = getLineStartToEnd(doc, i - 1) doc.apply_tag(self.errorTag, skipWhiteSpaces(s), e) errorCount += 1 except EnvironmentError: print "cannot generateErrorLines" if notification: self.errorNorify(errorCount)
def jump_error(self): view = self.geditWindow.get_active_view() doc = view.get_buffer() lang = getLanguageName(doc) if errorGenerator.has_key(lang): cursorLine = doc.get_iter_at_mark(doc.get_insert()).get_line() lines = [] for g in errorGenerator[lang]: lines.extend(g.errorLineMsg.keys()) if len(lines) != 0: lines.sort() for i in lines: if cursorLine < i - 1: doc.goto_line(i - 1) view.scroll_to_cursor() return doc.goto_line(lines[0] - 1) view.scroll_to_cursor()