Fixes: add character then choose new character does not set importance slider

See issue #102.

By default when a character is added to the character model, the
importance value is set to "0" (Minor).  However when the new
character is selected, the importance slider remains set to the value
of the previously selected character.

Steps to Reproduce:

1.  Click add character (plus sign) button.
2.  Select this "New character".
3.  Select "Basic infos" tab and change Name to "Bob".
4.  Move Importance slider all the way to the right (Main).
5.  Click add character (plus sign) button.
6.  Select this "New character".

    Note that the "New character" is shown in the character list pane
    under "Minor", but the Importance slider is still all the way to
    the right (Main).

This enhancement ensures that the corresponding character UI
importance slider is also set to the proper character importance.
This commit is contained in:
Curtis Gedak 2017-06-22 11:50:17 -06:00
parent fb9eb479f8
commit dedf5fb27a

View file

@ -179,6 +179,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Button color
self.updateCharacterColor(c.ID())
# Slider importance
self.updateCharacterImportance(c.ID())
# Character Infos
self.tblPersoInfos.setRootIndex(index)
@ -195,6 +198,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
color = c.color().name()
self.btnPersoColor.setStyleSheet("background:{};".format(color))
def updateCharacterImportance(self, ID):
c = self.mdlCharacter.getCharacterByID(ID)
self.sldPersoImportance.setValue(int(c.importance()))
###############################################################################
# PLOTS
###############################################################################