1
# Copyright (c) 2007, Enthought, Inc.
4
#--(View Default Button Changes)------------------------------------------------
6
View Default Button Changes
7
===========================
9
For the last year or so, use of the following **View** traits for managing the
10
default buttons displayed at the bottom of a view has been deprecated:
18
Use of these traits has been supplanted by use of the *buttons* trait instead.
20
As part of the ongoing phasing out of these traits, the following changes have
21
been implemented in Traits 3.0:
23
- All use of the *apply*, *revert*, *undo*, *ok* and *cancel* traits have been
24
removed from views contained within the traits package itself, and have been
25
replaced with the *buttons* trait.
27
- The default value for each of the deprecated traits has been changed from
28
**True** to **False**.
30
While use of the deprecated **View** traits is still allowed at the moment, the
31
affect of these changes could cause changes in behavior within existing code
32
that has not yet removed references to the deprecated traits.
34
In particular, the most likely side effect is for some or all of the default
35
**View** buttons to disappear from views which are implicitly relying on the
36
default values for each of the deprecated traits. Views which explicitly set
37
the deprecated **View** traits or use the newer *buttons* trait should not be
40
The correct fix for any **View** which has buttons disappear after installing
41
Traits 3.0 is to add a *buttons* trait with the correct value set to the
44
Note that in a future release, the deprecated view traits will actually be
45
removed from the **View** class.
48
#--<Imports>--------------------------------------------------------------------
50
from traits.api import *
51
from traitsui.api import *
53
#--[Adder Class]----------------------------------------------------------------
55
# Click the run button to view the pop-up dialog...
57
class Adder ( HasTraits ):
61
sum = Property( depends_on = [ 'value_1', 'value_2' ] )
67
Item( 'sum', style = 'readonly' ),
68
title = 'Adding Machine',
72
def _get_sum ( self ):
73
return (self.value_1 + self.value_2)
75
#--<Example>--------------------------------------------------------------------