1
# ------------------------------------------------------------------------------
2
# Copyright (c) 2008, Riverbank Computing Limited
3
# All rights reserved.
4
#
5
# This software is provided without warranty under the terms of the BSD license.
6
# However, when used with the GPL version of PyQt the additional terms
7
# described in the PyQt GPL exception also apply
8

9
#
10
# Author: Riverbank Computing Limited
11
# ------------------------------------------------------------------------------
12

13

14

15 0
from pyface.qt import QtCore
16

17 0
from .editor import Editor
18

19 0
from pyface.heading_text import HeadingText
20

21
# FIXME: ToolkitEditorFactory is a proxy class defined here just for backward
22
# compatibility. The class has been moved to the
23
# traitsui.editors.title_editor file.
24 0
from ..editors.title_editor import TitleEditor
25

26

27 0
class SimpleEditor(Editor):
28 0
    def init(self, parent):
29
        """ Finishes initializing the editor by creating the underlying toolkit
30
            widget.
31
        """
32 0
        self._control = HeadingText(None)
33 0
        self.control = self._control.control
34 11
        if self.factory.allow_selection:
35 0
            flags = (
36
                self.control.textInteractionFlags()
37
                | QtCore.Qt.TextSelectableByMouse
38
            )
39 0
            self.control.setTextInteractionFlags(flags)
40 0
        self.set_tooltip()
41

42 0
    def update_editor(self):
43
        """ Updates the editor when the object trait changes external to the
44
            editor.
45
        """
46 0
        self._control.text = self.str_value
47

48

49 0
CustomEditor = SimpleEditor
50 0
ReadonlyEditor = SimpleEditor
51 0
TextEditor = SimpleEditor

Read our documentation on viewing source code .

Loading