]> git.plutz.net Git - viper/blobdiff - main.py
implemeted most basic cropping controls
[viper] / main.py
diff --git a/main.py b/main.py
index 92511f3d475f3455515a09cdd57546c93a4695a6..b601efa51ad5638ecd36325f421a8c31d4a48729 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -1,23 +1,23 @@
 #!/usr/bin/python
 #encoding: utf-8
 
-#Viper - Video In Python Editing Reptile, a video editor
-#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/>
+# Viper - Video In Python Editing Reptile, a video editor
+# 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 timeline import *
@@ -101,27 +101,33 @@ class Main(Tk):
         call named_save_project() if no
         project directory is set yet
         """
-
-        self.named_save_project()
+       if self.subgets['timeline'].get_basedir() == None:
+           self.named_save_project()
+       else:
+           savedir = self.subgets['timeline'].get_basedir()
+            try: os.unlink(savedir + '/description.sqlite')
+           except: pass
+
+            dbcon = sqlite.connect(savedir + '/description.sqlite')
+            dbcur =  dbcon.cursor()
+            dbcur.execute('CREATE TABLE chunks (iorder INTEGER PRIMARY KEY, filename TEXT, start REAL, frames INTEGER, played INTEGER, marked BOOLEAN);')
+            dbcur.execute('CREATE TABLE filters (iorder INTEGER PRIMARY KEY, chunk INTEGER, FOREIGN KEY (chunk) REFERENCES chunks (iorder));')
+            dbcur.execute('CREATE TABLE filter_lines (iorder INTEGER PRIMARY KEY, line TEXT, filter INTEGER, FOREIGN KEY (filter) REFERENCES filters (iorder));')
+            for chunk in self.subgets['timeline'].chunks:
+                chunk.store(dbcur)
+    
+            dbcur.close()
+            dbcon.commit()
+            dbcon.close()
 
     def named_save_project(self):
         """
         Ask for directory to save to (and save project)
         """
-
         savedir = tkFileDialog.asksaveasfilename(filetypes = [('Viper Project Directory', '*.vpd')])
         os.makedirs(savedir)
-        dbcon = sqlite.connect(savedir + '/description.sqlite')
-        dbcur =  dbcon.cursor()
-        dbcur.execute('CREATE TABLE chunks (iorder INTEGER PRIMARY KEY, filename TEXT, start REAL, frames INTEGER, played INTEGER, marked BOOLEAN);')
-        dbcur.execute('CREATE TABLE filters (iorder INTEGER PRIMARY KEY, chunk INTEGER, FOREIGN KEY (chunk) REFERENCES chunks (iorder));')
-        dbcur.execute('CREATE TABLE filter_lines (iorder INTEGER PRIMARY KEY, line TEXT, filter INTEGER, FOREIGN KEY (filter) REFERENCES filters (iorder));')
-        for chunk in self.subgets['timeline'].chunks:
-            chunk.store(dbcur)
-
-        dbcur.close()
-        dbcon.commit()
-        dbcon.close()
+       self.subgets['timeline'].set_basedir(savedir)
+       self.save_project()
 
     def open_project(self):
         """
@@ -130,6 +136,7 @@ class Main(Tk):
         """
 
         opendir = tkFileDialog.askopenfilename(filetypes = [('Project Description', '*/description.sqlite')])
+       self.subgets['timeline'].set_basedir(opendir[0:-19])
 
         for chunk in self.subgets['timeline'].chunks: chunk.delete()