Exemplo n.º 1
0
class PagesLayoutDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("page1", String(None)),
        Field("page2", String(None)),
        Field("spaceDx", I32(4))
    ]
Exemplo n.º 2
0
class DirectionalLayoutDataDef(Struct):
    fields = [
        Field("controlName", String(None)),
        Field("sla", String(None)),  # this is really a float
        Field("snla", String(None)),  # this is really a float
        Field("align", String(None)),
    ]
Exemplo n.º 3
0
class ButtonVectorDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("clicked", String(None)),
        Field("path", String(None)),
        Field("styleDefault", String(None)),
        Field("styleMouseOver", String(None)),
    ]
Exemplo n.º 4
0
class VerticalLayoutDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("children", Array(DirectionalLayoutDataDef, []), Compact),
    ]
Exemplo n.º 5
0
class EbookPageDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("style", String(None)),
    ]
Exemplo n.º 6
0
class ScrollBarDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("style", String(None)),
        Field("cursor", String(None)),
    ]
Exemplo n.º 7
0
class ButtonDef(Struct):
    fields = [
        Field("name", String(None)),
        Field("text", WString(None)),
        Field("style", String(None)),
    ]
Exemplo n.º 8
0
def GetFields(xml):
    fields = []
    for xml_field in xml.getElementsByTagName("field"):
        field = Field()
        for attr_name, attr_value in xml_field.attributes.items():
            if attr_name.lower() == "name":
                field.name = attr_value
            elif attr_name.lower() == "rname":
                field.rname = attr_value
            elif attr_name.lower() == "domain":
                field.domain = attr_value
            elif attr_name.lower() == "description":
                field.description = attr_value
            elif attr_name.lower() == "props":
                for prop in attr_value.split(", "):
                    if prop == "input":
                        field.input = True
                    elif prop == "edit":
                        field.edit = True
                    elif prop == "show_in_grid":
                        field.show_in_grid = True
                    elif prop == "show_in_details":
                        field.show_in_details = True
                    elif prop == "is_mean":
                        field.is_mean = True
                    elif prop == "autocalculated":
                        field.autocalculated = True
                    elif prop == "required":
                        field.required = True
                    else:
                        raise ValueError(
                            "Invalid format of props string in constraints: {}"
                            .format(attr_value))
            else:
                raise ValueError(
                    "In tag \"{}\" Invalid attribute name \"{}\"".format(
                        field, attr_name))
        fields.append(field)
    return fields