Esempio n. 1
0
    def __init__(self):
        """
        Constructor
        """
        super(EditorCalltipsPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("EditorCalltipsPage")

        if QSCINTILLA_VERSION() >= 0x020700:
            self.positionComboBox.addItem(self.tr("Below Text"),
                                          QsciScintilla.CallTipsBelowText)
            self.positionComboBox.addItem(self.tr("Above Text"),
                                          QsciScintilla.CallTipsAboveText)
        else:
            self.calltipsPositionBox.hide()

        # set initial values
        self.ctEnabledCheckBox.setChecked(
            Preferences.getEditor("CallTipsEnabled"))

        self.ctVisibleSlider.setValue(Preferences.getEditor("CallTipsVisible"))
        self.initColour("CallTipsBackground", self.calltipsBackgroundButton,
                        Preferences.getEditorColour)

        self.ctScintillaCheckBox.setChecked(
            Preferences.getEditor("CallTipsScintillaOnFail"))

        if QSCINTILLA_VERSION() >= 0x020700:
            self.positionComboBox.setCurrentIndex(
                self.positionComboBox.findData(
                    Preferences.getEditor("CallTipsPosition")))
Esempio n. 2
0
    def save(self):
        """
        Public slot to save the EditorCalltips configuration.
        """
        Preferences.setEditor("CallTipsEnabled",
                              self.ctEnabledCheckBox.isChecked())

        Preferences.setEditor("CallTipsVisible", self.ctVisibleSlider.value())
        self.saveColours(Preferences.setEditorColour)

        Preferences.setEditor("CallTipsScintillaOnFail",
                              self.ctScintillaCheckBox.isChecked())

        if QSCINTILLA_VERSION() >= 0x020700:
            Preferences.setEditor(
                "CallTipsPosition",
                self.positionComboBox.itemData(
                    self.positionComboBox.currentIndex()))
Esempio n. 3
0
    def __init__(self):
        """
        Constructor
        """
        super(EditorStylesPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("EditorStylesPage")

        from QScintilla.QsciScintillaCompat import QsciScintillaCompat, \
            QSCINTILLA_VERSION
        self.foldStyles = [
            QsciScintilla.PlainFoldStyle,
            QsciScintilla.CircledFoldStyle,
            QsciScintilla.BoxedFoldStyle,
            QsciScintilla.CircledTreeFoldStyle,
            QsciScintilla.BoxedTreeFoldStyle,
            QsciScintillaCompat.ArrowFoldStyle,
            QsciScintillaCompat.ArrowTreeFoldStyle,
        ]

        self.edgeModes = [
            QsciScintilla.EdgeNone, QsciScintilla.EdgeLine,
            QsciScintilla.EdgeBackground
        ]

        self.wrapModeComboBox.addItem(self.tr("Disabled"),
                                      QsciScintilla.WrapNone)
        self.wrapModeComboBox.addItem(self.tr("Word Boundary"),
                                      QsciScintilla.WrapWord)
        self.wrapModeComboBox.addItem(self.tr("Character Boundary"),
                                      QsciScintilla.WrapCharacter)
        self.wrapVisualComboBox.addItem(self.tr("No Indicator"),
                                        QsciScintilla.WrapFlagNone)
        self.wrapVisualComboBox.addItem(self.tr("Indicator by Text"),
                                        QsciScintilla.WrapFlagByText)
        self.wrapVisualComboBox.addItem(self.tr("Indicator by Margin"),
                                        QsciScintilla.WrapFlagByBorder)
        if QSCINTILLA_VERSION() >= 0x020700:
            self.wrapVisualComboBox.addItem(
                self.tr("Indicator in Line Number Margin"),
                QsciScintilla.WrapFlagInMargin)

        if QSCINTILLA_VERSION() < 0x020800:
            self.caretlineAlwaysVisibleCheckBox.hide()

        # set initial values
        try:
            self.foldingStyleComboBox.setCurrentIndex(
                self.foldStyles.index(Preferences.getEditor("FoldingStyle")))
        except ValueError:
            self.foldingStyleComboBox.setCurrentIndex(0)
        self.marginsFont = Preferences.getEditorOtherFonts("MarginsFont")
        self.marginsFontSample.setFont(self.marginsFont)
        self.defaultFont = Preferences.getEditorOtherFonts("DefaultFont")
        self.defaultFontSample.setFont(self.defaultFont)
        self.monospacedFont = Preferences.getEditorOtherFonts("MonospacedFont")
        self.monospacedFontSample.setFont(self.monospacedFont)
        self.monospacedCheckBox.setChecked(
            Preferences.getEditor("UseMonospacedFont"))
        self.linenoCheckBox.setChecked(Preferences.getEditor("LinenoMargin"))
        self.foldingCheckBox.setChecked(Preferences.getEditor("FoldingMargin"))
        self.unifiedMarginsCheckBox.setChecked(
            Preferences.getEditor("UnifiedMargins"))

        self.caretlineVisibleCheckBox.setChecked(
            Preferences.getEditor("CaretLineVisible"))
        self.caretlineAlwaysVisibleCheckBox.setChecked(
            Preferences.getEditor("CaretLineAlwaysVisible"))
        self.caretWidthSpinBox.setValue(Preferences.getEditor("CaretWidth"))
        self.colourizeSelTextCheckBox.setChecked(
            Preferences.getEditor("ColourizeSelText"))
        self.customSelColourCheckBox.setChecked(
            Preferences.getEditor("CustomSelectionColours"))
        self.extentSelEolCheckBox.setChecked(
            Preferences.getEditor("ExtendSelectionToEol"))

        self.initColour("CaretForeground", self.caretForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("CaretLineBackground",
                        self.caretlineBackgroundButton,
                        Preferences.getEditorColour,
                        hasAlpha=True)
        self.initColour("SelectionForeground", self.selectionForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("SelectionBackground",
                        self.selectionBackgroundButton,
                        Preferences.getEditorColour,
                        hasAlpha=True)
        self.initColour("CurrentMarker",
                        self.currentLineMarkerButton,
                        Preferences.getEditorColour,
                        hasAlpha=True)
        self.initColour("ErrorMarker",
                        self.errorMarkerButton,
                        Preferences.getEditorColour,
                        hasAlpha=True)
        self.initColour("MarginsForeground", self.marginsForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("MarginsBackground", self.marginsBackgroundButton,
                        Preferences.getEditorColour)
        self.initColour("FoldmarginBackground",
                        self.foldmarginBackgroundButton,
                        Preferences.getEditorColour)
        self.initColour("FoldMarkersForeground",
                        self.foldmarkersForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("FoldMarkersBackground",
                        self.foldmarkersBackgroundButton,
                        Preferences.getEditorColour)

        self.editorColours = {}
        self.editorColours["AnnotationsWarningForeground"] = \
            QColor(Preferences.getEditorColour("AnnotationsWarningForeground"))
        self.editorColours["AnnotationsWarningBackground"] = \
            QColor(Preferences.getEditorColour("AnnotationsWarningBackground"))
        self.editorColours["AnnotationsErrorForeground"] = \
            QColor(Preferences.getEditorColour("AnnotationsErrorForeground"))
        self.editorColours["AnnotationsErrorBackground"] = \
            QColor(Preferences.getEditorColour("AnnotationsErrorBackground"))
        self.editorColours["AnnotationsStyleForeground"] = \
            QColor(Preferences.getEditorColour("AnnotationsStyleForeground"))
        self.editorColours["AnnotationsStyleBackground"] = \
            QColor(Preferences.getEditorColour("AnnotationsStyleBackground"))

        self.eolCheckBox.setChecked(Preferences.getEditor("ShowEOL"))
        self.wrapModeComboBox.setCurrentIndex(
            self.wrapModeComboBox.findData(
                Preferences.getEditor("WrapLongLinesMode")))
        self.wrapVisualComboBox.setCurrentIndex(
            self.wrapVisualComboBox.findData(
                Preferences.getEditor("WrapVisualFlag")))

        self.edgeModeCombo.setCurrentIndex(
            self.edgeModes.index(Preferences.getEditor("EdgeMode")))
        self.edgeLineColumnSlider.setValue(Preferences.getEditor("EdgeColumn"))
        self.initColour("Edge", self.edgeBackgroundColorButton,
                        Preferences.getEditorColour)

        self.bracehighlightingCheckBox.setChecked(
            Preferences.getEditor("BraceHighlighting"))
        self.initColour("MatchingBrace", self.matchingBracesButton,
                        Preferences.getEditorColour)
        self.initColour("MatchingBraceBack", self.matchingBracesBackButton,
                        Preferences.getEditorColour)
        self.initColour("NonmatchingBrace", self.nonmatchingBracesButton,
                        Preferences.getEditorColour)
        self.initColour("NonmatchingBraceBack",
                        self.nonmatchingBracesBackButton,
                        Preferences.getEditorColour)

        self.zoomfactorSlider.setValue(Preferences.getEditor("ZoomFactor"))

        self.whitespaceCheckBox.setChecked(
            Preferences.getEditor("ShowWhitespace"))
        self.whitespaceSizeSpinBox.setValue(
            Preferences.getEditor("WhitespaceSize"))
        self.initColour("WhitespaceForeground",
                        self.whitespaceForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("WhitespaceBackground",
                        self.whitespaceBackgroundButton,
                        Preferences.getEditorColour)
        if not hasattr(QsciScintilla, "setWhitespaceForegroundColor"):
            self.whitespaceSizeSpinBox.setEnabled(False)
            self.whitespaceForegroundButton.setEnabled(False)
            self.whitespaceBackgroundButton.setEnabled(False)

        self.miniMenuCheckBox.setChecked(
            Preferences.getEditor("MiniContextMenu"))

        self.enableAnnotationsCheckBox.setChecked(
            Preferences.getEditor("AnnotationsEnabled"))

        self.editAreaOverrideCheckBox.setChecked(
            Preferences.getEditor("OverrideEditAreaColours"))
        self.initColour("EditAreaForeground", self.editAreaForegroundButton,
                        Preferences.getEditorColour)
        self.initColour("EditAreaBackground", self.editAreaBackgroundButton,
                        Preferences.getEditorColour)

        self.enableChangeTraceCheckBox.setChecked(
            Preferences.getEditor("OnlineChangeTrace"))
        self.changeTraceTimeoutSpinBox.setValue(
            Preferences.getEditor("OnlineChangeTraceInterval"))
        self.initColour("OnlineChangeTraceMarkerUnsaved",
                        self.changeMarkerUnsavedColorButton,
                        Preferences.getEditorColour)
        self.initColour("OnlineChangeTraceMarkerSaved",
                        self.changeMarkerSavedColorButton,
                        Preferences.getEditorColour)

        self.initColour("BookmarksMap", self.bookmarksMapButton,
                        Preferences.getEditorColour)
        self.initColour("ErrorsMap", self.errorsMapButton,
                        Preferences.getEditorColour)
        self.initColour("WarningsMap", self.warningsMapButton,
                        Preferences.getEditorColour)
        self.initColour("BreakpointsMap", self.breakpointsMapButton,
                        Preferences.getEditorColour)
        self.initColour("TasksMap", self.tasksMapButton,
                        Preferences.getEditorColour)
        self.initColour("CoverageMap", self.coverageMapButton,
                        Preferences.getEditorColour)
        self.initColour("ChangesMap", self.changesMapButton,
                        Preferences.getEditorColour)
        self.initColour("CurrentMap", self.currentMapButton,
                        Preferences.getEditorColour)
        self.initColour("SearchMarkersMap", self.searchMarkerMapButton,
                        Preferences.getEditorColour)
        self.initColour("MarkerMapBackground", self.markerMapBackgroundButton,
                        Preferences.getEditorColour)

        self.indentguidesCheckBox.setChecked(
            Preferences.getEditor("IndentationGuides"))
        self.initColour("IndentationGuidesBackground",
                        self.indentationGuidesBackgroundButton,
                        Preferences.getEditorColour)
        self.initColour("IndentationGuidesForeground",
                        self.indentationGuidesForegroundButton,
                        Preferences.getEditorColour)
Esempio n. 4
0
def getSupportedLanguages():
    """
    Module function to get a dictionary of supported lexer languages.
    
    @return dictionary of supported lexer languages. The keys are the
        internal language names. The items are lists of three entries.
        The first is the display string for the language, the second
        is a dummy file name, which can be used to derive the lexer, and
        the third is the name of an icon file.
        (string, string, string)
    """
    supportedLanguages = {
        "Bash": [
            QCoreApplication.translate('Lexers', "Bash"), 'dummy.sh',
            "lexerBash.png"
        ],
        "Batch": [
            QCoreApplication.translate('Lexers', "Batch"), 'dummy.bat',
            "lexerBatch.png"
        ],
        "C++": [
            QCoreApplication.translate('Lexers', "C/C++"), 'dummy.cpp',
            "lexerCPP.png"
        ],
        "C#": [
            QCoreApplication.translate('Lexers', "C#"), 'dummy.cs',
            "lexerCsharp.png"
        ],
        "CMake": [
            QCoreApplication.translate('Lexers', "CMake"), 'dummy.cmake',
            "lexerCMake.png"
        ],
        "CSS": [
            QCoreApplication.translate('Lexers', "CSS"), 'dummy.css',
            "lexerCSS.png"
        ],
        "D":
        [QCoreApplication.translate('Lexers', "D"), 'dummy.d', "lexerD.png"],
        "Diff": [
            QCoreApplication.translate('Lexers', "Diff"), 'dummy.diff',
            "lexerDiff.png"
        ],
        "Fortran": [
            QCoreApplication.translate('Lexers', "Fortran"), 'dummy.f95',
            "lexerFortran.png"
        ],
        "Fortran77": [
            QCoreApplication.translate('Lexers', "Fortran77"), 'dummy.f',
            "lexerFortran.png"
        ],
        "HTML": [
            QCoreApplication.translate('Lexers', "HTML/PHP/XML"), 'dummy.html',
            "lexerHTML.png"
        ],
        "IDL": [
            QCoreApplication.translate('Lexers', "IDL"), 'dummy.idl',
            "lexerIDL.png"
        ],
        "Java": [
            QCoreApplication.translate('Lexers', "Java"), 'dummy.java',
            "lexerJava.png"
        ],
        "JavaScript": [
            QCoreApplication.translate('Lexers', "JavaScript"), 'dummy.js',
            "lexerJavaScript.png"
        ],
        "Lua": [
            QCoreApplication.translate('Lexers', "Lua"), 'dummy.lua',
            "lexerLua.png"
        ],
        "Makefile": [
            QCoreApplication.translate('Lexers', "Makefile"), 'dummy.mak',
            "lexerMakefile.png"
        ],
        "Pascal": [
            QCoreApplication.translate('Lexers', "Pascal"), 'dummy.pas',
            "lexerPascal.png"
        ],
        "Perl": [
            QCoreApplication.translate('Lexers', "Perl"), 'dummy.pl',
            "lexerPerl.png"
        ],
        "PostScript": [
            QCoreApplication.translate('Lexers', "PostScript"), 'dummy.ps',
            "lexerPostscript.png"
        ],
        "Povray": [
            QCoreApplication.translate('Lexers', "Povray"), 'dummy.pov',
            "lexerPOV.png"
        ],
        "Properties": [
            QCoreApplication.translate('Lexers', "Properties"), 'dummy.ini',
            "lexerProperties.png"
        ],
        "Python2": [
            QCoreApplication.translate('Lexers', "Python2"), 'dummy.py',
            "lexerPython.png"
        ],
        "Python3": [
            QCoreApplication.translate('Lexers', "Python3"), 'dummy.py',
            "lexerPython3.png"
        ],
        "QSS": [
            QCoreApplication.translate('Lexers', "QSS"), 'dummy.qss',
            "lexerCSS.png"
        ],
        "Ruby": [
            QCoreApplication.translate('Lexers', "Ruby"), 'dummy.rb',
            "lexerRuby.png"
        ],
        "SQL": [
            QCoreApplication.translate('Lexers', "SQL"), 'dummy.sql',
            "lexerSQL.png"
        ],
        "TCL": [
            QCoreApplication.translate('Lexers', "TCL"), 'dummy.tcl',
            "lexerTCL.png"
        ],
        "TeX": [
            QCoreApplication.translate('Lexers', "TeX"), 'dummy.tex',
            "lexerTeX.png"
        ],
        "VHDL": [
            QCoreApplication.translate('Lexers', "VHDL"), 'dummy.vhd',
            "lexerVHDL.png"
        ],
        "XML": [
            QCoreApplication.translate('Lexers', "XML"), 'dummy.xml',
            "lexerXML.png"
        ],
        "YAML": [
            QCoreApplication.translate('Lexers', "YAML"), 'dummy.yml',
            "lexerYAML.png"
        ],
    }

    if QSCINTILLA_VERSION() >= 0x020501:
        supportedLanguages.update({
            "Matlab": [
                QCoreApplication.translate('Lexers', "Matlab"),
                'dummy.m.matlab', "lexerMatlab.png"
            ],
            "Octave": [
                QCoreApplication.translate('Lexers', "Octave"),
                'dummy.m.octave', "lexerOctave.png"
            ],
        })

    if QSCINTILLA_VERSION() >= 0x020802:
        supportedLanguages["Gettext"] = \
            [QCoreApplication.translate('Lexers', "Gettext"), 'dummy.po',
             "lexerGettext.png"]

    if QSCINTILLA_VERSION() >= 0x020803:
        supportedLanguages["CoffeeScript"] = \
            [QCoreApplication.translate('Lexers', "CoffeeScript"),
             'dummy.coffee', "lexerCoffeeScript.png"]

    for name in LexerRegistry:
        if not name.startswith("Pygments|"):
            supportedLanguages[name] = \
                LexerRegistry[name][:2] + [LexerRegistry[name][6]]

    supportedLanguages["Guessed"] = \
        [QCoreApplication.translate('Lexers', "Pygments"), 'dummy.pygments',
         ""]

    return supportedLanguages
Esempio n. 5
0
def getDefaultLexerAssociations():
    """
    Module function to get a dictionary with the default associations.
    
    @return dictionary with the default lexer associations
    """
    assocs = {
        '*.sh': "Bash",
        '*.bash': "Bash",
        "*.bat": "Batch",
        "*.cmd": "Batch",
        '*.cpp': "C++",
        '*.cxx': "C++",
        '*.cc': "C++",
        '*.c': "C++",
        '*.hpp': "C++",
        '*.hh': "C++",
        '*.h': "C++",
        '*.cs': "C#",
        'CMakeLists.txt': "CMake",
        '*.cmake': "CMake",
        '*.cmake.in': "CMake",
        '*.ctest': "CMake",
        '*.ctest.in': "CMake",
        '*.css': "CSS",
        '*.qss': "QSS",
        "*.d": "D",
        "*.di": "D",
        "*.diff": "Diff",
        "*.patch": "Diff",
        '*.html': "HTML",
        '*.htm': "HTML",
        '*.asp': "HTML",
        '*.shtml': "HTML",
        '*.php': "HTML",
        '*.php3': "HTML",
        '*.php4': "HTML",
        '*.php5': "HTML",
        '*.phtml': "HTML",
        '*.xml': "HTML",
        '*.xsl': "HTML",
        '*.svg': "HTML",
        '*.xsd': "HTML",
        '*.xslt': "HTML",
        '*.dtd': "HTML",
        '*.rdf': "HTML",
        '*.xul': "HTML",
        '*.docbook': "HTML",
        '*.ui': "HTML",
        '*.ts': "HTML",
        '*.qrc': "HTML",
        '*.kid': "HTML",
        '*.idl': "IDL",
        '*.java': "Java",
        '*.js': "JavaScript",
        '*.lua': "Lua",
        "*makefile": "Makefile",
        "Makefile*": "Makefile",
        "*.mak": "Makefile",
        '*.pl': "Perl",
        '*.pm': "Perl",
        '*.ph': "Perl",
        '*.pov': "Povray",
        "*.properties": "Properties",
        "*.ini": "Properties",
        "*.inf": "Properties",
        "*.reg": "Properties",
        "*.cfg": "Properties",
        "*.cnf": "Properties",
        "*.rc": "Properties",
        '*.py': "Python",
        '*.pyw': "Python",
        '*.py2': "Python",
        '*.pyw2': "Python",
        '*.py3': "Python",
        '*.pyw3': "Python",
        '*.pyx': "Python",
        '*.ptl': "Python",
        '*.rb': "Ruby",
        '*.rbw': "Ruby",
        '*.sql': "SQL",
        "*.tex": "TeX",
        "*.sty": "TeX",
        "*.aux": "TeX",
        "*.toc": "TeX",
        "*.idx": "TeX",
        '*.vhd': "VHDL",
        '*.vhdl': "VHDL",
        "*.tcl": "TCL",
        "*.tk": "TCL",
        "*.f": "Fortran77",
        "*.for": "Fortran77",
        "*.f90": "Fortran",
        "*.f95": "Fortran",
        "*.f2k": "Fortran",
        "*.dpr": "Pascal",
        "*.dpk": "Pascal",
        "*.pas": "******",
        "*.dfm": "Pascal",
        "*.inc": "Pascal",
        "*.pp": "Pascal",
        "*.ps": "PostScript",
        "*.xml": "XML",
        "*.xsl": "XML",
        "*.svg": "XML",
        "*.xsd": "XML",
        "*.xslt": "XML",
        "*.dtd": "XML",
        "*.rdf": "XML",
        "*.xul": "XML",
        "*.yaml": "YAML",
        "*.yml": "YAML",
        '*.e4d': "XML",
        '*.e4k': "XML",
        '*.e4m': "XML",
        '*.e4p': "XML",
        '*.e4q': "XML",
        '*.e4s': "XML",
        '*.e4t': "XML",
        '*.e5d': "XML",
        '*.e5k': "XML",
        '*.e5m': "XML",
        '*.e5p': "XML",
        '*.e5q': "XML",
        '*.e5s': "XML",
        '*.e5t': "XML",
        '*.e6d': "XML",
        '*.e6k': "XML",
        '*.e6m': "XML",
        '*.e6p': "XML",
        '*.e6q': "XML",
        '*.e6s': "XML",
        '*.e6t': "XML",
    }

    if QSCINTILLA_VERSION() >= 0x020501:
        assocs.update({
            '*.m': "Matlab",
            '*.m.matlab': "Matlab",
            '*.m.octave': "Octave",
        })

    if QSCINTILLA_VERSION() >= 0x020803:
        assocs['*.coffee'] = "CoffeeScript"

    for name in LexerRegistry:
        for pattern in LexerRegistry[name][5]:
            assocs[pattern] = name

    return assocs
Esempio n. 6
0
def getSaveFileFiltersList(includeAll=False,
                           asString=False,
                           withAdditional=True):
    """
    Module function to get the file filter list for a save file operation.
    
    @param includeAll flag indicating the inclusion of the
        All Files filter (boolean)
    @param asString flag indicating the list should be returned
        as a string (boolean)
    @keyparam withAdditional flag indicating to include additional filters
        defined by the user (boolean)
    @return file filter list (list of strings or string)
    """
    saveFileFiltersList = [
        QCoreApplication.translate('Lexers', "Python2 Files (*.py2)"),
        QCoreApplication.translate('Lexers', "Python3 Files (*.py)"),
        QCoreApplication.translate('Lexers', "Python2 GUI Files (*.pyw2)"),
        QCoreApplication.translate('Lexers', "Python3 GUI Files (*.pyw)"),
        QCoreApplication.translate('Lexers', "Pyrex Files (*.pyx)"),
        QCoreApplication.translate('Lexers', "Quixote Template Files (*.ptl)"),
        QCoreApplication.translate('Lexers', "Ruby Files (*.rb)"),
        QCoreApplication.translate('Lexers', "IDL Files (*.idl)"),
        QCoreApplication.translate('Lexers', "C Files (*.c)"),
        QCoreApplication.translate('Lexers', "C++ Files (*.cpp)"),
        QCoreApplication.translate('Lexers', "C++/C Header Files (*.h)"),
        QCoreApplication.translate('Lexers', "C# Files (*.cs)"),
        QCoreApplication.translate('Lexers', "HTML Files (*.html)"),
        QCoreApplication.translate('Lexers', "PHP Files (*.php)"),
        QCoreApplication.translate('Lexers', "ASP Files (*.asp)"),
        QCoreApplication.translate('Lexers', "CSS Files (*.css)"),
        QCoreApplication.translate('Lexers', "QSS Files (*.qss)"),
        QCoreApplication.translate('Lexers', "XML Files (*.xml)"),
        QCoreApplication.translate('Lexers', "XSL Files (*.xsl)"),
        QCoreApplication.translate('Lexers', "DTD Files (*.dtd)"),
        QCoreApplication.translate('Lexers', "Qt Resource Files (*.qrc)"),
        QCoreApplication.translate('Lexers', "D Files (*.d)"),
        QCoreApplication.translate('Lexers', "D Interface Files (*.di)"),
        QCoreApplication.translate('Lexers', "Java Files (*.java)"),
        QCoreApplication.translate('Lexers', "JavaScript Files (*.js)"),
        QCoreApplication.translate('Lexers', "SQL Files (*.sql)"),
        QCoreApplication.translate('Lexers', "Docbook Files (*.docbook)"),
        QCoreApplication.translate('Lexers', "Perl Files (*.pl)"),
        QCoreApplication.translate('Lexers', "Perl Module Files (*.pm)"),
        QCoreApplication.translate('Lexers', "Lua Files (*.lua)"),
        QCoreApplication.translate('Lexers', "Shell Files (*.sh)"),
        QCoreApplication.translate('Lexers', "Batch Files (*.bat)"),
        QCoreApplication.translate('Lexers', "TeX Files (*.tex)"),
        QCoreApplication.translate('Lexers', "TeX Template Files (*.sty)"),
        QCoreApplication.translate('Lexers', "Diff Files (*.diff)"),
        QCoreApplication.translate('Lexers', "Make Files (*.mak)"),
        QCoreApplication.translate('Lexers', "Properties Files (*.ini)"),
        QCoreApplication.translate('Lexers', "Configuration Files (*.cfg)"),
        QCoreApplication.translate('Lexers', 'Povray Files (*.pov)'),
        QCoreApplication.translate('Lexers', 'CMake Files (CMakeLists.txt)'),
        QCoreApplication.translate('Lexers', 'CMake Macro Files (*.cmake)'),
        QCoreApplication.translate('Lexers', 'VHDL Files (*.vhd)'),
        QCoreApplication.translate('Lexers', 'TCL Files (*.tcl)'),
        QCoreApplication.translate('Lexers', 'Tk Files (*.tk)'),
        QCoreApplication.translate('Lexers', 'Fortran Files (*.f95)'),
        QCoreApplication.translate('Lexers', 'Fortran77 Files (*.f)'),
        QCoreApplication.translate('Lexers', 'Pascal Files (*.pas)'),
        QCoreApplication.translate('Lexers', 'PostScript Files (*.ps)'),
        QCoreApplication.translate('Lexers', 'YAML Files (*.yml)'),
    ]

    if QSCINTILLA_VERSION() >= 0x020501:
        saveFileFiltersList.extend([
            QCoreApplication.translate('Lexers', 'Matlab Files (*.m)'),
            QCoreApplication.translate('Lexers', 'Octave Files (*.m.octave)'),
        ])

    if QSCINTILLA_VERSION() >= 0x020802:
        saveFileFiltersList.append(
            QCoreApplication.translate('Lexers', 'Gettext Files (*.po)'), )

    if QSCINTILLA_VERSION() >= 0x020803:
        saveFileFiltersList.append(
            QCoreApplication.translate('Lexers',
                                       'CoffeeScript Files (*.coffee)'), )

    for name in LexerRegistry:
        saveFileFiltersList.extend(LexerRegistry[name][4])

    if withAdditional:
        saveFileFiltersList.extend(
            Preferences.getEditor("AdditionalSaveFilters"))

    saveFileFiltersList.sort()

    if includeAll:
        saveFileFiltersList.append(
            QCoreApplication.translate('Lexers', 'All Files (*)'))

    if asString:
        return ';;'.join(saveFileFiltersList)
    else:
        return saveFileFiltersList
Esempio n. 7
0
def getOpenFileFiltersList(includeAll=False,
                           asString=False,
                           withAdditional=True):
    """
    Module function to get the file filter list for an open file operation.
    
    @param includeAll flag indicating the inclusion of the
        All Files filter (boolean)
    @param asString flag indicating the list should be returned
        as a string (boolean)
    @keyparam withAdditional flag indicating to include additional filters
        defined by the user (boolean)
    @return file filter list (list of strings or string)
    """
    openFileFiltersList = [
        QCoreApplication.translate('Lexers',
                                   'Python Files (*.py *.py2 *.py3)'),
        QCoreApplication.translate('Lexers',
                                   'Python GUI Files (*.pyw *.pyw2 *.pyw3)'),
        QCoreApplication.translate('Lexers', 'Pyrex Files (*.pyx)'),
        QCoreApplication.translate('Lexers', 'Quixote Template Files (*.ptl)'),
        QCoreApplication.translate('Lexers', 'Ruby Files (*.rb)'),
        QCoreApplication.translate('Lexers', 'IDL Files (*.idl)'),
        QCoreApplication.translate('Lexers', 'C Files (*.h *.c)'),
        QCoreApplication.translate(
            'Lexers', 'C++ Files (*.h *.hpp *.hh *.cxx *.cpp *.cc)'),
        QCoreApplication.translate('Lexers', 'C# Files (*.cs)'),
        QCoreApplication.translate('Lexers',
                                   'HTML Files (*.html *.htm *.asp *.shtml)'),
        QCoreApplication.translate('Lexers', 'CSS Files (*.css)'),
        QCoreApplication.translate('Lexers', 'QSS Files (*.qss)'),
        QCoreApplication.translate(
            'Lexers', 'PHP Files (*.php *.php3 *.php4 *.php5 *.phtml)'),
        QCoreApplication.translate(
            'Lexers',
            'XML Files (*.xml *.xsl *.xslt *.dtd *.svg *.xul *.xsd)'),
        QCoreApplication.translate('Lexers', 'Qt Resource Files (*.qrc)'),
        QCoreApplication.translate('Lexers', 'D Files (*.d *.di)'),
        QCoreApplication.translate('Lexers', 'Java Files (*.java)'),
        QCoreApplication.translate('Lexers', 'JavaScript Files (*.js)'),
        QCoreApplication.translate('Lexers', 'SQL Files (*.sql)'),
        QCoreApplication.translate('Lexers', 'Docbook Files (*.docbook)'),
        QCoreApplication.translate('Lexers', 'Perl Files (*.pl *.pm *.ph)'),
        QCoreApplication.translate('Lexers', 'Lua Files (*.lua)'),
        QCoreApplication.translate(
            'Lexers', 'Tex Files (*.tex *.sty *.aux *.toc *.idx)'),
        QCoreApplication.translate('Lexers', 'Shell Files (*.sh)'),
        QCoreApplication.translate('Lexers', 'Batch Files (*.bat *.cmd)'),
        QCoreApplication.translate('Lexers', 'Diff Files (*.diff *.patch)'),
        QCoreApplication.translate('Lexers', 'Makefiles (*.mak)'),
        QCoreApplication.translate(
            'Lexers', 'Properties Files (*.properties *.ini *.inf *.reg *.cfg'
            ' *.cnf *.rc)'),
        QCoreApplication.translate('Lexers', 'Povray Files (*.pov)'),
        QCoreApplication.translate(
            'Lexers', 'CMake Files (CMakeLists.txt *.cmake *.ctest)'),
        QCoreApplication.translate('Lexers', 'VHDL Files (*.vhd *.vhdl)'),
        QCoreApplication.translate('Lexers', 'TCL/Tk Files (*.tcl *.tk)'),
        QCoreApplication.translate('Lexers',
                                   'Fortran Files (*.f90 *.f95 *.f2k)'),
        QCoreApplication.translate('Lexers', 'Fortran77 Files (*.f *.for)'),
        QCoreApplication.translate(
            'Lexers', 'Pascal Files (*.dpr *.dpk *.pas *.dfm *.inc *.pp)'),
        QCoreApplication.translate('Lexers', 'PostScript Files (*.ps)'),
        QCoreApplication.translate('Lexers', 'YAML Files (*.yaml *.yml)'),
    ]

    if QSCINTILLA_VERSION() >= 0x020501:
        openFileFiltersList.extend([
            QCoreApplication.translate('Lexers',
                                       'Matlab Files (*.m *.m.matlab)'),
            QCoreApplication.translate('Lexers',
                                       'Octave Files (*.m *.m.octave)'),
        ])

    if QSCINTILLA_VERSION() >= 0x020802:
        openFileFiltersList.append(
            QCoreApplication.translate('Lexers', 'Gettext Files (*.po)'), )

    if QSCINTILLA_VERSION() >= 0x020803:
        openFileFiltersList.append(
            QCoreApplication.translate('Lexers',
                                       'CoffeeScript Files (*.coffee)'), )

    for name in LexerRegistry:
        openFileFiltersList.extend(LexerRegistry[name][3])

    if withAdditional:
        openFileFiltersList.extend(
            Preferences.getEditor("AdditionalOpenFilters"))

    openFileFiltersList.sort()
    if includeAll:
        openFileFiltersList.append(
            QCoreApplication.translate('Lexers', 'All Files (*)'))

    if asString:
        return ';;'.join(openFileFiltersList)
    else:
        return openFileFiltersList
    def save(self):
        """
        Public slot to save the Editor Properties (1) configuration.
        """
        # All
        Preferences.setEditor("AllFoldCompact",
                              self.allFoldCompactCheckBox.isChecked())

        # Bash
        Preferences.setEditor("BashFoldComment",
                              self.foldBashCommentCheckBox.isChecked())

        # CMake
        Preferences.setEditor("CMakeFoldAtElse",
                              self.cmakeFoldAtElseCheckBox.isChecked())

        # C++
        Preferences.setEditor("CppFoldComment",
                              self.foldCppCommentCheckBox.isChecked())
        Preferences.setEditor("CppFoldPreprocessor",
                              self.foldCppPreprocessorCheckBox.isChecked())
        Preferences.setEditor("CppFoldAtElse",
                              self.foldCppAtElseCheckBox.isChecked())
        Preferences.setEditor("CppIndentOpeningBrace",
                              self.cppIndentOpeningBraceCheckBox.isChecked())
        Preferences.setEditor("CppIndentClosingBrace",
                              self.cppIndentClosingBraceCheckBox.isChecked())
        Preferences.setEditor("CppCaseInsensitiveKeywords",
                              self.cppCaseInsensitiveCheckBox.isChecked())
        Preferences.setEditor("CppDollarsAllowed",
                              self.cppDollarAllowedCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor(
                "CppStylePreprocessor",
                self.cppStylePreprocessorCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020600:
            Preferences.setEditor(
                "CppHighlightTripleQuotedStrings",
                self.cppHighlightTripleQuotedCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020700:
            Preferences.setEditor(
                "CppHighlightHashQuotedStrings",
                self.cppHighlightHashQuotedCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020900:
            Preferences.setEditor(
                "CppHighlightBackQuotedStrings",
                self.cppHighlightBackQuotedCheckBox.isChecked())
            Preferences.setEditor(
                "CppHighlightEscapeSequences",
                self.cppHighlightEsacepSequencesCheckBox.isChecked())
            Preferences.setEditor(
                "CppVerbatimStringEscapeSequencesAllowed",
                self.cppVerbatimStringEscapeAllowedCheckBox.isChecked())

        # CMake
        Preferences.setEditor("CMakeFoldAtElse",
                              self.cmakeFoldAtElseCheckBox.isChecked())

        # CoffeeScript
        if "CoffeeScript" in self.languages:
            Preferences.setEditor(
                "CoffeScriptFoldComment",
                self.foldCoffeeScriptCommentCheckBox.isChecked())
            Preferences.setEditor(
                "CoffeeScriptDollarsAllowed",
                self.coffeeScriptDollarAllowedCheckBox.isChecked())
            Preferences.setEditor(
                "CoffeeScriptStylePreprocessor",
                self.coffeeScriptStylePreprocessorCheckBox.isChecked())

        # CSS
        Preferences.setEditor("CssFoldComment",
                              self.foldCssCommentCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020700:
            Preferences.setEditor("CssHssSupport",
                                  self.cssHssCheckBox.isChecked())
            Preferences.setEditor("CssLessSupport",
                                  self.cssLessCheckBox.isChecked())
            Preferences.setEditor("CssSassySupport",
                                  self.cssSassyCheckBox.isChecked())

        # D
        Preferences.setEditor("DFoldComment",
                              self.foldDCommentCheckBox.isChecked())
        Preferences.setEditor("DFoldAtElse",
                              self.foldDAtElseCheckBox.isChecked())
        Preferences.setEditor("DIndentOpeningBrace",
                              self.dIndentOpeningBraceCheckBox.isChecked())
        Preferences.setEditor("DIndentClosingBrace",
                              self.dIndentClosingBraceCheckBox.isChecked())

        # Gettext
        if "Gettext" in self.languages:
            Preferences.setEditor("PoFoldComment",
                                  self.foldPoCommentCheckBox.isChecked())

        # HTML
        Preferences.setEditor("HtmlFoldPreprocessor",
                              self.foldHtmlPreprocessorCheckBox.isChecked())
        Preferences.setEditor("HtmlCaseSensitiveTags",
                              self.htmlCaseSensitiveTagsCheckBox.isChecked())
        Preferences.setEditor("HtmlFoldScriptComments",
                              self.foldHtmlScriptCommentsCheckBox.isChecked())
        Preferences.setEditor("HtmlFoldScriptHeredocs",
                              self.foldHtmlScriptHereDocsCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("HtmlDjangoTemplates",
                                  self.htmlDjangoCheckBox.isChecked())
            Preferences.setEditor("HtmlMakoTemplates",
                                  self.htmlMakoCheckBox.isChecked())

        # Pascal
        if "Pascal" in self.languages:
            Preferences.setEditor("PascalFoldComment",
                                  self.foldPascalCommentCheckBox.isChecked())
            Preferences.setEditor(
                "PascalFoldPreprocessor",
                self.foldPascalPreprocessorCheckBox.isChecked())
            Preferences.setEditor(
                "PascalSmartHighlighting",
                self.pascalSmartHighlightingCheckBox.isChecked())

        # Perl
        Preferences.setEditor("PerlFoldComment",
                              self.foldPerlCommentCheckBox.isChecked())
        Preferences.setEditor("PerlFoldPackages",
                              self.foldPerlPackagesCheckBox.isChecked())
        Preferences.setEditor("PerlFoldPODBlocks",
                              self.foldPerlPODBlocksCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020600:
            Preferences.setEditor("PerlFoldAtElse",
                                  self.foldPerlAtElseCheckBox.isChecked())

        # PostScript
        if "PostScript" in self.languages:
            Preferences.setEditor("PostScriptFoldAtElse",
                                  self.psFoldAtElseCheckBox.isChecked())
            Preferences.setEditor("PostScriptTokenize",
                                  self.psMarkTokensCheckBox.isChecked())
            Preferences.setEditor("PostScriptLevel",
                                  self.psLevelSpinBox.value())

        # Povray
        Preferences.setEditor("PovFoldComment",
                              self.foldPovrayCommentCheckBox.isChecked())
        Preferences.setEditor("PovFoldDirectives",
                              self.foldPovrayDirectivesCheckBox.isChecked())

        # Properties
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor(
                "PropertiesInitialSpaces",
                self.propertiesInitialSpacesCheckBox.isChecked())

        # Python
        Preferences.setEditor("PythonFoldComment",
                              self.foldPythonCommentCheckBox.isChecked())
        Preferences.setEditor("PythonFoldString",
                              self.foldPythonStringCheckBox.isChecked())
        Preferences.setEditor("PythonBadIndentation",
                              self.pythonBadIndentationComboBox.currentIndex())
        Preferences.setEditor("PythonAutoIndent",
                              self.pythonAutoindentCheckBox.isChecked())
        Preferences.setEditor("PythonAllowV2Unicode",
                              self.pythonV2UnicodeAllowedCheckBox.isChecked())
        Preferences.setEditor("PythonAllowV3Binary",
                              self.pythonV3BinaryAllowedCheckBox.isChecked())
        Preferences.setEditor("PythonAllowV3Bytes",
                              self.pythonV3BytesAllowedCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("PythonFoldQuotes",
                                  self.foldPythonQuotesCheckBox.isChecked())
            Preferences.setEditor(
                "PythonStringsOverNewLineAllowed",
                self.pythonStringsOverNewlineCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020600:
            Preferences.setEditor(
                "PythonHighlightSubidentifier",
                self.pythonHighlightSubidentifierCheckBox.isChecked())

        # Ruby
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("RubyFoldComment",
                                  self.foldRubyCommentCheckBox.isChecked())

        # SQL
        Preferences.setEditor("SqlFoldComment",
                              self.foldSqlCommentCheckBox.isChecked())
        Preferences.setEditor("SqlBackslashEscapes",
                              self.sqlBackslashEscapesCheckBox.isChecked())
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("SqlFoldAtElse",
                                  self.sqlFoldAtElseCheckBox.isChecked())
            Preferences.setEditor("SqlFoldOnlyBegin",
                                  self.sqlFoldOnlyBeginCheckBox.isChecked())
            Preferences.setEditor("SqlDottedWords",
                                  self.sqlDottedWordsCheckBox.isChecked())
            Preferences.setEditor("SqlHashComments",
                                  self.sqlHashCommentsCheckBox.isChecked())
            Preferences.setEditor(
                "SqlQuotedIdentifiers",
                self.sqlQuotedIdentifiersCheckBox.isChecked())

        # TCL
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("TclFoldComment",
                                  self.foldTclCommentCheckBox.isChecked())

        # TeX
        if QSCINTILLA_VERSION() >= 0x020500:
            Preferences.setEditor("TexFoldComment",
                                  self.foldTexCommentCheckBox.isChecked())
            Preferences.setEditor("TexProcessComments",
                                  self.texProcessCommentsCheckBox.isChecked())
            Preferences.setEditor("TexProcessIf",
                                  self.texProcessIfCheckBox.isChecked())

        # VHDL
        Preferences.setEditor("VHDLFoldComment",
                              self.vhdlFoldCommentCheckBox.isChecked())
        Preferences.setEditor("VHDLFoldAtElse",
                              self.vhdlFoldAtElseCheckBox.isChecked())
        Preferences.setEditor("VHDLFoldAtBegin",
                              self.vhdlFoldAtBeginCheckBox.isChecked())
        Preferences.setEditor("VHDLFoldAtParenthesis",
                              self.vhdlFoldAtParenthesisCheckBox.isChecked())

        # XML
        Preferences.setEditor("XMLStyleScripts",
                              self.xmlSyleScriptsCheckBox.isChecked())

        # YAML
        if "YAML" in self.languages:
            Preferences.setEditor("YAMLFoldComment",
                                  self.foldYamlCommentCheckBox.isChecked())
    def __init__(self, lexers):
        """
        Constructor
        
        @param lexers reference to the lexers dictionary
        """
        super(EditorPropertiesPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("EditorPropertiesPage")

        self.languages = sorted(list(lexers.keys())[:])

        # set initial values
        # All
        self.allFoldCompactCheckBox.setChecked(
            Preferences.getEditor("AllFoldCompact"))

        # Bash
        self.foldBashCommentCheckBox.setChecked(
            Preferences.getEditor("BashFoldComment"))

        # C++
        self.foldCppCommentCheckBox.setChecked(
            Preferences.getEditor("CppFoldComment"))
        self.foldCppPreprocessorCheckBox.setChecked(
            Preferences.getEditor("CppFoldPreprocessor"))
        self.foldCppAtElseCheckBox.setChecked(
            Preferences.getEditor("CppFoldAtElse"))
        self.cppIndentOpeningBraceCheckBox.setChecked(
            Preferences.getEditor("CppIndentOpeningBrace"))
        self.cppIndentClosingBraceCheckBox.setChecked(
            Preferences.getEditor("CppIndentClosingBrace"))
        self.cppCaseInsensitiveCheckBox.setChecked(
            Preferences.getEditor("CppCaseInsensitiveKeywords"))
        self.cppDollarAllowedCheckBox.setChecked(
            Preferences.getEditor("CppDollarsAllowed"))
        if QSCINTILLA_VERSION() >= 0x020500:
            self.cppStylePreprocessorCheckBox.setChecked(
                Preferences.getEditor("CppStylePreprocessor"))
        else:
            self.cppStylePreprocessorCheckBox.setEnabled(False)
        if QSCINTILLA_VERSION() >= 0x020600:
            self.cppHighlightTripleQuotedCheckBox.setChecked(
                Preferences.getEditor("CppHighlightTripleQuotedStrings"))
        else:
            self.cppHighlightTripleQuotedCheckBox.setEnabled(False)
        if QSCINTILLA_VERSION() >= 0x020700:
            self.cppHighlightHashQuotedCheckBox.setChecked(
                Preferences.getEditor("CppHighlightHashQuotedStrings"))
        else:
            self.cppHighlightHashQuotedCheckBox.setEnabled(False)
        if QSCINTILLA_VERSION() >= 0x020900:
            self.cppHighlightBackQuotedCheckBox.setChecked(
                Preferences.getEditor("CppHighlightBackQuotedStrings"))
            self.cppHighlightEsacepSequencesCheckBox.setChecked(
                Preferences.getEditor("CppHighlightEscapeSequences"))
            self.cppVerbatimStringEscapeAllowedCheckBox.setChecked(
                Preferences.getEditor(
                    "CppVerbatimStringEscapeSequencesAllowed"))
        else:
            self.cppHighlightBackQuotedCheckBox.setEnabled(False)
            self.cppHighlightEsacepSequencesCheckBox.setEnabled(False)
            self.cppVerbatimStringEscapeAllowedCheckBox.setEnabled(False)

        # CMake
        self.cmakeFoldAtElseCheckBox.setChecked(
            Preferences.getEditor("CMakeFoldAtElse"))

        # CoffeeScript
        if "CoffeeScript" in self.languages:
            self.foldCoffeeScriptCommentCheckBox.setChecked(
                Preferences.getEditor("CoffeScriptFoldComment"))
            self.coffeeScriptDollarAllowedCheckBox.setChecked(
                Preferences.getEditor("CoffeeScriptDollarsAllowed"))
            self.coffeeScriptStylePreprocessorCheckBox.setChecked(
                Preferences.getEditor("CoffeeScriptStylePreprocessor"))
        else:
            self.coffeeScriptGroup.setEnabled(False)

        # CSS
        self.foldCssCommentCheckBox.setChecked(
            Preferences.getEditor("CssFoldComment"))
        if QSCINTILLA_VERSION() >= 0x020700:
            self.cssHssCheckBox.setChecked(
                Preferences.getEditor("CssHssSupport"))
            self.cssLessCheckBox.setChecked(
                Preferences.getEditor("CssLessSupport"))
            self.cssSassyCheckBox.setChecked(
                Preferences.getEditor("CssSassySupport"))
        else:
            self.cssHssCheckBox.setEnabled(False)
            self.cssLessCheckBox.setEnabled(False)
            self.cssSassyCheckBox.setEnabled(False)

        # D
        self.foldDCommentCheckBox.setChecked(
            Preferences.getEditor("DFoldComment"))
        self.foldDAtElseCheckBox.setChecked(
            Preferences.getEditor("DFoldAtElse"))
        self.dIndentOpeningBraceCheckBox.setChecked(
            Preferences.getEditor("DIndentOpeningBrace"))
        self.dIndentClosingBraceCheckBox.setChecked(
            Preferences.getEditor("DIndentClosingBrace"))

        # Gettext
        if "Gettext" in self.languages:
            self.foldPoCommentCheckBox.setChecked(
                Preferences.getEditor("PoFoldComment"))
        else:
            self.gettextGroup.setEnabled(False)

        # HTML
        self.foldHtmlPreprocessorCheckBox.setChecked(
            Preferences.getEditor("HtmlFoldPreprocessor"))
        self.htmlCaseSensitiveTagsCheckBox.setChecked(
            Preferences.getEditor("HtmlCaseSensitiveTags"))
        self.foldHtmlScriptCommentsCheckBox.setChecked(
            Preferences.getEditor("HtmlFoldScriptComments"))
        self.foldHtmlScriptHereDocsCheckBox.setChecked(
            Preferences.getEditor("HtmlFoldScriptHeredocs"))
        if QSCINTILLA_VERSION() >= 0x020500:
            self.htmlDjangoCheckBox.setChecked(
                Preferences.getEditor("HtmlDjangoTemplates"))
            self.htmlMakoCheckBox.setChecked(
                Preferences.getEditor("HtmlMakoTemplates"))
        else:
            self.htmlDjangoCheckBox.setEnabled(False)
            self.htmlMakoCheckBox.setEnabled(False)

        # Pascal
        if "Pascal" in self.languages:
            self.pascalGroup.setEnabled(True)
            self.foldPascalCommentCheckBox.setChecked(
                Preferences.getEditor("PascalFoldComment"))
            self.foldPascalPreprocessorCheckBox.setChecked(
                Preferences.getEditor("PascalFoldPreprocessor"))
            if QSCINTILLA_VERSION() >= 0x020400:
                self.pascalSmartHighlightingCheckBox.setChecked(
                    Preferences.getEditor("PascalSmartHighlighting"))
            else:
                self.pascalSmartHighlightingCheckBox.setEnabled(False)
        else:
            self.pascalGroup.setEnabled(False)

        # Perl
        self.foldPerlCommentCheckBox.setChecked(
            Preferences.getEditor("PerlFoldComment"))
        self.foldPerlPackagesCheckBox.setChecked(
            Preferences.getEditor("PerlFoldPackages"))
        self.foldPerlPODBlocksCheckBox.setChecked(
            Preferences.getEditor("PerlFoldPODBlocks"))
        if QSCINTILLA_VERSION() >= 0x020600:
            self.foldPerlAtElseCheckBox.setChecked(
                Preferences.getEditor("PerlFoldAtElse"))
        else:
            self.foldPerlAtElseCheckBox.setEnabled(False)

        # PostScript
        if "PostScript" in self.languages:
            self.postscriptGroup.setEnabled(True)
            self.psFoldAtElseCheckBox.setChecked(
                Preferences.getEditor("PostScriptFoldAtElse"))
            self.psMarkTokensCheckBox.setChecked(
                Preferences.getEditor("PostScriptTokenize"))
            self.psLevelSpinBox.setValue(
                Preferences.getEditor("PostScriptLevel"))
        else:
            self.postscriptGroup.setEnabled(False)

        # Povray
        self.foldPovrayCommentCheckBox.setChecked(
            Preferences.getEditor("PovFoldComment"))
        self.foldPovrayDirectivesCheckBox.setChecked(
            Preferences.getEditor("PovFoldDirectives"))

        # Properties
        if QSCINTILLA_VERSION() >= 0x020500:
            self.propertiesInitialSpacesCheckBox.setChecked(
                Preferences.getEditor("PropertiesInitialSpaces"))
        else:
            self.propertiesInitialSpacesCheckBox.setEnabled(False)

        # Python
        self.pythonBadIndentationComboBox.addItems([
            self.tr("No Warning"),
            self.tr("Inconsistent"),
            self.tr("Tabs after Spaces"),
            self.tr("Spaces"),
            self.tr("Tabs"),
        ])
        self.pythonBadIndentationComboBox.setCurrentIndex(
            Preferences.getEditor("PythonBadIndentation"))
        self.foldPythonCommentCheckBox.setChecked(
            Preferences.getEditor("PythonFoldComment"))
        self.foldPythonStringCheckBox.setChecked(
            Preferences.getEditor("PythonFoldString"))
        self.pythonAutoindentCheckBox.setChecked(
            Preferences.getEditor("PythonAutoIndent"))
        self.pythonV2UnicodeAllowedCheckBox.setChecked(
            Preferences.getEditor("PythonAllowV2Unicode"))
        self.pythonV3BinaryAllowedCheckBox.setChecked(
            Preferences.getEditor("PythonAllowV3Binary"))
        self.pythonV3BytesAllowedCheckBox.setChecked(
            Preferences.getEditor("PythonAllowV3Bytes"))
        if QSCINTILLA_VERSION() >= 0x020500:
            self.foldPythonQuotesCheckBox.setChecked(
                Preferences.getEditor("PythonFoldQuotes"))
            self.pythonStringsOverNewlineCheckBox.setChecked(
                Preferences.getEditor("PythonStringsOverNewLineAllowed"))
        else:
            self.foldPythonQuotesCheckBox.setEnabled(False)
            self.pythonStringsOverNewlineCheckBox.setEnabled(False)
        if QSCINTILLA_VERSION() >= 0x020600:
            self.pythonHighlightSubidentifierCheckBox.setChecked(
                Preferences.getEditor("PythonHighlightSubidentifier"))
        else:
            self.pythonHighlightSubidentifierCheckBox.setEnabled(False)

        # Ruby
        if QSCINTILLA_VERSION() >= 0x020500:
            self.foldRubyCommentCheckBox.setChecked(
                Preferences.getEditor("RubyFoldComment"))
        else:
            self.foldRubyCommentCheckBox.setEnabled(False)

        # SQL
        self.foldSqlCommentCheckBox.setChecked(
            Preferences.getEditor("SqlFoldComment"))
        self.sqlBackslashEscapesCheckBox.setChecked(
            Preferences.getEditor("SqlBackslashEscapes"))
        if QSCINTILLA_VERSION() >= 0x020500:
            self.sqlFoldAtElseCheckBox.setChecked(
                Preferences.getEditor("SqlFoldAtElse"))
            self.sqlFoldOnlyBeginCheckBox.setChecked(
                Preferences.getEditor("SqlFoldOnlyBegin"))
            self.sqlDottedWordsCheckBox.setChecked(
                Preferences.getEditor("SqlDottedWords"))
            self.sqlHashCommentsCheckBox.setChecked(
                Preferences.getEditor("SqlHashComments"))
            self.sqlQuotedIdentifiersCheckBox.setChecked(
                Preferences.getEditor("SqlQuotedIdentifiers"))
        else:
            self.sqlFoldAtElseCheckBox.setEnabled(False)
            self.sqlFoldOnlyBeginCheckBox.setEnabled(False)
            self.sqlDottedWordsCheckBox.setEnabled(False)
            self.sqlHashCommentsCheckBox.setEnabled(False)
            self.sqlQuotedIdentifiersCheckBox.setEnabled(False)

        # TCL
        if QSCINTILLA_VERSION() >= 0x020500:
            self.foldTclCommentCheckBox.setChecked(
                Preferences.getEditor("TclFoldComment"))
        else:
            self.foldTclCommentCheckBox.setEnabled(False)

        # TeX
        if QSCINTILLA_VERSION() >= 0x020500:
            self.foldTexCommentCheckBox.setChecked(
                Preferences.getEditor("TexFoldComment"))
            self.texProcessCommentsCheckBox.setChecked(
                Preferences.getEditor("TexProcessComments"))
            self.texProcessIfCheckBox.setChecked(
                Preferences.getEditor("TexProcessIf"))
        else:
            self.foldTexCommentCheckBox.setEnabled(False)
            self.texProcessCommentsCheckBox.setEnabled(False)
            self.texProcessIfCheckBox.setEnabled(False)

        # VHDL
        self.vhdlFoldCommentCheckBox.setChecked(
            Preferences.getEditor("VHDLFoldComment"))
        self.vhdlFoldAtElseCheckBox.setChecked(
            Preferences.getEditor("VHDLFoldAtElse"))
        self.vhdlFoldAtBeginCheckBox.setChecked(
            Preferences.getEditor("VHDLFoldAtBegin"))
        self.vhdlFoldAtParenthesisCheckBox.setChecked(
            Preferences.getEditor("VHDLFoldAtParenthesis"))

        # XML
        self.xmlSyleScriptsCheckBox.setChecked(
            Preferences.getEditor("XMLStyleScripts"))

        # YAML
        if "YAML" in self.languages:
            self.yamlGroup.setEnabled(True)
            self.foldYamlCommentCheckBox.setChecked(
                Preferences.getEditor("YAMLFoldComment"))
        else:
            self.yamlGroup.setEnabled(False)