Exemplo n.º 1
0
 def changeFont(self, font):
     """
     Forwards selected font to the widget. If the chosen font is too different from the width of my symbol font,
     it declares it incompatible and disables structure visualization.
     """
     if self._currentWindow:
         self._currentWindow.widget().setFont(font)
         fmF = QFontMetricsF(font)
         if not fmF.averageCharWidth() - 0.5 <= self._currentWindow.widget().ssFontWidth <= \
                fmF.averageCharWidth() + 0.5:
             self.mainLogger.debug(
                 "Font size is too different from symbol font; disabling structure!"
             )
             self.mainStatus.showMessage(
                 "Font incompatible with structure symbols; please choose another!",
                 msecs=6000)
             self.optionsPane.structureActivate(False)
         elif self._currentWindow.widget(
         ).dssps and not self.optionsPane.checkStructure.isEnabled():
             self.optionsPane.structureActivate(True)
         del fmF
     del font