EventViewer
index
/home/david/Projects/Jokosher/trunk/Jokosher/EventViewer.py

#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#       THE 'COPYING' FILE FOR DETAILS
#
#       EventViewer.py
#       
#       This module is the gui class that represents an event.
#       It handles the drawing of the waveform, audio fades, and
#       anything else that happens when you click a rectangular 
#       event on the gui.
#
#-------------------------------------------------------------------------------

 
Modules
       
Globals
Project
Utils
cairo
gettext
gtk
os

 
Classes
       
gobject.DrawingArea(gobject.Widget)
EventViewer

 
class EventViewer(gobject.DrawingArea)
    The EventViewer class handles displaying a single event as part
of an EventLaneViewer object.
 
 
Method resolution order:
EventViewer
gobject.DrawingArea
gobject.Widget
gobject.Object
gobject.GObject
atk.ImplementorIface
gobject.GInterface
__builtin__.object

Methods defined here:
ContextMenu(self, mouse)
Creates a context menu in response to a right click.
 
Parameters:
        mouse -- GTK mouse event that fired this method call.
DeleteSelectedFadePoints(self, event)
Deletes the selected fade points from the Event.
 
Parameters:
        event -- reserved for GTK callbacks, don't use it explicitly.
Destroy(self)
Called when the EventViewer gets destroyed.
It also destroys any child widget and disconnects itself from any
listening objects via Monitored.
DrawWaveform(self, exposeArea)
Uses Cairo to draw the waveform level information onto a canvas in memory.
 
Parameters:
        exposeArea -- Cairo exposed area in which to draw the waveform.
GetSelectionAsPixels(self)
Obtain the Event selection as a list of two points, measured in
pixels instead of seconds like Event.selection.
 
Returns:
        list with two X points describing the selection.
OnCopy(self, gtkevent)
Copies the selected portion of the Event to the clipboard.
 
Parameters:
        gtkevent -- reserved for GTK callbacks, don't use it explicitly.
OnCut(self, gtkevent)
Cuts the selected portion of the Event, and puts it on the clipboard.
 
Parameters:
        gtkevent -- reserved for GTK callbacks, don't use it explicitly.
OnDelete(self, event=None)
Called when "Delete" is selected from context menu.
Deletes the selected Event from the Project.
        
Parameters:
        event -- reserved for GTK callbacks, don't use it explicitly.
OnDraw(self, widget, event)
Blits the waveform data onto the screen, and then draws the play
cursor over it.
 
widget -- GTK widget to be drawn.
event -- GTK event associated to the widget.
 
Returns:
        False -- stop propagating the GTK signal. *CHECK*
OnMenuDone(self, widget)
Hides the right-click context menu after the user has selected one
of its options or clicked elsewhere.
 
Parameters:
        widget -- reserved for GTK callbacks, don't use it explicitly.
OnMouseDown(self, widget, mouse)
Called when the user pressed a mouse button.
Possible click combinations to capture:
        {L|R}MB: deselect all Events, remove any existing selection in
                        this Event then select this Event and begin moving the Event.
        LMB+shift: remove any existing selection in this Event and begin
                        selecting part of this Event.
        {L|R}MB+ctrl: select this Event without deselecting other Events.
        RMB: display a context menu.
        LMB double-click: split this Event here.
        LMB over a fadeMarker: drag the correspondent marker.
 
Parameters:
        widget -- reserved for GTK callbacks, don't use it explicitly.
        mouse -- GTK mouse event that fired this method call.
        
Returns:
        True -- continue GTK signal propagation. *CHECK*
OnMouseLeave(self, widget, event)
Clears the StatusBar message when the mouse moves out of the
EventLaneViewer area. It also disables cursors accordingly.
 
Parameters:
        widget -- reserved for GTK callbacks, don't use it explicitly.
        mouse -- GTK mouse event that fired this method call.
OnMouseMove(self, widget, mouse)
Display a message in the StatusBar when the mouse hovers over the
EventViewer.
Also displays cursors depending on the current action being performed.
 
Parameters:
        widget -- reserved for GTK callbacks, don't use it explicitly.
        mouse -- GTK mouse event that fired this method call.
        
Returns:
        True -- continue GTK signal propagation. *CHECK*
OnMouseUp(self, widget, mouse)
Called when the left mouse button is released.
Finishes drag, fade and selection operations.
 
Parameters:
        widget -- reserved for GTK callbacks, don't use it explicitly.
        mouse -- GTK mouse event that fired this method call.
OnSplit(self, gtkevent)
Splits an Event in two.
 
