Пример #1
0
class CVExample(HasTraits):

    cv_float = CVFloat

    cv_int = CVInt

    cv_str = CVStr

    cv_unicode = CVType(Unicode, something='meta', sync_value='both')
Пример #2
0
class CVExample(HasTraits):

    cv_float = CVFloat

    cv_int = CVInt

    cv_str = CVStr

    cv_unicode = CVType(Str, something="meta", sync_value="both")
Пример #3
0
class VideoEditor(BasicEditorFactory):
    """Traits UI 'display only' video editor.

    This editor only displays the video stream, and does not attempt to
    provide UI elements for controlling playback.  It does provide a
    rich set of trait references that can be synchronised with the internal
    state of the video player.
    """

    #: The editor class to be created:
    klass = Property()

    #: The behaviour of the video display when the widget aspect ratio
    #: doesn't match the aspect ratio of the video stream.
    aspect_ratio = AspectRatio()

    #: True if the audio is muted, False otherwise
    muted = CVType(Bool, default_value=False, sync_value='from')

    #: Audio volume on a logarithmic scale
    volume = CVType(Range(0.0, 100.0), default_value=75.0, sync_value='from')

    #: The playback speed of the video. Negative values are allowed but may not
    #: be supported by the underlying implementation.
    playback_rate = CVType(Float, default_value=1.0, sync_value='from')

    #: The state (stopped, playing, paused) of the player
    state = CVType(PlayerState, default_value='stopped', sync_value='both')

    #: The current position, in seconds, in the video.
    position = CVType(Float, default_value=0.0, sync_value='both')

    #: Duration of the loaded video in seconds
    duration = Instance(ContextValue,
                        args=('', ),
                        allow_none=False,
                        sync_value='to')

    #: The status of the loaded video (see ``MediaStatus``)
    media_status = Instance(ContextValue,
                            args=('', ),
                            allow_none=False,
                            sync_value='to')

    #: An integer percentage representing how much of the player's buffer
    #: is filled.
    buffer = Instance(ContextValue,
                      args=('', ),
                      allow_none=False,
                      sync_value='to')

    #: A string describing an error encountered by the player
    video_error = Instance(ContextValue,
                           args=('', ),
                           allow_none=False,
                           sync_value='to')

    #: Callable to apply to video frames. Takes ref to new frame and a size
    #: tuple. Must return a QImage and a numpy array.
    image_func = CVType(Callable, sync_value='from')

    #: The name of a trait to synchronise with the player's notify interval.
    #: The referenced trait should be a Float representing time in seconds.
    notify_interval = CVType(Float, default_value=1.0, sync_value='from')

    def _get_klass(self):
        """Returns the editor class to be instantiated."""
        return toolkit_object('video_editor:VideoEditor')