def OnPreviewVideo(self, evt): h = TrackList.background_size()['height'] max_height = 480 scale = min(1, max_height / (h or max_height)) wx.GetApp().RunInBackground(mix.preview_thread, TrackList.all_tracks(), **TrackList.background_size(), scale=scale)
def _updateLayout(self, tracks, force=False): old_tracks = set(self.m_layoutPreview.GetTrackNames()) needs_layout = set(old_tracks) != set(t['path'] for t in tracks) # Update the layout preview self.m_layoutPreview.SetTracks(tracks) self.m_layoutPreview.SetBackgroundSize(**TrackList.background_size()) # New tracks means run the layout again if tracks and (needs_layout or force): layout = TrackList.as_layout(self.video_width / self.video_height, self.video_height) TrackList.update_from_layout(layout, self.video_width, self.video_height)
def OnExportShotcut(self, evt): file = dialogs.file_dialog(self, message="Save a file", wildcard="Shotcut Files (*.mlt)|.mlt", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) if file: tracks = TrackList.as_mlt_tracks() # Folks usually include an image for the background, so add a blank track # to make that possible tracks.append({'blank_track': True}) # Shotcut puts the first track at the bottom, so reverse the order tracks.reverse() with open(file, 'w') as f: f.write(mlt.xml.write_file(tracks, **TrackList.background_size()))
def OnPreviewAudio(self, evt): wx.GetApp().RunInBackground(mix.preview_thread, TrackList.all_tracks(), **TrackList.background_size(), audio_only=True)