Skip to content

Commit f7b98a2

Browse files
committed
Convert string2num during export
- This PR enables the conversion from string to num wherever possible upon clicking on export before validating. Previously, this conversion was only enabled while changing between EDIT and VIEW mode.
1 parent 435aba6 commit f7b98a2

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/fourc_webviewer/fourc_webserver.py

Lines changed: 19 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,8 @@ 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()
1030+
10371031

10381032
"""------------------- Controller functions -------------------"""
10391033

@@ -1111,6 +1105,21 @@ def click_save_button(self, **kwargs):
11111105

11121106
""" --- Other helper functions"""
11131107

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

src/fourc_webviewer/gui_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def _prop_value_table():
414414
html.Th(
415415
"Property",
416416
classes="text-center font-weight-bold",
417-
)
417+
)
418418
html.Th(
419419
"Value",
420420
classes="text-center font-weight-bold",

0 commit comments

Comments
 (0)