~ubuntu-branches/ubuntu/utopic/python-traitsui/utopic

« back to all changes in this revision

Viewing changes to traitsui/basic_editor_factory.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-09 13:57:39 UTC
  • Revision ID: james.westby@ubuntu.com-20110709135739-x5u20q86huissmn1
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#------------------------------------------------------------------------------
 
2
#
 
3
#  Copyright (c) 2008, Enthought, Inc.
 
4
#  All rights reserved.
 
5
#
 
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
 
10
#
 
11
#  Thanks for using Enthought open source!
 
12
#
 
13
#  Author: David C. Morrill
 
14
#  Date:   10/21/2004
 
15
#
 
16
#------------------------------------------------------------------------------
 
17
 
 
18
""" Defines the BasicEditorFactory class, which allows creating editor
 
19
    factories that use the same class for creating all editor styles.
 
20
"""
 
21
 
 
22
#-------------------------------------------------------------------------------
 
23
#  Imports:
 
24
#-------------------------------------------------------------------------------
 
25
 
 
26
from __future__ import absolute_import
 
27
 
 
28
from traits.api import Any
 
29
 
 
30
from .editor_factory import EditorFactory
 
31
 
 
32
#-------------------------------------------------------------------------------
 
33
#  'BasicEditorFactory' base class:
 
34
#-------------------------------------------------------------------------------
 
35
 
 
36
class BasicEditorFactory ( EditorFactory ):
 
37
    """ Base class for editor factories that use the same class for creating
 
38
        all editor styles.
 
39
    """
 
40
 
 
41
    #---------------------------------------------------------------------------
 
42
    #  Trait definitions:
 
43
    #---------------------------------------------------------------------------
 
44
 
 
45
    # Editor class to be instantiated
 
46
    klass = Any
 
47
 
 
48
    #---------------------------------------------------------------------------
 
49
    #  Property getters.
 
50
    #---------------------------------------------------------------------------
 
51
 
 
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.
 
55
 
 
56
        """
 
57
        return self.klass
 
58
 
 
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.
 
62
 
 
63
        """
 
64
        return self.klass
 
65
 
 
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.
 
69
 
 
70
        """
 
71
        return self.klass
 
72
 
 
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.
 
76
 
 
77
        """
 
78
        return self.klass
 
79
 
 
80
    #---------------------------------------------------------------------------
 
81
    #  Allow an instance to be called:
 
82
    #---------------------------------------------------------------------------
 
83
 
 
84
    def __call__ ( self, *args, **traits ):
 
85
        return self.set( **traits )
 
86
 
 
87
## EOF ########################################################################
 
88