1
#------------------------------------------------------------------------------
3
# Copyright (c) 2008, Enthought, Inc.
6
# This software is provided without warranty under the terms of the BSD
7
# license included in enthought/LICENSE.txt and may be redistributed only
8
# under the conditions described in the aforementioned license. The license
9
# is also available online at http://www.enthought.com/licenses/BSD.txt
11
# Thanks for using Enthought open source!
13
# Author: David C. Morrill
16
#------------------------------------------------------------------------------
18
""" Defines the BasicEditorFactory class, which allows creating editor
19
factories that use the same class for creating all editor styles.
22
#-------------------------------------------------------------------------------
24
#-------------------------------------------------------------------------------
26
from __future__ import absolute_import
28
from traits.api import Any
30
from .editor_factory import EditorFactory
32
#-------------------------------------------------------------------------------
33
# 'BasicEditorFactory' base class:
34
#-------------------------------------------------------------------------------
36
class BasicEditorFactory ( EditorFactory ):
37
""" Base class for editor factories that use the same class for creating
41
#---------------------------------------------------------------------------
43
#---------------------------------------------------------------------------
45
# Editor class to be instantiated
48
#---------------------------------------------------------------------------
50
#---------------------------------------------------------------------------
52
def _get_simple_editor_class ( self ):
53
""" Returns the editor class to use for "simple" style views.
54
Overridden to return the value of the 'klass' trait.
59
def _get_custom_editor_class ( self ):
60
""" Returns the editor class to use for "custom" style views.
61
Overridden to return the value of the 'klass' trait.
66
def _get_text_editor_class ( self ):
67
""" Returns the editor class to use for "text" style views.
68
Overridden to return the value of the 'klass' trait.
73
def _get_readonly_editor_class ( self ):
74
""" Returns the editor class to use for "readonly" style views.
75
Overridden to return the value of the 'klass' trait.
80
#---------------------------------------------------------------------------
81
# Allow an instance to be called:
82
#---------------------------------------------------------------------------
84
def __call__ ( self, *args, **traits ):
85
return self.set( **traits )
87
## EOF ########################################################################