Skip to content
Snippets Groups Projects
Commit 50f3b25b authored by Johannes Kung's avatar Johannes Kung
Browse files

Fixed f-string syntax that is invalid in python 3.10

parent 9de3f1e1
No related branches found
No related tags found
1 merge request!45General gui module
Pipeline #134569 failed
...@@ -86,9 +86,9 @@ def format_to_str(format_info: FormatInfo, value: Any) -> str: ...@@ -86,9 +86,9 @@ def format_to_str(format_info: FormatInfo, value: Any) -> str:
case Format.Str: case Format.Str:
pass pass
case Format.Bin: case Format.Bin:
return f"{value:0{format_info.kwargs["bit_length"]}b}" return f"{value:0{format_info.kwargs['bit_length']}b}"
case Format.Hex: case Format.Hex:
return f"{value:0{math.ceil(format_info.kwargs["bit_length"]/4)}x}" return f"{value:0{math.ceil(format_info.kwargs['bit_length']/4)}x}"
case Format.Decimal: case Format.Decimal:
pass pass
case Format.DecimalSigned: case Format.DecimalSigned:
...@@ -116,4 +116,3 @@ def parse_str(format_info: FormatInfo, value: str) -> Any: ...@@ -116,4 +116,3 @@ def parse_str(format_info: FormatInfo, value: str) -> Any:
return int(value) return int(value)
case Format.Hex: case Format.Hex:
return int(value, base=16) return int(value, base=16)
...@@ -117,7 +117,7 @@ class ModuleWidget(QGraphicsWidget): ...@@ -117,7 +117,7 @@ class ModuleWidget(QGraphicsWidget):
format_info = self._state_vars[state_var] format_info = self._state_vars[state_var]
value = format_to_str(format_info, self._module.get_state()[state_var]) value = format_to_str(format_info, self._module.get_state()[state_var])
painter.drawText( painter.drawText(
text_rect, text_flags, f"{self._module.get_state()["name"]}: {value}" text_rect, text_flags, f"{self._module.get_state()['name']}: {value}"
) )
# Draw the name of the module and each state variable with its value on one row each # Draw the name of the module and each state variable with its value on one row each
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment