Skip to content

Commit

Permalink
Added checking state of ok button. this refs #58
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Apr 10, 2023
1 parent 89fea40 commit ff1f4db
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/hyperctui/autonomous_reconstruction/select_tof_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(self, parent=None):
self.load_time_spectra()
self.calculate_lambda_axis()
self.check_table_state()
self.check_state_ok_button()

def initialization(self):
o_init = InitializationSelectTofRegions(parent=self, grand_parent=self.parent)
Expand Down Expand Up @@ -325,6 +326,7 @@ def top_roi_changed(self):

def checkButton_clicked(self):
self.table_changed()
self.check_state_ok_button()

def replot_bragg_regions(self):
"""replot the Bragg regions"""
Expand Down Expand Up @@ -373,6 +375,25 @@ def regions_manually_moved(self):
o_table.unblock_signals()
# self.update_evaluation_regions_dict()

def is_ok_button_ready(self):
tof_regions = self.parent.tof_regions
nbr_region_enabled = 0
for _key in tof_regions.keys():
if tof_regions[_key][EvaluationRegionKeys.state]:
nbr_region_enabled += 1

if nbr_region_enabled > 0:
return True

return False

def check_state_ok_button(self):
if self.is_ok_button_ready():
self.ui.pushButton.setEnabled(True)
else:
self.ui.pushButton.setEnabled(False)


def accept(self):
self.ok_clicked = True
self.save_table()
Expand Down

0 comments on commit ff1f4db

Please sign in to comment.