def __init__(self, context, pipeline): super(MultiObjectsDisplay, self).__init__() self.__context = context self.__pipeline = pipeline self.__cancelled = False self.__default_odisp = None self.__queues = {} self.__ocount = 0 self.__do_autoswitch = True self.__suppress_noyield = not not list(pipeline.get_status_commands()) self.set_show_tabs(False) self.__inputqueue = None intype = self.__pipeline.get_input_type() _logger.debug("input type %s opt: %s", intype, self.__pipeline.get_input_optional()) # FIXME assume for the moment we can only input strings; also explicitly avoid allowing input for 'any' # Long term we might consider only allowing input for SysBuiltin. if intype not in (None, 'any') and Pipeline.streamtype_is_assignable( intype, str, False) and self.__pipeline.get_input_optional(): self.__inputqueue = CommandQueue() self.__pipeline.set_input_queue(self.__inputqueue) self.append_ostream(pipeline.get_output_type(), None, pipeline.get_output(), False) for aux in pipeline.get_auxstreams(): self.append_ostream(aux.schema.otype, aux.name, aux.queue, aux.schema.merge_default)
def get_output(self): # Can't just return objects directly as this can be # called from other threads # TODO make this actually async queue = CommandQueue() gobject.idle_add(self.__enqueue_output, queue) for obj in QueueIterator(queue): yield obj