

def on_timer(self, event):
    if self._interactive:
        self.update()
    else:
        self.draw()
        self._tile_index += 1
        clock_time_elapsed = (time.clock() - self._clock_time_start)
        rendered_tile_count = (self._tile_index + (self._render_frame_index * self._tile_count))
        total_tile_count = (self._tile_count * self._render_frame_count)
        clock_time_per_tile = (clock_time_elapsed / float(rendered_tile_count))
        clock_time_total = (clock_time_per_tile * total_tile_count)
        clock_time_remain = (clock_time_total - clock_time_elapsed)
        print(('Tile %d / %d (%.2f%%); %s elapsed; %s remaining; %s total' % (rendered_tile_count, total_tile_count, ((rendered_tile_count * 100.0) / total_tile_count), str(datetime.timedelta(seconds=round(clock_time_elapsed))), str(datetime.timedelta(seconds=round(clock_time_remain))), str(datetime.timedelta(seconds=round(clock_time_total))))))
        if (self._tile_index == self._tile_count):
            if self._ffmpeg_pipe:
                self.write_video_frame(self._img)
                self._render_frame_index += 1
                if ((self._render_frame_count is not None) and (self._render_frame_index >= self._render_frame_count)):
                    app.quit()
                    return
                self._tile_index = 0
                self._tile_coord = [0, 0]
                self.advance_time()
            else:
                self.write_img(self._img, self._output)
                app.quit()
                return
        else:
            self._tile_coord[0] += self._render_size[0]
            if (self._tile_coord[0] >= self._output_size[0]):
                self._tile_coord[0] = 0
                self._tile_coord[1] += self._render_size[1]
                if self._progress_file:
                    self.write_img(self._img, self._progress_file)

dataset/ETHPy150Open alexjc/shadertoy-render/shadertoy-render.py RenderingCanvas.on_timer/original