48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
"""This module implements a vertical division between widgets"""
|
||
|
from __future__ import division
|
||
|
from __future__ import absolute_import
|
||
|
from __future__ import print_function
|
||
|
from __future__ import unicode_literals
|
||
|
from builtins import range
|
||
|
from asciimatics.widgets.widget import Widget
|
||
|
|
||
|
|
||
|
class VerticalDivider(Widget):
|
||
|
"""
|
||
|
A vertical divider for separating columns.
|
||
|
|
||
|
This widget should be put into a column of its own in the Layout.
|
||
|
"""
|
||
|
|
||
|
__slots__ = ["_required_height"]
|
||
|
|
||
|
def __init__(self, height=Widget.FILL_COLUMN):
|
||
|
"""
|
||
|
:param height: The required height for this divider.
|
||
|
"""
|
||
|
super(VerticalDivider, self).__init__(None, tab_stop=False)
|
||
|
self._required_height = height
|
||
|
|
||
|
def process_event(self, event):
|
||
|
return event
|
||
|
|
||
|
def update(self, frame_no):
|
||
|
(color, attr, background) = self._frame.palette["borders"]
|
||
|
vert = u"│" if self._frame.canvas.unicode_aware else "|"
|
||
|
for i in range(self._h):
|
||
|
self._frame.canvas.print_at(vert, self._x, self._y + i, color, attr, background)
|
||
|
|
||
|
def reset(self):
|
||
|
pass
|
||
|
|
||
|
def required_height(self, offset, width):
|
||
|
return self._required_height
|
||
|
|
||
|
@property
|
||
|
def value(self):
|
||
|
"""
|
||
|
The current value for this VerticalDivider.
|
||
|
"""
|
||
|
return self._value
|