File: //snap/core22/2111/lib/python3/dist-packages/urwid/__pycache__/canvas.cpython-310.pyc
o
��o_� � @ s` d dl mZmZ d dlZd dlmZmZmZmZm Z m
Z
mZmZ d dl
mZmZ d dlmZ G dd� de�ZG dd � d e�ZG d
d� de�ZG dd
� d
e�ZG dd� de�Ze� ZG dd� de�ZG dd� de�Zdd� Zdd� Zdd� Zdd� Zd7dd�Z dd � Z!d!d"� Z"d#d$� Z#d%d&� Z$d'd(� Z%d)d*� Z&d+d,� Z'd-d.� Z(d/d0� Z)d1d2� Z*d3d4� Z+d5d6� Z,dS )8� )�division�print_functionN)�rle_len�rle_append_modify�rle_join_modify�rle_product�
calc_width�
calc_text_pos�apply_target_encoding�trim_text_attr_cs)� trim_line�
LayoutSegment)�bytesc @ sx e Zd ZdZi Zi Zi ZdZdZdZ dd� Z
ee
�Z
dd� Zee�Zdd� Z
ee
�Z
d d
� Zee�Zdd� Zee�Zd
S )�CanvasCachea`
Cache for rendered canvases. Automatically populated and
accessed by Widget render() MetaClass magic, cleared by
Widget._invalidate().
Stores weakrefs to the canvas objects, so an external class
must maintain a reference for this cache to be effective.
At present the Screen classes store the last topmost canvas
after redrawing the screen, keeping the canvases from being
garbage collected.
_widgets[widget] = {(wcls, size, focus): weakref.ref(canvas), ...}
_refs[weakref.ref(canvas)] = (widget, wcls, size, focus)
_deps[widget} = [dependent_widget, ...]
r c s� |j sdS |jsJ d��|j\}}}� fdd�� t|dd�}|du r+t|d�r+� |�}|rI|D ]
}|| jvr9 dS q/|D ]}| j�|g ��|� q<t� || j
�}||||f| j|<