From 1ff1b76397e92a497e640f77308360044740dc02 Mon Sep 17 00:00:00 2001 From: Daniel Kratzert Date: Sun, 24 Sep 2023 10:29:43 +0200 Subject: [PATCH 1/2] Fixes saving of multi-CIF * renaming of data_ names did not work in multi-CIF --- finalcif/appwindow.py | 3 ++- finalcif/cif/cif_file_io.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/finalcif/appwindow.py b/finalcif/appwindow.py index b3650000..f94e958b 100644 --- a/finalcif/appwindow.py +++ b/finalcif/appwindow.py @@ -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: diff --git a/finalcif/cif/cif_file_io.py b/finalcif/cif/cif_file_io.py index 17b52335..533eb6b8 100644 --- a/finalcif/cif/cif_file_io.py +++ b/finalcif/cif/cif_file_io.py @@ -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: From 51c6123bedda0dd107c866ced6a37111fddc77dd Mon Sep 17 00:00:00 2001 From: Daniel Kratzert Date: Sun, 24 Sep 2023 10:35:11 +0200 Subject: [PATCH 2/2] Update description.rst --- docs/description.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/description.rst b/docs/description.rst index e6db8218..184f23fe 100644 --- a/docs/description.rst +++ b/docs/description.rst @@ -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