Skip to content

Commit 58fe058

Browse files
better string formatting
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
1 parent b6f09f3 commit 58fe058

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

openmc_plotter/main_window.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,20 +1232,20 @@ def viewMaterialProps(self, id):
12321232
"""display material properties in message box"""
12331233
mat = openmc.lib.materials[id]
12341234
if mat.name:
1235-
msg_str = "Material {} ({}) Properties\n\n".format(id, mat.name)
1235+
msg_str = f"Material {id} ({mat.name}) Properties\n\n"
12361236
else:
1237-
msg_str = "Material {} Properties\n\n".format(id)
1237+
msg_str = f"Material {id} Properties\n\n"
12381238

12391239
# get density and temperature
12401240
dens_g = mat.get_density(units='g/cm3')
12411241
dens_a = mat.get_density(units='atom/b-cm')
1242-
msg_str += "Density: {:.3f} g/cm3 ({:.3e} atom/b-cm)\n".format(dens_g, dens_a)
1243-
msg_str += "Temperature: {} K\n\n".format(mat.temperature)
1242+
msg_str += f"Density: {dens_g:.3f} g/cm3 ({dens_a:.3e} atom/b-cm)\n"
1243+
msg_str += f"Temperature: {mat.temperature} K\n\n"
12441244

12451245
# get nuclides and their densities
12461246
msg_str += "Nuclide densities [atom/b-cm]:\n"
12471247
for nuc, dens in zip(mat.nuclides, mat.densities):
1248-
msg_str += '{}: {:5.3e}\n'.format(nuc, dens)
1248+
msg_str += f'{nuc}: {dens:5.3e}\n'
12491249

12501250
msg_box = QMessageBox()
12511251
msg_box.setText(msg_str)

0 commit comments

Comments
 (0)