144
by Jonathan Thomas
Bumping version to 0.9.30 |
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 os |
|
20 |
import gtk, gtk.glade |
|
21 |
from windows.SimpleGladeApp import SimpleGladeApp |
|
162.1.3
by Andy Finch
Improved the save routine so any extra settings that are not yet in the xml get saved to the file. |
22 |
from windows import preferences |
144
by Jonathan Thomas
Bumping version to 0.9.30 |
23 |
from classes import project, messagebox |
24 |
||
25 |
# init the foreign language
|
|
26 |
from language import Language_Init |
|
27 |
||
28 |
||
29 |
class frmAddFiles(SimpleGladeApp): |
|
30 |
||
31 |
def __init__(self, path="AddFiles.glade", root="frmAddFiles", domain="OpenShot", form=None, project=None, **kwargs): |
|
32 |
SimpleGladeApp.__init__(self, os.path.join(project.GLADE_DIR, path), root, domain, **kwargs) |
|
33 |
||
34 |
# Add language support
|
|
35 |
_ = Language_Init.Translator(project).lang.gettext |
|
36 |
||
37 |
self.frmAddFiles.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) |
|
38 |
self.frmAddFiles.set_select_multiple(True) |
|
39 |
#if the video folder exists, default to this
|
|
40 |
#video_dir = os.path.join(os.path.expanduser("~"), "Video")
|
|
41 |
#if video_dir:
|
|
42 |
# self.frmAddFiles.set_current_folder(video_dir)
|
|
43 |
||
44 |
self.form = form |
|
45 |
self.project = project |
|
162.1.3
by Andy Finch
Improved the save routine so any extra settings that are not yet in the xml get saved to the file. |
46 |
|
47 |
#open the last used folder
|
|
48 |
default_folder = preferences.Settings.app_state["import_folder"] |
|
49 |
if default_folder != "None": |
|
50 |
self.frmAddFiles.set_current_folder(preferences.Settings.app_state["import_folder"]) |
|
51 |
||
144
by Jonathan Thomas
Bumping version to 0.9.30 |
52 |
self.frmAddFiles.show_all() |
53 |
||
54 |
||
55 |
def on_btnCancel_clicked(self, widget, *args): |
|
56 |
self.frmAddFiles.destroy() |
|
57 |
||
58 |
def on_btnAdd_clicked(self, widget, *args): |
|
59 |
files_to_add = self.frmAddFiles.get_filenames() |
|
60 |
try: |
|
61 |
for file in files_to_add: |
|
62 |
# add each file
|
|
63 |
self.project.project_folder.AddFile(file) |
|
64 |
||
175
by Jonathan Thomas
Bumped to version 0.9.52 |
65 |
#set the project as modified
|
66 |
self.project.set_project_modified(is_modified=True, refresh_xml=False) |
|
67 |
||
144
by Jonathan Thomas
Bumping version to 0.9.30 |
68 |
# refresh the main form
|
69 |
self.form.refresh() |
|
70 |
||
71 |
except: |
|
72 |
messagebox.show(_("Error"), _("There was an error importing the selected files")) |
|
73 |
||
162.1.3
by Andy Finch
Improved the save routine so any extra settings that are not yet in the xml get saved to the file. |
74 |
#set the last used folder
|
75 |
preferences.Settings.app_state["import_folder"] = self.frmAddFiles.get_current_folder() |
|
76 |
||
77 |
||
144
by Jonathan Thomas
Bumping version to 0.9.30 |
78 |
self.frmAddFiles.destroy() |
79 |
||
188
by Jonathan Thomas
Added 2 patches from Andy that address a bug in |
80 |
def on_frmAddFiles_file_activated(self, widget, *args): |
81 |
#call the open project method when a file is double clicked
|
|
82 |
self.on_btnAdd_clicked(widget, *args) |
|
83 |
||
144
by Jonathan Thomas
Bumping version to 0.9.30 |
84 |
|
85 |
||
86 |
def main(): |
|
87 |
frm_add_files = frmAddFiles() |
|
88 |
frm_add_files.run() |
|
89 |
||
90 |
if __name__ == "__main__": |
|
91 |
main() |