Project
index
/home/laszlo/Dev/joko-gtk-builder/Jokosher/Project.py

#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#       THE 'COPYING' FILE FOR DETAILS
#
#       Project.py
#       
#       This module is the central non-gui class for Jokosher. It saves and loads
#       project files, and handles any project wide functionality including;
#       settings, instruments, recording, playing, exporint, zooming, scrolling, 
#       undo, redo, volume, etc.
#
#-------------------------------------------------------------------------------

 
Modules
       
AudioBackend
Event
Globals
IncrementalSave
Instrument
PlatformUtils
ProjectManager
TransportManager
UndoSystem
Utils
gobject
gst
gzip
os
pygst
re
xml.dom.minidom

 
Classes
       
gobject._gobject.GObject(__builtin__.object)
Project

 
class Project(gobject._gobject.GObject)
    This class maintains all of the information required about single Project. It also
saves and loads Project files.
 
 
Method resolution order:
Project
gobject._gobject.GObject
__builtin__.object

Methods defined here:
AddInstrument = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
AddInstrumentAndEvents(self, fileList, copyFile=False, undoAction=None)
Adds a new instrument of type "audio file" to the project, and adds the
given files to the new instrument.
 
Parameters:
        fileList -- the list of paths of the files that should be added.
        copyFile -- True = copy the files to Project's audio directory.
                        False = don't copy the files to the Project's audio directory.
AddInstruments(self, instrTuples)
Adds one or more instruments to the Project, and ensures that
they are all appended to the undo stack as a single atomic action.
 
Parameters:
        instrTuples -- a list of tuples containing name and type
                        that will be passed to AddInstrument().
        
Returns:
        A list of the added Instruments.
AppendToCurrentStack(self, object)
Appends the action specified by object onto the relevant
undo/redo stack.
 
Parameters:
        object -- action to be added to the undo/redo stack
CanDoIncrementalRestore(self)
CanPerformRedo(self)
Whether it's possible to perform an redo operation.
 
Returns:
        True -- there is another redo command in the stack that can be performed.
        False -- there are no available redo commands.
CanPerformUndo(self)
Whether it's possible to perform an undo operation.
 
Returns:
        True -- there is another undo command in the stack that can be performed.
        False -- there are no available undo commands.
CheckUnsavedChanges(self)
Uses boolean self.__unsavedChanges and Undo/Redo to 
determine if the program needs to save anything on exit.
 
Return:
        True -- there's unsaved changes, undoes or redoes
        False -- the Project can be safely closed.
ClearClickTimes(self)
Clears the click track controller times.
ClearEventSelections(self)
Clears the selection of any events.
CloseProject(self)
Closes down this Project.
DeleteInstrument = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
DeleteInstrumentsOrEvents(self, instrumentOrEventList)
Removes the given instruments the Project.
 
Parameters:
        instrumentList -- a list of Instrument instances to be removed.
DoIncrementalRestore(self)
Loads all the actions from the .incremental file and executes them
to restore the project's state.
DumpDotFile(self)
ExecuteAction(self, undoAction)
Executes an AtomicUndoAction object, reverting all operations stored
in it.
        
Parameters:
        undoAction -- the instance of AtomicUndoAction to be executed.
Export(self, filename, encodeBin)
Export to location filename with format specified by format variable.
 
Parameters:
        filename -- filename where the exported audio will be saved.
        encodeBin -- the gst-launch syntax string of the encoder as used in Globals.EXPORT_FORMATS:
                        for ogg: "vorbisenc ! oggmux"
                        for mp3: "lame"
                        for wav: "wavenc"
GenerateUniqueID(self, id=None, reserve=True)
Creates a new unique ID which can be assigned to an new Project object.
 
Parameters:
        id -- an unique ID proposal. If it's already taken, a new one is generated.
        reserve -- if True, the ID will be recorded and never returned again.
        
Returns:
        an unique ID suitable for a new Project.
GetAudioAndLevelsFilenames(self, include_deleted=False)
GetExportProgress(self)
Returns a tuple with the number of seconds exported
and the number of total seconds.
GetInputFilenames(self)
Obtains a list of  all filenames that are to be input to
the pipeline.
 
Return: 
        a list of  the filenames
GetIsExporting(self)
Returns true if the Project is not in the stopped state,
because paused, playing and recording are all forms of playing.
GetIsPlaying(self)
Returns true if the Project is not in the stopped state,
because paused, playing and recording are all forms of playing.
GetIsRecording(self)
Returns true if the Project is in the recording state.
GetProjectLength(self)
Returns the length of the Project.
 
Returns:
        lenght of the Project in seconds.
JokosherObjectFromString(self, string)
Converts a string used to serialize references to Project, Instrument
and Event instances into a reference to the actual object.
 
Parameters:
        string -- The string to convert such as "P" for project or "I2" for instrument with ID equal to 2.
MakeProjectSink(self)
Contructs a GStreamer sink element (or bin with ghost pads) for the 
Project's audio output, according to the Global "audiosink" property.
 
