def _setBestZoomRatio(self): ruler_width = self.timeline.ruler.get_allocation()[2] timeline_duration = self.project.timeline.duration ideal_zoom_ratio = ruler_width / float(timeline_duration / gst.SECOND) nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio) Zoomable.setZoomLevel(nearest_zoom_level)
def run(self): self.watchdog.start() if self.no_ui: self.instance.run(["--no-ui"]) else: from pitivi.ui.zoominterface import Zoomable # set a common zoom ratio so that things like edge snapping values # are consistent Zoomable.setZoomLevel((3 * Zoomable.zoom_steps) / 4) self.instance.run([])
def setBestZoomRatio(self, p=0): """Set the zoom level so that the entire timeline is in view.""" ruler_width = self.timeline.ruler.get_allocation()[2] # Add gst.SECOND - 1 to the timeline duration to make sure the # last second of the timeline will be in view. timeline_duration = self.project.timeline.duration + gst.SECOND - 1 timeline_duration_s = int(timeline_duration / gst.SECOND) ideal_zoom_ratio = float(ruler_width) / timeline_duration_s nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio) Zoomable.setZoomLevel(nearest_zoom_level)