Beispiel #1
0
    def _onSettingsDialogAboutToExecute(self, dialog):
        """UI settings dialogue is about to execute.
        Add own options
        """
        fontWidget = _SettingsPageWidget('Font.ui', dialog)
        indentWidget = _SettingsPageWidget('Indentation.ui', dialog)
        complWidget = _SettingsPageWidget('Autocompletion.ui', dialog)
        eolWidget = _SettingsPageWidget('Eol.ui', dialog)
        edgeWidget = _SettingsPageWidget('Edge.ui', dialog)
        wrapWidget = _SettingsPageWidget('Wrap.ui', dialog)

        dialog.appendPage(u"Editor/Font", fontWidget)
        dialog.appendPage(u"Editor/Indentation", indentWidget)
        dialog.appendPage(u"Editor/Autocompletion", complWidget)
        dialog.appendPage(u"Editor/EOL", eolWidget)
        dialog.appendPage(u"Editor/Edge", edgeWidget)
        dialog.appendPage(u"Editor/Wrap", wrapWidget)

        cfg = core.config()
        options = \
        (
            FontOption(dialog, cfg, "Qutepart/Font/Family", "Qutepart/Font/Size",
                       fontWidget.lFont, fontWidget.pbFont),

            ChoiseOption(dialog, cfg, "Qutepart/Indentation/UseTabs",
                         {indentWidget.rbIndentationSpaces : False,
                          indentWidget.rbIndentationTabs: True}),
            NumericOption(dialog, cfg, "Qutepart/Indentation/Width", indentWidget.sIndentationWidth),
            CheckableOption(dialog, cfg, "Qutepart/Indentation/AutoDetect", indentWidget.cbAutodetectIndent),

            ChoiseOption(dialog, cfg, "Qutepart/EOL/Mode",
                         {eolWidget.rbEolUnix: r'\n',
                          eolWidget.rbEolWindows: r'\r\n',
                          eolWidget.rbEolMac: r'\r'}),
            CheckableOption(dialog, cfg, "Qutepart/EOL/AutoDetect", eolWidget.cbAutoDetectEol),

            CheckableOption(dialog, cfg, "Qutepart/Edge/Enabled", edgeWidget.gbEdgeEnabled),
            NumericOption(dialog, cfg, "Qutepart/Edge/Column", edgeWidget.sEdgeColumnNumber),
            ColorOption(dialog, cfg, "Qutepart/Edge/Color", edgeWidget.tbEdgeColor),

            CheckableOption(dialog, cfg, "Qutepart/AutoCompletion/Enabled", complWidget.gbAutoCompletion),
            NumericOption(dialog, cfg, "Qutepart/AutoCompletion/Threshold", complWidget.sThreshold),

            CheckableOption(dialog, cfg, "Qutepart/Wrap/Enabled", wrapWidget.gbWrapEnabled),
            ChoiseOption(dialog, cfg, "Qutepart/Wrap/Mode",
                         {wrapWidget.rbWrapAtWord : "WrapAtWord",
                          wrapWidget.rbWrapAnywhere: "WrapAnywhere"}),
        )

        for option in options:
            dialog.appendOption(option)

        eolWidget.lReloadToReapply.setVisible(
            eolWidget.cbAutoDetectEol.isChecked())
Beispiel #2
0
    def _onSettingsDialogAboutToExecute(self, dialog):
        """UI settings dialogue is about to execute.
        Add own options
        """
        from .settings_widget import SettingsWidget
        widget = SettingsWidget(dialog)

        icon = QIcon(os.path.join(os.path.dirname(__file__), 'python.png'))
        dialog.appendPage("Lint/Python", widget, icon)

        # Options
        dialog.appendOption(
            CheckableOption(dialog, core.config(), "Lint/Python/Enabled",
                            widget.gbEnabled))
        dialog.appendOption(
            ChoiseOption(
                dialog, core.config(), "Lint/Python/Show", {
                    widget.rbErrors: "errors",
                    widget.rbErrorsAndWarnings: "errorsAndWarnings",
                    widget.rbAll: "all"
                }))
        dialog.appendOption(
            TextOption(dialog, core.config(), "Lint/Python/Path",
                       widget.leFlake8Path))
        dialog.appendOption(
            TextOption(dialog, core.config(), "Lint/Python/IgnoredMessages",
                       widget.leIgnoredMessages))
        dialog.appendOption(
            NumericOption(dialog, core.config(), "Lint/Python/MaxLineLength",
                          widget.spMaxLineLength))