Parameters:
        gtkevent -- reserved for GTK callbacks, don't use it explicitly.
OnStateChanged(self, obj, change=None, *extra)
Called when a change of state is signalled by any of the
objects this view is 'listening' to.
Redraws the Event if any of its audio has been modified.
 
Parameters:
        obj -- object changing state.
        change -- the change which has occured.
        extra -- extra parameters passed by the caller.
PixXFromSec(self, sec)
Converts seconds to an X pixel position in the waveform.
 
Parameters:
        sec -- value in seconds.
        
Returns:
        the correspondent pixel X position in the waveform.
PixYFromVol(self, vol)
Converts a volume value into a Y pixel position in the waveform.
 
Parameters:
        vol -- volume value in a [0.0, 1.0] range.
        
Returns:
        the correspondent pixel Y position in the waveform.
SecFromPixX(self, pixx)
Converts an X pixel position in the waveform into seconds.
 
Parameters:
        pixx -- X pixel position value.
        
Returns:
        the correspondent value in seconds.
SetAudioFadePointsFromCurrentSelection(self)
Creates fade points for the current selection.
SnapSelectionToFadePoints(self, event)
Snaps the selection to a set of fade points.
 
Parameters:
        event -- reserved for GTK callbacks, don't use it explicitly.
TrimToSelection(self, gtkevent)
Cut this Event down so only the selected bit remains. This Event
is L-S-R, where S is the selected bit; L and R will be removed.
 
Parameters:
        gtkevent -- reserved for GTK callbacks, don't use it explicitly.
UpdateDrawerPosition(self, reverseSelectionPoints=False)
Updates the drawer position to the correct position when user
moves the mouse over the EventViewer.
 
Parameters:
        reverseSelectionPoints -- True if the selection points should
                                                                be reversed.
UpdateFadeMarkers(self)
Called when the a fade point's value changes, to update the graphical
marker over the waveform.
VolFromPixY(self, pixy)
Converts a Y pixel position in the waveform into a volume value.
 
Parameters:
        pixy -- Y pixel position value.
        
Returns:
        the correspondent value, in seconds, in a [0.0, 1.0] range.
__init__(self, lane, project, event, height, mainview, small=False)
Creates a new instance of EventViewer.
 
Parameters:
        lane -- parent EventLaneViewer for this instance.
        project -- the currently active Project.
        event -- Event drawn by this EventViewer.
        height -- height in pixels for this EventViewer.
        mainview -- the parent MainApp Jokosher window.
        small - set to True if we want small edit views (i.e. for mixing view).
do_size_request(self, requisition)
This function has been overrided to avoid getting a 1x1 display size.
 
Parameters:
        requisition -- TODO

Data and other attributes defined here:
__gtype__ = <GType EventViewer (137957448)>
__gtype_name__ = 'EventViewer'

Methods inherited from gobject.DrawingArea:
size(...)

