File: action_event.py

package info (click to toggle)
enthought-traits-ui 2.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 15,204 kB
  • ctags: 9,623
  • sloc: python: 45,547; sh: 32; makefile: 19
file content (42 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
""" The event passed to an action's 'perform' method. """


# Standard library imports.
import time

# Enthought library imports.
from enthought.traits.api import Float, HasTraits, Int


class ActionEvent(HasTraits):
    """ The event passed to an action's 'perform' method. """

    #### 'ActionEvent' interface ##############################################
    
    # When the action was performed (time.time()).
    when = Float

    ###########################################################################
    # 'object' interface.
    ###########################################################################

    def __init__(self, **traits):
        """ Creates a new action event.

        Note: Every keyword argument becoames a public attribute of the event.

        """

        # Base-class constructor.
        super(ActionEvent, self).__init__(**traits)

        # fixme: We currently allow anything to be tagged onto the event, which
        # is going to make code very hard to read.
        self.__dict__.update(traits)

        # When the action was performed.
        self.when = time.time()
        
        return

#### EOF ######################################################################