mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-30 15:48:13 +00:00
added stopping confirmation
This commit is contained in:
parent
e107ddc96e
commit
a98d1c7277
@ -4,7 +4,7 @@
|
||||
Creator: Video2X GUI
|
||||
Author: K4YT3X
|
||||
Date Created: May 5, 2020
|
||||
Last Modified: May 15, 2020
|
||||
Last Modified: May 17, 2020
|
||||
"""
|
||||
|
||||
# local imports
|
||||
@ -1104,13 +1104,39 @@ You can [submit an issue on GitHub](https://github.com/k4yt3x/video2x/issues/new
|
||||
self.reset_progress_display()
|
||||
|
||||
def stop(self):
|
||||
with contextlib.suppress(AttributeError):
|
||||
self.upscaler.running = False
|
||||
|
||||
try:
|
||||
# if upscaler is running, ask the user for confirmation
|
||||
if self.upscaler.running is True:
|
||||
confirmation = QMessageBox.question(self,
|
||||
'Stopping Confirmation',
|
||||
'Are you sure you want to want to stop the upscaling process?',
|
||||
QMessageBox.Yes,
|
||||
QMessageBox.No)
|
||||
# if the user indeed wants to stop processing
|
||||
if confirmation == QMessageBox.Yes:
|
||||
with contextlib.suppress(AttributeError):
|
||||
self.upscaler.running = False
|
||||
return True
|
||||
# if the user doesn't want ot stop processing
|
||||
else:
|
||||
return False
|
||||
|
||||
# if the upscaler is not running
|
||||
else:
|
||||
return True
|
||||
|
||||
# if an AttributeError happens
|
||||
# that means the upscaler object haven't been created yet
|
||||
except AttributeError:
|
||||
return True
|
||||
|
||||
def closeEvent(self, event):
|
||||
# try cleaning up temp directories
|
||||
self.stop()
|
||||
event.accept()
|
||||
if self.stop():
|
||||
event.accept()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
|
||||
# this file shouldn't be imported
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>671</width>
|
||||
<width>673</width>
|
||||
<height>802</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2103,8 +2103,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ffmpegMigrateStreamsOutputOptionsCopyCodecCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Copy streams without re-encoding</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stream copy (-c copy)</string>
|
||||
<string>Copy streams (-c copy)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -2529,7 +2532,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>671</width>
|
||||
<width>673</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user