Xi-CAM / Xi-cam.gui

0 stars 9 forks source link

Error using kwargs in MetadataView #20

Open ercius opened 5 years ago

ercius commented 5 years ago

It is not possible to pass keyword args to MetadataView() for example when using the reservedkeys keyword (see 7b4ac15a0c65da3f42fd35768f260b832e1e1abc). This is due to an issue with the subclassing of MetadataWidgetBase(ParameterTree), and ParameterTree does not accept kwargs, Simply removing the **kwargs from the super() call works as expected (see below).

class MetadataWidgetBase(ParameterTree):
    def __init__(self, *args, **kwargs):
        #super(MetadataWidgetBase, self).__init__(*args, **kwargs)
        super(MetadataWidgetBase, self).__init__(*args)
        LazyGroupParameter.itemClass.initialize_treewidget(self)
        self.kwargs = kwargs
ercius commented 5 years ago

Can we get this implemented in master? Or is there some issue with the way I fixed this? Seems to me that ParameterTree class does not take **kwargs and thus removing it from the super() call is the right way to do this. I dont know the ParameterTree class very well though.