How to use the pycaption.geometry.HorizontalAlignmentEnum function in pycaption

To help you get started, we’ve selected a few pycaption examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pbs / pycaption / pycaption / dfxp / base.py View on Github external
def _create_external_horizontal_alignment(horizontal_component):
    """From an internal horizontal alignment value, create a value to be used
    in the dfxp output file.

    :type horizontal_component: unicode
    :rtype: unicode
    """
    result = None

    if horizontal_component == HorizontalAlignmentEnum.LEFT:
        result = 'left'
    if horizontal_component == HorizontalAlignmentEnum.CENTER:
        result = 'center'
    if horizontal_component == HorizontalAlignmentEnum.RIGHT:
        result = 'right'
    if horizontal_component == HorizontalAlignmentEnum.START:
        result = 'start'
    if horizontal_component == HorizontalAlignmentEnum.END:
        result = 'end'

    return result
github pbs / pycaption / pycaption / geometry.py View on Github external
def from_horizontal_and_vertical_align(cls, text_align=None,
                                           display_align=None):
        horizontal_obj = None
        vertical_obj = None

        if text_align == 'left':
            horizontal_obj = HorizontalAlignmentEnum.LEFT
        if text_align == 'start':
            horizontal_obj = HorizontalAlignmentEnum.START
        if text_align == 'center':
            horizontal_obj = HorizontalAlignmentEnum.CENTER
        if text_align == 'right':
            horizontal_obj = HorizontalAlignmentEnum.RIGHT
        if text_align == 'end':
            horizontal_obj = HorizontalAlignmentEnum.END

        if display_align == 'before':
            vertical_obj = VerticalAlignmentEnum.TOP
        if display_align == 'center':
            vertical_obj = VerticalAlignmentEnum.CENTER
        if display_align == 'after':
            vertical_obj = VerticalAlignmentEnum.BOTTOM
github pbs / pycaption / pycaption / dfxp / base.py View on Github external
def _create_external_horizontal_alignment(horizontal_component):
    """From an internal horizontal alignment value, create a value to be used
    in the dfxp output file.

    :type horizontal_component: unicode
    :rtype: unicode
    """
    result = None

    if horizontal_component == HorizontalAlignmentEnum.LEFT:
        result = 'left'
    if horizontal_component == HorizontalAlignmentEnum.CENTER:
        result = 'center'
    if horizontal_component == HorizontalAlignmentEnum.RIGHT:
        result = 'right'
    if horizontal_component == HorizontalAlignmentEnum.START:
        result = 'start'
    if horizontal_component == HorizontalAlignmentEnum.END:
        result = 'end'

    return result
github pbs / pycaption / pycaption / geometry.py View on Github external
def from_horizontal_and_vertical_align(cls, text_align=None,
                                           display_align=None):
        horizontal_obj = None
        vertical_obj = None

        if text_align == 'left':
            horizontal_obj = HorizontalAlignmentEnum.LEFT
        if text_align == 'start':
            horizontal_obj = HorizontalAlignmentEnum.START
        if text_align == 'center':
            horizontal_obj = HorizontalAlignmentEnum.CENTER
        if text_align == 'right':
            horizontal_obj = HorizontalAlignmentEnum.RIGHT
        if text_align == 'end':
            horizontal_obj = HorizontalAlignmentEnum.END

        if display_align == 'before':
            vertical_obj = VerticalAlignmentEnum.TOP
        if display_align == 'center':
            vertical_obj = VerticalAlignmentEnum.CENTER
        if display_align == 'after':
            vertical_obj = VerticalAlignmentEnum.BOTTOM

        if not any([horizontal_obj, vertical_obj]):
            return None
        return cls(horizontal_obj, vertical_obj)
github pbs / pycaption / pycaption / dfxp / base.py View on Github external
def _create_external_horizontal_alignment(horizontal_component):
    """From an internal horizontal alignment value, create a value to be used
    in the dfxp output file.

    :type horizontal_component: unicode
    :rtype: unicode
    """
    result = None

    if horizontal_component == HorizontalAlignmentEnum.LEFT:
        result = 'left'
    if horizontal_component == HorizontalAlignmentEnum.CENTER:
        result = 'center'
    if horizontal_component == HorizontalAlignmentEnum.RIGHT:
        result = 'right'
    if horizontal_component == HorizontalAlignmentEnum.START:
        result = 'start'
    if horizontal_component == HorizontalAlignmentEnum.END:
        result = 'end'

    return result
github pbs / pycaption / pycaption / dfxp / base.py View on Github external
def _create_external_horizontal_alignment(horizontal_component):
    """From an internal horizontal alignment value, create a value to be used
    in the dfxp output file.

    :type horizontal_component: unicode
    :rtype: unicode
    """
    result = None

    if horizontal_component == HorizontalAlignmentEnum.LEFT:
        result = 'left'
    if horizontal_component == HorizontalAlignmentEnum.CENTER:
        result = 'center'
    if horizontal_component == HorizontalAlignmentEnum.RIGHT:
        result = 'right'
    if horizontal_component == HorizontalAlignmentEnum.START:
        result = 'start'
    if horizontal_component == HorizontalAlignmentEnum.END:
        result = 'end'

    return result
github pbs / pycaption / pycaption / dfxp / base.py View on Github external
'''

DFXP_DEFAULT_STYLE = {
    'color': 'white',
    'font-family': 'monospace',
    'font-size': '1c',
}

DFXP_DEFAULT_REGION = Layout(
    alignment=Alignment(
        HorizontalAlignmentEnum.CENTER, VerticalAlignmentEnum.BOTTOM)
)

DFXP_DEFAULT_STYLE_ID = 'default'
DFXP_DEFAULT_REGION_ID = 'bottom'


class DFXPReader(BaseReader):

    def __init__(self, *args, **kw):
        super(DFXPReader, self).__init__(*args, **kw)
        self.read_invalid_positioning = (
            kw.get('read_invalid_positioning', False))
        self.nodes = []

    def detect(self, content):
        if '' in content.lower():
github pbs / pycaption / pycaption / geometry.py View on Github external
def from_horizontal_and_vertical_align(cls, text_align=None,
                                           display_align=None):
        horizontal_obj = None
        vertical_obj = None

        if text_align == 'left':
            horizontal_obj = HorizontalAlignmentEnum.LEFT
        if text_align == 'start':
            horizontal_obj = HorizontalAlignmentEnum.START
        if text_align == 'center':
            horizontal_obj = HorizontalAlignmentEnum.CENTER
        if text_align == 'right':
            horizontal_obj = HorizontalAlignmentEnum.RIGHT
        if text_align == 'end':
            horizontal_obj = HorizontalAlignmentEnum.END

        if display_align == 'before':
            vertical_obj = VerticalAlignmentEnum.TOP
        if display_align == 'center':
            vertical_obj = VerticalAlignmentEnum.CENTER
        if display_align == 'after':
            vertical_obj = VerticalAlignmentEnum.BOTTOM

        if not any([horizontal_obj, vertical_obj]):
            return None
        return cls(horizontal_obj, vertical_obj)