[Fix] <resedit> Nebulae loading and writing was borked.
This commit is contained in:
parent
a1aa45f7ff
commit
f2199bea53
@ -41,6 +41,21 @@ def load_Tag(node, do_array=None, do_special=None, do_special2=None):
|
||||
else:
|
||||
use_array = False
|
||||
|
||||
# I think they ugly hacks are a little overkill now.
|
||||
#
|
||||
# -- PARAMETER FORMAT --
|
||||
# { KEY:VALUE, ... }
|
||||
#
|
||||
# -- XML INPUT --
|
||||
# <KEY VALUE="aaa" ...>"xxx"</KEY>
|
||||
#
|
||||
# -- PYTHON OUTPUT --
|
||||
# KEY:{"xxx":"aaa"}
|
||||
#
|
||||
if do_special2 != None and node.nodeName in do_special2.keys():
|
||||
return { node.firstChild.data: \
|
||||
node.attributes[do_special2[node.nodeName]].value }, 1
|
||||
|
||||
for child in filter(lambda x: x.nodeType == x.ELEMENT_NODE, node.childNodes):
|
||||
n = 0
|
||||
|
||||
@ -89,24 +104,6 @@ def load_Tag(node, do_array=None, do_special=None, do_special2=None):
|
||||
child.attributes[do_special[node.nodeName]].value
|
||||
array.append(section)
|
||||
|
||||
# Maybe the ugly hacks are a litle overkill...
|
||||
#
|
||||
# -- PARAMETER FORMAT --
|
||||
# { KEY:VALUE, ... }
|
||||
#
|
||||
# -- XML INPUT --
|
||||
# <KEY VALUE="aaa" ...>"xxx"</KEY>
|
||||
#
|
||||
# -- PYTHON OUTPUT --
|
||||
# KEY:["xxx", "aaa"]
|
||||
#
|
||||
elif do_special2 != None and node.nodeName in do_special2.keys():
|
||||
array2 = []
|
||||
array2.append(child.firstChild.data)
|
||||
for item in do_special2[node.nodeName]:
|
||||
array2.append(child.attributes[do_special[node.nodeName]].value)
|
||||
section[node.nodeName]
|
||||
|
||||
# Normal way (but will overwrite lists).
|
||||
else:
|
||||
section[child.nodeName] = child.firstChild.data
|
||||
|
@ -307,7 +307,7 @@ class Space:
|
||||
self.__swidget("spiNebuVolatility").set_text(str(val))
|
||||
except:
|
||||
system["general"]["nebulae"] = {}
|
||||
nebu = system["general"]["nebuale"]['0'] = '0'
|
||||
nebu = system["general"]["nebuale"] = { '0':'0' }
|
||||
self.__swidget("spiNebuDensity").set_text("0")
|
||||
self.__swidget("spiNebuVolatility").set_Text("0")
|
||||
|
||||
@ -507,7 +507,7 @@ class Space:
|
||||
system["general"]["nebulae"] = {}
|
||||
density = self.__swidget("spiNebuDensity").get_text()
|
||||
volatility = self.__swidget("spiNebuVolatility").get_text()
|
||||
system["general"]["nebulae"]["density"] = volatility
|
||||
system["general"]["nebulae"] = { density:volotility }
|
||||
|
||||
def __pstore(self):
|
||||
'''
|
||||
@ -925,7 +925,7 @@ class Space:
|
||||
"""
|
||||
def __snew(self, wgt=None, event=None):
|
||||
name = "new system"
|
||||
gen = { "asteroids":0, "interference":0, "stars":100 }
|
||||
gen = { "asteroids":0, "interference":0, "stars":100, "nebulae":{ "0":"0" }}
|
||||
pos = { "x":0, "y":0 }
|
||||
new_ssys = { "general":gen, "pos":pos, "jumps":[], "fleets":[], "planets":[] }
|
||||
self.systems[name] = new_ssys
|
||||
|
Loading…
Reference in New Issue
Block a user