31 from classes.updates
import UpdateInterface
32 from classes.logger
import log
33 from classes.app
import get_app
34 from classes
import settings
44 project = self.app.project
48 fps = project.get([
"fps"])
49 width = project.get([
"width"])
50 height = project.get([
"height"])
51 sample_rate = project.get([
"sample_rate"])
52 channels = project.get([
"channels"])
53 channel_layout = project.get([
"channel_layout"])
56 self.
timeline = openshot.Timeline(width, height, openshot.Fraction(fps[
"num"], fps[
"den"]), sample_rate, channels,
58 self.timeline.info.channel_layout = channel_layout
59 self.timeline.info.has_audio =
True 60 self.timeline.info.has_video =
True 61 self.timeline.info.video_length = 99999
62 self.timeline.info.duration = 999.99
63 self.timeline.info.sample_rate = sample_rate
64 self.timeline.info.channels = channels
71 self.app.updates.add_listener(self, 0)
78 if len(action.key) >= 1
and action.key[0].lower()
in [
"files",
"markers",
"layers",
"export_path"]:
81 elif len(action.key) >= 1
and action.key[0].lower()
in [
"profile"]:
83 current_speed = self.window.preview_thread.player.Speed()
86 self.window.SpeedSignal.emit(0)
89 self.timeline.ApplyMapperToClips()
92 self.window.SpeedSignal.emit(current_speed)
98 current_speed = self.window.preview_thread.player.Speed()
101 self.window.SpeedSignal.emit(0)
103 if action.type ==
"load":
105 self.timeline.SetJson(action.json(only_value=
True))
109 self.window.refreshFrameSignal.emit()
113 self.timeline.ApplyJsonDiff(action.json(is_array=
True))
116 self.window.SpeedSignal.emit(current_speed)
118 except Exception
as e:
119 log.info(
"Error applying JSON to timeline object in libopenshot: %s" % e)
def get_app()
Returns the current QApplication instance of OpenShot.
This class syncs changes from the timeline to libopenshot.
def __init__(self, window)
def get_settings()
Get the current QApplication's settings instance.
def changed(self, action)
This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface) ...