Exemplo n.º 1
0
 def digestFont(font: QtGui.QFont) -> str:
     features = [font.family()]
     font.bold() and features.append("Bold")
     font.italic() and features.append("Italic")
     font.underline() and features.append("Underline")
     font.strikeOut() and features.append("Strike Out")
     len(features) == 1 and features.append("Regular")
     features.append(f"{font.pointSize()} pt")
     return " ".join(features)
Exemplo n.º 2
0
    def restoreDefaults(self):
        """
        restoreDefaults restore application defaults
        """

        self.parent.ui.chkBoxRestoreWindowSize.setChecked(True)
        self.parent.ui.chkBoxEnableLogging.setChecked(False)
        if config.data.get(config.ConfigKey.JobHistory) is not None:
            self.parent.ui.chkBoxEnableJobHistory.setChecked(False)
        self.parent.ui.chkBoxEnableLogViewer.setChecked(False)
        defaultFont = QFont()
        defaultFont.fromString(config.data.get(config.ConfigKey.SystemFont))
        self.parent.ui.fcmbBoxFontFamily.setCurrentFont(defaultFont.family())
        self.parent.ui.spinBoxFontSize.setValue(defaultFont.pointSize())
        if config.data.get(config.ConfigKey.Algorithm) is not None:
            self.parent.radioButtons[config.ALGORITHMDEFAULT].setChecked(True)
Exemplo n.º 3
0
    def clickedButton(self, button):
        """
        clickedButton deals with the final button clicked

        Args:
            button (QPushButton): buttons for the Preferences Dialog
        """

        buttonRole = self.parent.ui.btnBox.buttonRole(button)

        if buttonRole in [
                QDialogButtonBox.AcceptRole, QDialogButtonBox.ResetRole
        ]:
            if buttonRole == QDialogButtonBox.ResetRole:
                self.parent.ui.chkBoxRestoreWindowSize.setChecked(True)
                self.parent.ui.chkBoxEnableLogging.setChecked(False)
                defaultFont = QFont()
                defaultFont.fromString(
                    config.data.get(config.ConfigKey.SystemFont))
                self.parent.ui.fcmbBoxFontFamily.setCurrentFont(
                    defaultFont.family())
                self.parent.ui.spinBoxFontSize.setValue(
                    defaultFont.pointSize())
Exemplo n.º 4
0
 def _feedback_font_size(self, font: QFont):
     size = font.pointSize()
     self.size_input.setText(str(size))
     family = font.family()
     if family in self._fonts:
         self.family_menu.setCurrentIndex(self._fonts[family])
Exemplo n.º 5
0
    def _initUI(self):
        #
        # Interface Language
        #
        language = config.data.get(config.ConfigKey.Language)
        index = 0
        self.ui.cmbBoxInterfaceLanguage.clear()
        for key, value in config.data.get(
                config.ConfigKey.InterfaceLanguages).items():
            self.ui.cmbBoxInterfaceLanguage.addItem(value)
            if key == language:
                self.ui.cmbBoxInterfaceLanguage.setCurrentIndex(index)
            index += 1
        #
        # Font & Size
        #
        font = QFont()
        font.fromString(config.data.get(config.ConfigKey.Font))
        self.ui.fcmbBoxFontFamily.setCurrentFont(font.family())
        self.ui.spinBoxFontSize.setValue(font.pointSize())
        #
        # Logging is boolean value
        #
        isLogging = config.data.get(config.ConfigKey.Logging)
        self.ui.chkBoxEnableLogging.setChecked(
            config.data.get(config.ConfigKey.Logging))
        #
        # Enable Log Viewer
        #
        self.ui.chkBoxEnableLogViewer.setChecked(
            config.data.get(config.ConfigKey.LogViewer))
        #
        # Does not follow global palette fully
        #
        if platform.system() == "Windows":
            disabledColor = QColor(127, 127, 127)
            chkBoxPalette = self.ui.chkBoxEnableLogViewer.palette()
            chkBoxPalette.setColor(QPalette.Disabled, QPalette.WindowText,
                                   disabledColor)
            self.ui.chkBoxEnableLogViewer.setPalette(chkBoxPalette)
        if not isLogging:
            self.ui.chkBoxEnableLogViewer.setEnabled(False)
        #
        # Enable History
        #
        # Temporalily disable History
        #
        if config.data.get(config.ConfigKey.JobHistoryDisabled):
            self.ui.chkBoxEnableJobHistory.setEnabled(False)
            self.ui.chkBoxAutoSaveJobHistory.setEnabled(False)
            self.ui.chkBoxEnableJobHistory.hide()
            self.ui.chkBoxAutoSaveJobHistory.hide()

        if config.data.get(config.ConfigKey.JobHistory) is not None:
            self.ui.chkBoxEnableJobHistory.setChecked(
                config.data.get(config.ConfigKey.JobHistory))
        if config.data.get(config.ConfigKey.JobsAutoSave) is not None:
            self.ui.chkBoxAutoSaveJobHistory.setChecked(
                config.data.get(config.ConfigKey.JobsAutoSave))

        #
        # Restore Windows Size
        #
        self.ui.chkBoxRestoreWindowSize.setChecked(False)
        #
        # Algorithm
        #
        if config.data.get(config.ConfigKey.Algorithm) is not None:
            currentAlgorithm = config.data.get(config.ConfigKey.Algorithm)
            self.radioButtons[currentAlgorithm].setChecked(True)