Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
JHolba committed Jan 3, 2025
1 parent 5a8b2a9 commit d1aa80f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
31 changes: 5 additions & 26 deletions src/ert/gui/ertwidgets/analysismodulevariablespanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def __init__(self, analysis_module: AnalysisModule, ensemble_size: int):
partial(
self.valueChangedCheckBox,
"localization",
bool,
local_checkbox,
)
)
Expand Down Expand Up @@ -179,31 +178,11 @@ def createDoubleSpinBox(

spinner.setSingleStep(step_length)
spinner.setValue(variable_value)
spinner.valueChanged.connect(
partial(self.valueChanged, variable_name, float, spinner)
)
spinner.valueChanged.connect(partial(self.valueChangedSpinner, variable_name))
return spinner

def valueChanged(
self,
variable_name: str,
variable_type: type[bool] | type[float],
variable_control: QWidget,
value: float,
) -> None:
if value is not None:
self.analysis_module.__setattr__(variable_name, value) # noqa: PLC2801

def valueChangedCheckBox(
self,
variable_name: str,
variable_type: type[bool] | type[float],
variable_control: QWidget,
) -> None:
value = None
if variable_type == bool:
assert isinstance(variable_control, QCheckBox)
value = variable_control.isChecked()
def valueChangedSpinner(self, name: str, value: float) -> None:
self.analysis_module.__setattr__(name, value) # noqa: PLC2801

if value is not None:
self.analysis_module.__setattr__(variable_name, value) # noqa: PLC2801
def valueChangedCheckBox(self, name: str, control: QCheckBox) -> None:
self.analysis_module.__setattr__(name, control.isChecked()) # noqa: PLC2801
2 changes: 1 addition & 1 deletion src/ert/gui/model/fm_step_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def headerData(
return header.capitalize()
if orientation == Qt.Orientation.Vertical:
return section
return QObject()
return None

@override
def columnCount(
Expand Down
2 changes: 1 addition & 1 deletion src/ert/gui/model/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __repr__(self) -> str:
class ForwardModelStepNode(_NodeBase):
parent: RealNode | None = None
data: FMStepSnapshot = field(default_factory=lambda: FMStepSnapshot()) # noqa: PLW0108
children: None = None
children: dict[None, None] = field(default_factory=dict)

def add_child(self, _: _NodeBase) -> None:
raise RuntimeError(f"Can not add children to {self.__class__.__name__}")
Expand Down

0 comments on commit d1aa80f

Please sign in to comment.