Skip to content

Commit

Permalink
syncing work. this refs #79
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Aug 22, 2023
1 parent f097449 commit 8ecc776
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 31 deletions.
6 changes: 6 additions & 0 deletions src/hyperctui/autonomous_reconstruction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ class ReconstructionTableColumnIndex:
folder_name = 0
preview = 1
status = 2


class KeysTofReconstructionConfig:

tof_reconstruction_folders = "tof reconstruction folders"
process_id = "process id"
77 changes: 46 additions & 31 deletions src/hyperctui/autonomous_reconstruction/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from hyperctui.pre_processing_monitor import IN_PROGRESS, IN_QUEUE, READY
from hyperctui.pre_processing_monitor.get import Get as GetMonitor

from hyperctui.autonomous_reconstruction import KeysTofReconstructionConfig
from hyperctui.autonomous_reconstruction.help_golden_angle import HelpGoldenAngle
from hyperctui.autonomous_reconstruction.select_evaluation_regions import SelectEvaluationRegions
from hyperctui.autonomous_reconstruction.select_tof_regions import SelectTofRegions
Expand Down Expand Up @@ -349,35 +350,37 @@ def checking_state_of_projections_table(self):
self.parent.ui.autonomous_reconstruction_tabWidget.setTabEnabled(1, True)
self.parent.ui.autonomous_reconstruction_tabWidget.setCurrentIndex(1)

# fill table with as many as TOF regions reconstruction requested
tof_regions_dict = self.parent.session_dict[SessionKeys.tof_regions]
o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstructions_tableWidget)

row_index = 0
for _key in tof_regions_dict.keys():
if tof_regions_dict[_key][EvaluationRegionKeys.state]:
o_table.insert_empty_row(row=row_index)

# temporary folder name holder
o_table.insert_item(row=row_index,
column=ReconstructionTableColumnIndex.folder_name,
value=tof_regions_dict[_key][EvaluationRegionKeys.str_from_to_value])

if row_index == 0:
message = DataStatus.in_progress
background_color = IN_PROGRESS

else:
message = DataStatus.in_queue
background_color = IN_QUEUE

o_table.insert_item(row=row_index,
column=ReconstructionTableColumnIndex.status,
value=message)
o_table.set_background_color(row=row_index,
column=ReconstructionTableColumnIndex.status,
qcolor=background_color)
row_index += 1
self.initialize_reconstruction_table()

def initialize_reconstruction_table(self):
# fill table with as many as TOF regions reconstruction requested
tof_regions_dict = self.parent.session_dict[SessionKeys.tof_regions]
o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstructions_tableWidget)
row_index = 0
for _key in tof_regions_dict.keys():
if tof_regions_dict[_key][EvaluationRegionKeys.state]:
o_table.insert_empty_row(row=row_index)

# temporary folder name holder
o_table.insert_item(row=row_index,
column=ReconstructionTableColumnIndex.folder_name,
value=tof_regions_dict[_key][EvaluationRegionKeys.str_from_to_value])

if row_index == 0:
message = DataStatus.in_progress
background_color = IN_PROGRESS

else:
message = DataStatus.in_queue
background_color = IN_QUEUE

o_table.insert_item(row=row_index,
column=ReconstructionTableColumnIndex.status,
value=message)
o_table.set_background_color(row=row_index,
column=ReconstructionTableColumnIndex.status,
qcolor=background_color)
row_index += 1

def refresh_reconstruction_table_clicked(self):
"""this is where we will check the json file in {{location TBD}} and look for tag that
Expand All @@ -392,12 +395,24 @@ def refresh_reconstruction_table_clicked(self):

logging.info(f"- config file {reconstruction_config} has been located!")
o_config = ConfigHandler(parent=self.parent)
o_config.load_reconstruction_config()

o_config.load_reconstruction_config(file_name=reconstruction_config)

config = self.parent.reconstruction_config
list_tof_reconstruction_folders = config.get(KeysTofReconstructionConfig.tof_reconstruction_folders, None)
if not list_tof_reconstruction_folders:
logging.info("- no TOF reconstruction folders found yet!")
return

logging.info(f"- list of reconstruction folders: {list_tof_reconstruction_folders}")
if len(list_tof_reconstruction_folders) > 0:
self.refresh_reconstruction_table()


def refresh_reconstruction_table(self):
"""
executed when we want to check the status of all the autonomous projections folders
"""
pass

def fill_table_with_list_folders(self, list_folders=None, starting_row_index=0):

Expand Down

0 comments on commit 8ecc776

Please sign in to comment.