~openshot.code/openshot/main

« back to all changes in this revision

Viewing changes to main/classes/marker.py

  • Committer: Jonathan Thomas
  • Date: 2009-09-08 04:49:08 UTC
  • Revision ID: jonathan@jonathan64-20090908044908-kzhw2m1dl251yt9y
Bumping version to 0.9.30

Here it goes.  Massive re-factoring across OpenShot.  I put
a ton of regression work into this to ensure everything still
works, but as always, I could have missed something.

The biggest changes: 
------------------------------
1) Distutils is now used to install OpenShot (setup.py install).
   Installing OpenShot this way will copy Mime Types, Register Icons,
   Add launcher to Application menu, and copy the OpenShot .py code 
   to the /site-packages/ folder.
2) Python code moved into ~/openshot/openshot/
3) New folders ~/openshot/[bin,docs,xdg]
4) Translations moved to ~/openshot/openshot/locale
5) classes/project.py contains all of the PATH variables
6) classes/info.py contains the version of OpenShot
7) after installing (using setup.py), the /openshot/bin/openshot 
   is the launcher that gets copied to the /usr/bin
8) A few bug fixes have also been added:
   A) removing marker clears timeline
   B) opening a project stopped some changes from refreshing the video
9) Arguments can be passed to OpenShot ($ openshot 'video1.avi', 'video2.avi')
------------------------------

There are now 2 ways to launch OpenShot.

$ openshot (assuming setup.py was used to install OpenShot)
$ ~/openshot/openshot/openshot.py  (I know... it looks funny)

Good luck to everyone testing this!  =)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#       OpenShot Video Editor is a program that creates, modifies, and edits video files.
2
 
#   Copyright (C) 2009  Jonathan Thomas
3
 
#
4
 
#       This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
5
 
#
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.
10
 
#
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.
15
 
#
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/>.
18
 
 
19
 
import gtk
20
 
import goocanvas
21
 
 
22
 
 
23
 
########################################################################
24
 
class marker:
25
 
        """This class represents a marker (i.e. a reference point) on the timeline."""
26
 
 
27
 
        #----------------------------------------------------------------------
28
 
        def __init__(self, marker_name, position, parent):
29
 
                """Constructor"""
30
 
                self.name = marker_name
31
 
                self.position_on_track = float(position)
32
 
                self.parent = parent
33
 
                
34
 
        #----------------------------------------------------------------------
35
 
        def Render(self):
36
 
                
37
 
                # get the previous track from the parent sequence (if any)
38
 
                pixels_per_second = self.parent.get_pixels_per_second()
39
 
                y_top = 22
40
 
                
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
45
 
                
46
 
                # Add an item to the goocanvas
47
 
                root_left = canvas_left.get_root_item ()
48
 
                root_right = canvas_right.get_root_item ()
49
 
                
50
 
                # load marker image
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)
54
 
                
55
 
                # determine position
56
 
                x = pixels_per_second * self.position_on_track
57
 
                
58
 
                # Add Left Image to Group
59
 
                image1 = goocanvas.Image (parent = root_right,
60
 
                                                                  pixbuf = imgMarker.get_pixbuf(),
61
 
                                                                  x = x - offset,
62
 
                                                                  y = y_top)
63
 
                
64
 
                # attach button click event to marker image
65
 
                image1.connect ("button_press_event", self.on_marker_press)
66
 
                
67
 
                
68
 
        def on_marker_press (self, item, target, event):
69
 
                """ This is the click signal for a marker. """
70
 
                
71
 
                if event.button == 3:
72
 
                        # show the marker popup menu
73
 
                        self.parent.project.form.mnuMarker1.showmnu(event, self)
74
 
 
75
 
                return True
 
 
b'\\ No newline at end of file'