Skip to content

allow python connivence syntax for sub-nodes in devices #2483

Description

@joshStillerman

Devices provide 'original_part_name' methods which can be used to access the device's member nodes as lower-case part-name properties of the device head. For example givent a device with a sub-node 'COMMENT', its methods could refer to self.comment to refer to that node, or head-node.comment to refer to that node. Nodes deeper in the hierarchy from the top level of the device like that 'START_IDX' under the 'INPUT_xx' nodes have convenience names replacing the punctuation with '_'. So the device subnode: 'INPUT_01:OFFSET' can be referred to as self.input_01_offset. or head-node.input_01_offset. I propose that this be extended so that given a node like INPUT_01 it have a property 'offset'. For example:

chan = self.input_01
offset = chan.offset

This could be done in the generic property code of tree nodes:
Something like:

if I am the head of a device
   if it is all lower case
      do the current original part name behavior
else if I am part of the device
      if it is all lower case
         get the original part name of myself
         add '_<property-name>' to the end
         do the current original part name behavior

What do people think?
-Josh

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions