# (C) Copyright 2005-2023 Enthought, Inc., Austin, TX# All rights reserved.## This software is provided without warranty under the terms of the BSD# license included in LICENSE.txt and may be redistributed only under# the conditions described in the aforementioned license. The license# is also available online at http://www.enthought.com/licenses/BSD.txt## Thanks for using Enthought open source!""" Base class for all tree label providers. """from.label_providerimportLabelProvider
[docs]classTreeLabelProvider(LabelProvider):""" Base class for all tree label providers. By default an element has no label image, and 'str' is used to generate its label text. """# ------------------------------------------------------------------------# 'LabelProvider' interface.# ------------------------------------------------------------------------
[docs]defset_text(self,viewer,element,text):""" Sets the text representation of a node. Returns True if setting the text succeeded, otherwise False. """returnlen(text.strip())>0
[docs]defget_drag_value(self,viewer,element):""" Get the value that is dragged for an element. By default the drag value is the element itself. """returnelement
[docs]defis_collapsible(self,viewer,element):""" Returns True is the element is collapsible, otherwise False. """returnTrue
[docs]defis_expandable(self,viewer,node):""" Returns True is the node is expandanble, otherwise False. """returnTrue