Commit 97ac3d87 authored by Domanski, Marian M.'s avatar Domanski, Marian M.
Browse files

disable/enable steady/unsteady radio buttons for profile

parent 53ccef70
......@@ -137,14 +137,31 @@ class HecrasDialog(QDialog):
"""Handle function for changing current plan"""
# Populate profile based on current plan in ras project
if self.ui.comboBox_plan.hasFocus():
self.logger.debug("Plan changed")
current_plan = self.ui.comboBox_plan.currentText()
self.logger.debug("Plan changed to {}".format(current_plan))
file_path = self.ui.lineEdit_project.text()
with RASProject(file_path) as ras_project:
ras_project.set_current_plan(current_plan)
is_unsteady = ras_project.current_plan_is_unsteady()
if is_unsteady:
self.logger.debug("{} is unsteady".format(current_plan))
self.ui.radioButton_unsteady.setEnabled(True)
else:
self.logger.debug("{} is not unsteady".format(current_plan))
self.ui.radioButton_steady.setDown(True)
self.ui.radioButton_unsteady.setDisabled(True)
self.populate_profiles()
def handle_steadiness_change(self):
"""Handle function for changing steadiness option (steady vs. unsteady)"""
if self.ui.radioButton_steady.isChecked():
self.logger.debug("Set project to steady")
self.ui.comboBox_profile.setEnabled(True)
elif self.ui.radioButton_unsteady.isChecked():
self.logger.debug("Set project to unsteady")
self.ui.comboBox_profile.setEnabled(False)
def populate_plans(self):
......@@ -157,11 +174,21 @@ class HecrasDialog(QDialog):
with RASProject(file_path) as ras_project:
plan_names = ras_project.plan_names()
current_plan_name = ras_project.current_plan_name()
is_unsteady = ras_project.current_plan_is_unsteady()
self.logger.debug("Plan names: {}".format(", ".join(plan_names)))
self.logger.debug("Current plan name in RAS project: {}".format(
current_plan_name))
if is_unsteady:
self.logger.debug("{} is unsteady".format(current_plan_name))
self.ui.radioButton_unsteady.setEnabled(True)
else:
self.logger.debug("{} is not unsteady".format(
current_plan_name))
self.ui.radioButton_steady.setDown(True)
self.ui.radioButton_unsteady.setDisabled(True)
# Clear and populate plans
self.ui.comboBox_plan.clear()
self.ui.comboBox_plan.addItems(plan_names)
......@@ -182,7 +209,6 @@ class HecrasDialog(QDialog):
self.logger.debug(
"Populating profiles for plan {}".format(current_plan))
with RASProject(file_path) as ras_project:
ras_project.set_current_plan(current_plan)
profile_names = ras_project.profile_names()
self.logger.debug("Profile names: {}".format(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment