From eb3e7a37bed9ad893064cffbe7bf3d5d9cb0d2cb Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Tue, 2 Aug 2016 11:08:12 -0300 Subject: [PATCH] Cycling through measurements colours instead of randomized --- invesalius/constants.py | 11 ++++++----- invesalius/data/measures.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 022cd89..a35e9d4 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -21,6 +21,7 @@ import os.path import platform import sys import wx +import itertools from project import Project @@ -219,11 +220,11 @@ MASK_COLOUR = [[0.33, 1, 0.33], #(0.66666666666666663, 0.792156862745098, 1.0)] -MEASURE_COLOUR = [[1, 0, 0], - [1, 0.4, 0], - [0, 0, 1], - [1, 0, 1], - [0, 0.6, 0]] +MEASURE_COLOUR = itertools.cycle([[1, 0, 0], + [1, 0.4, 0], + [0, 0, 1], + [1, 0, 1], + [0, 0.6, 0]]) SURFACE_COLOUR = [(0.33, 1, 0.33), (1, 1, 0.33), diff --git a/invesalius/data/measures.py b/invesalius/data/measures.py index 593f6e5..02c95b4 100644 --- a/invesalius/data/measures.py +++ b/invesalius/data/measures.py @@ -348,7 +348,7 @@ class Measurement(): Measurement.general_index += 1 self.index = Measurement.general_index self.name = const.MEASURE_NAME_PATTERN %(self.index+1) - self.colour = random.choice(const.MEASURE_COLOUR) + self.colour = const.MEASURE_COLOUR.next() self.value = 0 self.location = const.SURFACE # AXIAL, CORONAL, SAGITTAL self.type = const.LINEAR # ANGULAR -- libgit2 0.21.2