#!/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 *
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):
"""
"""
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()