Example #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())
Example #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())
Example #3
0
    def test_peso_accion(self):
        for i in range(8):
            Action.objects.create(bit=i,
                                  descripcion='Accion bit %d' % i,
                                  script='',
                                  argumentos='')

        def pks(objs):
            [obj.pk for obj in objs]



        self.assertEqual(
                        pks(Action.get_actions_for_peso(3)),
                        pks(Action.objects.filter(bit__in = [1,2]))
                        )