From 9eda44887fe024887cbc7c5e5139a1cc751529ec Mon Sep 17 00:00:00 2001 From: James Crake-Merani Date: Fri, 4 Oct 2024 13:52:48 +0100 Subject: [PATCH] Other fixes to stop crashes. --- sasdata/metadata_filename_gui/metadata_tree_widget.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sasdata/metadata_filename_gui/metadata_tree_widget.py b/sasdata/metadata_filename_gui/metadata_tree_widget.py index 6a73faf..5f903ff 100644 --- a/sasdata/metadata_filename_gui/metadata_tree_widget.py +++ b/sasdata/metadata_filename_gui/metadata_tree_widget.py @@ -7,15 +7,16 @@ def __init__(self): self.setColumnCount(2) self.setHeaderLabels(['Name', 'Filename Components']) - # TODO: This is placeholder data that'll need to be replaced by the real metadata. - def draw_tree(self): + def draw_tree(self, options: list[str]): self.clear() + # TODO: This is placeholder data that'll need to be replaced by the real metadata. metadata = {'Instrument': ['Slit width', 'Other']} for top_level, items in metadata.items(): top_level_item = QTreeWidgetItem([top_level]) for metadatum in items: selector = MetadataComponentSelector() metadatum_item = QTreeWidgetItem([metadatum, selector]) + selector.draw_options(options) top_level_item.addChild(metadatum_item) - self.insertTopLevelItem(top_level_item) + self.insertTopLevelItem(0, top_level_item)