Skip to content

Commit

Permalink
Merge pull request #75 from dkratzert/74-saving-a-multi-cif-more-than…
Browse files Browse the repository at this point in the history
…-one-time-problem

74 saving a multi cif more than one time problem
  • Loading branch information
dkratzert authored Sep 24, 2023
2 parents 9b73091 + 51c6123 commit fe3eaf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit fe3eaf8

Please sign in to comment.