mirror of
				https://github.com/k4yt3x/video2x.git
				synced 2025-10-31 12:50:59 +01:00 
			
		
		
		
	added stopping confirmation
This commit is contained in:
		
							parent
							
								
									e107ddc96e
								
							
						
					
					
						commit
						a98d1c7277
					
				| @ -4,7 +4,7 @@ | |||||||
| Creator: Video2X GUI | Creator: Video2X GUI | ||||||
| Author: K4YT3X | Author: K4YT3X | ||||||
| Date Created: May 5, 2020 | Date Created: May 5, 2020 | ||||||
| Last Modified: May 15, 2020 | Last Modified: May 17, 2020 | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| # local imports | # local imports | ||||||
| @ -1104,13 +1104,39 @@ You can [submit an issue on GitHub](https://github.com/k4yt3x/video2x/issues/new | |||||||
|         self.reset_progress_display() |         self.reset_progress_display() | ||||||
| 
 | 
 | ||||||
|     def stop(self): |     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): |     def closeEvent(self, event): | ||||||
|         # try cleaning up temp directories |         # try cleaning up temp directories | ||||||
|         self.stop() |         if self.stop(): | ||||||
|         event.accept() |             event.accept() | ||||||
|  |         else: | ||||||
|  |             event.ignore() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # this file shouldn't be imported | # this file shouldn't be imported | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|    <rect> |    <rect> | ||||||
|     <x>0</x> |     <x>0</x> | ||||||
|     <y>0</y> |     <y>0</y> | ||||||
|     <width>671</width> |     <width>673</width> | ||||||
|     <height>802</height> |     <height>802</height> | ||||||
|    </rect> |    </rect> | ||||||
|   </property> |   </property> | ||||||
| @ -2103,8 +2103,11 @@ | |||||||
|                   </item> |                   </item> | ||||||
|                   <item> |                   <item> | ||||||
|                    <widget class="QCheckBox" name="ffmpegMigrateStreamsOutputOptionsCopyCodecCheckBox"> |                    <widget class="QCheckBox" name="ffmpegMigrateStreamsOutputOptionsCopyCodecCheckBox"> | ||||||
|  |                     <property name="toolTip"> | ||||||
|  |                      <string>Copy streams without re-encoding</string> | ||||||
|  |                     </property> | ||||||
|                     <property name="text"> |                     <property name="text"> | ||||||
|                      <string>Stream copy (-c copy)</string> |                      <string>Copy streams (-c copy)</string> | ||||||
|                     </property> |                     </property> | ||||||
|                     <property name="checked"> |                     <property name="checked"> | ||||||
|                      <bool>true</bool> |                      <bool>true</bool> | ||||||
| @ -2529,7 +2532,7 @@ | |||||||
|     <rect> |     <rect> | ||||||
|      <x>0</x> |      <x>0</x> | ||||||
|      <y>0</y> |      <y>0</y> | ||||||
|      <width>671</width> |      <width>673</width> | ||||||
|      <height>21</height> |      <height>21</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user