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

74 saving a multi cif more than one time problem #75

Merged
merged 2 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Some CIF writing programs still use the 'global\_' keyword. You may circumvent t

Since version 99, FinalCif supports multi-CIFs, so CIF files with multiple 'data\_' blocks can be
opened and edited. Please note that auto-filling of missing values is disabled in multi-CIF mode.
Some other minor details my not function as in single-CIF mode.
Some other functions, such as renaming a data block, do not work in multi-CIF mode. It is advisable
to complete each CIF before creating a multi-CIF.


.. figure:: pics/multi_cif.png
Expand Down
3 changes: 2 additions & 1 deletion finalcif/appwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,8 @@ def save_current_cif_file(self) -> Union[bool, None]:
if not self.cif:
# No file is opened
return None
self.cif.rename_data_name(''.join(self.ui.datanameComboBox.currentText().split(' ')))
if not self.cif.is_multi_cif:
self.cif.rename_data_name(''.join(self.ui.datanameComboBox.currentText().split(' ')))
self.store_data_from_table_rows()
self.save_ccdc_number()
try:
Expand Down
3 changes: 1 addition & 2 deletions finalcif/cif/cif_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@ def rename_data_name(self, newname: str = ''):
Renames data_ tags to the newname. Also _vrf tags are renamed accordingly.
http://journals.iucr.org/services/cif/checking/checkfaq.html
"""
# Have to use ord(), because Python 3.6 has not str.isascii():
newname = ''.join([i for i in newname if ord(i) < 127])
newname = ''.join([i for i in newname if i.isascii()])
self.block.name = newname
for item in self.block:
if item.pair is not None:
Expand Down