Commit 4710eb3f2e5c67be1d1ff8f5087d58f8b0c92d50
1 parent
162a620a
Exists in
master
and in
25 other branches
Better measurement color
Showing
1 changed file
with
15 additions
and
5 deletions
Show diff stats
invesalius/data/measures.py
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | import math | 4 | import math |
5 | import random | 5 | import random |
6 | +import sys | ||
6 | 7 | ||
7 | from wx.lib.pubsub import pub as Publisher | 8 | from wx.lib.pubsub import pub as Publisher |
8 | 9 | ||
@@ -37,6 +38,15 @@ map_id_locations = {const.SURFACE: "3D", | @@ -37,6 +38,15 @@ map_id_locations = {const.SURFACE: "3D", | ||
37 | const.SAGITAL: "SAGITAL", | 38 | const.SAGITAL: "SAGITAL", |
38 | } | 39 | } |
39 | 40 | ||
41 | +if sys.platform == 'win32': | ||
42 | + MEASURE_LINE_COLOUR = (255, 0, 0, 255) | ||
43 | + MEASURE_TEXT_COLOUR = (0, 0, 0) | ||
44 | + MEASURE_TEXTBOX_COLOUR = (255, 255, 165, 255) | ||
45 | +else: | ||
46 | + MEASURE_LINE_COLOUR = (255, 0, 0, 128) | ||
47 | + MEASURE_TEXT_COLOUR = (0, 0, 0) | ||
48 | + MEASURE_TEXTBOX_COLOUR = (255, 255, 165, 255) | ||
49 | + | ||
40 | class MeasureData: | 50 | class MeasureData: |
41 | """ | 51 | """ |
42 | Responsible to keep measures data. | 52 | Responsible to keep measures data. |
@@ -571,10 +581,10 @@ class LinearMeasure(object): | @@ -571,10 +581,10 @@ class LinearMeasure(object): | ||
571 | 581 | ||
572 | if len(points) > 1: | 582 | if len(points) > 1: |
573 | for (p0, p1) in zip(points[:-1:], points[1::]): | 583 | for (p0, p1) in zip(points[:-1:], points[1::]): |
574 | - canvas.draw_line(p0, p1) | 584 | + canvas.draw_line(p0, p1, colour=MEASURE_LINE_COLOUR) |
575 | 585 | ||
576 | txt = u"%.3f mm" % self.GetValue() | 586 | txt = u"%.3f mm" % self.GetValue() |
577 | - canvas.draw_text_box(txt, ((points[0][0]+points[1][0])/2.0, (points[0][1]+points[1][1])/2.0)) | 587 | + canvas.draw_text_box(txt, ((points[0][0]+points[1][0])/2.0, (points[0][1]+points[1][1])/2.0), txt_colour=MEASURE_TEXT_COLOUR, bg_colour=MEASURE_TEXTBOX_COLOUR) |
578 | 588 | ||
579 | def GetNumberOfPoints(self): | 589 | def GetNumberOfPoints(self): |
580 | return len(self.points) | 590 | return len(self.points) |
@@ -830,13 +840,13 @@ class AngularMeasure(object): | @@ -830,13 +840,13 @@ class AngularMeasure(object): | ||
830 | 840 | ||
831 | if len(points) > 1: | 841 | if len(points) > 1: |
832 | for (p0, p1) in zip(points[:-1:], points[1::]): | 842 | for (p0, p1) in zip(points[:-1:], points[1::]): |
833 | - canvas.draw_line(p0, p1) | 843 | + canvas.draw_line(p0, p1, colour=MEASURE_LINE_COLOUR) |
834 | 844 | ||
835 | if len(points) == 3: | 845 | if len(points) == 3: |
836 | txt = u"%.3f° / %.3f°" % (self.GetValue(), 360.0 - self.GetValue()) | 846 | txt = u"%.3f° / %.3f°" % (self.GetValue(), 360.0 - self.GetValue()) |
837 | 847 | ||
838 | - canvas.draw_arc(points[1], points[0], points[2]) | ||
839 | - canvas.draw_text_box(txt, (points[1][0], points[1][1])) | 848 | + canvas.draw_arc(points[1], points[0], points[2], line_colour=MEASURE_LINE_COLOUR) |
849 | + canvas.draw_text_box(txt, (points[1][0], points[1][1]), txt_colour=MEASURE_TEXT_COLOUR, bg_colour=MEASURE_TEXTBOX_COLOUR) | ||
840 | 850 | ||
841 | def GetNumberOfPoints(self): | 851 | def GetNumberOfPoints(self): |
842 | return self.number_of_points | 852 | return self.number_of_points |