File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1228,3 +1228,26 @@ def exportTallyData(self):
12281228 # show export tool dialog
12291229 self .showExportDialog ()
12301230
1231+ def viewMaterialProps (self , id ):
1232+ """display material properties in message box"""
1233+ mat = openmc .lib .materials [id ]
1234+ if mat .name :
1235+ msg_str = f"Material { id } ({ mat .name } ) Properties\n \n "
1236+ else :
1237+ msg_str = f"Material { id } Properties\n \n "
1238+
1239+ # get density and temperature
1240+ dens_g = mat .get_density (units = 'g/cm3' )
1241+ dens_a = mat .get_density (units = 'atom/b-cm' )
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 "
1244+
1245+ # get nuclides and their densities
1246+ msg_str += "Nuclide densities [atom/b-cm]:\n "
1247+ for nuc , dens in zip (mat .nuclides , mat .densities ):
1248+ msg_str += f'{ nuc } : { dens :5.3e} \n '
1249+
1250+ msg_box = QMessageBox (self )
1251+ msg_box .setText (msg_str )
1252+ msg_box .setModal (False )
1253+ msg_box .show ()
Original file line number Diff line number Diff line change @@ -354,9 +354,14 @@ def contextMenuEvent(self, event):
354354
355355 # Domain ID
356356 if domain [id ].name :
357- domainID = self .menu .addAction ("{} {}: \" {}\" " .format (domain_kind , id , domain [id ].name ))
357+ domainID = self .menu .addAction ("{} {} Info : \" {}\" " .format (domain_kind , id , domain [id ].name ))
358358 else :
359- domainID = self .menu .addAction ("{} {}" .format (domain_kind , id ))
359+ domainID = self .menu .addAction ("{} {} Info" .format (domain_kind , id ))
360+
361+ # add connector to a new window of info here for material props
362+ if domain_kind == 'Material' :
363+ mat_prop_connector = partial (self .main_window .viewMaterialProps , id )
364+ domainID .triggered .connect (mat_prop_connector )
360365
361366 self .menu .addSeparator ()
362367
You can’t perform that action at this time.
0 commit comments