Skip to content

Commit

Permalink
#126 and #146: remove chatter and fix X=None in selection
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolakis committed Jun 12, 2024
1 parent 7809132 commit d48f69a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions mdaviz/mda_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def updateSelectionForNewPVs(
print(f"\n----- Selection before clean up: {old_selection}")
changes_made = False
tableview = self.currentFileTableview()
new_selection = {"Y": [], "X": None}
new_selection = {"Y": [], "X": 0}
# Update Y selections: if either left operand or right operand is True, result will be True.
changes_made |= self.updateDetectorSelection(
oldPvList, old_selection, newPvList, new_selection, verbose
Expand All @@ -325,10 +325,7 @@ def updateSelectionForNewPVs(
new_idx = 0
if old_idx != new_idx:
changes_made = True
if verbose:
print(
f"POS <{oldPvList[old_idx]}> changed from {old_idx} to {new_idx} <{newPvList[new_idx]}>"
)
new_selection["X"] = new_idx
if changes_made:
self.applySelectionChanges(new_selection)
if verbose:
Expand Down Expand Up @@ -426,10 +423,11 @@ def onFileSelected(self, index, verbose=False):
# TODO - later: find out why this sometimes fails - not that important:
try:
self.updateSelectionForNewPVs(
old_selection, old_pv_list, new_pv_list, verbose
old_selection, old_pv_list, new_pv_list, verbose=False
)
except Exception as exc:
print(str(exc))

self.handlePlotBasedOnMode()
else:
self.setStatus("Could not find a (positioner,detector) pair to plot.")
Expand Down Expand Up @@ -531,7 +529,6 @@ def onTabChanged(self, index, file_path, file_data, selection_field):
if index == -1:
self.setCurrentFileTableview() # Reset to indicate no active file table view
self.setSelectionField() # Reset selection field to default
print("No file currently selected.")
return

# Retrieve the table view for the currently selected tab:
Expand Down

0 comments on commit d48f69a

Please sign in to comment.