Skip to content

Commit

Permalink
Added cancel button in evaluation regions. this refs #58
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Apr 10, 2023
1 parent 0f33ac3 commit 89fea40
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

class SelectEvaluationRegions(QDialog):

ok_clicked = False

def __init__(self, parent=None):
super(SelectEvaluationRegions, self).__init__(parent)
self.parent = parent
Expand All @@ -27,6 +29,7 @@ def __init__(self, parent=None):
self.ui = load_ui(ui_full_path, baseinstance=self)
self.setWindowTitle("Select Evaluation Regions")

self.parent.backup_evaluation_regions = self.parent.evaluation_regions
self.initialization()
self.update_display_regions()
self.check_state_ok_button()
Expand Down Expand Up @@ -232,6 +235,16 @@ def check_state_ok_button(self):
self.ui.pushButton.setEnabled(False)

def accept(self):
self.ok_clicked = True
self.save_table()
self.parent.update_autonomous_widgets()
self.close()

def cancel(self):
self.close()

def closeEvent(self, a0):
if self.ok_clicked:
pass
else:
self.parent.evaluation_regions = self.parent.backup_evaluation_regions
74 changes: 51 additions & 23 deletions src/hyperctui/ui/select_evaluation_regions.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
Expand Down Expand Up @@ -125,24 +125,35 @@
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>843</width>
<height>20</height>
</size>
</property>
</spacer>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="cancel_pushButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>843</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand All @@ -155,8 +166,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>508</x>
<y>909</y>
<x>857</x>
<y>935</y>
</hint>
<hint type="destinationlabel">
<x>372</x>
Expand All @@ -171,19 +182,36 @@
<slot>table_changed()</slot>
<hints>
<hint type="sourcelabel">
<x>366</x>
<y>427</y>
<x>551</x>
<y>764</y>
</hint>
<hint type="destinationlabel">
<x>150</x>
<y>493</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancel_pushButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>cancel()</slot>
<hints>
<hint type="sourcelabel">
<x>62</x>
<y>917</y>
</hint>
<hint type="destinationlabel">
<x>219</x>
<y>899</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>add_a_region_clicked()</slot>
<slot>remove_selected_region_clicked()</slot>
<slot>table_changed()</slot>
<slot>cancel()</slot>
</slots>
</ui>

0 comments on commit 89fea40

Please sign in to comment.