def create_descriptor_list(self):
        from core.modules.module_registry import get_module_registry, \
            module_registry_loaded
        if not module_registry_loaded():
            return None
        registry = get_module_registry()
        assert self.sigstring[0] == '(' and self.sigstring[-1] == ')'

        recompute_sigstring = False
        self._descriptors = []
        if self.sigstring != '()':
            for sig in self.sigstring[1:-1].split(','):
                k = sig.split(':', 2)
                if len(k) < 2:
                    d = registry.get_descriptor_from_name_only(k[0])
                    self._descriptors.append(d)
                    recompute_sigstring = True
                else:
                    d = registry.get_descriptor_by_name(*k)
                    self._descriptors.append(d)

        if recompute_sigstring:
            self.sigstring = "(" + \
                ",".join(d.sigstring for d in self._descriptors) + ")"
            self.create_tooltip()
    def create_sigstring_and_descriptors(self):
        """create_sigstring() -> None

        Creates string with the signature of the portspec.

        """
        from core.modules.module_registry import get_module_registry, \
            module_registry_loaded
        if not module_registry_loaded():
            return None
        registry = get_module_registry()
        sig_list = []
        self._descriptors = []

        for (klass, _) in self._entries:
            descriptor = registry.get_descriptor(klass)
            sig_list.append(descriptor.sigstring)
            self._descriptors.append(descriptor)

        self.sigstring = "(" + ",".join(sig_list) + ")"
 def convert(_port_spec):
     from core.modules.module_registry import module_registry_loaded, \
         ModuleRegistryException
     if _port_spec.__class__ == PortSpec:
         return
     _port_spec.__class__ = PortSpec
     _port_spec._entries = None
     _port_spec._descriptors = None
     _port_spec._short_sigstring = None
     _port_spec._labels = None
     _port_spec._defaults = None
     _port_spec._tooltip = None
     _port_spec.is_valid = True
     # FIXME probably can just let validation take care of this...
     if module_registry_loaded():
         try:
             _port_spec.create_entries_and_descriptors()
             _port_spec.create_tooltip()
         except ModuleRegistryException, e:
             _port_spec._descriptors = None
             _port_spec._entries = None