def __init__(self, parent, name, value, valid_values, info, visible=None):
        """
        Args:
            name:
            value:
            valid_values:
            info:
            visible (optional):

        Returns:

        """

        super(B26QTreeItem, self ).__init__(parent)


        self.ui_type = None
        self.name = name
        self.valid_values = valid_values
        self._value = value
        self.info = info
        self._visible = visible

        self.setData(0, 0, self.name)

        if isinstance(self.valid_values, list):
            self.ui_type = 'combo_box'
            self.combo_box = QtWidgets.QComboBox()
            for item in self.valid_values:
                self.combo_box.addItem(str(item))
            self.combo_box.setCurrentIndex(self.combo_box.findText(str(self.value)))
            self.treeWidget().setItemWidget(self, 1, self.combo_box)
            self.combo_box.currentIndexChanged.connect(lambda: self.setData(1, 2, self.combo_box))
            self.combo_box.setFocusPolicy(QtCore.Qt.StrongFocus)
            self._visible = False

        elif self.valid_values is bool:
            self.ui_type = 'checkbox'
            self.checkbox = QtWidgets.QCheckBox()
            self.checkbox.setChecked(self.value)
            self.treeWidget().setItemWidget( self, 1, self.checkbox )
            self.checkbox.stateChanged.connect(lambda: self.setData(1, 2, self.checkbox))
            self._visible = False

        elif isinstance(self.value, Parameter):
            for key, value in self.value.items():
                B26QTreeItem(self, key, value, self.value.valid_values[key], self.value.info[key])

        elif isinstance(self.value, dict):
            for key, value in self.value.items():
                if self.valid_values == dict:
                    B26QTreeItem(self, key, value, type(value), '')
                else:
                    B26QTreeItem(self, key, value, self.valid_values[key], self.info[key])

        elif isinstance(self.value, Instrument):
            index_top_level_item = self.treeWidget().indexOfTopLevelItem(self)
            top_level_item = self.treeWidget().topLevelItem(index_top_level_item)
            if top_level_item == self:
                # instrument is on top level, thus we are in the instrument tab
                for key, value in self.value.settings.items():
                    B26QTreeItem(self, key, value, self.value.settings.valid_values[key], self.value.settings.info[key])
            else:
                self.valid_values = [self.value.name]
                self.value = self.value.name
                self.combo_box = QtWidgets.QComboBox()
                for item in self.valid_values:
                    self.combo_box.addItem(item)
                self.combo_box.setCurrentIndex(self.combo_box.findText(str(self.value)))
                self.treeWidget().setItemWidget(self, 1, self.combo_box)
                self.combo_box.currentIndexChanged.connect(lambda: self.setData(1, 2, self.combo_box))
                self.combo_box.setFocusPolicy(QtCore.Qt.StrongFocus)

        elif isinstance(self.value, Script):
            for key, value in self.value.settings.items():
                B26QTreeItem(self, key, value, self.value.settings.valid_values[key], self.value.settings.info[key])

            for key, value in self.value.instruments.items():
                B26QTreeItem(self, key, self.value.instruments[key],  type(self.value.instruments[key]), '')

            for key, value in self.value.scripts.items():
                B26QTreeItem(self, key, self.value.scripts[key],  type(self.value.scripts[key]), '')

            self.info = self.value.__doc__

        else:
            self.setData(1, 0, self.value)
            self._visible = False
        self.setToolTip(1, str(self.info if isinstance(self.info, str) else ''))

        if self._visible is not None:
            self.check_show = QtWidgets.QCheckBox()
            self.check_show.setChecked(self.visible)
            self.treeWidget().setItemWidget(self, 2, self.check_show)

        self.setFlags(self.flags() | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable)
def __init__ ( self , parent , name , value , valid_values , info , visible = None ) : super ( B26QTreeItem , self ) . __init__ ( parent ) self . ui_type = None self . name = name self . valid_values = valid_values self . _value = value self . info = info self . _visible = visible self . setData ( 0 , 0 , self . name ) if isinstance ( self . valid_values , list ) : self . ui_type = 'combo_box' self . combo_box = QtWidgets . QComboBox ( ) for item in self . valid_values : self . combo_box . addItem ( str ( item ) ) self . combo_box . setCurrentIndex ( self . combo_box . findText ( str ( self . value ) ) ) self . treeWidget ( ) . setItemWidget ( self , 1 , self . combo_box ) self . combo_box . currentIndexChanged . connect ( lambda : self . setData ( 1 , 2 , self . combo_box ) ) self . combo_box . setFocusPolicy ( QtCore . Qt . StrongFocus ) self . _visible = False elif self . valid_values is bool : self . ui_type = 'checkbox' self . checkbox = QtWidgets . QCheckBox ( ) self . checkbox . setChecked ( self . value ) self . treeWidget ( ) . setItemWidget ( self , 1 , self . checkbox ) self . checkbox . stateChanged . connect ( lambda : self . setData ( 1 , 2 , self . checkbox ) ) self . _visible = False elif isinstance ( self . value , Parameter ) : for key , value in self . value . items ( ) : B26QTreeItem ( self , key , value , self . value . valid_values [ key ] , self . value . info [ key ] ) elif isinstance ( self . value , dict ) : for key , value in self . value . items ( ) : if self . valid_values == dict : B26QTreeItem ( self , key , value , type ( value ) , '' ) else : B26QTreeItem ( self , key , value , self . valid_values [ key ] , self . info [ key ] ) elif isinstance ( self . value , Instrument ) : index_top_level_item = self . treeWidget ( ) . indexOfTopLevelItem ( self ) top_level_item = self . treeWidget ( ) . topLevelItem ( index_top_level_item ) if top_level_item == self : for key , value in self . value . settings . items ( ) : B26QTreeItem ( self , key , value , self . value . settings . valid_values [ key ] , self . value . settings . info [ key ] ) else : self . valid_values = [ self . value . name ] self . value = self . value . name self . combo_box = QtWidgets . QComboBox ( ) for item in self . valid_values : self . combo_box . addItem ( item ) self . combo_box . setCurrentIndex ( self . combo_box . findText ( str ( self . value ) ) ) self . treeWidget ( ) . setItemWidget ( self , 1 , self . combo_box ) self . combo_box . currentIndexChanged . connect ( lambda : self . setData ( 1 , 2 , self . combo_box ) ) self . combo_box . setFocusPolicy ( QtCore . Qt . StrongFocus ) elif isinstance ( self . value , Script ) : for key , value in self . value . settings . items ( ) : B26QTreeItem ( self , key , value , self . value . settings . valid_values [ key ] , self . value . settings . info [ key ] ) for key , value in self . value . instruments . items ( ) : B26QTreeItem ( self , key , self . value . instruments [ key ] , type ( self . value . instruments [ key ] ) , '' ) for key , value in self . value . scripts . items ( ) : B26QTreeItem ( self , key , self . value . scripts [ key ] , type ( self . value . scripts [ key ] ) , '' ) self . info = self . value . __doc__ else : self . setData ( 1 , 0 , self . value ) self . _visible = False self . setToolTip ( 1 , str ( self . info if isinstance ( self . info , str ) else '' ) ) if self . _visible is not None : self . check_show = QtWidgets . QCheckBox ( ) self . check_show . setChecked ( self . visible ) self . treeWidget ( ) . setItemWidget ( self , 2 , self . check_show ) self . setFlags ( self . flags ( ) | QtCore . Qt . ItemIsUserCheckable | QtCore . Qt . ItemIsEnabled | QtCore . Qt . ItemIsEditable )
Args:
            name:
            value:
            valid_values:
            info:
            visible (optional):

        Returns: