32 from classes.updates
import UpdateInterface
33 from classes.logger
import log
34 from classes.app
import get_app
35 from classes
import settings
45 project = self.app.project
49 fps = project.get([
"fps"])
50 width = project.get([
"width"])
51 height = project.get([
"height"])
52 sample_rate = project.get([
"sample_rate"])
53 channels = project.get([
"channels"])
54 channel_layout = project.get([
"channel_layout"])
57 self.
timeline = openshot.Timeline(width, height, openshot.Fraction(fps[
"num"], fps[
"den"]), sample_rate, channels,
59 self.timeline.info.channel_layout = channel_layout
60 self.timeline.info.has_audio =
True
61 self.timeline.info.has_video =
True
62 self.timeline.info.video_length = 99999
63 self.timeline.info.duration = 999.99
64 self.timeline.info.sample_rate = sample_rate
65 self.timeline.info.channels = channels
72 self.app.updates.add_listener(self, 0)
82 if len(action.key) >= 1
and action.key[0].lower()
in [
"files",
"history",
"markers",
"layers",
"export_path",
"import_path",
"scale"]:
85 elif len(action.key) >= 1
and action.key[0].lower()
in [
"profile"]:
88 self.timeline.ApplyMapperToClips()
93 if action.type ==
"load":
95 self.timeline.SetJson(action.json(only_value=
True))
99 self.timeline.ApplyMapperToClips()
102 self.window.refreshFrameSignal.emit()
106 self.timeline.ApplyJsonDiff(action.json(is_array=
True))
108 except Exception
as e:
109 log.info(
"Error applying JSON to timeline object in libopenshot: %s. %s" % (e, action.json(is_array=
True)))
114 while not self.window.initialized:
115 log.info(
'Waiting for main window to initialize before calling SetMaxSize')
118 log.info(
"Adjusting max size of preview image: %s" % new_size)
121 self.timeline.ClearAllCache()
124 self.timeline.SetMaxSize(new_size.width(), new_size.height())
def get_app
Returns the current QApplication instance of OpenShot.
This class syncs changes from the timeline to libopenshot.
def MaxSizeChangedCB
Callback for max sized change (i.e.
def changed
This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface) ...
def get_settings
Get the current QApplication's settings instance.