def do(self): timeable_left = self.controller.get_timeable_by_id(self.view_id) timeable_left.resizable_right = 0 model_left = timeable_left.model model_left.set_end(model_left.clip.Start() + pos_to_seconds(self.pos), is_sec=True) new_model = make_timeable_model(model_left.file_name, self.new_model_id) new_model.set_start(model_left.clip.End(), is_sec=True) new_model.set_end(self.model_end, is_sec=True) new_model.move(model_left.clip.Position() + pos_to_seconds(self.pos), is_sec=True) new_model.set_layer(timeable_left.model.clip.Layer()) self.controller.create_timeable( timeable_left.track_id, timeable_left.name, timeable_left.width - self.pos, self.pos + timeable_left.x_pos, new_model, self.new_view_id, hist=False, res_right=timeable_left.resizable_right) timeable_left.set_width(self.pos) timeable_left.setPos(timeable_left.x_pos, 0) timeable_left.update_handles_pos()
def trim_start(self, pos): """ start = start + sec(pos) """ new_start = self.clip.Start() + pos_to_seconds(pos) self.clip.Start(new_start) data = {"start": new_start} self.timeline_instance.change("update", ["clips", { "id": self.clip.Id() }], data)
def trim_end(self, pos): """ end = end + sec(pos) """ new_end = self.clip.End() + pos_to_seconds(pos) self.clip.End(new_end) data = {"end": new_end} self.timeline_instance.change("update", ["clips", { "id": self.clip.Id() }], data)
def move(self, pos, is_sec=False): """ Sets the position of the clip """ new_position = pos if is_sec: self.clip.Position(new_position) else: new_position = pos_to_seconds(pos) self.clip.Position(new_position) data = {"position": new_position} self.timeline_instance.change("update", ["clips", { "id": self.clip.Id() }], data)
def set_end(self, pos, is_sec=False): """ Sets the end of the clip """ new_end = pos if is_sec: self.clip.End(new_end) else: new_end = pos_to_seconds(pos) self.clip.End(new_end) data = {"end": new_end} self.timeline_instance.change("update", ["clips", { "id": self.clip.Id() }], data)
def set_start(self, pos, is_sec=False): """ Sets the start of the clip """ new_start = pos if is_sec: self.clip.Start(pos) else: new_start = pos_to_seconds(pos) self.clip.Start(new_start) data = {"start": new_start} self.timeline_instance.change("update", ["clips", { "id": self.clip.Id() }], data)