Methods inherited from gobject.Widget:
activate(...)
add_accelerator(...)
add_events(...)
add_mnemonic_label(...)
can_activate_accel(...)
child_focus(...)
child_notify(...)
class_path(...)
create_pango_context(...)
create_pango_layout(...)
destroy(...)
drag_begin(...)
drag_check_threshold(...)
drag_dest_add_image_targets(...)
drag_dest_add_text_targets(...)
drag_dest_add_uri_targets(...)
drag_dest_find_target(...)
drag_dest_get_target_list(...)
drag_dest_get_track_motion(...)
drag_dest_set(...)
drag_dest_set_proxy(...)
drag_dest_set_target_list(...)
drag_dest_set_track_motion(...)
drag_dest_unset(...)
drag_get_data(...)
drag_highlight(...)
drag_source_add_image_targets(...)
drag_source_add_text_targets(...)
drag_source_add_uri_targets(...)
drag_source_get_target_list(...)
drag_source_set(...)
drag_source_set_icon(...)
drag_source_set_icon_name(...)
drag_source_set_icon_pixbuf(...)
drag_source_set_icon_stock(...)
drag_source_set_target_list(...)
drag_source_unset(...)
drag_unhighlight(...)
draw(...)
ensure_style(...)
event(...)
freeze_child_notify(...)
get_accessible(...)
get_action(...)
get_allocation(...)
get_ancestor(...)
get_child_requisition(...)
get_child_visible(...)
get_clipboard(...)
get_colormap(...)
get_composite_name(...)
get_direction(...)
get_display(...)
get_events(...)
get_extension_events(...)
get_modifier_style(...)
get_name(...)
get_no_show_all(...)
get_pango_context(...)
get_parent(...)
get_parent_window(...)
get_pointer(...)
get_root_window(...)
get_screen(...)
get_settings(...)
get_size_request(...)
get_style(...)
get_toplevel(...)
get_visual(...)
grab_add(...)
grab_default(...)
grab_focus(...)
grab_remove(...)
has_screen(...)
hide(...)
hide_all(...)
hide_on_delete(...)
input_shape_combine_mask(...)
intersect(...)
is_ancestor(...)
is_composited(...)
is_focus(...)
list_mnemonic_labels(...)
map(...)
menu_get_for_attach_widget(...)
mnemonic_activate(...)
modify_base(...)
modify_bg(...)
modify_fg(...)
modify_font(...)
modify_style(...)
modify_text(...)
path(...)
queue_clear(...)
queue_clear_area(...)
queue_draw(...)
queue_draw_area(...)
queue_resize(...)
queue_resize_no_redraw(...)
rc_get_style(...)
realize(...)
region_intersect(...)
remove_accelerator(...)
remove_mnemonic_label(...)
render_icon(...)
reparent(...)
reset_rc_styles(...)
reset_shapes(...)
selection_add_target(...)
selection_add_targets(...)
selection_clear_targets(...)
selection_convert(...)
selection_owner_set(...)
selection_remove_all(...)
send_expose(...)
set_accel_path(...)
set_app_paintable(...)
set_child_visible(...)
set_colormap(...)
set_composite_name(...)
set_direction(...)
set_double_buffered(...)
set_events(...)
set_extension_events(...)
set_name(...)
set_no_show_all(...)
set_parent(...)
set_parent_window(...)
set_redraw_on_allocate(...)
set_scroll_adjustments(...)
set_sensitive(...)
set_size_request(...)
set_state(...)
set_style(...)
set_uposition(...)
set_usize(...)
shape_combine_mask(...)
show(...)
show_all(...)
show_now(...)
size_allocate(...)
size_request(...)
style_get_property(...)
thaw_child_notify(...)
translate_coordinates(...)
unmap(...)
unparent(...)
unrealize(...)

