Skip to content

fix #75 : display a message when saving or loading a file failed #80

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

Conversation

alixdamman
Copy link
Contributor

No description provided.

dirname = os.path.dirname(filepath[0])
basenames = [os.path.basename(fpath) for fpath in filepath]
self.set_current_file(dirname)
self.statusBar().showMessage("CSV files {} loaded".format(' ,'.join(basenames)), 4000)
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to merge both code paths and inline _update_arrays?

if isinstance(filepath, (list, tuple)):
    filepath = None
    names = filepath
    ...
    current_file_name = dirname
    display_name = ' ,'.join(basenames)
else:
    names = None
    current_file_name = filepath
    display_name = filepath
try:
    session.load(filepath, names)
    self._reset()
    self.set_current_file(current_file_name)
    self._add_arrays(session)
    self._listwidget.setCurrentRow(0)
    self.unsaved_modifications = False
    self.statusBar().showMessage("Loaded: {}".format(display_name, 4000))
except Exception as e:
    QMessageBox.critical(self, "Error", "Something went wrong when loading: {}\n{}".format(display_name, e))

@alixdamman alixdamman force-pushed the display_open_save_failure_feedback_75 branch from 886ae8a to 4148a7c Compare September 27, 2017 09:25
Copy link
Collaborator

@gdementen gdementen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a changelog

@alixdamman alixdamman merged commit a4e0a42 into larray-project:master Sep 27, 2017
@alixdamman alixdamman deleted the display_open_save_failure_feedback_75 branch September 27, 2017 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants