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 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 11
""" Defines the font editor factory for all traits user interface toolkits.
19
"""
20

21

22

23 11
from ..editor_factory import EditorFactory
24

25 11
from ..toolkit import toolkit_object
26

27
# -------------------------------------------------------------------------
28
#  'ToolkitEditorFactory' class:
29
# -------------------------------------------------------------------------
30

31

32 11
class ToolkitEditorFactory(EditorFactory):
33
    """ Editor factory for font editors.
34
    """
35

36 11
    pass
37

38

39
# Define the FontEditor class
40
# The function will try to return the toolkit-specific editor factory (located
41
# in traitsui.<toolkit>.font_editor, and if none is found, the
42
# ToolkitEditorFactory declared here is returned.
43 11
def FontEditor(*args, **traits):
44
    r""" Returns an instance of the toolkit-specific editor factory declared in
45
    traitsui.<toolkit>.font_editor. If such an editor factory
46
    cannot be located, an instance of the abstract ToolkitEditorFactory
47
    declared in traitsui.editors.font_editor is returned.
48

49
    Parameters
50
    ----------
51
    \*args, \*\*traits
52
        arguments and keywords to be passed on to the editor
53
        factory's constructor.
54
    """
55

56 0
    try:
57 0
        return toolkit_object("font_editor:ToolkitEditorFactory", True)(
58
            *args, **traits
59
        )
60 0
    except Exception as e:
61 0
        return ToolkitEditorFactory(*args, **traits)

Read our documentation on viewing source code .

Loading