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() panel.Layout()
def onCBGlobalColorBySlot(self, event): def onCBGlobalColorBySlot(self, event):
self.sFit.serviceFittingOptions["divideSlots"] = self.cbDivideSlots.GetValue() self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue()
fitID = self.mainFrame.getActiveFit() fitID = self.mainFrame.getActiveFit()
self.sFit.refreshFit(fitID) self.sFit.refreshFit(fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
event.Skip() event.Skip()
def onCBGlobalDivideSlots(self, event): def onCBGlobalDivideSlots(self, event):
self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue() self.sFit.serviceFittingOptions["divideSlots"] = self.cbDivideSlots.GetValue()
fitID = self.mainFrame.getActiveFit() fitID = self.mainFrame.getActiveFit()
self.sFit.refreshFit(fitID) self.sFit.refreshFit(fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))

View File

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

View File

@@ -82,7 +82,13 @@ class Fit(object):
self.booster = False self.booster = False
self.dirtyFitIDs = set() 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) self.serviceFittingOptions = SettingsProvider.getInstance().getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)