Exemple #1
0
def import_profile_from_workbook(
    profile,
    workbook,
    svg_path,
    post_calculate=False,
):
    """Command independent importer"""

    # Process COMaster for profile
    COMaster.import_excel(workbook, profile=profile)
    # Configuration for text representation of events
    EventText.import_excel(workbook, profile=profile)
    EventDescription.import_excel(workbook, profile=profile)
    ComEventKind.import_excel(workbook, profile=profile)
    Action.import_excel(workbook, profile=profile)

    # Fabric inspired directory change
    with cd(svg_path):
        SVGScreen.import_excel(workbook, profile=profile)

    SVGElement.import_excel(workbook, screens=profile.screens.all())
    Formula.import_excel(workbook, screens=profile.screens.all())
    Color.import_excel(workbook, profile=profile)
    SVGPropertyChangeSet.import_excel(workbook, profile=profile)

    if post_calculate:
        ok, error = Formula.calculate()
        return result_type(ok, error, ok + error)
    return result_type(0, 0, Formula.objects.all().count())
Exemple #2
0
def import_profile_from_workbook(profile, workbook, svg_path,
                                 post_calculate=False,):
    """Command independent importer"""

    # Process COMaster for profile
    COMaster.import_excel(workbook, profile=profile)
    # Configuration for text representation of events
    EventText.import_excel(workbook, profile=profile)
    EventDescription.import_excel(workbook, profile=profile)
    ComEventKind.import_excel(workbook, profile=profile)
    Action.import_excel(workbook, profile=profile)

    # Fabric inspired directory change
    with cd(svg_path):
        SVGScreen.import_excel(workbook, profile=profile)

    SVGElement.import_excel(workbook, screens=profile.screens.all())
    Formula.import_excel(workbook, screens=profile.screens.all())
    Color.import_excel(workbook, profile=profile)
    SVGPropertyChangeSet.import_excel(workbook, profile=profile)

    if post_calculate:
        ok, error = Formula.calculate()
        return result_type(ok, error, ok + error)
    return result_type(0, 0, Formula.objects.all().count())
Exemple #3
0
def import_profile_from_workbook(profile, workbook, no_calculate=False,):
    """Command independent importer"""

    for comaster in profile.comasters.all():
        add_vs_to_comaster(comaster)

    ieds = IED.objects.filter(co_master__profile=profile)
    DI.import_excel(workbook, ieds=ieds)
    AI.import_excel(workbook, ieds=ieds)

    screens = profile.screens.all()
    SVGElement.import_excel(workbook, screens=screens)
    Formula.import_excel(workbook, screens=screens)

    if not no_calculate:
        ok, error = Formula.calculate()
        return result_type(ok, error, ok + error)
    return result_type(0, 0, Formula.objects.all().count())
def import_profile_from_workbook(
    profile,
    workbook,
    no_calculate=False,
):
    """Command independent importer"""

    for comaster in profile.comasters.all():
        add_vs_to_comaster(comaster)

    ieds = IED.objects.filter(co_master__profile=profile)
    DI.import_excel(workbook, ieds=ieds)
    AI.import_excel(workbook, ieds=ieds)

    screens = profile.screens.all()
    SVGElement.import_excel(workbook, screens=screens)
    Formula.import_excel(workbook, screens=screens)

    if not no_calculate:
        ok, error = Formula.calculate()
        return result_type(ok, error, ok + error)
    return result_type(0, 0, Formula.objects.all().count())