1
#-------------------------------------------------------------------------------
3
# Copyright (c) 2007, 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
""" Traits UI 'display only' image editor.
21
#-------------------------------------------------------------------------------
23
#-------------------------------------------------------------------------------
25
from pyface.image_resource \
28
from traitsui.ui_traits \
31
# FIXME: ImageEditor is a proxy class defined here just for backward
32
# compatibility. The class has been moved to the
33
# traitsui.editors.image_editor file.
34
from traitsui.editors.image_editor \
43
#-------------------------------------------------------------------------------
44
# '_ImageEditor' class:
45
#-------------------------------------------------------------------------------
47
class _ImageEditor ( Editor ):
48
""" Traits UI 'display only' image editor.
51
#---------------------------------------------------------------------------
52
# Finishes initializing the editor by creating the underlying toolkit
54
#---------------------------------------------------------------------------
56
def init ( self, parent ):
57
""" Finishes initializing the editor by creating the underlying toolkit
60
image = self.factory.image
64
self.control = ImageControl( parent, convert_bitmap( image ),
69
#---------------------------------------------------------------------------
70
# Updates the editor when the object trait changes external to the editor:
71
#---------------------------------------------------------------------------
73
def update_editor ( self ):
74
""" Updates the editor when the object trait changes externally to the
77
if self.factory.image is None:
79
if isinstance( value, ImageResource ):
80
self.control.Bitmap( convert_bitmap( value ) )
82
### EOF #######################################################################