Skip to content

manageElements.py setLineAttributes doesn't work #106

@ghost

Description

This function isn't currently working.
The issue seems to be that it's setting to.linetype, to.linewidth, and to.linecolor when the attributes that to has are linetypes, linewidths, linecolors.
From conversation with @chaosphere2112 it appears to should be a isoline, 1d, or vector object.
I'll work on a patch and submit a PR when I get it working.

def setLineAttributes(to, l):
    """
    Set attributes linecolor, linewidth and linetype from line l.
    l can be a line name defined in vcs.elements or a line object

    :Example:

        .. doctest:: manageElements_setLineAttributes

            >>> vcs.show('line')
            *******************Line Names List**********************
            ...
            *******************End Line Names List**********************
            >>> new_isoline=vcs.createisoline()
            >>> vcs.setLineAttributes(new_isoline, 'continents')

    :param to:
    :param l:
    :return:
    """
    import queries
    line = None
    if (queries.isline(l)):
        line = l
    elif l in vcs.elements["line"]:
        line = vcs.elements["line"][l]
    else:
        raise ValueError("Expecting a line object or a " +
                         "line name defined in vcs.elements, got type " +
                         type(l).__name__)
    to.linecolor = line.color[0]
    to.linewidth = line.width[0]
    to.linetype = line.type[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions