Skip to content

Commit

Permalink
added info to report
Browse files Browse the repository at this point in the history
  • Loading branch information
giumas committed Aug 4, 2024
1 parent 264de86 commit 6cb1c7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions examples/app/report/ex_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

r += "Total [TOTAL]"
r += "Issues: 3"
r += "Warnings: 3"
r += "Info messages: 3"
r += "Issues: 3 [SKIP_REP]"

r.generate_pdf(path=output_pdf, title="Test Report", use_colors=True)
Expand Down
2 changes: 1 addition & 1 deletion hyo2/abc2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger.addHandler(logging.NullHandler())

name = "ABC"
__version__ = "2.3.9"
__version__ = "2.3.10"
__license__ = "LGPLv3 license"
__copyright__ = "Copyright 2024 University of New Hampshire, Center for Coastal and Ocean Mapping"

Expand Down
23 changes: 18 additions & 5 deletions hyo2/abc2/app/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def generate_pdf(self, path: str, title: str = "Document", use_colors: bool = Fa
# prepare some drawing tools
blue_pen = QtGui.QPen(QtGui.QColor(30, 30, 255))
red_pen = QtGui.QPen(QtGui.QColor(255, 30, 30))
orange_pen = QtGui.QPen(QtGui.QColor(255, 165, 30))
orange_pen = QtGui.QPen(QtGui.QColor(219, 116, 26))
magenta_pen = QtGui.QPen(QtGui.QColor(102, 0, 204))
green_pen = QtGui.QPen(QtGui.QColor(30, 200, 30))
gray_pen = QtGui.QPen(QtGui.QColor(120, 120, 120))
black_pen = QtGui.QPen(QtGui.QColor(30, 30, 30))
Expand Down Expand Up @@ -280,7 +281,12 @@ def print_page_template():

if int(last_item) > 0: # troubles -> red pen
if use_colors:
painter.setPen(red_pen)
if "warning" in content_item.lower():
painter.setPen(orange_pen)
elif "info" in content_item.lower():
painter.setPen(magenta_pen)
else:
painter.setPen(red_pen)
painter.drawText(row_area, lc_flags, "- " + content_item)
if use_colors:
painter.setPen(black_pen)
Expand Down Expand Up @@ -367,16 +373,23 @@ def print_page_template():
painter.setPen(black_pen)

else:
if first_item == "[WARNING]":
if first_item == "[ERROR]":
if use_colors:
painter.setPen(red_pen)
painter.drawText(row_area, lc_flags, content_item)
if use_colors:
painter.setPen(black_pen)

elif first_item == "[WARNING]":
if use_colors:
painter.setPen(orange_pen)
painter.drawText(row_area, lc_flags, content_item)
if use_colors:
painter.setPen(black_pen)

elif first_item == "[ERROR]":
elif first_item == "[INFO]":
if use_colors:
painter.setPen(red_pen)
painter.setPen(magenta_pen)
painter.drawText(row_area, lc_flags, content_item)
if use_colors:
painter.setPen(black_pen)
Expand Down

0 comments on commit 6cb1c7a

Please sign in to comment.