ignore Qt signals outside of GUI

This commit is contained in:
Niv Kaminer 2022-09-09 03:55:22 +03:00
parent f118838f40
commit 5a3ea33cfc

View File

@ -28,6 +28,17 @@ except ImportError as e:
print("\nIf pip doesn't work, try update through Anaconda")
print("install Anaconda : https://www.anaconda.com/distribution/ \n")
"""
to allow decensoring in CLI, ignore all methods targeting Qt signals,
when they aren't initialized (i.e. when the class isn't created by the GUI)
"""
class IgnoreAll(object):
def __getattr__(self,attr):
return IgnoreAll()
def __call__(self, *args, **kwargs):
return IgnoreAll()
class Decensor(QtCore.QThread):
def __init__(self, parentThread = None, text_edit = None, text_cursor = None, ui_mode = None):
super().__init__(parentThread)
@ -39,7 +50,7 @@ class Decensor(QtCore.QThread):
self.decensor_input_original_path = args.decensor_input_original_path
self.decensor_output_path = args.decensor_output_path
self.signals = None # Signals class will be given by progressWindow
self.signals = IgnoreAll() # Signals class will be given by progressWindow
self.model = None
self.warm_up = False