Skip to content

Commit 6c32006

Browse files
authored
Merge pull request #11 from dragos-ana/convert-strings-during-export
Convert string2num during export
2 parents 4dea2d1 + 05ca323 commit 6c32006

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/fourc_webviewer/fourc_webserver.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,16 +1012,8 @@ def change_edit_mode(self, edit_mode, **kwargs):
10121012
if (
10131013
edit_mode == self.state.all_edit_modes["view_mode"]
10141014
): # after edit mode we are again in view mode
1015-
self.state.general_sections = convert_string2number(
1016-
self.state.general_sections
1017-
)
1018-
self.state.materials_section = convert_string2number(
1019-
self.state.materials_section
1020-
)
1021-
self.state.dc_sections = convert_string2number(self.state.dc_sections)
1022-
self.state.result_description_section = convert_string2number(
1023-
self.state.result_description_section
1024-
)
1015+
self.convert_string2num_all_sections()
1016+
10251017
# for now we don't convert the function section, because it
10261018
# works itself with strings, e.g.
10271019
# 'SYMBOLIC_FUNCTION_OF_SPACE_TIME' is a string even if it
@@ -1034,6 +1026,7 @@ def change_export_mode(self, export_mode, **kwargs):
10341026
"""Reaction to change of state.export_mode."""
10351027
# revert export status to "INFO"
10361028
self.state.export_status = self.state.all_export_statuses["info"]
1029+
self.convert_string2num_all_sections()
10371030

10381031
"""------------------- Controller functions -------------------"""
10391032

@@ -1111,6 +1104,18 @@ def click_save_button(self, **kwargs):
11111104

11121105
""" --- Other helper functions"""
11131106

1107+
def convert_string2num_all_sections(self):
1108+
"""Converts string to num wherever possible for all considered
1109+
sections."""
1110+
self.state.general_sections = convert_string2number(self.state.general_sections)
1111+
self.state.materials_section = convert_string2number(
1112+
self.state.materials_section
1113+
)
1114+
self.state.dc_sections = convert_string2number(self.state.dc_sections)
1115+
self.state.result_description_section = convert_string2number(
1116+
self.state.result_description_section
1117+
)
1118+
11141119
def determine_master_mat_ind_for_current_selection(self):
11151120
"""Determines the real master/source material of the currently selected
11161121
material. Accounts for CLONING MATERIAL MAP by going one step further

0 commit comments

Comments
 (0)