Data and other attributes inherited from gobject.Widget:
allocation = <attribute 'allocation' of 'gtk.Widget' objects>
do_button_press_event = <built-in method do_button_press_event of GObjectMeta object>
do_button_release_event = <built-in method do_button_release_event of GObjectMeta object>
do_can_activate_accel = <built-in method do_can_activate_accel of GObjectMeta object>
do_client_event = <built-in method do_client_event of GObjectMeta object>
do_composited_changed = <built-in method do_composited_changed of GObjectMeta object>
do_configure_event = <built-in method do_configure_event of GObjectMeta object>
do_delete_event = <built-in method do_delete_event of GObjectMeta object>
do_destroy_event = <built-in method do_destroy_event of GObjectMeta object>
do_direction_changed = <built-in method do_direction_changed of GObjectMeta object>
do_drag_begin = <built-in method do_drag_begin of GObjectMeta object>
do_drag_data_delete = <built-in method do_drag_data_delete of GObjectMeta object>
do_drag_data_get = <built-in method do_drag_data_get of GObjectMeta object>
do_drag_data_received = <built-in method do_drag_data_received of GObjectMeta object>
do_drag_drop = <built-in method do_drag_drop of GObjectMeta object>
do_drag_end = <built-in method do_drag_end of GObjectMeta object>
do_drag_leave = <built-in method do_drag_leave of GObjectMeta object>
do_drag_motion = <built-in method do_drag_motion of GObjectMeta object>
do_enter_notify_event = <built-in method do_enter_notify_event of GObjectMeta object>
do_event = <built-in method do_event of GObjectMeta object>
do_expose_event = <built-in method do_expose_event of GObjectMeta object>
do_focus = <built-in method do_focus of GObjectMeta object>
do_focus_in_event = <built-in method do_focus_in_event of GObjectMeta object>
do_focus_out_event = <built-in method do_focus_out_event of GObjectMeta object>
do_get_accessible = <built-in method do_get_accessible of GObjectMeta object>
do_grab_broken_event = <built-in method do_grab_broken_event of GObjectMeta object>
do_grab_focus = <built-in method do_grab_focus of GObjectMeta object>
do_grab_notify = <built-in method do_grab_notify of GObjectMeta object>
do_hide = <built-in method do_hide of GObjectMeta object>
do_hide_all = <built-in method do_hide_all of GObjectMeta object>
do_hierarchy_changed = <built-in method do_hierarchy_changed of GObjectMeta object>
do_key_press_event = <built-in method do_key_press_event of GObjectMeta object>
do_key_release_event = <built-in method do_key_release_event of GObjectMeta object>
do_leave_notify_event = <built-in method do_leave_notify_event of GObjectMeta object>
do_map = <built-in method do_map of GObjectMeta object>
do_map_event = <built-in method do_map_event of GObjectMeta object>
do_mnemonic_activate = <built-in method do_mnemonic_activate of GObjectMeta object>
do_motion_notify_event = <built-in method do_motion_notify_event of GObjectMeta object>
do_no_expose_event = <built-in method do_no_expose_event of GObjectMeta object>
do_parent_set = <built-in method do_parent_set of GObjectMeta object>
do_popup_menu = <built-in method do_popup_menu of GObjectMeta object>
do_property_notify_event = <built-in method do_property_notify_event of GObjectMeta object>
do_proximity_in_event = <built-in method do_proximity_in_event of GObjectMeta object>
do_proximity_out_event = <built-in method do_proximity_out_event of GObjectMeta object>
do_realize = <built-in method do_realize of GObjectMeta object>
do_screen_changed = <built-in method do_screen_changed of GObjectMeta object>
do_scroll_event = <built-in method do_scroll_event of GObjectMeta object>
do_selection_clear_event = <built-in method do_selection_clear_event of GObjectMeta object>
do_selection_get = <built-in method do_selection_get of GObjectMeta object>
do_selection_notify_event = <built-in method do_selection_notify_event of GObjectMeta object>
do_selection_received = <built-in method do_selection_received of GObjectMeta object>
do_selection_request_event = <built-in method do_selection_request_event of GObjectMeta object>
do_show = <built-in method do_show of GObjectMeta object>
do_show_all = <built-in method do_show_all of GObjectMeta object>
do_show_help = <built-in method do_show_help of GObjectMeta object>
do_size_allocate = <built-in method do_size_allocate of GObjectMeta object>
do_state_changed = <built-in method do_state_changed of GObjectMeta object>
do_style_set = <built-in method do_style_set of GObjectMeta object>
do_unmap = <built-in method do_unmap of GObjectMeta object>
do_unmap_event = <built-in method do_unmap_event of GObjectMeta object>
do_unrealize = <built-in method do_unrealize of GObjectMeta object>
do_visibility_notify_event = <built-in method do_visibility_notify_event of GObjectMeta object>
do_window_state_event = <built-in method do_window_state_event of GObjectMeta object>
get_activate_signal = <built-in method get_activate_signal of GObjectMeta object>
name = <attribute 'name' of 'gtk.Widget' objects>
parent = <attribute 'parent' of 'gtk.Widget' objects>
saved_state = <attribute 'saved_state' of 'gtk.Widget' objects>
set_activate_signal = <built-in method set_activate_signal of GObjectMeta object>
set_set_scroll_adjustments_signal = <built-in method set_set_scroll_adjustments_signal of GObjectMeta object>
state = <attribute 'state' of 'gtk.Widget' objects>
style = <attribute 'style' of 'gtk.Widget' objects>
window = <attribute 'window' of 'gtk.Widget' objects>

Methods inherited from gobject.Object:
flags(...)
remove_data(...)
remove_no_notify(...)
set_flags(...)
unset_flags(...)

Data and other attributes inherited from gobject.Object:
do_destroy = <built-in method do_destroy of GObjectMeta object>

Methods inherited from gobject.GObject:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__gobject_init__(...)
__hash__(...)
x.__hash__() <==> hash(x)
__repr__(...)
x.__repr__() <==> repr(x)
chain(...)
connect(...)
connect_after(...)
connect_object(...)
connect_object_after(...)
disconnect(...)
disconnect_by_func(...)
emit(...)
emit_stop_by_name(...)
freeze_notify(...)
get_data(...)
get_property(...)
handler_block(...)
handler_block_by_func(...)
handler_disconnect(...)
handler_is_connected(...)
handler_unblock(...)
handler_unblock_by_func(...)
notify(...)
set_data(...)
set_property(...)
stop_emission(...)
thaw_notify(...)

Data and other attributes inherited from gobject.GObject:
__dict__ = <dictproxy object>
__gdoc__ = 'Object EventViewer\n\n\n\tThe EventViewer class hand...ointer\n\nSignals from GObject:\n notify (GParam)\n\n'
__grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
__new__ = <built-in method __new__ of GObjectMeta object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
props = <gobject.GProps object>

Methods inherited from atk.ImplementorIface:
ref_accessible(...)