~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to pitivi/ui/mainwindow.py

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2007-01-31 15:32:37 UTC
  • mto: (3.2.1 hardy) (1.2.1 upstream) (6.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20070131153237-de4p8lipjv8x5x3b
Tags: upstream-0.10.2
ImportĀ upstreamĀ versionĀ 0.10.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import gobject
28
28
import gtk
29
29
import gst
 
30
import gconf
30
31
 
31
32
import pitivi.instance as instance
32
33
import pitivi.configure as configure
33
34
 
 
35
from gettext import gettext as _
 
36
 
34
37
from timeline import TimelineWidget
35
38
from sourcefactories import SourceFactoriesWidget
36
39
from viewer import PitiviViewer
37
40
from projectsettings import ProjectSettingsDialog
38
41
from pitivi.configure import pitivi_version, APPNAME
39
42
 
 
43
D_G_INTERFACE = "/desktop/gnome/interface"
 
44
 
 
45
for gconf_dir in (D_G_INTERFACE,):
 
46
    gconf.client_get_default ().add_dir (gconf_dir, gconf.CLIENT_PRELOAD_NONE)
 
47
 
40
48
class PitiviMainWindow(gtk.Window):
41
49
    """
42
50
    Pitivi's main window
62
70
    def _setActions(self):
63
71
        """ sets up the GtkActions """
64
72
        self.actions = [
65
 
            ("NewProject", gtk.STOCK_NEW, None, None, "Create a new project", self._newProjectCb),
66
 
            ("OpenProject", gtk.STOCK_OPEN, None, None, "Opens an existing project", self._openProjectCb),
67
 
            ("SaveProject", gtk.STOCK_SAVE, None, None, "Save the current project", self._saveProjectCb),
68
 
            ("SaveProjectAs", gtk.STOCK_SAVE_AS, None, None, "Save the current project", self._saveProjectAsCb),
69
 
            ("ProjectSettings", gtk.STOCK_PROPERTIES, "Project Settings", None, "Edit the project settings", self._projectSettingsCb),
70
 
            ("ImportSources", gtk.STOCK_ADD, "_Import Sources...", None, "Import sources to use", self._importSourcesCb),
 
73
            ("NewProject", gtk.STOCK_NEW, None, None, _("Create a new project"), self._newProjectCb),
 
74
            ("OpenProject", gtk.STOCK_OPEN, None, None, _("Open an existing project"), self._openProjectCb),
 
75
            ("SaveProject", gtk.STOCK_SAVE, None, None, _("Save the current project"), self._saveProjectCb),
 
76
            ("SaveProjectAs", gtk.STOCK_SAVE_AS, None, None, _("Save the current project"), self._saveProjectAsCb),
 
77
            ("ProjectSettings", gtk.STOCK_PROPERTIES, _("Project Settings"), None, _("Edit the project settings"), self._projectSettingsCb),
 
78
            ("ImportSources", gtk.STOCK_ADD, _("_Import Sources..."), None, _("Import sources to use"), self._importSourcesCb),
 
79
            ("ImportSourcesFolder", gtk.STOCK_ADD, _("_Import Folder of sources..."), None, _("Import folder of sources to use"), self._importSourcesFolderCb),
71
80
            ("Quit", gtk.STOCK_QUIT, None, None, None, self._quitCb),
72
 
            ("FullScreen", gtk.STOCK_FULLSCREEN, None, None, "View the main window on the whole screen", self._fullScreenCb),
73
 
            ("About", gtk.STOCK_ABOUT, None, None, "Information about %s" % APPNAME, self._aboutCb),
74
 
            ("File", None, "_File"),
75
 
            ("View", None, "_View"),
76
 
            ("Help", None, "_Help")
 
81
            ("FullScreen", gtk.STOCK_FULLSCREEN, None, None, _("View the main window on the whole screen"), self._fullScreenCb),
 
82
            ("About", gtk.STOCK_ABOUT, None, None, _("Information about %s") % APPNAME, self._aboutCb),
 
83
            ("File", None, _("_File")),
 
84
            ("View", None, _("_View")),
 
85
            ("Help", None, _("_Help"))
77
86
            ]
78
 
        self.toggleactions = [
79
 
            ("AdvancedView", None, "Advanced Vie_w", None, "Switch to advanced view", self._advancedViewCb)
 
87
        
 
88
        self.toggleactions = [
 
89
            ("AdvancedView", None, _("Advanced Vie_w"), None, _("Switch to advanced view"), self._advancedViewCb)
80
90
            ]
81
91
 
82
92
        self.actiongroup = gtk.ActionGroup("mainwindow")
88
98
        for action in self.actiongroup.list_actions():
89
99
            if action.get_name() in ["ProjectSettings", "Quit", "File", "Help",
90
100
                                     "About", "View", "FullScreen", "ImportSources",
91
 
                                     "AdvancedView"]:
 
101
                                     "ImportSourcesFolder", "AdvancedView"]:
92
102
                action.set_sensitive(True)
93
103
            else:
94
104
                action.set_sensitive(False)
98
108
        self.uimanager.insert_action_group(self.actiongroup, 0)
99
109
        self.uimanager.add_ui_from_file(os.path.join(os.path.dirname(os.path.abspath(__file__)), "actions.xml"))
100
110
 
101
 
        self.connect("key-press-event", self._keyPressEventCb)
 
111
        self.connect_after("key-press-event", self._keyPressEventCb)
102
112
 
103
113
    def _createUi(self):
104
114
        """ Create the graphical interface """
114
124
        vbox.pack_start(self.menu, expand=False)
115
125
 
116
126
        self.toolbar = self.uimanager.get_widget("/MainToolBar")
117
 
        self.toolbar.set_style(gtk.TOOLBAR_ICONS)
118
127
 
119
128
        vbox.pack_start(self.toolbar, expand=False)
120
129
 
213
222
        else:
214
223
            self.timeline.showSimpleView()
215
224
 
 
225
    def _aboutResponseCb(self, dialog, unused_response):
 
226
        dialog.destroy()
 
227
 
216
228
    def _aboutCb(self, unused_action):
217
229
        abt = gtk.AboutDialog()
218
230
        abt.set_name(APPNAME)
219
231
        abt.set_version("v%s" % pitivi_version)
220
232
        abt.set_website("http://www.pitivi.org/")
221
 
        authors = ["Edward Hervey <edward@fluendo.com>" ]
 
233
        authors = ["Edward Hervey <edward@fluendo.com>","",_("Contributors:"),
 
234
                   "Christophe Sauthier <christophe.sauthier@gmail.com> (i18n)",
 
235
                   "Laszlo Pandy <laszlok2@gmail.com> (UI)", ]
222
236
        abt.set_authors(authors)
223
 
        abt.set_license("GNU Lesser General Public License\nSee http://www.gnu.org/copyleft/lesser.html for more details")
 
237
        abt.set_license(_("GNU Lesser General Public License\nSee http://www.gnu.org/copyleft/lesser.html for more details"))
224
238
        abt.set_icon_from_file(configure.get_global_pixmap_dir() + "/pitivi.png")
 
239
        abt.connect("response", self._aboutResponseCb)
225
240
        abt.show()
226
241
 
227
242
    def _importSourcesCb(self, unused_action):
228
243
        self.sourcefactories.sourcelist.showImportSourcesDialog()
229
244
 
 
245
    def _importSourcesFolderCb(self, unused_action):
 
246
        self.sourcefactories.sourcelist.showImportSourcesDialog(True)
 
247
 
230
248
    ## PiTiVi main object callbacks
231
249
 
232
250
    def _newProjectCb(self, pitivi, project):