Пример #1
0
def main():
    docs = Documentation()
    parser = argparse.ArgumentParser(
        description="Build Documentation for FrameLib")
    parser.add_argument("-hf",
                        "--helpfiles",
                        default=True,
                        action='store_false',
                        help="Toggle to build help files")
    parser.add_argument("-c",
                        "--clean",
                        default=True,
                        action='store_false',
                        help="Toggle for post-cleanup")
    parser.add_argument("-p",
                        "--package",
                        help="Provide a custom location for a package")
    args = parser.parse_args()

    if args.package:
        docs.set_package(args.package)

    tmp.main(docs)

    sign_off()
    space()

    # Stage 0
    # There is a prior stage here where make_object_list.py is called by Xcode.
    # This produces the header file which Build_Max_Docs.cpp uses to know about FrameLib objects and types.
    # Also, this where a number of temporary directories are created

    # Creates a category database in .json format.
    # The JSON file is used by 2_edit_raw_XML.py to assign object categories to the xml files.
    print("1. Building Category Database")
    create_category_database.main(docs)
    hyp()

    # The purpose of this script is to set the categories for the Raw XML files.
    # C++ doesnt know about the categories at XML creation.
    # Edited XML files are copied from /tmp/ to the refpages directory
    print("2. Editing XML Files")
    edit_raw_XML.main(docs)
    hyp()

    # This script creates a dictionary used to display specific object info in the extras Max Patch.
    # Similar to the qlookup, but is specifically used to display the digest with mouse hovering
    print("4. Building dlookup")
    parse_to_dlookup.main(docs)
    hyp()

    ## This script creates a dictionary that contains specific object information.
    # This provides the dynamic hover behaviour
    print("5. Building qlookup")
    parse_to_qlookup.main(docs)
    hyp()

    # Creates a dictionary used to display names and descriptions of tutorials in the extras Max Patch.
    # The tutorials are categorised by difficulty. {Beginner, Intermediate, Advanced}
    print("6. Building tlookup")
    parse_to_tlookup.main(docs)
    hyp()

    # Creates a dict containing information about object parameters. This is used by the help file template.
    print("7. Building jlookup")
    parse_to_jlookup.main(docs)
    hyp()

    # Creates a coll containing the file names of the tutorials. Makes it a bit easier to load them.
    print("8. Building tutorial name coll")
    create_tutorial_coll.main(docs)
    hyp()

    if args.helpfiles:
        # Creates the templates for each help file.
        # This is an outer shell containing generic information and framework to be filled in
        print("10. Creating help file templates")
        template_help.main(docs)
        hyp()

        print("11. Merging master templates with internal patchers")
        merge.main(docs)
        hyp()

        # Merges the hard coded tabs with the templates
        # This creates the finished help file
        print("12. Adding mismatch and trigger_ins tabs")
        mt.main(docs)
        hyp()

    if args.clean:
        cleanup.main(docs)
        print("Performing cleanup")

    print("Completed all python scripts.")
Пример #2
0
import xml.etree.ElementTree as et
from FrameLibDocs.utils import write_json, strip_space
from FrameLibDocs.classes import jParseAndBuild, Documentation


def main(docs: Documentation):
    """
    Creates a dict for the Max Documentation system.
    This dict contains more detailed information displayed in real-time when hovering over a certain tutorial in the umenu.
    """

    obj_lookup = docs.interfaces_dir / "FrameLib-obj-jlookup.json"

    worker = jParseAndBuild()

    refpages = [x for x in docs.refpages_dir.rglob("fl.*.xml")]

    for ref in refpages:
        worker.extract_from_refpage(ref)

    write_json(obj_lookup, worker.j_master_dict)


if __name__ == "__main__":
    main(Documentation())
from FrameLibDocs.classes import Documentation
from pathlib import Path
import sys

docs = Documentation()
op = open(docs.max_docs_dir / "Max_Object_List.h", "w+")


def write_comma(counter: int, ceiling: int) -> None:
    if counter < ceiling - 1:
        op.write(",")
        op.write("\n")
    else:
        op.write("\n")


def name_sanitisation(name: str) -> str:
    name = name.split(">")[0]
    name = name.split(",")[0]
    if name == "FrameLib_MaxClass_ToMax":
        name = "FrameLib_ToHost"
    elif name == "FrameLib_MaxClass_FromMax":
        name = "FrameLib_FromHost"
    elif name == "FrameLib_MaxClass_Info":
        name = "FrameLib_Info"
    elif name == "FrameLib_MaxClass_Read":
        name = "FrameLib_Read"
    elif name == "FrameLib_MaxClass_ComplexExpression":
        name = "FrameLib_ComplexExpression"
    elif name == "FrameLib_MaxClass_Expression":
        name = "FrameLib_Expression"