mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Some slight updates.
This commit is contained in:
parent
363fa7e6ea
commit
3bac853c61
@ -230,6 +230,9 @@ class SeparatedListOf(Value):
|
|||||||
L[i] = v()
|
L[i] = v()
|
||||||
self.setValue(L)
|
self.setValue(L)
|
||||||
|
|
||||||
|
def setValue(self, v):
|
||||||
|
Value.setValue(self, list(v))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.joiner(self.value)
|
return self.joiner(self.value)
|
||||||
|
|
||||||
@ -309,9 +312,11 @@ class Group(object):
|
|||||||
def getValues(self, getChildren=False, fullNames=True):
|
def getValues(self, getChildren=False, fullNames=True):
|
||||||
L = []
|
L = []
|
||||||
items = self.values.items()
|
items = self.values.items()
|
||||||
for (name, child) in self.children.items():
|
# If getChildren=True, the group will insert itself into its getValues.
|
||||||
if hasattr(child, 'value'):
|
if not getChildren:
|
||||||
items.append((name, child))
|
for (name, child) in self.children.items():
|
||||||
|
if hasattr(child, 'value'):
|
||||||
|
items.append((name, child))
|
||||||
utils.sortBy(lambda (k, _): (k.lower(), len(k), k), items)
|
utils.sortBy(lambda (k, _): (k.lower(), len(k), k), items)
|
||||||
for (name, value) in items:
|
for (name, value) in items:
|
||||||
if fullNames:
|
if fullNames:
|
||||||
@ -346,6 +351,12 @@ class GroupWithValue(Group):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.value)
|
return str(self.value)
|
||||||
|
|
||||||
|
def getValues(self, getChildren=False, fullNames=True):
|
||||||
|
L = Group.getValues(self, getChildren, fullNames)
|
||||||
|
if getChildren:
|
||||||
|
L.insert(0, (self.getName(), self))
|
||||||
|
return L
|
||||||
|
|
||||||
|
|
||||||
class GroupWithDefault(GroupWithValue):
|
class GroupWithDefault(GroupWithValue):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
@ -362,6 +373,7 @@ class GroupWithDefault(GroupWithValue):
|
|||||||
GroupWithValue.__init__(self, value)
|
GroupWithValue.__init__(self, value)
|
||||||
|
|
||||||
def __makeChild(self, attr, s):
|
def __makeChild(self, attr, s):
|
||||||
|
#print '***', attr, ':', repr(s)
|
||||||
v = copy.copy(self.value)
|
v = copy.copy(self.value)
|
||||||
v.set(s)
|
v.set(s)
|
||||||
v.__class__ = self.X
|
v.__class__ = self.X
|
||||||
|
Loading…
Reference in New Issue
Block a user