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='__')
| 657 | |
| 658 | |
| 659 | def 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 | |
| 685 | def connect_setup(parent, targets, *, prefix=None, sep='__'): |
no test coverage detected