summaryrefslogtreecommitdiff
path: root/silx/gui/plot/items/marker.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot/items/marker.py')
-rw-r--r--silx/gui/plot/items/marker.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/silx/gui/plot/items/marker.py b/silx/gui/plot/items/marker.py
index 09767a5..80ca0b6 100644
--- a/silx/gui/plot/items/marker.py
+++ b/silx/gui/plot/items/marker.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
@@ -32,6 +32,7 @@ __date__ = "06/03/2017"
import logging
+from ....utils.proxy import docstring
from .core import (Item, DraggableMixIn, ColorMixIn, LineMixIn, SymbolMixIn,
ItemChangedType)
@@ -39,7 +40,7 @@ from .core import (Item, DraggableMixIn, ColorMixIn, LineMixIn, SymbolMixIn,
_logger = logging.getLogger(__name__)
-class _BaseMarker(Item, DraggableMixIn, ColorMixIn):
+class MarkerBase(Item, DraggableMixIn, ColorMixIn):
"""Base class for markers"""
_DEFAULT_COLOR = (0., 0., 0., 1.)
@@ -75,6 +76,10 @@ class _BaseMarker(Item, DraggableMixIn, ColorMixIn):
"""Update backend renderer"""
raise NotImplementedError()
+ @docstring(DraggableMixIn)
+ def drag(self, from_, to):
+ self.setPosition(to[0], to[1])
+
def isOverlay(self):
"""Return true if marker is drawn as an overlay.
@@ -166,14 +171,14 @@ class _BaseMarker(Item, DraggableMixIn, ColorMixIn):
return args
-class Marker(_BaseMarker, SymbolMixIn):
+class Marker(MarkerBase, SymbolMixIn):
"""Description of a marker"""
_DEFAULT_SYMBOL = '+'
"""Default symbol of the marker"""
def __init__(self):
- _BaseMarker.__init__(self)
+ MarkerBase.__init__(self)
SymbolMixIn.__init__(self)
self._x = 0.
@@ -204,11 +209,11 @@ class Marker(_BaseMarker, SymbolMixIn):
return x, self.getYPosition()
-class _LineMarker(_BaseMarker, LineMixIn):
+class _LineMarker(MarkerBase, LineMixIn):
"""Base class for line markers"""
def __init__(self):
- _BaseMarker.__init__(self)
+ MarkerBase.__init__(self)
LineMixIn.__init__(self)
def _addBackendRenderer(self, backend):