From 1ff1b76397e92a497e640f77308360044740dc02 Mon Sep 17 00:00:00 2001 From: Daniel Kratzert Date: Sun, 24 Sep 2023 10:29:43 +0200 Subject: [PATCH] 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: