~nico-inattendu/luciole/luciole-with-sound

« back to all changes in this revision

Viewing changes to luciole/ctrl/ctrl_timeline.py

  • Committer: Nico
  • Date: 2011-02-28 09:34:33 UTC
  • Revision ID: nico@inattendu.org-20110228093433-e60uj3imlfglid7t
add sound management in new project assistant

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
# standard library imports
30
30
import os.path
31
31
import urllib
 
32
import gettext
 
33
_ = gettext.gettext
 
34
 
32
35
# related third party imports
33
36
import gst
34
37
import copy
552
555
 
553
556
 
554
557
    def add_sound_track(self, path) :
 
558
        """ add a sound track to timeline """
 
559
        if os.path.splitext(path)[1] != '.ogg' :
 
560
            _msg = _('Invalid sound file : %s. Only ogg files allowed.'%path)
 
561
            self.error(_msg)
 
562
            self.ctrl_project.gui.status_bar.display_message(_msg)
 
563
            return
 
564
        
555
565
        self.debug('Add sound track : %s', path )
556
566
        # check if a sound track is avlbl, if yes remove it
557
567
        _dest_path = os.path.join(   self.project.props['project_dir'],
562
572
             
563
573
 
564
574
        
565
 
        # copy sound track on project
566
 
        # TODO : allow only ogg files
567
575
        
568
576
        try :
569
577
            LT.copyf(path, _dest_path) 
574
582
            self.ctrl_project.is_modified = True
575
583
            self.project.props['sound']['name'] = LCONST.SOUND_TRACK_NAME
576
584
            self._update_sound_props(self.project.props, active='no')
 
585
            _msg = _('Sound track %s loaded in project'% path )
 
586
            self.info(_msg)
 
587
            self.ctrl_project.gui.status_bar.display_message(_msg)
 
588
 
577
589
 
578
590
    
579
591
    def go_to_position(self, position) :