Merge branch 'aacn500-validate-import'
This commit is contained in:
@@ -261,6 +261,9 @@ class Fit(object):
|
|||||||
self.recalc(fit, withBoosters=True)
|
self.recalc(fit, withBoosters=True)
|
||||||
fit.fill()
|
fit.fill()
|
||||||
|
|
||||||
|
# Check that the states of all modules are valid
|
||||||
|
self.checkStates(fit, None)
|
||||||
|
|
||||||
eos.db.commit()
|
eos.db.commit()
|
||||||
fit.inited = True
|
fit.inited = True
|
||||||
return fit
|
return fit
|
||||||
|
|||||||
@@ -123,7 +123,10 @@ class Port(object):
|
|||||||
|
|
||||||
# If XML-style start of tag encountered, detect as XML
|
# If XML-style start of tag encountered, detect as XML
|
||||||
if re.match("<", firstLine):
|
if re.match("<", firstLine):
|
||||||
return "XML", cls.importXml(string, callback, encoding)
|
if encoding:
|
||||||
|
return "XML", cls.importXml(string, callback, encoding)
|
||||||
|
else:
|
||||||
|
return "XML", cls.importXml(string, callback)
|
||||||
|
|
||||||
# If JSON-style start, parse os CREST/JSON
|
# If JSON-style start, parse os CREST/JSON
|
||||||
if firstLine[0] == '{':
|
if firstLine[0] == '{':
|
||||||
@@ -176,10 +179,13 @@ class Port(object):
|
|||||||
# When item can't be added to any slot (unknown item or just charge), ignore it
|
# When item can't be added to any slot (unknown item or just charge), ignore it
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
if m.isValidState(State.ACTIVE):
|
if m.fits(f):
|
||||||
m.state = State.ACTIVE
|
m.owner = f
|
||||||
|
if m.isValidState(State.ACTIVE):
|
||||||
|
m.state = State.ACTIVE
|
||||||
|
|
||||||
|
f.modules.append(m)
|
||||||
|
|
||||||
f.modules.append(m)
|
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -219,9 +225,11 @@ class Port(object):
|
|||||||
for i in xrange(int(amount)):
|
for i in xrange(int(amount)):
|
||||||
try:
|
try:
|
||||||
m = Module(item)
|
m = Module(item)
|
||||||
f.modules.append(m)
|
if m.fits(f):
|
||||||
|
f.modules.append(m)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
m.owner = f
|
||||||
if m.isValidState(State.ACTIVE):
|
if m.isValidState(State.ACTIVE):
|
||||||
m.state = State.ACTIVE
|
m.state = State.ACTIVE
|
||||||
|
|
||||||
@@ -315,12 +323,15 @@ class Port(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if setOffline is True and m.isValidState(State.OFFLINE):
|
if m.fits(fit):
|
||||||
m.state = State.OFFLINE
|
m.owner = fit
|
||||||
elif m.isValidState(State.ACTIVE):
|
if setOffline is True and m.isValidState(State.OFFLINE):
|
||||||
m.state = State.ACTIVE
|
m.state = State.OFFLINE
|
||||||
|
elif m.isValidState(State.ACTIVE):
|
||||||
|
m.state = State.ACTIVE
|
||||||
|
|
||||||
|
fit.modules.append(m)
|
||||||
|
|
||||||
fit.modules.append(m)
|
|
||||||
|
|
||||||
for droneName in droneMap:
|
for droneName in droneMap:
|
||||||
d = Drone(sMkt.getItem(droneName))
|
d = Drone(sMkt.getItem(droneName))
|
||||||
@@ -467,6 +478,7 @@ class Port(object):
|
|||||||
|
|
||||||
# Create module and activate it if it's activable
|
# Create module and activate it if it's activable
|
||||||
m = Module(modItem)
|
m = Module(modItem)
|
||||||
|
m.owner = f
|
||||||
if m.isValidState(State.ACTIVE):
|
if m.isValidState(State.ACTIVE):
|
||||||
m.state = State.ACTIVE
|
m.state = State.ACTIVE
|
||||||
# Add charge to mod if applicable, on any errors just don't add anything
|
# Add charge to mod if applicable, on any errors just don't add anything
|
||||||
@@ -478,7 +490,9 @@ class Port(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# Append module to fit
|
# Append module to fit
|
||||||
f.modules.append(m)
|
if m.fits(f):
|
||||||
|
f.modules.append(m)
|
||||||
|
|
||||||
# Append fit to list of fits
|
# Append fit to list of fits
|
||||||
fits.append(f)
|
fits.append(f)
|
||||||
|
|
||||||
@@ -534,12 +548,16 @@ class Port(object):
|
|||||||
# When item can't be added to any slot (unknown item or just charge), ignore it
|
# When item can't be added to any slot (unknown item or just charge), ignore it
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
if m.isValidState(State.ACTIVE):
|
if m.fits(f):
|
||||||
m.state = State.ACTIVE
|
m.owner = f
|
||||||
|
if m.isValidState(State.ACTIVE):
|
||||||
|
m.state = State.ACTIVE
|
||||||
|
|
||||||
|
f.modules.append(m)
|
||||||
|
|
||||||
f.modules.append(m)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fits.append(f)
|
fits.append(f)
|
||||||
if callback:
|
if callback:
|
||||||
wx.CallAfter(callback, None)
|
wx.CallAfter(callback, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user