-
Notifications
You must be signed in to change notification settings - Fork 61
properly close HDF5 filles and percussions for opening. #1237
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
base: master
Are you sure you want to change the base?
Changes from all commits
1b0b0b9
f1b3868
0d3a3c0
4422c37
9763587
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -365,23 +365,30 @@ def _sourceSelectorSlot(self, ddict): | |
| if not found: | ||
| _logger.debug("WARNING: source not found") | ||
| return | ||
| sourceType = source.sourceType | ||
| del self.sourceList[self.sourceList.index(source)] | ||
| for source in self.sourceList: | ||
| if sourceType == source.sourceType: | ||
| closedSource = source | ||
| sourceType = closedSource.sourceType | ||
| del self.sourceList[self.sourceList.index(closedSource)] | ||
| try: | ||
| for source in self.sourceList: | ||
| if sourceType == source.sourceType: | ||
| self.selectorWidget[sourceType].setDataSource(source) | ||
| self.tabWidget.setCurrentWidget(self.selectorWidget[sourceType]) | ||
| return | ||
| #there is no other selection of that type | ||
| if len(self.sourceList): | ||
| source = self.sourceList[0] | ||
| sourceType = source.sourceType | ||
| self.selectorWidget[sourceType].setDataSource(source) | ||
| self.tabWidget.setCurrentWidget(self.selectorWidget[sourceType]) | ||
| return | ||
| #there is no other selection of that type | ||
| if len(self.sourceList): | ||
| source = self.sourceList[0] | ||
| sourceType = source.sourceType | ||
| self.selectorWidget[sourceType].setDataSource(source) | ||
| else: | ||
| self.selectorWidget[sourceType].setDataSource(None) | ||
| self.tabWidget.setCurrentWidget(self.selectorWidget[sourceType]) | ||
| elif ddict["event"] == "SourceClosed": | ||
| _logger.debug("not implemented yet") | ||
| else: | ||
| self.selectorWidget[sourceType].setDataSource(None) | ||
| self.tabWidget.setCurrentWidget(self.selectorWidget[sourceType]) | ||
| finally: | ||
| # Without this the file stays "open" in the process | ||
| # and could not be reopened until PyMca restarted. | ||
| try: | ||
| closedSource.close() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I don't mind making sure we close the file here in a |
||
| except Exception as e: | ||
| _logger.debug("Error closing source: %s", e) | ||
|
|
||
| def _selectionUpdatedSlot(self, ddict): | ||
| _logger.debug("_selectionUpdatedSlot(self, dict=%s)", ddict) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileModelis per source so you will have the error only once per source. A better solution is needed: perhaps refresh at failure is the solution.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See new
_recoverFromReadErrorinQNexusWidget