MCPcopy Create free account
hub / github.com/LabPy/lantz / connect_driver

Function connect_driver

lantz/ui/widgets.py:659–682  ·  view source on GitHub ↗

Connect all children widgets to their corresponding lantz feature matching by name. Non-matching names are ignored. :param parent: parent widget. :param target: the driver. :param prefix: prefix to be prepended to the lantz feature (default = '') :param sep: separator between pr

(parent, target, *, prefix='', sep='__')

Source from the content-addressed store, hash-verified

657
658
659def connect_driver(parent, target, *, prefix='', sep='__'):
660 """Connect all children widgets to their corresponding lantz feature
661 matching by name. Non-matching names are ignored.
662
663 :param parent: parent widget.
664 :param target: the driver.
665 :param prefix: prefix to be prepended to the lantz feature (default = '')
666 :param sep: separator between prefix, name and suffix
667 """
668
669 logger.debug('Connecting {} to {}, {}, {}'.format(parent, target, prefix, sep))
670
671 ChildrenWidgets.patch(parent)
672
673 if prefix:
674 prefix += sep
675
676 for name, _, wid in parent.widgets:
677 if prefix and name.startswith(prefix):
678 name = name[len(prefix):]
679 if sep in name:
680 name, _ = name.split(sep, 1)
681 if name in target.feats:
682 connect_feat(wid, target, name)
683
684
685def connect_setup(parent, targets, *, prefix=None, sep='__'):

Callers 3

connect_setupFunction · 0.85
start_guiFunction · 0.85

Calls 2

connect_featFunction · 0.85
patchMethod · 0.80

Tested by

no test coverage detected