Skip to content

Commit

Permalink
Fixes saving of multi-CIF
Browse files Browse the repository at this point in the history
* renaming of data_ names did not work in multi-CIF
  • Loading branch information
dkratzert committed Sep 24, 2023
1 parent 9b73091 commit 1ff1b76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 1ff1b76

Please sign in to comment.