Return:
        the newly created GStreamer sink element.
MoveInstrument = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
NewAtomicUndoAction(self)
Creates a new AtomicUndoAction and adds to the
appropriate undo/redo stack for this project.
 
Return:
        The newly created AtomicUndoAction instance.
OnAllInstrumentsMute(self)
Mutes all Instruments in this Project.
OnCaptureBackendChange(self)
Pause(self)
Play(self, newAudioState=None)
Start playback or recording.
 
Parameters:
        newAudioState -- determines the Project audio state to set when playback commences:
                                        AUDIO_PAUSED or AUDIO_PLAYING = move the graphical indicator along playback.
                                        AUDIO_EXPORTING = perform playback without moving the graphical bar.
        recording -- determines if the Project should only playback or playback and record:
                                True = playback and record.
                                False = playback only.
PrepareClick(self)
Prepares the click track.
Record(self)
Start recording all selected instruments.
Redo(self)
Attempts to redo the last undone action.
ResurrectInstrument = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SaveIncrementalAction(self, action)
SaveProjectFile(self, path=None, backup=False)
Saves the Project and its children as an XML file
to the path specified by file.
 
Parameters:
        path -- path to the Project file.
SelectInstrument(self, instrument=None)
Selects an instrument and clears the selection of all other instruments.
 
Parameters:
        instrument -- Instrument object corresponding to the selected instrument.
SetAudioState(self, newState)
Set the Project's audio state to the new state enum value.
 
Parameters:
        newState -- the new state to set the Project to.
SetAuthor(self, author)
SetBPM = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetClickTrackVolume(self, value)
Unmutes and enables the click track.
 
Parameters:
        value -- The volume of the click track between 0.0 and 1.0
SetLevel(self, level)
Sets the current REPORTED level, NOT THE VOLUME!
 
Parameters:
        level -- a value in the range [0,1]
SetMeter = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetName(self, name)
SetNotes(self, notes)
SetProjectSink(self)
Grabs the sink element based on the Global preferences, and sets
the pipeline to use that sink.
SetProjectSinkDevice(self)
Grabs the sink element device based on the Global preferences, and sets
the pipeline to use that device.
SetTransportMode = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetUnsavedChanges(self)
SetViewScale(self, scale)
Sets the scale of the Project view.
 
Parameters:
        scale -- view scale in pixels per second.
SetViewStart(self, start)
Sets the time at which the Project view should start.
 
Parameters:
        start -- start time for the view in seconds.
SetVolume(self, volume)
Sets the volume of an instrument.
 
Parameters:
        volume - a value in the range [0,1]
Stop(self, bus=None, message=None)
Stop playback or recording
 
Parameters:
        bus -- reserved for GStreamer callbacks, don't use it explicitly.
        message -- reserved for GStreamer callbacks, don't use it explicitly.
TerminateExport(self, bus=None, message=None)
GStreamer End Of Stream handler. It is connected to eos on 
mainpipeline while export is taking place.
 
Parameters:
        bus -- reserved for GStreamer callbacks, don't use it explicitly.
        message -- reserved for GStreamer callbacks, don't use it explicitly.
TerminateRecording(self)
Terminate all instruments. Disregards recording when an 
error occurs after instruments have started.
Undo(self)
Attempts to revert the last user action by popping an action
from the undo stack and executing it.
__init__(self)
Creates a new instance of Project with default values.

Data and other attributes defined here:
AUDIO_EXPORTING = 4
AUDIO_PAUSED = 3
AUDIO_PLAYING = 2
AUDIO_RECORDING = 1
AUDIO_STOPPED = 0
INCREMENTAL_SAVE_DELIMITER = '\n<<delimiter>>\n'
INCREMENTAL_SAVE_EXT = '.incremental'
__gtype__ = <GType Project+Project (35968784)>

Methods inherited from gobject._gobject.GObject:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__copy__(...)
__deepcopy__(...)
__delattr__(...)
x.__delattr__('name') <==> del x.name
__gobject_init__(...)
__hash__(...)
x.__hash__() <==> hash(x)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
chain(...)
connect(...)
connect_after(...)
connect_object(...)
connect_object_after(...)
disconnect(...)
disconnect_by_func(...)
emit(...)
emit_stop_by_name(...)
freeze_notify(...)
get_data(...)
get_properties(...)
get_property(...)
handler_block(...)
handler_block_by_func(...)
handler_disconnect(...)
handler_is_connected(...)
handler_unblock(...)
handler_unblock_by_func(...)
notify(...)
set_data(...)
set_properties(...)
set_property(...)
stop_emission(...)
thaw_notify(...)
weak_ref(...)

Data descriptors inherited from gobject._gobject.GObject:
__dict__
__grefcount__

Data and other attributes inherited from gobject._gobject.GObject:
__gdoc__ = 'Object Project+Project\n\n\n\tThis class maintains a...array)\n\nSignals from GObject:\n notify (GParam)\n\n'
__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>