MCPcopy Index your code
hub / github.com/LabPy/lantz / __init__

Method __init__

lantz/ui/widgets.py:492–566  ·  view source on GitHub ↗
(self, parent, target)

Source from the content-addressed store, hash-verified

490 """
491
492 def __init__(self, parent, target):
493 super().__init__(parent)
494 self._lantz_target = target
495
496 layout = QtGui.QVBoxLayout(self)
497
498 label = QtGui.QLabel()
499 label.setText(str(target))
500 layout.addWidget(label)
501
502 recall = QtGui.QPushButton()
503 recall.setText('Refresh')
504 recall.clicked.connect(lambda x: target.refresh())
505
506 update = QtGui.QPushButton()
507 update.setText('Update')
508 update.clicked.connect(lambda x: target.update(self.widgets_values_as_dict()))
509
510 auto = QtGui.QCheckBox()
511 auto.setText('Update on change')
512 auto.setChecked(True)
513 auto.stateChanged.connect(self.update_on_change)
514
515 hlayout = QtGui.QHBoxLayout()
516 hlayout.addWidget(recall)
517 hlayout.addWidget(update)
518 hlayout.addWidget(auto)
519
520 layout.addLayout(hlayout)
521
522 self.writable_widgets = []
523 self.widgets = []
524
525 # Feat
526 for feat_name, feat in sorted(target.feats.items()):
527 try:
528 feat_widget = LabeledFeatWidget(self, target, feat)
529
530 self.widgets.append(feat_widget)
531 if feat_widget.writable:
532 self.writable_widgets.append(feat_widget)
533
534 layout.addWidget(feat_widget)
535 except Exception as ex:
536 logger.debug('Could not create control for {}: {}'.format(feat_name, ex))
537 if __PRINT_TRACEBACK__:
538 import traceback
539 traceback.print_exc()
540
541 # Actions
542 line = QtGui.QFrame(self)
543 #self.line.setGeometry(QtCore.QRect(110, 80, 351, 31))
544 line.setFrameShape(QtGui.QFrame.HLine)
545 line.setFrameShadow(QtGui.QFrame.Sunken)
546 layout.addWidget(line)
547
548
549 actions_label = QtGui.QLabel(self)

Callers

nothing calls this directly

Calls 8

LabeledFeatWidgetClass · 0.85
refreshMethod · 0.80
updateMethod · 0.80
__init__Method · 0.45
connectMethod · 0.45
itemsMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected