mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
added Enum.hasString and Enum.fromString
This commit is contained in:
parent
56ac220fa8
commit
85fc649f2c
@ -2360,6 +2360,15 @@ class Enum:
|
|||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return EnumIter(self)
|
return EnumIter(self)
|
||||||
|
|
||||||
|
def hasString(self, string):
|
||||||
|
return string in set(self._stringTable.values())
|
||||||
|
|
||||||
|
def fromString(self, string):
|
||||||
|
if self.hasString(string):
|
||||||
|
return self.__dict__[string]
|
||||||
|
# throw an error
|
||||||
|
{}[string]
|
||||||
|
|
||||||
def getString(self, value):
|
def getString(self, value):
|
||||||
return self._stringTable[value]
|
return self._stringTable[value]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user