newDefaultLocation: Return location in design space
This commit is contained in:
parent
c4899330c5
commit
5f7afa23b2
@ -1128,11 +1128,14 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
|
|||||||
self.rules.append(ruleDescriptor)
|
self.rules.append(ruleDescriptor)
|
||||||
|
|
||||||
def newDefaultLocation(self):
|
def newDefaultLocation(self):
|
||||||
|
"""Return default location in design space."""
|
||||||
# Without OrderedDict, output XML would be non-deterministic.
|
# Without OrderedDict, output XML would be non-deterministic.
|
||||||
# https://github.com/LettError/designSpaceDocument/issues/10
|
# https://github.com/LettError/designSpaceDocument/issues/10
|
||||||
loc = collections.OrderedDict()
|
loc = collections.OrderedDict()
|
||||||
for axisDescriptor in self.axes:
|
for axisDescriptor in self.axes:
|
||||||
loc[axisDescriptor.name] = axisDescriptor.default
|
loc[axisDescriptor.name] = axisDescriptor.map_forward(
|
||||||
|
axisDescriptor.default
|
||||||
|
)
|
||||||
return loc
|
return loc
|
||||||
|
|
||||||
def updateFilenameFromPath(self, masters=True, instances=True, force=False):
|
def updateFilenameFromPath(self, masters=True, instances=True, force=False):
|
||||||
|
@ -5,9 +5,10 @@
|
|||||||
<labelname xml:lang="en">Wéíght</labelname>
|
<labelname xml:lang="en">Wéíght</labelname>
|
||||||
<labelname xml:lang="fa-IR">قطر</labelname>
|
<labelname xml:lang="fa-IR">قطر</labelname>
|
||||||
</axis>
|
</axis>
|
||||||
<axis tag="wdth" name="width" minimum="0" maximum="1000" default="20" hidden="1">
|
<axis tag="wdth" name="width" minimum="0" maximum="1000" default="15" hidden="1">
|
||||||
<labelname xml:lang="fr">Chasse</labelname>
|
<labelname xml:lang="fr">Chasse</labelname>
|
||||||
<map input="0" output="10"/>
|
<map input="0" output="10"/>
|
||||||
|
<map input="15" output="20"/>
|
||||||
<map input="401" output="66"/>
|
<map input="401" output="66"/>
|
||||||
<map input="1000" output="990"/>
|
<map input="1000" output="990"/>
|
||||||
</axis>
|
</axis>
|
||||||
|
@ -66,10 +66,10 @@ def test_fill_document(tmpdir):
|
|||||||
a2 = AxisDescriptor()
|
a2 = AxisDescriptor()
|
||||||
a2.minimum = 0
|
a2.minimum = 0
|
||||||
a2.maximum = 1000
|
a2.maximum = 1000
|
||||||
a2.default = 20
|
a2.default = 15
|
||||||
a2.name = "width"
|
a2.name = "width"
|
||||||
a2.tag = "wdth"
|
a2.tag = "wdth"
|
||||||
a2.map = [(0.0, 10.0), (401.0, 66.0), (1000.0, 990.0)]
|
a2.map = [(0.0, 10.0), (15.0, 20.0), (401.0, 66.0), (1000.0, 990.0)]
|
||||||
a2.hidden = True
|
a2.hidden = True
|
||||||
a2.labelNames[u'fr'] = u"Chasse"
|
a2.labelNames[u'fr'] = u"Chasse"
|
||||||
doc.addAxis(a2)
|
doc.addAxis(a2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user