Example #1
0
class DrawMode(SmartEnum):
    ###############################################################################
    """
    Describes which draw mode we're in.
    """

    # Allows us to change how the class works. In this case, I want to be able
    # to iterate over the class with the semantics of iterating over all the
    # possible enum values. I also want to be able to use the "in" operator
    # to check if something is a valid enum value.
    __metaclass__ = _DrawModeMeta

    # Enum values. Note these are *placeholders*, the free code below this
    # class will replace these values with proper DrawMode objects.
    CIV, \
    LAND, \
    YIELD, \
    ELEVATION, \
    SNOWPACK, \
    SEASURFACETEMP, \
    MOISTURE, \
    GEOLOGY, \
    MAGMA, \
    TENSION, \
    WIND, \
    TEMPERATURE, \
    PRESSURE, \
    PRECIP, \
    DEWPOINT = range(15)

    # Derive names from class members.
    _NAMES = create_names_by_enum_value(vars())

    def __init__(self, value):
        super(DrawMode, self).__init__(value)
Example #2
0
class Direction(SmartEnum):
    ###############################################################################
    """
    Describes directionality
    """

    __metaclass__ = _DirectionMeta

    # Enum values. Note these are *placeholders*, the free code below this
    # class will replace these values with proper Direction objects.
    N,   \
    NNE, \
    NE,  \
    ENE, \
    E,   \
    ESE, \
    SE , \
    SSE, \
    S,   \
    SSW, \
    SW,  \
    WSW, \
    W,   \
    WNW, \
    NW,  \
    NNW = range(16)

    # Derive names from class members.
    _NAMES = create_names_by_enum_value(vars())

    def __init__(self, value):
        super(Direction, self).__init__(value)
Example #3
0
class AnomalyCategory(SmartEnum):
    ###############################################################################
    """
    Describes the types of anomalies that can happen
    """

    __metaclass__ = _AnomalyCategoryMeta

    # Enum values. Note these are *placeholders*, the free code below this
    # class will replace these values with proper AnomalyCategory objects.
    TEMPERATURE, \
    PRECIP, \
    PRESSURE = range(3)

    # Derive names from class members.
    _NAMES = create_names_by_enum_value(vars())

    def __init__(self, value):
        super(AnomalyCategory, self).__init__(value)
Example #4
0
class Season(SmartEnum):
###############################################################################
    """
    Describes which season we're in.
    """

    __metaclass__ = _SeasonMeta

    # Enum values. Note these are *placeholders*, the free code below this
    # class will replace these values with proper Season objects.
    WINTER, \
    SPRING, \
    SUMMER, \
    FALL = range(4)

    # Derive names from class members.
    _NAMES = create_names_by_enum_value(vars())

    def __init__(self, value):
        super(Season, self).__init__(value)
Example #5
0
class Interfaces(SmartEnum):
    ###############################################################################
    """
    An enum that lists the various interface choices
    """

    __metaclass__ = _InterfacesMeta

    # Enum values. Note these are *placeholders*, the free code below this
    # class will replace these values with proper Interfaces objects.
    #
    # First listed interface will be default
    TEXT, \
    PYGAME, \
    PANDA = range(3)

    # Derive names from class members.
    _NAMES = create_names_by_enum_value(vars())

    def __init__(self, value):
        super(Interfaces, self).__init__(value)