mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Add custom args to GUI and add arg conflict validation to workers
This commit is contained in:
@@ -92,8 +92,28 @@ class BaseRenderWorker(object):
|
||||
logging.exception(e)
|
||||
return path
|
||||
|
||||
def _generate_subprocess(self):
|
||||
raise NotImplementedError("_generate_subprocess not implemented")
|
||||
def validate(self):
|
||||
if not os.path.exists(self.input_path):
|
||||
raise FileNotFoundError(f"Cannot find input path: {self.input_path}")
|
||||
self.generate_subprocess()
|
||||
|
||||
def generate_subprocess(self):
|
||||
# Convert raw args from string if available and catch conflicts
|
||||
cmd = self.generate_worker_subprocess()
|
||||
raw_args = self.args.get('raw', None)
|
||||
if raw_args:
|
||||
import shlex
|
||||
args_split = shlex.split(raw_args)
|
||||
flags = [x for x in args_split if x.startswith('-')]
|
||||
conflict = any(element in flags for element in args_split)
|
||||
if conflict:
|
||||
raise ValueError("Custom args conflicts set parameters")
|
||||
else:
|
||||
cmd.extend(args_split)
|
||||
return cmd
|
||||
|
||||
def generate_worker_subprocess(self):
|
||||
raise NotImplementedError("generate_worker_subprocess not implemented")
|
||||
|
||||
def start(self):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user