def load_elements(self, filename): """Loads 'filename' as current pipeline""" elements = SlideShow.read_elements(filename, self.config) info = SlideShow.initialize_elements(elements, self.config) self.info = info self.elelist.clear() for element in elements: self.elelist.append([element, element]) self.window.set_title("SlideShow: "+os.path.basename(self.config["input_txtfile"])) self.dirty = False self.update_preview()
def load_elements(self, filename): """Loads 'filename' as current pipeline""" elements = SlideShow.read_elements(filename, self.config) info = SlideShow.initialize_elements(elements, self.config) self.info = info self.elelist.clear() for element in elements: self.elelist.append([element, element]) self.window.set_title("SlideShow: " + os.path.basename(self.config["input_txtfile"])) self.dirty = False self.update_preview()
def writeToFile(): print("Created file: " + "output_" + data) f = open("output_" + data, "w+") f.write( "Submission file\t\t\t\t\t\t-----\t\t\t\t\t\t Description\n".format( len(slideList))) f.write("{0}\t\t\t\t\t\t-----\t\t\t\t\t\tThis submission has {0} slides\n". format(len(slideList))) for i in range(len(slideList)): if (len(slideList[i].photo) > 1): image_id = [ slideList[i].photo[j].id for j in range(len(slideList[i].photo)) ] f.write( "{0}\t\t\t\t\t\t-----\t\t\t\t\t\tSlide number {1} contains photo {0} \n" .format(image_id, i)) else: f.write( "{0}\t\t\t\t\t\t-----\t\t\t\t\t\tSlide number {1} contains photo {0} \n" .format(slideList[i].photo[0].id, i)) f.write("Score:\t\t\t\t\t\t{0}".format(ss.scoring(slideList))) f.close()
def set_frontend(self, frontend, info, config): self.stop() self.init() self.config = config self.frontend = frontend if(self.frontend): self.backend = SlideShow.get_preview_backend(self.config, info["num_audio_tracks"]) self.pipeline = SlideShow.get_gst_pipeline(self.frontend, self.backend) bus = self.pipeline.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) else: self.backend = None self.pipeline = None self.update_gui_state()
def load(self, filename=None): self.preview.stop() self.config, self.elements, self.frontend, info = SlideShow.get_config_to_frontend(filename) if self.config.has_key("input_txtfile"): self.input_txtfile = self.config["input_txtfile"] self.preview.set_frontend(self.frontend, info, self.config) self.preview.set_size(self.config["width"], self.config["height"]) self.window.resize(*self.builder.get_object("topbox").size_request()) self.preview.set_size(-1,-1)
def load(self, filename=None): self.preview.stop() self.config, self.elements, self.frontend, info = SlideShow.get_config_to_frontend( filename) if self.config.has_key("input_txtfile"): self.input_txtfile = self.config["input_txtfile"] self.preview.set_frontend(self.frontend, info, self.config) self.preview.set_size(self.config["width"], self.config["height"]) self.window.resize(*self.builder.get_object("topbox").size_request()) self.preview.set_size(-1, -1)
def set_frontend(self, frontend, info, config): self.stop() self.init() self.config = config self.frontend = frontend if (self.frontend): self.backend = SlideShow.get_preview_backend( self.config, info["num_audio_tracks"]) self.pipeline = SlideShow.get_gst_pipeline(self.frontend, self.backend) bus = self.pipeline.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) else: self.backend = None self.pipeline = None self.update_gui_state()
def update_preview(self): frontend, info = SlideShow.get_frontend(self.get_elements(), self.config) self.preview.set_frontend(frontend, info, self.config) self.preview.pause()
def add_element(self, element): if SlideShow.isSlide(element): self.info["video_duration"] += element.duration
def remove_element(self, element): if SlideShow.isSlide(element): self.info["video_duration"] -= element.duration
def update_preview(self): frontend,info = SlideShow.get_frontend(self.get_elements(), self.config) self.preview.set_frontend(frontend, info, self.config) self.preview.pause()