Skip to content

Commit

Permalink
Fixed crashes on startup, and when unsetting automatic global map colour
Browse files Browse the repository at this point in the history
  • Loading branch information
akamal committed Dec 19, 2015
1 parent 7dcf52e commit 5e87f0a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions widgets/map/globalmapwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ def init(self, app, datamanager):
self.widget.mapFileComboBox.currentIndexChanged.connect(self._slotMapFileComboTriggered)
# Init color controls
self.widget.mapColorButton.clicked.connect(self._slotMapColorSelectionTriggered)
self.widget.mapColorAutoToggle.setChecked(bool(int(self._app.settings.value('globalmapwidget/autoColour', 0))))
try:
self.widget.mapColorAutoToggle.setChecked(bool(int(self._app.settings.value('globalmapwidget/autoColour', 0))))
except ValueError:
self.widget.mapColorAutoToggle.setChecked(bool(self._app.settings.value('globalmapwidget/autoColour', False)))
#self.widget.mapColorAutoToggle.setChecked(False)

self.widget.mapColorAutoToggle.stateChanged.connect(self._slotMapColorAutoModeTriggered)
# Init stickyLabels Checkbox
self.stickyLabelsEnabled = False
Expand Down Expand Up @@ -773,7 +778,11 @@ def _slotMapColorAutoModeTriggered(self, value):
self._onPipColorChanged(None, None, None)
elif self.pipColor:
self.pipColor.unregisterValueUpdatedListener(self._onPipColorChanged)
self.signalSetColor.emit(self.pipColor)
r = self.pipColor.child(0).value() * 255
g = self.pipColor.child(1).value() * 255
b = self.pipColor.child(2).value() * 255
pipColor = QtGui.QColor.fromRgb(r,g,b)
self.signalSetColor.emit(pipColor)


@QtCore.pyqtSlot()
Expand Down

0 comments on commit 5e87f0a

Please sign in to comment.