qiskit-community / qiskit-metal

Quantum Hardware Design. Open-source project for engineers and scientists to design superconducting quantum devices with ease.
https://qiskit-community.github.io/qiskit-metal/
Apache License 2.0
288 stars 208 forks source link

fixes #669 by updating main_window.py #739

Closed chauhan-shobhit closed 2 years ago

chauhan-shobhit commented 2 years ago

What are the issues this pull addresses (issue numbers / links)?

Issue #669 https://github.com/Qiskit/qiskit-metal/issues/669

Did you add tests to cover your changes (yes/no)?

no

Did you update the documentation accordingly (yes/no)?

yes

Did you read the CONTRIBUTING document (yes/no)?

yes

Summary

Fixed the issue #669 by updating save_design function in qiskit_metal/_gui/main_window.py

Details and comments

When using cancel instead of save, QFileDialog.getSaveFileName returns empty string( https://github.com/Qiskit/qiskit-metal/blob/main/qiskit_metal/_gui/main_window.py#L163 ) as filename. This caused a FileNotFoundError during opening of file (https://github.com/Qiskit/qiskit-metal/blob/main/qiskit_metal/_gui/main_window.py#L171).

To fix the issue , an empty check was added. File will be opened and written to only if filename is non-empty (length of string is non-zero)

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


shobhit seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.