Skip to content

List2.EditTextList2Cell needs an alignment kwarg. #161

@typesupply

Description

@typesupply

This should have the same alignment options as TextBox. In the meantime, here's a workaround for @LettError:

import AppKit
import vanilla


class RightAlignEditTextList2Cell(vanilla.EditTextList2Cell):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.editText.getNSTextField().setAlignment_(AppKit.NSTextAlignmentRight)


class Test:

    def __init__(self):
        items = [
            dict(left="A", right="A"),
            dict(left="BB", right="BB"),
            dict(left="CCC", right="CCC"),
        ]
        columnDescriptions = [
            dict(
                identifier="left",
                width=75
            ),
            dict(
                identifier="right",
                width=75,
                cellClass=RightAlignEditTextList2Cell
            )
        ]

        self.w = vanilla.Window((200, 200))
        self.w.l = vanilla.List2(
            (10, 10, -10, -10),
            items,
            columnDescriptions=columnDescriptions
        )
        self.w.open()

Test()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions