Skip to content

Commit

Permalink
interaction of widgets. this refs #58
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Apr 10, 2023
1 parent ff1f4db commit 780e397
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 4 deletions.
30 changes: 30 additions & 0 deletions src/hyperctui/autonomous_reconstruction/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from hyperctui import EvaluationRegionKeys
from hyperctui import interact_me_style, normal_style, error_style

from hyperctui.utilities.status_message_config import StatusMessageStatus, show_status_message

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 @@ -96,3 +98,31 @@ def check_state_of_start_pre_acquisition_button(self):
self.parent.ui.start_first_reconstruction_pushButton.setStyleSheet(interact_me_style)
else:
self.parent.ui.start_first_reconstruction_pushButton.setStyleSheet(normal_style)

def evaluation_frequency_changed(self):
pass

def start_acquisition(self):
# disable all previous widgets
self.parent.ui.autonomous_projections_groupBox.setEnabled(False)
self.parent.ui.autonomous_evaluation_groupBox.setEnabled(False)
self.parent.ui.autonomous_tof_regions_groupBox.setEnabled(False)
self.parent.ui.start_first_reconstruction_pushButton.setEnabled(False)
self.parent.ui.start_first_reconstruction_pushButton.setStyleSheet(normal_style)

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

number_angles = self.parent.ui.evaluation_frequency_spinBox.value()
show_status_message(parent=self.parent,
message=f"Starting acquisition of {number_angles} angles!",
duration_s=5)

self.init_autonomous_table()

def init_autonomous_table(self):
pass

def refresh_table_clicked(self):
pass
12 changes: 12 additions & 0 deletions src/hyperctui/hyperctui.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,18 @@ def tof_region_selection_button_clicked(self):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.tof_region_selection_button_clicked()

def autonomous_evaluation_frequency_changed(self, new_value):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.evaluation_frequency_changed()

def autonomous_start_acquisition_clicked(self):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.start_acquisition()

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

# leaving ui
def closeEvent(self, c):
o_session = SessionHandler(parent=self)
Expand Down
6 changes: 6 additions & 0 deletions src/hyperctui/initialization/gui_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ 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)
o_table.set_column_sizes(column_sizes=table_columns)

def full_reset(self):
pass

Expand All @@ -69,6 +73,8 @@ def widgets(self):
self.parent.ui.logo.setPixmap(logo_icon)
# self.parent.ui.tab.setStyleSheet("background-image: url('" + background_file + "'); background-repeat: no-repeat")

self.parent.ui.autonomous_monitor_groupBox.setVisible(False)

def statusbar(self):
self.parent.eventProgress = QProgressBar(self.parent.ui.statusbar)
self.parent.eventProgress.setMinimumSize(20, 14)
Expand Down
133 changes: 129 additions & 4 deletions src/hyperctui/ui/main_application.ui
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="autonomous_projections_groupBox">
<property name="title">
<string>Projections angles</string>
</property>
Expand Down Expand Up @@ -1057,7 +1057,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="autonomous_evaluation_groupBox">
<property name="title">
<string>Evaluation frequency</string>
</property>
Expand Down Expand Up @@ -1110,7 +1110,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<widget class="QGroupBox" name="autonomous_tof_regions_groupBox">
<property name="title">
<string>TOF - region(s) of interest</string>
</property>
Expand Down Expand Up @@ -1282,7 +1282,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>459</height>
<height>198</height>
</size>
</property>
</spacer>
Expand All @@ -1297,6 +1297,80 @@
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="autonomous_monitor_groupBox">
<property name="title">
<string>Monitor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="autonomous_refresh_pushButton">
<property name="text">
<string>Refresh table</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="autonomous_reconstruction_tableWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>File name</string>
</property>
</column>
<column>
<property name="text">
<string>Log</string>
</property>
</column>
<column>
<property name="text">
<string>Err</string>
</property>
</column>
<column>
<property name="text">
<string>Meta.</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
Expand Down Expand Up @@ -2097,6 +2171,54 @@
</hint>
</hints>
</connection>
<connection>
<sender>start_first_reconstruction_pushButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>autonomous_start_acquisition_clicked()</slot>
<hints>
<hint type="sourcelabel">
<x>552</x>
<y>657</y>
</hint>
<hint type="destinationlabel">
<x>1221</x>
<y>789</y>
</hint>
</hints>
</connection>
<connection>
<sender>evaluation_frequency_spinBox</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>autonomous_evaluation_frequency_changed()</slot>
<hints>
<hint type="sourcelabel">
<x>125</x>
<y>264</y>
</hint>
<hint type="destinationlabel">
<x>4</x>
<y>374</y>
</hint>
</hints>
</connection>
<connection>
<sender>autonomous_refresh_pushButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>autonomous_refresh_table_clicked()</slot>
<hints>
<hint type="sourcelabel">
<x>1101</x>
<y>686</y>
</hint>
<hint type="destinationlabel">
<x>1217</x>
<y>852</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>step1_instrument_changed()</slot>
Expand Down Expand Up @@ -2135,5 +2257,8 @@
<slot>projections_automatic_help_clicked()</slot>
<slot>evaluation_frequency_help_clicked()</slot>
<slot>tof_region_selection_button_clicked()</slot>
<slot>autonomous_start_acquisition_clicked()</slot>
<slot>autonomous_evaluation_frequency_changed()</slot>
<slot>autonomous_refresh_table_clicked()</slot>
</slots>
</ui>

0 comments on commit 780e397

Please sign in to comment.