Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logview highlighting #831

Merged

Conversation

larsbijl
Copy link
Contributor

Show coloured output in the logview. Make it easier for users
to catch important info.

Closes #830

@larsbijl
Copy link
Contributor Author

highlight

LOG_ERROR = QtGui.QColor(224, 52, 52)
LOG_WARNING = QtGui.QColor(255, 201, 25)
LOG_INFO = QtGui.QColor(111, 140, 255)
LOG_COMPLETE = QtGui.QColor(132, 201, 12)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There should be a newline at the end of every code file. There should be an IDE setting you can use to do this automatically.

@@ -362,6 +362,9 @@ def __init__(self, parent=None):
self._content_box.moveCursor(QtGui.QTextCursor.End)
self._content_box.ensureCursorVisible()

self.highlighter = Highlighter(self._content_box.document())
print("highlight turned on")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop this print, or turn it into a logger message if it's important.

@@ -600,7 +605,7 @@ def _move_to_match(self, pos, length):

def _move_to_search_box(self):
"""
Case-sensitive checkbox state has changed. Trigger a new search
Case-sensetive checkbox state has changed. Trigger a new search
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can revert this line -- "sensitive" is the correct spelling.

@@ -376,6 +379,8 @@ def __init__(self, parent=None):
self._case_stv_checkbox.stateChanged.connect(self._move_to_search_box)

self._search_box = QtWidgets.QLineEdit('', self)
self._search_box.setClearButtonEnabled(True)
self._search_box.setPlaceholderText("Search log...")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The string here can use single quotes.

line = text.lower()
done = False

for error in ['error','aborted','fatal', 'failed', 'killed', 'command not found']:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should move this list, and the lists of things which are detected as warnings and progress lines, to Constants.py instead of hardcoding them here. That should make it easier to customize.

Eventually we will need to figure out a better way to allow customization of these things, via config files or something like that, but I think having them as constants is good enough for now.

Show coloured output in the logview. Make it easier to users
to catch important info.

Closes AcademySoftwareFoundation#830
Copy link
Collaborator

@bcipriano bcipriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bcipriano
Copy link
Collaborator

@larsbijl Ready to merge here, but looks like there's a merge conflict, probably from one of your other PRs.

@bcipriano
Copy link
Collaborator

Thanks!

@bcipriano bcipriano merged commit 0ec4136 into AcademySoftwareFoundation:master Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add colour hightlight to logview
2 participants