summaryrefslogtreecommitdiff
path: root/silx/gui/plot/items/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot/items/core.py')
-rw-r--r--silx/gui/plot/items/core.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/silx/gui/plot/items/core.py b/silx/gui/plot/items/core.py
index e000751..bf3b719 100644
--- a/silx/gui/plot/items/core.py
+++ b/silx/gui/plot/items/core.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -27,20 +27,23 @@
__authors__ = ["T. Vincent"]
__license__ = "MIT"
-__date__ = "14/06/2018"
+__date__ = "29/01/2019"
import collections
from copy import deepcopy
import logging
+import enum
import warnings
import weakref
+
import numpy
-from silx.third_party import six, enum
+import six
from ... import qt
from ... import colors
from ...colors import Colormap
+from silx import config
_logger = logging.getLogger(__name__)
@@ -82,6 +85,9 @@ class ItemChangedType(enum.Enum):
COLOR = 'colorChanged'
"""Item's color changed flag."""
+ LINE_BG_COLOR = 'lineBgColorChanged'
+ """Item's line background color changed flag."""
+
YAXIS = 'yAxisChanged'
"""Item's Y axis binding changed flag."""
@@ -411,10 +417,12 @@ class ColormapMixIn(ItemMixInBase):
return self._colormap
def setColormap(self, colormap):
- """Set the colormap of this image
+ """Set the colormap of this item
:param silx.gui.colors.Colormap colormap: colormap description
"""
+ if self._colormap is colormap:
+ return
if isinstance(colormap, dict):
colormap = Colormap._fromDict(colormap)
@@ -433,10 +441,10 @@ class ColormapMixIn(ItemMixInBase):
class SymbolMixIn(ItemMixInBase):
"""Mix-in class for items with symbol type"""
- _DEFAULT_SYMBOL = ''
+ _DEFAULT_SYMBOL = None
"""Default marker of the item"""
- _DEFAULT_SYMBOL_SIZE = 6.0
+ _DEFAULT_SYMBOL_SIZE = config.DEFAULT_PLOT_SYMBOL_SIZE
"""Default marker size of the item"""
_SUPPORTED_SYMBOLS = collections.OrderedDict((
@@ -451,8 +459,15 @@ class SymbolMixIn(ItemMixInBase):
"""Dict of supported symbols"""
def __init__(self):
- self._symbol = self._DEFAULT_SYMBOL
- self._symbol_size = self._DEFAULT_SYMBOL_SIZE
+ if self._DEFAULT_SYMBOL is None: # Use default from config
+ self._symbol = config.DEFAULT_PLOT_SYMBOL
+ else:
+ self._symbol = self._DEFAULT_SYMBOL
+
+ if self._DEFAULT_SYMBOL_SIZE is None: # Use default from config
+ self._symbol_size = config.DEFAULT_PLOT_SYMBOL_SIZE
+ else:
+ self._symbol_size = self._DEFAULT_SYMBOL_SIZE
@classmethod
def getSupportedSymbols(cls):
@@ -892,14 +907,14 @@ class Points(Item, SymbolMixIn, AlphaMixIn):
# use the getData class method because instance method can be
# overloaded to return additional arrays
data = Points.getData(self, copy=False,
- displayed=True)
+ displayed=True)
if len(data) == 5:
# hack to avoid duplicating caching mechanism in Scatter
# (happens when cached data is used, caching done using
# Scatter._logFilterData)
- x, y, xerror, yerror = data[0], data[1], data[3], data[4]
+ x, y, _xerror, _yerror = data[0], data[1], data[3], data[4]
else:
- x, y, xerror, yerror = data
+ x, y, _xerror, _yerror = data
self._boundsCache[(xPositive, yPositive)] = (
numpy.nanmin(x),