Пример #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())
Пример #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))
Пример #3
0
    def __init__(self, dialog):
        # Initialize the dialog, loading in the literate programming settings
        # GUI.
        QWidget.__init__(self, dialog)
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), 'CodeChat_Settings.ui'),
            self)

        if CodeToRest is None:
            # If the CodeChat module can't be loaded, then disable the
            # associated checkbox and show the "not installed" message.
            self.cbCodeChat.setEnabled(False)
            self.labelCodeChatNotInstalled.setVisible(True)
            self.labelCodeChatNotInstalled.setEnabled(True)
        else:
            # Hide the "not installed" message.
            self.labelCodeChatNotInstalled.setVisible(False)

        # Add this GUI to the settings dialog box.
        dialog.appendPage("Literate programming", self)
        # Next, have the setting UI auto-update the corresponding CodeChat and
        # config entries.
        dialog.appendOption(
            CheckableOption(dialog, core.config(), "CodeChat/Enabled",
                            self.cbCodeChat))
Пример #4
0
    def __init__(self, settingsPage, dialog):
        # Initialize the dialog, loading in the literate programming settings
        # GUI.
        QWidget.__init__(self, dialog)
        uic.loadUi(os.path.join(os.path.dirname(__file__),
                                'Sphinx_Settings.ui'), self)

        # Make links gray when they are disabled
        palette = self.palette()
        palette.setColor(QPalette.Disabled,
                         QPalette.Link,
                         palette.color(QPalette.Disabled, QPalette.Text))
        self.lbSphinxReference.setPalette(palette)

        palette = self.palette()
        palette.setColor(QPalette.Active,
                         QPalette.WindowText,
                         palette.color(QPalette.Normal, QPalette.Link))
        self.lbSphinxEnableAdvMode.setPalette(palette)

        # Clicking on advanced mode label triggers either advanced mode or
        # normal mode.
        self.lbSphinxEnableAdvMode.mousePressEvent = self.on_ToggleSphinxSettingModeClicked

        # Update misc pieces of the GUI that can't be stored in the .ui file.
        self._updateSphinxSettingMode()

        # Add this GUI to the settings dialog box.
        settingsPage.addWidget(QLabel("<h3>Sphinx</h3>"))
        settingsPage.addWidget(self)
        # Next, have the setting UI auto-update the corresponding CodeChat and
        # config entries.
        dialog.appendOption(CheckableOption(dialog, core.config(),
                                            "Sphinx/Enabled",
                                            self.gbSphinxProject))
        dialog.appendOption(ChoiseOption(dialog, core.config(),
                                         "Sphinx/BuildOnSave",
                                         {self.rbBuildOnlyOnSave: True,
                                          self.rbBuildOnFileChange: False}))
        dialog.appendOption(TextOption(dialog, core.config(),
                                       "Sphinx/ProjectPath",
                                       self.leSphinxProjectPath))
        dialog.appendOption(TextOption(dialog, core.config(),
                                       "Sphinx/SourcePath",
                                       self.leSphinxSourcePath))
        dialog.appendOption(TextOption(dialog, core.config(),
                                       "Sphinx/OutputPath",
                                       self.leSphinxOutputPath))
        dialog.appendOption(TextOption(dialog, core.config(),
                                       "Sphinx/Executable",
                                       self.leSphinxExecutable))
        dialog.appendOption(TextOption(dialog, core.config(),
                                       "Sphinx/Cmdline",
                                       self.leSphinxCmdline))

        # Run this after the appendOption calls, since these fields must be set
        # up before _updateleValidateSphinxExecutable can run.
        self._updateleValidateSphinxExecutable()
Пример #5
0
    def _onSettingsDialogAboutToExecute(self, dialog):
        """UI settings dialogue is about to execute.
        Add own options
        """
        page = SettingsPage(dialog)
        dialog.appendPage(u"Autosave", page)

        # Options
        dialog.appendOption(
            CheckableOption(dialog, core.config(), "Autosave/Active",
                            page.checkbox))
Пример #6
0
    def _onSettingsDialogAboutToExecute(self, dialog):
        """UI settings dialogue is about to execute.
        Add own options
        """
        widget = SettingsWidget(dialog)

        dialog.appendPage("Navigator", widget, QIcon(':/enkiicons/goto.png'))

        # Options
        dialog.appendOption(
            TextOption(dialog, core.config(), "Navigator/CtagsPath",
                       widget.leCtagsPath))
        dialog.appendOption(
            CheckableOption(dialog, core.config(),
                            "Navigator/SortAlphabetically",
                            widget.cbSortTagsAlphabetically))