Exemplo n.º 1
0
    def create_tag(self, name, description, text="tag"):
        """
        Creates a new tag object. Returns the new tag object.

        If either the name or description parameters are None, the user will be
        prompted to input them.

        The "text" parameter should be the text description to use upon user
        input. For example, if we were creating a tag, this would be "tag"
        (the default). If we were creating a tagset, this could be "tag set".
        """
        if name is None:
            name = raw_input("Please enter a name for this %s: " % text)

        if description is None:
            description = raw_input("Please enter a description for this %s: "
                                    % text)

        if name is not None and description is not None and name != '':
            tag = TagAnnotationI()
            tag.textValue = rstring(name)
            if description is not None and len(description) > 0:
                tag.description = rstring(description)

            return tag
        else:
            self.ctx.err("Tag/tagset name cannot be 'None' or empty.")
            sys.exit(1)
def createTag(name, description=None):
    print "Create Tag:", name
    tag = TagAnnotationI()
    tag.textValue = rstring(name)
    if description is not None:
        tag.description = rstring(description)
    return tag
Exemplo n.º 3
0
    def create_tag(self, name, description, text="tag"):
        """
        Creates a new tag object. Returns the new tag object.

        If either the name or description parameters are None, the user will be
        prompted to input them.

        The "text" parameter should be the text description to use upon user
        input. For example, if we were creating a tag, this would be "tag"
        (the default). If we were creating a tagset, this could be "tag set".
        """
        if name is None:
            name = raw_input("Please enter a name for this %s: " % text)

        if description is None:
            description = raw_input(
                "Please enter a description for this %s: " % text)

        if name is not None and description is not None and name != '':
            tag = TagAnnotationI()
            tag.textValue = rstring(name)
            if description is not None and len(description) > 0:
                tag.description = rstring(description)

            return tag
        else:
            self.ctx.err("Tag/tagset name cannot be 'None' or empty.")
            sys.exit(1)
Exemplo n.º 4
0
def tags_userA_userB(request, userA, userB, groupA):
    """
    Returns new OMERO Tags with descriptions
    """
    tags = []
    ctx = {'omero.group': native_str(groupA.id.val)}
    for name, user in zip(["userAtag", "userBtag"], [userA, userB]):
        tag = TagAnnotationI()
        tag.textValue = rstring(name)
        # Only add description to first tag
        if name == "userAtag":
            tag.description = rstring('tag description')
        tag = get_update_service(user).saveAndReturnObject(tag, ctx)
        tags.append(tag)
    tags.sort(key=lambda x: unwrap(x.id))
    return tags