~nico-inattendu/luciole/bug_740324

« back to all changes in this revision

Viewing changes to pitivi/ui/projectsettings.py

  • Committer: NicoInattendu
  • Date: 2011-02-28 18:27:56 UTC
  • mfrom: (123.1.54 luciole-with-sound)
  • Revision ID: nico@inattendu.org-20110228182756-weonszu8zpzermrl
initial merge with luciole-with-sound branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# PiTiVi , Non-linear video editor
 
2
#
 
3
#       ui/projectsettings.py
 
4
#
 
5
# Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
 
6
#
 
7
# This program is free software; you can redistribute it and/or
 
8
# modify it under the terms of the GNU Lesser General Public
 
9
# License as published by the Free Software Foundation; either
 
10
# version 2.1 of the License, or (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
# Lesser General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Lesser General Public
 
18
# License along with this program; if not, write to the
 
19
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
20
# Boston, MA 02111-1307, USA.
 
21
 
 
22
"""
 
23
Dialog box for project settings
 
24
"""
 
25
 
 
26
import gtk
 
27
from pitivi.ui.glade import GladeWindow
 
28
from pitivi.ui.exportsettingswidget import ExportSettingsWidget
 
29
 
 
30
class ProjectSettingsDialog(GladeWindow):
 
31
    glade_file = "projectsettings.glade"
 
32
 
 
33
    def __init__(self, parent, project):
 
34
        GladeWindow.__init__(self, parent)
 
35
        self.project = project
 
36
        self.expwidget = ExportSettingsWidget(parent)
 
37
        self.widgets["vbox1"].pack_start(self.expwidget)
 
38
        self.expwidget.show()
 
39
        self.expwidget.setSettings(self.project.getSettings().copy())
 
40
        self._fillSettings()
 
41
 
 
42
    def _fillSettings(self):
 
43
        w = self.widgets
 
44
        w["nameentry"].set_text(self.project.name)
 
45
        w["descriptiontextview"].get_buffer().set_text(self.project.description)
 
46
 
 
47
    def updateSettings(self):
 
48
        # apply selected settings to project
 
49
        w = self.widgets
 
50
 
 
51
        # Name/Description
 
52
        self.project.name = w["nameentry"].get_text()
 
53
        txtbuffer = w["descriptiontextview"].get_buffer()
 
54
        self.project.description = txtbuffer.get_text(txtbuffer.get_start_iter(),
 
55
                                                      txtbuffer.get_end_iter())
 
56
        self.project.setSettings(self.expwidget.updateSettings())
 
57
 
 
58
    def _responseCb(self, unused_widget, response):
 
59
        # if the response is gtk.RESPONSE_OK update the settings
 
60
        # else destroy yourself !
 
61
        self.hide()
 
62
        if response == gtk.RESPONSE_OK:
 
63
            self.updateSettings()
 
64
        self.destroy()