videoframegrid.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:desktop-stream-viewer 作者: AbiosGaming 项目源码 文件源码
def delete_stream(self, videoframe):
        """Removes selected stream/videoframe from grid"""

        videoframe.hide()

        # If one or two frames
        if len(self.videoframes) < 3:
            # Reset coordinates and delete frame
            self.coordinates = VideoFrameCoordinates(x=0, y=0)
            self.delete_videoframe(videoframe)
            # If one frame left after deletion
            if len(self.videoframes) == 1:
                # Set last frame's coordinates to (0,0) and update coordinates
                last_frame = self.videoframes[0]
                last_frame._coordinates = self.coordinates
                self.update_new_stream_coordinates()
        # Otherwise there are more frames
        else:
            # Get coordinates of frame
            x = videoframe._coordinates.x
            y = videoframe._coordinates.y
            self.coordinates = VideoFrameCoordinates(x=x, y=y)

            # Determine which frames need to be moved
            index = self.videoframes.index(videoframe)
            frames_to_move = self.videoframes[index + 1:]

            # Delete frame and all its children
            self.delete_videoframe(videoframe)

            # Move remaining frames
            for frame in frames_to_move:
                self.relocate_frame(frame, self.coordinates)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号