Skip to content

Commit ea8eb6a

Browse files
committed
first_commit
1 parent 14db121 commit ea8eb6a

1 file changed

Lines changed: 40 additions & 22 deletions

File tree

openmc_plotter/plotgui.py

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def mouseMoveEvent(self, event):
267267
domain[id].name,
268268
density,
269269
temperature
270-
))
270+
))
271271
elif id != _NOT_FOUND:
272272
domainInfo = ("{} {}{}\t Density: {} g/cc\t"
273273
"Temperature: {} K".format(domain_kind,
@@ -282,7 +282,8 @@ def mouseMoveEvent(self, event):
282282
tid, value = self.getTallyInfo(event)
283283
if value is not None and value != np.nan:
284284
self.updateTallyDataIndicatorValue(value)
285-
tallyInfo = "Tally {} {}: {:.5E}".format(tid, cv.tallyValue, value)
285+
tallyInfo = "Tally {} {}: {:.5E}".format(
286+
tid, cv.tallyValue, value)
286287
else:
287288
self.updateTallyDataIndicatorValue(0.0)
288289
else:
@@ -348,8 +349,10 @@ def contextMenuEvent(self, event):
348349

349350
self.menu.clear()
350351

351-
self.main_window.undoAction.setText('&Undo ({})'.format(len(self.model.previousViews)))
352-
self.main_window.redoAction.setText('&Redo ({})'.format(len(self.model.subsequentViews)))
352+
self.main_window.undoAction.setText(
353+
'&Undo ({})'.format(len(self.model.previousViews)))
354+
self.main_window.redoAction.setText(
355+
'&Redo ({})'.format(len(self.model.subsequentViews)))
353356

354357
id, instance, properties, domain, domain_kind = self.getIDinfo(event)
355358

@@ -366,18 +369,22 @@ def contextMenuEvent(self, event):
366369

367370
# Domain ID
368371
if domain[id].name:
369-
domainID = self.menu.addAction("{} {} Info: \"{}\"".format(domain_kind, id, domain[id].name))
372+
domainID = self.menu.addAction(
373+
"{} {} Info: \"{}\"".format(domain_kind, id, domain[id].name))
370374
else:
371-
domainID = self.menu.addAction("{} {} Info".format(domain_kind, id))
375+
domainID = self.menu.addAction(
376+
"{} {} Info".format(domain_kind, id))
372377

373378
# add connector to a new window of info here for material props
374379
if domain_kind == 'Material':
375-
mat_prop_connector = partial(self.main_window.viewMaterialProps, id)
380+
mat_prop_connector = partial(
381+
self.main_window.viewMaterialProps, id)
376382
domainID.triggered.connect(mat_prop_connector)
377383

378384
self.menu.addSeparator()
379385

380-
colorAction = self.menu.addAction('Edit {} Color...'.format(domain_kind))
386+
colorAction = self.menu.addAction(
387+
'Edit {} Color...'.format(domain_kind))
381388
colorAction.setDisabled(cv.highlighting)
382389
colorAction.setToolTip('Edit {} color'.format(domain_kind))
383390
colorAction.setStatusTip('Edit {} color'.format(domain_kind))
@@ -397,12 +404,15 @@ def contextMenuEvent(self, event):
397404
id=id)
398405
maskAction.toggled.connect(mask_connector)
399406

400-
highlightAction = self.menu.addAction('Highlight {}'.format(domain_kind))
407+
highlightAction = self.menu.addAction(
408+
'Highlight {}'.format(domain_kind))
401409
highlightAction.setCheckable(True)
402410
highlightAction.setChecked(domain[id].highlight)
403411
highlightAction.setDisabled(not cv.highlighting)
404-
highlightAction.setToolTip('Toggle {} highlight'.format(domain_kind))
405-
highlightAction.setStatusTip('Toggle {} highlight'.format(domain_kind))
412+
highlightAction.setToolTip(
413+
'Toggle {} highlight'.format(domain_kind))
414+
highlightAction.setStatusTip(
415+
'Toggle {} highlight'.format(domain_kind))
406416
highlight_connector = partial(self.main_window.toggleDomainHighlight,
407417
kind=domain_kind,
408418
id=id)
@@ -415,14 +425,16 @@ def contextMenuEvent(self, event):
415425
if cv.colorby not in _MODEL_PROPERTIES:
416426
self.menu.addSeparator()
417427
if int(id) == _NOT_FOUND:
418-
bgColorAction = self.menu.addAction('Edit Background Color...')
428+
bgColorAction = self.menu.addAction(
429+
'Edit Background Color...')
419430
bgColorAction.setToolTip('Edit background color')
420431
bgColorAction.setStatusTip('Edit plot background color')
421432
connector = partial(self.main_window.editBackgroundColor,
422433
apply=True)
423434
bgColorAction.triggered.connect(connector)
424435
elif int(id) == _OVERLAP:
425-
olapColorAction = self.menu.addAction('Edit Overlap Color...')
436+
olapColorAction = self.menu.addAction(
437+
'Edit Overlap Color...')
426438
olapColorAction.setToolTip('Edit overlap color')
427439
olapColorAction.setStatusTip('Edit plot overlap color')
428440
connector = partial(self.main_window.editOverlapColor,
@@ -503,7 +515,8 @@ def updatePixmap(self):
503515
idx = 1
504516
cmap_label = "Density (g/cc)"
505517

506-
norm = SymLogNorm(1E-10) if cv.color_scale_log[cv.colorby] else None
518+
norm = SymLogNorm(
519+
1E-10) if cv.color_scale_log[cv.colorby] else None
507520

508521
data = self.model.properties[:, :, idx]
509522
self.image = self.figure.subplots().imshow(data,
@@ -526,7 +539,7 @@ def updatePixmap(self):
526539
color='blue',
527540
clip_on=True)
528541
self.colorbar.ax.add_line(self.data_indicator)
529-
self.colorbar.ax.margins(0.0 ,0.0)
542+
self.colorbar.ax.margins(0.0, 0.0)
530543
self.updateDataIndicatorVisibility()
531544
self.updateColorMinMax(cv.colorby)
532545

@@ -667,7 +680,7 @@ def updateTallyDataIndicatorValue(self, y_val):
667680
cv = self.model.currentView
668681

669682
if not cv.tallyDataVisible or not cv.tallyDataIndicator:
670-
return
683+
return
671684

672685
if self.tally_data_indicator is not None:
673686
data = self.tally_data_indicator.get_data()
@@ -719,6 +732,7 @@ def updateColorMinMax(self, property_type):
719732
self.colorbar.draw_all()
720733
self.draw()
721734

735+
722736
class ColorDialog(QDialog):
723737

724738
def __init__(self, model, font_metric, parent=None):
@@ -745,7 +759,8 @@ def createDialogLayout(self):
745759

746760
self.tab_bar = QTabWidget()
747761
self.tab_bar.setMaximumHeight(800)
748-
self.tab_bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
762+
self.tab_bar.setSizePolicy(
763+
QSizePolicy.Expanding, QSizePolicy.Expanding)
749764
self.tab_bar.addTab(self.generalTab, 'General')
750765
self.tab_bar.addTab(self.tabs['cell'], 'Cells')
751766
self.tab_bar.addTab(self.tabs['material'], 'Materials')
@@ -805,13 +820,15 @@ def createGeneralTab(self):
805820
self.colorbyBox.addItem("cell")
806821
self.colorbyBox.addItem("temperature")
807822
self.colorbyBox.addItem("density")
808-
self.colorbyBox.currentTextChanged[str].connect(main_window.editColorBy)
823+
self.colorbyBox.currentTextChanged[str].connect(
824+
main_window.editColorBy)
809825

810826
self.universeLevelBox = QComboBox(self)
811827
self.universeLevelBox.addItem('all')
812828
for i in range(self.model.max_universe_levels):
813829
self.universeLevelBox.addItem(str(i))
814-
self.universeLevelBox.currentTextChanged[str].connect(main_window.editUniverseLevel)
830+
self.universeLevelBox.currentTextChanged[str].connect(
831+
main_window.editUniverseLevel)
815832

816833
# Overlap plotting
817834
self.overlapCheck = QCheckBox('', self)
@@ -910,7 +927,8 @@ def createPropertyTab(self, property_kind):
910927
propertyTab.maxBox.valueChanged.connect(connector3)
911928

912929
propertyTab.colormapBox = QComboBox(self)
913-
cmaps = sorted(m for m in mcolormaps.datad if not m.endswith("_r"))
930+
cmaps = sorted(m for m in mcolormaps._gen_cmap_registry()
931+
if not m.endswith("_r"))
914932
for cmap in cmaps:
915933
propertyTab.colormapBox.addItem(cmap)
916934

@@ -958,8 +976,8 @@ def updateColorMaps(self):
958976
cmaps = self.model.activeView.colormaps
959977
for key, val in cmaps.items():
960978
idx = self.tabs[key].colormapBox.findText(
961-
val,
962-
QtCore.Qt.MatchFixedString)
979+
val,
980+
QtCore.Qt.MatchFixedString)
963981
if idx >= 0:
964982
self.tabs[key].colormapBox.setCurrentIndex(idx)
965983

0 commit comments

Comments
 (0)