BCDA-APS / mdaviz

Data visualization for mda
https://bcda-aps.github.io/mdaviz/
Other
3 stars 0 forks source link

Keep relevant folder/file tabs open #90

Closed rodolakis closed 4 months ago

rodolakis commented 7 months ago

Now when a new file and/or folder is selected, I would like to KEEP the table views tabs (in both MDAFolderTableView and SelectFieldsTableView) as long as some content from this file/folder is displayed on the graph.

Image

For example in this picture, if I select mda_0024.mda, as long as there are some data from mda_0023 displayed on the plot, I would like to keep the tab for mda_0023.mda in my field table view, but add a new one for mda_0024 (and bring it in focus/front).

This will allow some manipulation on the file/folder (eg change normalization by I0, add a detector, etc.) without having to reopen/look for the previous folder/file.

rodolakis commented 7 months ago

BTW, not a big deal, but when there is no content (like below in the no_mda_folder), the tab in the field table view widget still shows the file name of the last file displayed.

Image

rodolakis commented 7 months ago

This issue will help with the following event crash that occurs in auto-add mode:

This is easy to prevent, but in reality this should not happen when the issue above is addresses since the tab would go away if there are no detector currently on the graph for the corresponding file (file is removed from the tabs)

========= Selected file: mda_0008.mda in /Users/fannysimoes/src/mdaviz/mdaviz/data/test_folder1

doPlot called: args=('add', {'X': 1, 'Y': [2]})

========= Selected file: mda_0007.mda in /Users/fannysimoes/src/mdaviz/mdaviz/data/test_folder1
Traceback (most recent call last):
  File "/Users/fannysimoes/src/mdaviz/mdaviz/mda_folder.py", line 308, in doFileSelected
    self.updateSelectionForNewPVs(oldPvList, newPvList, verbose)
  File "/Users/fannysimoes/src/mdaviz/mdaviz/mda_folder.py", line 205, in updateSelectionForNewPVs
    changes_made |= self.updateDetectorSelection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fannysimoes/src/mdaviz/mdaviz/mda_folder.py", line 227, in updateDetectorSelection
    for old_idx in self.selectionField()["Y"]:
                   ~~~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 'Y'
Abort trap: 6
rodolakis commented 7 months ago

Tabs can be closed easily with

         <property name="tabsClosable">
          <bool>true</bool>
         </property>

Image

Image

rodolakis commented 7 months ago

Related to this https://github.com/BCDA-APS/mdaviz/issues/39#issuecomment-1724230879 Related to https://github.com/BCDA-APS/mdaviz/issues/41

rodolakis commented 7 months ago

Image

rodolakis commented 7 months ago

Going home, getting closer but still some work to do:

Image

rodolakis commented 7 months ago

Make sure to disable open the same file in multiple tabs (it is the case now)