Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG updateFolderView triggers onFileSelected unexpectedly #138

Open
rodolakis opened this issue Jun 4, 2024 · 1 comment
Open

BUG updateFolderView triggers onFileSelected unexpectedly #138

rodolakis opened this issue Jun 4, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rodolakis
Copy link
Collaborator

    def updateFolderView(self):
        """Clear existing data and set new data for the folder tableview"""
        self.mda_folder_tableview.clearContents()
        self.mda_folder_tableview.displayTable()
        model = self.mda_folder_tableview.tableView.model()
        if model is not None and len(self.mdaFileList()) > 0:
            self.mda_folder_tableview.tableView.setFocus()
            selection_model = self.mda_folder_tableview.tableView.selectionModel()
            self.setSelectionModel(selection_model)
            utils.reconnect(self.selectionModel().currentChanged, self.onFileSelected)

This last line triggers onFileSelected (for what appear to be the first file of the previous selected subfolder?); only happens at the third occurrence of changing subfolder in subfolder menu, then second, then every time? Commenting out this line solve the problem but would create more issues (new selection model no longer connected to the new folder table view).

I tried to disconnect the selection model prior to creating the new one but that does not work:

    def updateFolderView(self):
        """Clear existing data and set new data for the folder tableview"""
        if self.selectionModel() is not None:
            try:
                self.selectionModel().currentChanged.disconnect(self.onFileSelected)
            except (TypeError, RuntimeError):
                pass
        self.mda_folder_tableview.clearContents()
        self.mda_folder_tableview.displayTable()
        model = self.mda_folder_tableview.tableView.model()
        if model is not None and len(self.mdaFileList()) > 0:
            self.mda_folder_tableview.tableView.setFocus()
            selection_model = self.mda_folder_tableview.tableView.selectionModel()
            self.setSelectionModel(selection_model)
            self.selectionModel().currentChanged.connect(self.onFileSelected)

To be investigated.
@prjemian I think That can be v1.1, not a big deal (does not make the app crash.

@rodolakis rodolakis added the bug Something isn't working label Jun 4, 2024
@rodolakis rodolakis added this to the v1.1 milestone Jun 4, 2024
@rodolakis rodolakis self-assigned this Jun 4, 2024
@rodolakis
Copy link
Collaborator Author

See notes from notebook (page 6/1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Upgrades
Development

No branches or pull requests

1 participant