Skip to content

Commit 5b17b4c

Browse files
author
arch
committed
allow exit of mtfg
1 parent 93ba6d6 commit 5b17b4c

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

funscript_editor/ui/cut_tracking_result.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,19 @@ def __init__(self, raw_score, metrics, parent=None):
7575
"stop": data_len
7676
}
7777
self.update_plot()
78+
self.close_with_ok = False
7879

7980
cutCompleted = QtCore.pyqtSignal(dict)
8081

8182

83+
def closeEvent(self, event):
84+
event.accept()
85+
if not self.close_with_ok:
86+
sys.exit(1)
87+
88+
8289
def confirm(self):
90+
self.close_with_ok = True
8391
self.hide()
8492
self.cutCompleted.emit(self.result)
8593
self.close()

funscript_editor/ui/postprocessing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import funscript_editor.utils.logging as logging
88
import copy
9+
import sys
910
import numpy as np
1011
import pyqtgraph as pg
1112

@@ -59,6 +60,7 @@ def __init__(self, metric, raw_score, video_info, parent=None):
5960
self.result_idx = []
6061
self.result_val = []
6162

63+
self.close_with_ok = False
6264
self.update_plot()
6365

6466

@@ -158,7 +160,14 @@ def get_current_tab_name(self) -> str:
158160
return self.tabs.tabText(self.tabs.currentIndex())
159161

160162

163+
def closeEvent(self, event):
164+
event.accept()
165+
if not self.close_with_ok:
166+
sys.exit(1)
167+
168+
161169
def confirm(self):
170+
self.close_with_ok = True
162171
self.hide()
163172
self.postprocessingCompleted.emit(self.metric, self.result_idx, self.result_val)
164173
self.close()

funscript_editor/ui/settings_dialog.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" Settings Dialog for the Funscript Generator """
22
import json
33
import os
4+
import sys
45
import webbrowser
56

67
import funscript_editor.ui.settings_view as settings_view
@@ -12,6 +13,19 @@
1213

1314
from PyQt5 import QtWidgets, QtCore, QtGui
1415

16+
17+
class MyQDialog(QtWidgets.QDialog):
18+
19+
def __init__(self):
20+
super(MyQDialog, self).__init__()
21+
self.close_with_ok = False
22+
23+
def closeEvent(self, event):
24+
event.accept()
25+
if not self.close_with_ok:
26+
sys.exit(1)
27+
28+
1529
class SettingsDialog(QtWidgets.QDialog):
1630
""" Settings Dialog
1731
@@ -26,7 +40,7 @@ def __init__(self, settings: dict, include_vr: bool = True, include_multiaxis :
2640
self.include_vr = include_vr
2741
self.include_multiaxis = include_multiaxis
2842
self.ui = settings_view.Ui_Form()
29-
self.form = QtWidgets.QDialog()
43+
self.form = MyQDialog()
3044
self.ui.setupUi(self.form)
3145
self.form.setWindowTitle("MTFG Settings")
3246
self.settings = settings
@@ -171,6 +185,7 @@ def __set_tracking_metric(self, value):
171185

172186

173187
def __apply(self):
188+
self.form.close_with_ok = True
174189
self.__save_settings()
175190
self.form.hide()
176191
self.applySettings.emit()

0 commit comments

Comments
 (0)