Burgerlib Python
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
burger.validators.EnumProperty Class Reference

Class to enforce string list in member variable. More...

Inheritance diagram for burger.validators.EnumProperty:
Inheritance graph
[legend]
Collaboration diagram for burger.validators.EnumProperty:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, name, enums)
 Initialize to default. More...
 
def __set__ (self, instance, value)
 Set the string value. More...
 
- Public Member Functions inherited from burger.validators.Property
def __init__ (self, name)
 Initialize to default. More...
 
def __get__ (self, instance, owner=None)
 Return value. More...
 
def __set__ (self, instance, value)
 Set the string value. More...
 

Private Attributes

 _enums
 Enumeration dictionary.
 

Detailed Description

Class to enforce string list in member variable.

Examples

j = (("a", "b", "c"), "d", "e", ["f", "g", "h"], "i")
"Inherit from (object) for Python 2.7"
>>> class foo(object):
"Init to 0"
x = EnumProperty(j, "a")
"Init to 0"
y = EnumProperty(j)
"Init to 4"
z = EnumProperty(j, "i")
"Create the class"
f = foo()
"Print 0"
print(f.x)
"Print 2"
f.x = "g"
print(f.x)
"Print 2"
f.x = "h"
print(f.x)

Constructor & Destructor Documentation

◆ __init__()

def burger.validators.EnumProperty.__init__ (   self,
  name,
  enums 
)

Initialize to default.

Parameters
nameName of the instance storage index
enumslist of enumeration strings

Reimplemented from burger.validators.Property.

Member Function Documentation

◆ __set__()

def burger.validators.EnumProperty.__set__ (   self,
  instance,
  value 
)

Set the string value.

Parameters
instanceReference to object containing data
valueNone or value the can be converted to bool

Reimplemented from burger.validators.Property.