module timelinelib.wxgui.frames.mainframe.lockhandler

exception timelinelib.wxgui.frames.mainframe.lockhandler.LockedException[source]

Bases: Exception

class timelinelib.wxgui.frames.mainframe.lockhandler.LockHandler[source]

Bases: object

This class is a helper for handling locking of a timeline file.

Whenever a timeline is edited, a lock is created so that no one else can edit the same timeline file at the same time. If you try to edit a timeline file that has a lock on it, a warning message will be displayed.

When the edit is done, the lock is removed.

The lock is accomplished by creating a file in the same directory and with the same name as the timeline file, byt with the extra extension ‘.lock’. The removal of this file releases the lock.

The LockHandler is created and “owned” by the MainFrameController class.

__init__(main_frame)[source]

Initialize self. See help(type(self)) for accurate signature.

locked(path)[source]

Return True if there exists a lock for the given path (timeline).

the_lock_is_mine(path)[source]

Return True if you are the owner of the lock on path (timeline)

lock(path, timeline)[source]

Lock the timeline with the given path. The lock is accomplished by creating a file with the name path + ‘.lock’. Three lines of information is written to the file:

  • The user name

  • A timestamp when the lock was created

  • The id of the process in which Timeline is running

unlock(path)[source]

Remove the lock on the timeline pointed out by path. That is remove the lock file.