Beispiel #1
0
    def update_frame(self, e):
        current_frame = self.ui.frame_spin_box.value() - 1
        if self.frame_collection == None or self.frame_collection.get_frame_count(
        ) == 0 or self.frame_collection.get_frame(e) == None:
            self.ui.frame_spin_box.setValue(e)
            return
        elif e - 1 >= self.frame_collection.get_frame_count():
            e = self.frame_collection.get_frame_count() - 1
        else:
            self.ui.frame_spin_box.setValue(
                self.frame_collection.get_frame(e).get_frame_number())
        if not self.frame_collection.get_frame(e).is_cached():
            self.frame_collection.cache_frame(e)
        (image, output) = self.frame_collection.get_frame_pixmap(e)
        if image == None or output == None:
            return
        if self.ui.paint_interface.get_output(
        ) != None and self.ui.paint_interface.output_changed(
        ) and current_frame >= 0 and current_frame < self.frame_collection.get_frame_count(
        ):
            new_pixmap = self.ui.paint_interface.get_output()
            new_pixmap.toImage()
            buffer = qtc.QBuffer()
            buffer.open(qtc.QIODevice.OpenMode.ReadWrite)
            new_pixmap.save(buffer, 'PNG')
            self.frame_collection.update_output(current_frame, buffer)

        self.ui.paint_interface.unload_pixmaps()
        self.ui.paint_interface.load_pixmaps(output, image)
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.config.gui = self
        self.gui_config = GUI_Config(config)
        #from other program, call self.config.gui.style
        self.style = PyQtStyle()
        self.logger = self.config.logger
        try:
            signal.signal(signal.SIGTERM, self.quit_by_ctrl_c)
            signal.signal(signal.SIGINT, self.quit_by_ctrl_c)
            signal.signal(signal.SIGQUIT, self.quit_by_ctrl_c)
            signal.signal(signal.SIGHUP, self.quit_by_ctrl_c)
        except:
            pass

        self.display_buffer = QtCore.QBuffer()

        self.init_window()