Fix brush mode always resetting to "Biome"
This commit is contained in:
parent
6690a1cad5
commit
9967550ed9
@ -229,16 +229,24 @@ class BrushModeWidget(QtGui.QComboBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BrushModeWidget, self).__init__(*args, **kwargs)
|
||||
self.currentIndexChanged.connect(self.indexDidChange)
|
||||
|
||||
self.adding = False
|
||||
def setModes(self, modes):
|
||||
for mode in modes:
|
||||
self.addItem(mode.displayName, mode.name)
|
||||
|
||||
currentID = BrushModeSetting.value()
|
||||
currentIndex = self.findData(currentID)
|
||||
if currentIndex == -1:
|
||||
currentIndex = 0
|
||||
self.setCurrentIndex(currentIndex)
|
||||
self.adding = True
|
||||
try:
|
||||
for mode in modes:
|
||||
self.addItem(mode.displayName, mode.name)
|
||||
|
||||
currentID = BrushModeSetting.value()
|
||||
currentIndex = self.findData(currentID)
|
||||
if currentIndex == -1:
|
||||
log.info("Search failed!")
|
||||
currentIndex = 0
|
||||
log.info("Loading BrushModeWidget setting: found %s at %s", currentID, currentIndex)
|
||||
self.setCurrentIndex(currentIndex)
|
||||
finally:
|
||||
self.adding = False
|
||||
|
||||
def indexDidChange(self):
|
||||
if self.adding:
|
||||
return
|
||||
BrushModeSetting.setValue(self.itemData(self.currentIndex()))
|
||||
|
Reference in New Issue
Block a user