~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to pitivi/ui/timeline.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Bicha
  • Date: 2011-08-15 02:32:20 UTC
  • mfrom: (1.5.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110815023220-x2n5l0i4deiqn7dn
Tags: 0.14.2-0ubuntu1
* New upstream version.
  - New Mallard format help
* debian/control:
  - Add gnome-doc-utils to build-depends
  - Bump pygtk minimum to 2.24
* debian/patches/01_lpi.patch
  - Move LPI items below User Manual in Help menu
* debian/watch: Watch for 0.14.* tar.bz2

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
from pitivi.ui.filelisterrordialog import FileListErrorDialog
44
44
from pitivi.ui.curve import Curve
45
45
from pitivi.ui.common import SPACING
 
46
from pitivi.ui.alignmentprogress import AlignmentProgressDialog
 
47
from pitivi.ui.depsmanager import DepsManager
 
48
from pitivi.timeline.align import AutoAligner
 
49
from pitivi.check import soft_deps
46
50
 
47
51
from pitivi.factories.operation import EffectFactory
48
52
 
64
68
LINK = _("Link together arbitrary clips")
65
69
UNGROUP = _("Ungroup clips")
66
70
GROUP = _("Group clips")
 
71
ALIGN = _("Align clips based on their soundtracks")
67
72
SELECT_BEFORE = ("Select all sources before selected")
68
73
SELECT_AFTER = ("Select all after selected")
69
74
 
87
92
                <menuitem action="UnlinkObj" />
88
93
                <menuitem action="GroupObj" />
89
94
                <menuitem action="UngroupObj" />
 
95
                <menuitem action="AlignObj" />
90
96
                <separator />
91
97
                <menuitem action="Prevframe" />
92
98
                <menuitem action="Nextframe" />
104
110
            <toolitem action="LinkObj" />
105
111
            <toolitem action="GroupObj" />
106
112
            <toolitem action="UngroupObj" />
 
113
            <toolitem action="AlignObj" />
107
114
        </placeholder>
108
115
    </toolbar>
109
116
    <accelerator action="DeleteObj" />
158
165
        self.infolabel.set_alignment(0, 0.5)
159
166
 
160
167
        self.questionbutton = gtk.Button()
161
 
        self.questionbutton.set_image(gtk.image_new_from_stock(gtk.STOCK_INFO,
162
 
                                                               gtk.ICON_SIZE_SMALL_TOOLBAR))
 
168
        self.infoicon = gtk.Image()
 
169
        self.infoicon.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_SMALL_TOOLBAR)
 
170
        self.questionbutton.add(self.infoicon)
163
171
        self.questionbutton.connect("clicked", self._questionButtonClickedCb)
164
172
        self._questionshowing = False
165
173
 
236
244
 
237
245
        # zooming slider's "zoom fit" button
238
246
        zoom_controls_hbox = gtk.HBox()
239
 
        zoom_best_fit_button = gtk.Button(_("Zoom"))
240
 
        zoom_best_fit_button.set_relief(gtk.RELIEF_NONE)
241
 
        zoom_best_fit_button.set_tooltip_text(ZOOM_FIT)
242
 
        zoom_best_fit_button.set_image(gtk.image_new_from_stock(gtk.STOCK_ZOOM_FIT, gtk.ICON_SIZE_BUTTON))
243
 
        zoom_best_fit_button.connect("clicked", self._zoomFitCb)
244
 
        zoom_controls_hbox.pack_start(zoom_best_fit_button)
 
247
        zoom_fit_btn = gtk.Button()
 
248
        zoom_fit_btn.set_relief(gtk.RELIEF_NONE)
 
249
        zoom_fit_btn.set_tooltip_text(ZOOM_FIT)
 
250
        zoom_fit_icon = gtk.Image()
 
251
        zoom_fit_icon.set_from_stock(gtk.STOCK_ZOOM_FIT, gtk.ICON_SIZE_BUTTON)
 
252
        zoom_fit_btn_hbox = gtk.HBox()
 
253
        zoom_fit_btn_hbox.pack_start(zoom_fit_icon)
 
254
        zoom_fit_btn_hbox.pack_start(gtk.Label(_("Zoom")))
 
255
        zoom_fit_btn.add(zoom_fit_btn_hbox)
 
256
        zoom_fit_btn.connect("clicked", self._zoomFitCb)
 
257
        zoom_controls_hbox.pack_start(zoom_fit_btn)
245
258
        # zooming slider
246
259
        self._zoomAdjustment = gtk.Adjustment()
247
260
        self._zoomAdjustment.set_value(Zoomable.getCurrentZoomLevel())
326
339
                self.ungroupSelected),
327
340
            ("GroupObj", "pitivi-group", None, "<Control>G", GROUP,
328
341
                self.groupSelected),
 
342
            ("AlignObj", "pitivi-align", None, "<Shift><Control>A", ALIGN,
 
343
                self.alignSelected),
329
344
        )
330
345
 
331
346
        self.playhead_actions = (
350
365
        self.unlink_action = actiongroup.get_action("UnlinkObj")
351
366
        self.group_action = actiongroup.get_action("GroupObj")
352
367
        self.ungroup_action = actiongroup.get_action("UngroupObj")
 
368
        self.align_action = actiongroup.get_action("AlignObj")
353
369
        self.delete_action = actiongroup.get_action("DeleteObj")
354
370
        self.split_action = actiongroup.get_action("Split")
355
371
        self.keyframe_action = actiongroup.get_action("Keyframe")
713
729
        unlink = False
714
730
        group = False
715
731
        ungroup = False
 
732
        align = False
716
733
        split = False
717
734
        keyframe = False
718
735
        if timeline.selection:
720
737
            if len(timeline.selection) > 1:
721
738
                link = True
722
739
                group = True
 
740
                align = AutoAligner.canAlign(timeline.selection)
723
741
 
724
742
            start = None
725
743
            duration = None
748
766
        self.unlink_action.set_sensitive(unlink)
749
767
        self.group_action.set_sensitive(group)
750
768
        self.ungroup_action.set_sensitive(ungroup)
 
769
        self.align_action.set_sensitive(align)
751
770
        self.split_action.set_sensitive(split)
752
771
        self.keyframe_action.set_sensitive(keyframe)
753
772
 
768
787
    def deleteSelected(self, unused_action):
769
788
        if self.timeline:
770
789
            self.app.action_log.begin("delete clip")
 
790
            self.timeline.disableUpdates()
771
791
            self.timeline.deleteSelection()
 
792
            self.timeline.enableUpdates()
772
793
            self.app.action_log.commit()
773
794
 
774
795
    def unlinkSelected(self, unused_action):
789
810
        if self.timeline:
790
811
            self.timeline.groupSelection()
791
812
 
 
813
    def alignSelected(self, unused_action):
 
814
        if "NumPy" in soft_deps:
 
815
            DepsManager(self.app)
 
816
 
 
817
        elif self.timeline:
 
818
            progress_dialog = AlignmentProgressDialog(self.app)
 
819
            progress_dialog.window.show()
 
820
            self.app.action_log.begin("align")
 
821
            self.timeline.disableUpdates()
 
822
 
 
823
            def alignedCb():  # Called when alignment is complete
 
824
                self.timeline.enableUpdates()
 
825
                self.app.action_log.commit()
 
826
                progress_dialog.window.destroy()
 
827
 
 
828
            pmeter = self.timeline.alignSelection(alignedCb)
 
829
            pmeter.addWatcher(progress_dialog.updatePosition)
 
830
 
792
831
    def split(self, action):
793
832
        self.app.action_log.begin("split")
794
833
        self.timeline.disableUpdates()