]> git.plutz.net Git - viper/blobdiff - timeline.py
implemeted most basic cropping controls
[viper] / timeline.py
index 1ed4d5ca1061ee91ea74c4320b6d73db0f257917..eb454a4dcc587db690b1121f0a2a8055a44993c1 100644 (file)
@@ -1,23 +1,24 @@
 #encoding: utf-8
-#Copyright 2009 - 2010 Paul Hänsch
-
-#This file is part of Viper.
-
-#Viper is free software: you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
-
-#Viper is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with Viper.  If not, see <http://www.gnu.org/licenses/>
+#Copyright 2009 - 2011 Paul Hänsch
+
+# This file is part of Viper.
+#
+# Viper is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Viper is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Viper.  If not, see <http://www.gnu.org/licenses/>
 
 from Tkinter import *
 from vchunk import *
+from vframeset import *
 import Pmw
 
 class Timeline(Frame):
@@ -44,6 +45,7 @@ class Timeline(Frame):
         self.chunks = []
         self.mods = []    # list of chunk modifying objects (filter and effect dialogs)
         self.view = None  # viewer widget
+       self.basedir = None  #path of project directory, required for framesets
         self.animChunks = BooleanVar(value = True)
         tooltips = Pmw.Balloon(self)
 
@@ -109,9 +111,22 @@ class Timeline(Frame):
 
     def convert(self):
         """
-        Converts marked chunks to framesets (not yet implemented)
+        Converts marked chunks to framesets
         """
-        pass
+       for vc in self.chunks:
+            if vc.marked.get():
+                index = self.chunks.index(vc)
+                new = VFrameset(self.subgets['chunklist'].interior(),
+                                vurl = vc.videofile,
+                               )
+                new.played.set(value = vc.played.get())
+                new.marked.set(value = vc.marked.get())
+                if self.animChunks.get(): new.play()
+                new.pack(before = vc, side=LEFT)
+                self.chunks.insert(index, new)
+                self.chunks.remove(vc)
+                vc.stop()
+                vc.destroy()
 
     def playall(self):
         """
@@ -173,7 +188,8 @@ class Timeline(Frame):
                 new.filters = list(vc.filters)
                 new.played.set(value = vc.played.get())
                 new.marked.set(value = vc.marked.get())
-                new.play()
+                if self.animChunks.get(): new.play()
+               else: new.stop()
                 new.pack(before = vc, side=LEFT)
                 self.chunks.insert(index, new)
                 vc.schedule = ''
@@ -219,3 +235,10 @@ class Timeline(Frame):
 
     def set_mods(self, mods):
         self.mods = mods
+
+    def set_basedir(self, basedir):
+       self.basedir = basedir
+       self.subgets['b_frameset'].config(state = 'normal')
+
+    def get_basedir(self):
+       return self.basedir