--- a/QScintilla/EditorButtonsWidget.py Tue Jan 10 19:41:43 2017 +0100 +++ b/QScintilla/EditorButtonsWidget.py Wed Jan 11 19:28:04 2017 +0100 @@ -15,6 +15,7 @@ QSizePolicy, QScrollArea import UI.PixmapCache +import Preferences from . import MarkupProviders @@ -51,6 +52,7 @@ self.__editor.editorSaved.connect(self.__updateButtonStates) self.__editor.editorRenamed.connect(self.__updateButtonStates) self.__editor.selectionChanged.connect(self.__editorSelectionChanged) + self.__editor.settingsRead.connect(self.__editorSettingsRead) self.__createButtons() @@ -283,8 +285,8 @@ self.__editorSelectionChanged() - # TODO: make this configurable - self.setVisible(self.__provider.kind() != "none") + if Preferences.getEditor("HideFormatButtons"): + self.setVisible(self.__provider.kind() != "none") def __formatClicked(self, format): """ @@ -349,3 +351,13 @@ self.__provider.hasLine() and not hasSelection) self.__buttons["image"].setEnabled( self.__provider.hasImage() and not hasSelection) + + def __editorSettingsRead(self): + """ + Private slot to handle a change of the editor related settings. + """ + if Preferences.getEditor("HideFormatButtons"): + if self.__provider is not None: + self.setVisible(self.__provider.kind() != "none") + else: + self.setVisible(True)