Skip to content

Commit

Permalink
Merge pull request #410 from ISISNeutronMuon/chi/fix-trajectory-same-…
Browse files Browse the repository at this point in the history
…name-gui

Fix action tab for trajectories with the same filename
  • Loading branch information
MBartkowiakSTFC authored Apr 7, 2024
2 parents 73131f4 + 89af596 commit 7a1e720
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, *args, **kwargs):
self._job_starter = None
self._trajectory_combo = QComboBox()
self._trajectory_combo.setEditable(False)
self._trajectory_combo.currentTextChanged.connect(self.set_current_trajectory)
self._trajectory_combo.currentIndexChanged.connect(self.set_current_trajectory)
if cmodel is not None:
self._trajectory_combo.setModel(cmodel)
self._core.add_widget(self._trajectory_combo)
Expand All @@ -52,9 +52,9 @@ def set_job_starter(self, job_starter):
self._job_starter = job_starter
self.action.new_thread_objects.connect(self._job_starter.startProcess)

@Slot(str)
def set_current_trajectory(self, new_name: str) -> None:
self._current_trajectory = new_name
@Slot(int)
def set_current_trajectory(self, index: int) -> None:
self._current_trajectory = self._trajectory_combo.currentText()

traj_model = self._trajectory_combo.model()
if traj_model.rowCount() < 1:
Expand All @@ -64,9 +64,9 @@ def set_current_trajectory(self, new_name: str) -> None:
self.action.clear_panel()
return

node_number = traj_model.item(self._trajectory_combo.currentIndex(), 0).data()
node_number = traj_model.item(index, 0).data()
print(
f"Combo model: node_number {node_number} found in item {self._trajectory_combo.currentText()}"
f"Combo model: node_number {node_number} found in item {self._current_trajectory}"
)
# The combobox was changed we need to update the action
# widgets with the new trajectory
Expand Down

0 comments on commit 7a1e720

Please sign in to comment.