From 32f0d9fdb63c7ff574d312bbdbfac37c3ca7735e Mon Sep 17 00:00:00 2001 From: gandalf3 Date: Sun, 9 Jul 2017 14:49:34 -0700 Subject: [PATCH] Add docstrings --- subprocess_adapter.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/subprocess_adapter.py b/subprocess_adapter.py index 37724e5..2156d7e 100644 --- a/subprocess_adapter.py +++ b/subprocess_adapter.py @@ -35,6 +35,9 @@ def subprocess_operator(cls: Operator, polling_interval=.01) -> Operator: def decorate_invoke(orig_invoke): + """ + Create pipe and modal timer, start subprocess + """ def invoke(self, context, event): self.pipe = Pipe() @@ -57,6 +60,9 @@ def subprocess_operator(cls: Operator, polling_interval=.01) -> Operator: return invoke def poll_subprocess(self): + """ + Check the pipe for new messages (nonblocking). If there is a new message, call the callback + """ self.log.debug("polling") try: if self.pipe[0].poll(): @@ -75,8 +81,6 @@ def subprocess_operator(cls: Operator, polling_interval=.01) -> Operator: self.handle_response(resp.data) #TODO: make this a customizable callback # this should allow chaining of multiple subprocess in a single operator - return {'PASS_THROUGH'} - decoratify(cls, 'execute', decorate_execute) decoratify(cls, 'invoke', decorate_invoke) setattr(cls, 'poll_subprocess', poll_subprocess) @@ -104,6 +108,10 @@ def subprocess_function(func, *args, pipe, **kwargs): return wrapper class SubprocessMessage: + """ + Container for communications between child processes and the parent process + """ + #TODO: currently only used for child -> parent, might need something different for parent -> child? def __init__(self, exception=None, data=None): self.exception = exception self.data = data