diff --git a/mapclientplugins/sparccurationhelperstep/helpers/contextannotationwidget.py b/mapclientplugins/sparccurationhelperstep/helpers/contextannotationwidget.py index ab61c8e..a762031 100644 --- a/mapclientplugins/sparccurationhelperstep/helpers/contextannotationwidget.py +++ b/mapclientplugins/sparccurationhelperstep/helpers/contextannotationwidget.py @@ -15,7 +15,7 @@ import sparc.curation.tools.context_annotations as context_annotations from sparc.curation.tools.models.contextinfo import ContextInfoAnnotation -from sparc.curation.tools.helpers.file_helper import is_annotation_csv_file, OnDiskFiles, search_for_context_data_files +from sparc.curation.tools.helpers.file_helper import is_annotation_csv_file, OnDiskFiles class ContextAnnotationWidget(QtWidgets.QWidget): @@ -49,7 +49,7 @@ def update_info(self, location): thumbnail_list_model = _build_list_model(thumbnail_files) - context_files = search_for_context_data_files(location, convert_to_bytes("2MiB")) + context_files = context_annotations.search_for_annotation_csv_files(location, convert_to_bytes("2MiB")) # Upgrade old version 0.1.0 context info files. Load version 0.2.0 context info files. for context_file in context_files: with open(context_file, encoding='utf-8') as f: @@ -105,10 +105,8 @@ def update_info(self, location): # Basis of the interface relies on the context info list being the same size as the metadata files list. assert len(self._context_info_list) == len(metadata_files) - self._ui.comboBoxBanner.blockSignals(True) self._ui.comboBoxBanner.setModel(thumbnail_list_model) - self._ui.comboBoxBanner.blockSignals(False) - if self._current_index != -1: + if self._current_index: self._populate_ui(self._context_info_list[self._current_index]) # Find annotation file. @@ -130,11 +128,6 @@ def clean_ui(self): def _populate_ui(self, data): self.clean_ui() self._ui.lineEditSummaryHeading.setText(data.get_heading()) - banner_index = self._ui.comboBoxBanner.findText(self._from_partial_path(data.get_banner())) - if banner_index > -1: - self._ui.comboBoxBanner.blockSignals(True) - self._ui.comboBoxBanner.setCurrentIndex(banner_index) - self._ui.comboBoxBanner.blockSignals(False) self._ui.plainTextEditSummaryDescription.setPlainText(data.get_description()) for view in data.get_views(): self._create_view(view["id"]) @@ -168,7 +161,6 @@ def write_context_annotation(self): self.update_current_context_info() for context_info in self._context_info_list: context_annotations.update_context_info(context_info) - context_annotations.annotate_context_info(context_info) def _open_annotation_map_file(self): _is_annotation_csv_file = False @@ -214,9 +206,6 @@ def _on_metadata_changed(self): def to_serialisable_path(self, path): return pathlib.PureWindowsPath(os.path.relpath(path, self._location)).as_posix() if path else "" - def _from_partial_path(self, partial): - return pathlib.PureWindowsPath(os.path.join(self._location, partial)).as_posix() - def _on_banner_changed(self, current_text): self._context_info_list[self._current_index].update({ "banner": self.to_serialisable_path(current_text) diff --git a/uip.bat b/uip.bat index d7ebf6c..2489dc7 100644 --- a/uip.bat +++ b/uip.bat @@ -1,2 +1,3 @@ call C:\Users\ywan787\pyvenv\venv39\Scripts\activate -pyside6-uic -o mapclientplugins\sparccurationhelperstep\helpers\ui_viewswidget.py mapclientplugins\sparccurationhelperstep\qt\viewswidget.ui \ No newline at end of file +pyside6-uic -o mapclientplugins\sparccurationhelperstep\helpers\ui_viewswidget.py mapclientplugins\sparccurationhelperstep\qt\viewswidget.ui +pyside6-uic -o mapclientplugins\sparccurationhelperstep\helpers\ui_plotannotationwidget.py mapclientplugins\sparccurationhelperstep\qt\plotannotationwidget.ui \ No newline at end of file