diff options
author | Agustin Zubiaga <aguzubiaga97@gmail.com> | 2011-12-09 17:15:29 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguzubiaga97@gmail.com> | 2011-12-09 17:15:29 (GMT) |
commit | 754761db9136383ee6c8435a168ba41a98c51894 (patch) | |
tree | 3625bcbf88c043e76be047e68509918abca6effc /pep8_check.py | |
parent | fb9627fc7ecdc80143c4a905a8db2cd759ca2d79 (diff) |
Some bugs removed and edit toolbar redesign
Signed-off-by: Agustin Zubiaga <aguzubiaga97@gmail.com>
Diffstat (limited to 'pep8_check.py')
-rw-r--r-- | pep8_check.py | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/pep8_check.py b/pep8_check.py index a1c2dd7..6b627d4 100644 --- a/pep8_check.py +++ b/pep8_check.py @@ -44,7 +44,7 @@ class PEP8_Check(): def highlight_errors(self, editor, chk): text = editor._get_all_text() editor.buffer.set_text("") - num = -1 + num = 0 for line in text.split("\n"): num += 1 if str(num) in chk: @@ -89,17 +89,32 @@ class PEP8_Check(): return checks def set_bar_text(self, widget, step_size, count, extend_selection, check): - if step_size == gtk.MOVEMENT_DISPLAY_LINES: - cursor_position = widget.buffer.get_property("cursor-position") - offset_iter = widget.buffer.get_iter_at_offset(cursor_position) - line = offset_iter.get_line() - print line - if str(line) in check: - this_line_error = check[str(line)] - char = this_line_error.split(":")[0] - this_line_error = this_line_error.split(":")[1] - self.activity.pep8_bar.label.set_text( - str(line)+":"+char+" "+this_line_error) - print this_line_error - self.activity.pep8_bar.show_all() - else: self.activity.pep8_bar.hide() + cursor_position = widget.buffer.get_property("cursor-position") + offset_iter = widget.buffer.get_iter_at_offset(cursor_position) + line = offset_iter.get_line()+2 + if str(line) in check: + this_line_error = check[str(line)] + char = this_line_error.split(":")[0] + this_line_error = this_line_error.split(":")[1] + self.activity.pep8_bar.label.set_text( + str(line)+":"+char+" "+this_line_error) + print this_line_error + self.activity.pep8_bar.show_all() + else: pass + + def check_exit(self): + text = self.activity.editor._get_all_text() + self.activity.editor.buffer.set_text("") + editor = self.activity.editor + num = 0 + for line in text.split("\n"): + num += 1 + line_iter = editor.buffer.get_iter_at_line(num) + if num == len(text.split("\n"))-1: + editor.buffer.insert_with_tags_by_name(line_iter, line) + else: + editor.buffer.insert_with_tags_by_name(line_iter, \ + line+"\n") + + self.activity.pep8_bar.hide() + self.activity.pep8_bar.label.set_text("") |