1
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
2
# Copyright (C) 2009 Jonathan Thomas
4
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
6
# OpenShot Video Editor is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# OpenShot Video Editor is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
23
########################################################################
25
"""This class represents a marker (i.e. a reference point) on the timeline."""
27
#----------------------------------------------------------------------
28
def __init__(self, marker_name, position, parent):
30
self.name = marker_name
31
self.position_on_track = float(position)
34
#----------------------------------------------------------------------
37
# get the previous track from the parent sequence (if any)
38
pixels_per_second = self.parent.get_pixels_per_second()
41
# get a reference to the 2 main canvas objects & theme
42
theme = self.parent.project.theme
43
canvas_left = self.parent.project.form.MyCanvas_Left
44
canvas_right = self.parent.project.form.MyCanvas
46
# Add an item to the goocanvas
47
root_left = canvas_left.get_root_item ()
48
root_right = canvas_right.get_root_item ()
51
imgMarker = gtk.image_new_from_file("%s/themes/%s/marker.png" % (self.parent.project.form.openshot_path, theme))
52
imgMarker_Width = imgMarker.get_pixbuf().get_width()
53
offset = float(imgMarker_Width) / float(2.0)
56
x = pixels_per_second * self.position_on_track
58
# Add Left Image to Group
59
image1 = goocanvas.Image (parent = root_right,
60
pixbuf = imgMarker.get_pixbuf(),
64
# attach button click event to marker image
65
image1.connect ("button_press_event", self.on_marker_press)
68
def on_marker_press (self, item, target, event):
69
""" This is the click signal for a marker. """
72
# show the marker popup menu
73
self.parent.project.form.mnuMarker1.showmnu(event, self)
b'\\ No newline at end of file'