File: scrubber_editor.py

package info (click to toggle)
python-traitsui 8.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,232 kB
  • sloc: python: 58,982; makefile: 113
file content (62 lines) | stat: -rw-r--r-- 1,935 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# (C) Copyright 2004-2023 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" Editor factory for scrubber-based integer or float value editors.
"""

from pyface.ui_traits import Alignment
from traits.api import Float, Property

from traitsui.basic_editor_factory import BasicEditorFactory
from traitsui.toolkit import toolkit_object
from traitsui.toolkit_traits import Color

# -------------------------------------------------------------------------
#  Create the editor factory object:
# -------------------------------------------------------------------------

# Editor factory for scrubber-based integer or float value editors.


class ScrubberEditor(BasicEditorFactory):

    #: The editor class to be instantiated:
    klass = Property()

    #: The low end of the scrubber range:
    low = Float()

    #: The high end of the scrubber range:
    high = Float()

    #: The normal increment (default: auto-calculate):
    increment = Float()

    #: The alignment of the text within the scrubber:
    alignment = Alignment("center")

    #: The background color for the scrubber:
    color = Color(None)

    #: The hover mode background color for the scrubber:
    hover_color = Color(None)

    #: The active mode background color for the scrubber:
    active_color = Color(None)

    #: The scrubber border color:
    border_color = Color(None)

    #: The color to use for the value text:
    text_color = Color("black")

    def _get_klass(self):
        """Returns the toolkit-specific editor class to be instantiated."""
        return toolkit_object("scrubber_editor:_ScrubberEditor")