Fix and implement preferences

This commit is contained in:
blitzmann
2014-03-24 12:23:22 -04:00
parent 22f92bed24
commit b98edc3f65
3 changed files with 26 additions and 20 deletions

View File

@@ -70,14 +70,14 @@ class PFGeneralPref ( PreferenceView):
panel.Layout()
def onCBGlobalColorBySlot(self, event):
self.sFit.serviceFittingOptions["divideSlots"] = self.cbDivideSlots.GetValue()
self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue()
fitID = self.mainFrame.getActiveFit()
self.sFit.refreshFit(fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
event.Skip()
def onCBGlobalDivideSlots(self, event):
self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue()
self.sFit.serviceFittingOptions["divideSlots"] = self.cbDivideSlots.GetValue()
fitID = self.mainFrame.getActiveFit()
self.sFit.refreshFit(fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))

View File

@@ -509,24 +509,24 @@ class FittingView(d.Display):
else:
self.SetItemBackgroundColour(i, self.GetBackgroundColour())
# if preference = enabled
# Get list of internal indexes, which is simply range of number of current items
internal = range(self.GetItemCount())
self.modMapping = {}
# Get list of internal indexes, which is simply range of number of current items
internal = range(self.GetItemCount())
if sFit.serviceFittingOptions["divideSlots"]:
# Insert blank row at correct index
for i, x in enumerate(self.blanks):
self.blanks[i] = x+i # modify blanks
self.InsertStringItem( x+i, '' ) # @todo: make it actually display something
# Insert row at correct index
for i, x in enumerate(self.blanks):
self.blanks[i] = x+i # modify blanks
self.InsertStringItem( x+i, 'l' ) # @todo: make it actually display something
# Create map
for i in range(self.GetItemCount()):
if i in self.blanks:
continue
self.modMapping[i] = internal.pop(0)
# else: map is simply internal indices
# Create map
for i in range(self.GetItemCount()):
if i in self.blanks:
continue
self.modMapping[i] = internal.pop(0)
else:
# if not dividing by slots, mapping is 1:1 with internal
self.modMapping = internal
self.Thaw()

View File

@@ -82,7 +82,13 @@ class Fit(object):
self.booster = False
self.dirtyFitIDs = set()
serviceFittingDefaultOptions = {"useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False}
serviceFittingDefaultOptions = {
"useGlobalCharacter": False,
"useGlobalDamagePattern": False,
"defaultCharacter": self.character.ID,
"useGlobalForceReload": False,
"colorFitBySlot": False,
"divideSlots": False}
self.serviceFittingOptions = SettingsProvider.getInstance().getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
@@ -141,11 +147,11 @@ class Fit(object):
self.recalc(fit)
return fit.ID
def toggleBoostFit(self, fitID):
def toggleBoostFit(self, fitID):
fit = eos.db.getFit(fitID)
fit.booster = not fit.booster
eos.db.commit()
def renameFit(self, fitID, newName):
fit = eos.db.getFit(fitID)
fit.name = newName