Skip to content

Commit

Permalink
about to look at the status of the reconstructions. this refs #76
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Aug 17, 2023
1 parent 03e285e commit fc7e91c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 29 deletions.
32 changes: 14 additions & 18 deletions src/hyperctui/autonomous_reconstruction/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def start_acquisition(self):

# enable
self.parent.ui.autonomous_refresh_pushButton.setEnabled(True)
self.parent.ui.autonomous_monitor_groupBox.setVisible(True)
self.parent.ui.autonomous_reconstruction_tabWidget.setVisible(True)
self.parent.ui.autonomous_refresh_pushButton.setStyleSheet(interact_me_style)

number_angles = self.parent.ui.evaluation_frequency_spinBox.value()
Expand Down Expand Up @@ -217,7 +217,7 @@ def init_autonomous_table(self):
logging.info(f"- {list_tof_region_index =}")
logging.info(f"- {list_tof_region_collected =}")

o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstruction_tableWidget)
o_table = TableHandler(table_ui=self.parent.ui.autonomous_projections_tableWidget)
o_table.remove_all_rows()

for _row in np.arange(nbr_angles):
Expand Down Expand Up @@ -271,7 +271,7 @@ def preview_data(self, row=-1):
file_name=file_name)
preview_image.show()

def refresh_table_clicked(self):
def refresh_projections_table_clicked(self):
"""refresh button next to the table has been clicked"""
logging.info("User refreshing the autonomous reconstruction step1 table!")

Expand Down Expand Up @@ -321,9 +321,9 @@ def refresh_table_clicked(self):
self.fill_table_with_list_folders(list_folders=list_new_folders,
starting_row_index=starting_row_index)

self.checking_state_of_widgets_post_reconstruction()
self.checking_state_of_projections_table()

def checking_state_of_widgets_post_reconstruction(self):
def checking_state_of_projections_table(self):
"""This is looking for all the projections angles requested. If they are all there, then
it will change the state of the widgets."""

Expand All @@ -345,13 +345,8 @@ def checking_state_of_widgets_post_reconstruction(self):
self.parent.ui.autonomous_reconstruction_tabWidget.setCurrentIndex(1)

# fill table with as many as TOF regions reconstruction requested
o_get = AutonomousGet(parent=self.parent)
nbr_tof_regions = o_get.get_nbr_tof_regions()

tof_regions_dict = self.parent.session_dict[SessionKeys.tof_regions]

o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstructions_tableWidget)
o_table.insert_empty_row(row=nbr_tof_regions)

row_index = 0
for _key in tof_regions_dict.keys():
Expand All @@ -377,22 +372,23 @@ def checking_state_of_widgets_post_reconstruction(self):
o_table.set_background_color(row=row_index,
column=ReconstructionTableColumnIndex.status,
qcolor=background_color)
row_index += 1

def refrech_reconstruction_table_clicked(self):
"""this is where we will check the json file in {{location TBD}} and look for tag that
list the reconstruction done!"""
pass


# checking if any reconstruction showed up
if self.is_reconstruction_done():
self.parent.ui.autonomous_reconstructed_status_label.setText(DataStatus.ready)

else:
# if not
pass

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

if list_folders is None:
return

o_get = GetMonitor(grand_parent=self.parent)
o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstruction_tableWidget)
o_table = TableHandler(table_ui=self.parent.ui.autonomous_projections_tableWidget)

for _offset_row_index in np.arange(len(list_folders)):

Expand Down Expand Up @@ -552,4 +548,4 @@ def update_autonomous_reconstruction_widgets(self):
list_folders_acquired = self.parent.session_dict[SessionKeys.list_projections_folders_acquired_so_far]
self.fill_table_with_list_folders(list_folders=list_folders_acquired,
starting_row_index=0)
self.checking_state_of_widgets_post_reconstruction()
self.checking_state_of_projections_table()
4 changes: 2 additions & 2 deletions src/hyperctui/hyperctui.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,11 @@ def autonomous_reconstruction_stop_process_button_clicked(self):

def autonomous_refresh_table_clicked(self):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.refresh_table_clicked()
o_event.refresh_projections_table_clicked()

def autonomous_checking_reconstruction_clicked(self):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.checking_reconstruction_clicked()
o_event.refrech_reconstruction_table_clicked()

# leaving ui
def closeEvent(self, c):
Expand Down
8 changes: 6 additions & 2 deletions src/hyperctui/initialization/gui_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ def tables(self):
column_sizes = [600, 50]
o_table.set_column_sizes(column_sizes=column_sizes)

table_columns = [540, 80, 80, 80, 100]
o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstruction_tableWidget)
table_columns = [540, 80, 80, 80, 80, 100]
o_table = TableHandler(table_ui=self.parent.ui.autonomous_projections_tableWidget)
o_table.set_column_sizes(column_sizes=table_columns)

recon_table_columns = [740, 80, 100]
o_table = TableHandler(table_ui=self.parent.ui.autonomous_reconstructions_tableWidget)
o_table.set_column_sizes(column_sizes=table_columns)

def full_reset(self):
Expand Down
37 changes: 30 additions & 7 deletions src/hyperctui/ui/main_application.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@
</layout>
</item>
<item>
<widget class="QTableWidget" name="autonomous_reconstruction_tableWidget">
<widget class="QTableWidget" name="autonomous_projections_tableWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
Expand Down Expand Up @@ -1532,7 +1532,29 @@
</layout>
</item>
<item>
<widget class="QTableWidget" name="autonomous_reconstructions_tableWidget"/>
<widget class="QTableWidget" name="autonomous_reconstructions_tableWidget">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Folder name</string>
</property>
</column>
<column>
<property name="text">
<string>Preview</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -2416,7 +2438,7 @@
<hints>
<hint type="sourcelabel">
<x>481</x>
<y>456</y>
<y>530</y>
</hint>
<hint type="destinationlabel">
<x>1132</x>
Expand Down Expand Up @@ -2447,8 +2469,8 @@
<slot>autonomous_refresh_table_clicked()</slot>
<hints>
<hint type="sourcelabel">
<x>1070</x>
<y>525</y>
<x>1062</x>
<y>613</y>
</hint>
<hint type="destinationlabel">
<x>1132</x>
Expand Down Expand Up @@ -2575,8 +2597,8 @@
<slot>autonomous_checking_reconstruction_clicked()</slot>
<hints>
<hint type="sourcelabel">
<x>1029</x>
<y>672</y>
<x>1021</x>
<y>595</y>
</hint>
<hint type="destinationlabel">
<x>1089</x>
Expand Down Expand Up @@ -2633,5 +2655,6 @@
<slot>action_settings_clicked()</slot>
<slot>refresh_list_of_obs_button_clicked()</slot>
<slot>autonomous_checking_reconstruction_clicked()</slot>
<slot>autonomous_checking_projections_clicked()</slot>
</slots>
</ui>

0 comments on commit fc7e91c

Please sign in to comment.