Beispiel #1
0
def pep8mod_refresh_checks():
    """
    Force to reload all checks in pep8mod.py
    """
    pep8mod.refresh_checks()
Beispiel #2
0
def load_settings():
    qsettings = QSettings()
    #Globals
    global TOOLBAR_AREA
    global LANGUAGE
    global SHOW_START_PAGE
    global CONFIRM_EXIT
    global UI_LAYOUT
    global NOTIFY_UPDATES
    global PYTHON_PATH
    global PROFILES
    global NINJA_SKIN
    global EXECUTION_OPTIONS
    global SUPPORTED_EXTENSIONS
    global WORKSPACE
    global INDENT
    global MARGIN_LINE
    global REMOVE_TRAILING_SPACES
    global SHOW_TABS_AND_SPACES
    global USE_TABS
    global ALLOW_WORD_WRAP
    global COMPLETE_DECLARATIONS
    global HIGHLIGHT_WHOLE_LINE
    global FONT_FAMILY
    global FONT_SIZE
    global SHOW_MARGIN_LINE
    global FIND_ERRORS
    global ERRORS_HIGHLIGHT_LINE
    global CHECK_STYLE
    global CHECK_HIGHLIGHT_LINE
    global CODE_COMPLETION
    global CENTER_ON_SCROLL
    global SHOW_PROJECT_EXPLORER
    global SHOW_SYMBOLS_LIST
    global SHOW_WEB_INSPECTOR
    global SHOW_ERRORS_LIST
    global BOOKMARKS
    global CHECK_FOR_DOCSTRINGS
    global BREAKPOINTS
    global BRACES
    global HIDE_TOOLBAR
    global TOOLBAR_ITEMS
    global SHOW_MINIMAP
    global MINIMAP_MAX_OPACITY
    global MINIMAP_MIN_OPACITY
    global SIZE_PROPORTION
    #General
    HIDE_TOOLBAR = qsettings.value("window/hide_toolbar", 'false') == 'true'
    TOOLBAR_AREA = int(qsettings.value('preferences/general/toolbarArea', 1))
    LANGUAGE = qsettings.value('preferences/interface/language', '')
    SHOW_START_PAGE = qsettings.value(
        'preferences/general/showStartPage', 'true') == 'true'
    CONFIRM_EXIT = qsettings.value('preferences/general/confirmExit',
        'true') == 'true'
    UI_LAYOUT = int(qsettings.value('preferences/interface/uiLayout', 0))
    NOTIFY_UPDATES = qsettings.value(
        'preferences/general/notifyUpdates', 'true') == 'true'
    PYTHON_PATH = qsettings.value('preferences/execution/pythonPath',
        'python')
    NINJA_SKIN = qsettings.value('preferences/theme/skin',
        'Default')
    profileDict = dict(qsettings.value('ide/profiles', {}))
    for key in profileDict:
        profile_list = list(profileDict[key])
        files = []
        if profile_list:
            files = [item
                for item in list(profile_list[0])]
        tempFiles = []
        for file_ in files:
            fileData = list(file_)
            if len(fileData) > 0:
                tempFiles.append([fileData[0], int(fileData[1])])
        files = tempFiles
        projects = []
        if len(profile_list) > 1:
            projects = [item for item in list(profile_list[1])]
        PROFILES[key] = [files, projects]
    toolbar_items = [item for item in list(qsettings.value(
        'preferences/interface/toolbar', []))]
    if toolbar_items:
        TOOLBAR_ITEMS = toolbar_items
    #EXECUTION OPTIONS
    EXECUTION_OPTIONS = qsettings.value(
        'preferences/execution/executionOptions', '')
    extensions = [item for item in list(qsettings.value(
        'preferences/general/supportedExtensions', []))]
    if extensions:
        SUPPORTED_EXTENSIONS = extensions
    WORKSPACE = qsettings.value(
        'preferences/general/workspace', "")
    #Editor
    SHOW_MINIMAP = qsettings.value(
        'preferences/editor/minimapShow', 'false') == 'true'
    MINIMAP_MAX_OPACITY = float(qsettings.value(
        'preferences/editor/minimapMaxOpacity', 0.8))
    MINIMAP_MIN_OPACITY = float(qsettings.value(
        'preferences/editor/minimapMinOpacity', 0.1))
    SIZE_PROPORTION = float(qsettings.value(
        'preferences/editor/minimapSizeProportion', 0.17))
    INDENT = int(qsettings.value('preferences/editor/indent', 4))
    MARGIN_LINE = int(qsettings.value('preferences/editor/marginLine', 80))
    pep8mod.MAX_LINE_LENGTH = MARGIN_LINE
    REMOVE_TRAILING_SPACES = qsettings.value(
        'preferences/editor/removeTrailingSpaces', 'true') == 'true'
    SHOW_TABS_AND_SPACES = qsettings.value(
        'preferences/editor/showTabsAndSpaces', 'true') == 'true'
    USE_TABS = qsettings.value('preferences/editor/useTabs', 'false') == 'true'
    if USE_TABS:
        pep8mod.options.ignore.append("W191")
        pep8mod.refresh_checks()
    ALLOW_WORD_WRAP = qsettings.value(
        'preferences/editor/allowWordWrap', 'false') == 'true'
    COMPLETE_DECLARATIONS = qsettings.value(
        'preferences/editor/completeDeclarations', 'true') == 'true'
    HIGHLIGHT_WHOLE_LINE = qsettings.value(
        'preferences/editor/highlightWholeLine', 'true') == 'true'
    font_family = qsettings.value(
        'preferences/editor/fontFamily', "")
    if font_family:
        FONT_FAMILY = font_family
    font_size = int(qsettings.value('preferences/editor/fontSize', 0))
    if font_size != 0:
        FONT_SIZE = font_size
    SHOW_MARGIN_LINE = qsettings.value(
        'preferences/editor/showMarginLine', 'true') == 'true'
    FIND_ERRORS = qsettings.value('preferences/editor/errors',
        'true') == 'true'
    ERRORS_HIGHLIGHT_LINE = qsettings.value(
        'preferences/editor/errorsInLine', 'true') == 'true'
    CHECK_STYLE = qsettings.value('preferences/editor/checkStyle',
        'true') == 'true'
    CHECK_HIGHLIGHT_LINE = qsettings.value(
        'preferences/editor/checkStyleInline', 'true') == 'true'
    CODE_COMPLETION = qsettings.value(
        'preferences/editor/codeCompletion', 'true') == 'true'
    CENTER_ON_SCROLL = qsettings.value(
        'preferences/editor/centerOnScroll', 'true') == 'true'
    parentheses = qsettings.value('preferences/editor/parentheses',
        'true') == 'true'
    if not parentheses:
        del BRACES['(']
    brackets = qsettings.value('preferences/editor/brackets', 'true') == 'true'
    if not brackets:
        del BRACES['[']
    keys = qsettings.value('preferences/editor/keys', 'true') == 'true'
    if not keys:
        del BRACES['{']
    simpleQuotes = qsettings.value('preferences/editor/simpleQuotes',
        'true') == 'true'
    if not simpleQuotes:
        del QUOTES["'"]
    doubleQuotes = qsettings.value('preferences/editor/doubleQuotes',
        'true') == 'true'
    if not doubleQuotes:
        del QUOTES['"']
    #Projects
    SHOW_PROJECT_EXPLORER = qsettings.value(
        'preferences/interface/showProjectExplorer', 'true') == 'true'
    SHOW_SYMBOLS_LIST = qsettings.value(
        'preferences/interface/showSymbolsList', 'true') == 'true'
    SHOW_WEB_INSPECTOR = qsettings.value(
        'preferences/interface/showWebInspector', 'false') == 'true'
    SHOW_ERRORS_LIST = qsettings.value(
        'preferences/interface/showErrorsList', 'false') == 'true'
    #Bookmarks and Breakpoints
    bookmarks = dict(qsettings.value('preferences/editor/bookmarks', {}))
    for key in bookmarks:
        if key:
            BOOKMARKS[key] = [int(i) for i in list(bookmarks[key])]
    breakpoints = dict(qsettings.value('preferences/editor/breakpoints', {}))
    for key in breakpoints:
        if key:
            BREAKPOINTS[key] = [int(i) for i in list(breakpoints[key])]
    # Checkers
    CHECK_FOR_DOCSTRINGS = qsettings.value(
        'preferences/editor/checkForDocstrings', 'false') == 'true'
    # Import introspection here, it not needed in the namespace of
    # the rest of the file.
    from ninja_ide.tools import introspection
    #Set Default Symbol Handler
    set_symbols_handler('py', introspection)
Beispiel #3
0
def load_settings():
    qsettings = QSettings()
    #Globals
    global TOOLBAR_AREA
    global LANGUAGE
    global SHOW_START_PAGE
    global CONFIRM_EXIT
    global UI_LAYOUT
    global NOTIFY_UPDATES
    global PYTHON_PATH
    global PROFILES
    global NINJA_SKIN
    global EXECUTION_OPTIONS
    global SUPPORTED_EXTENSIONS
    global WORKSPACE
    global INDENT
    global MARGIN_LINE
    global REMOVE_TRAILING_SPACES
    global SHOW_TABS_AND_SPACES
    global USE_TABS
    global ALLOW_WORD_WRAP
    global COMPLETE_DECLARATIONS
    global HIGHLIGHT_WHOLE_LINE
    global FONT_FAMILY
    global FONT_SIZE
    global SHOW_MARGIN_LINE
    global FIND_ERRORS
    global ERRORS_HIGHLIGHT_LINE
    global CHECK_STYLE
    global CHECK_HIGHLIGHT_LINE
    global SHOW_MIGRATION_TIPS
    global CODE_COMPLETION
    global CENTER_ON_SCROLL
    global SHOW_PROJECT_EXPLORER
    global SHOW_SYMBOLS_LIST
    global SHOW_WEB_INSPECTOR
    global SHOW_ERRORS_LIST
    global SHOW_MIGRATION_LIST
    global BOOKMARKS
    global CHECK_FOR_DOCSTRINGS
    global BREAKPOINTS
    global BRACES
    global HIDE_TOOLBAR
    global TOOLBAR_ITEMS
    global SHOW_MINIMAP
    global MINIMAP_MAX_OPACITY
    global MINIMAP_MIN_OPACITY
    global SIZE_PROPORTION
    #General
    HIDE_TOOLBAR = qsettings.value("window/hide_toolbar", 'false') == 'true'
    TOOLBAR_AREA = int(qsettings.value('preferences/general/toolbarArea', 1))
    LANGUAGE = qsettings.value('preferences/interface/language', '')
    SHOW_START_PAGE = qsettings.value(
        'preferences/general/showStartPage', 'true') == 'true'
    CONFIRM_EXIT = qsettings.value('preferences/general/confirmExit',
        'true') == 'true'
    UI_LAYOUT = int(qsettings.value('preferences/interface/uiLayout', 0))
    NOTIFY_UPDATES = qsettings.value(
        'preferences/general/notifyUpdates', 'true') == 'true'
    PYTHON_PATH = qsettings.value('preferences/execution/pythonPath',
        'python')
    NINJA_SKIN = qsettings.value('preferences/theme/skin',
        'Default')
    profileDict = dict(qsettings.value('ide/profiles', {}))
    for key in profileDict:
        profile_list = list(profileDict[key])
        files = []
        if profile_list:
            files = [item
                for item in list(profile_list[0])]
        tempFiles = []
        for file_ in files:
            fileData = list(file_)
            if len(fileData) > 0:
                tempFiles.append([fileData[0], int(fileData[1])])
        files = tempFiles
        projects = []
        if len(profile_list) > 1:
            projects = [item for item in list(profile_list[1])]
        PROFILES[key] = [files, projects]
    toolbar_items = [item for item in list(qsettings.value(
        'preferences/interface/toolbar', []))]
    if toolbar_items:
        TOOLBAR_ITEMS = toolbar_items
    #EXECUTION OPTIONS
    EXECUTION_OPTIONS = qsettings.value(
        'preferences/execution/executionOptions', '')
    extensions = [item for item in list(qsettings.value(
        'preferences/general/supportedExtensions', []))]
    if extensions:
        SUPPORTED_EXTENSIONS = extensions
    WORKSPACE = qsettings.value(
        'preferences/general/workspace', "")
    #Editor
    SHOW_MINIMAP = qsettings.value(
        'preferences/editor/minimapShow', 'false') == 'true'
    MINIMAP_MAX_OPACITY = float(qsettings.value(
        'preferences/editor/minimapMaxOpacity', 0.8))
    MINIMAP_MIN_OPACITY = float(qsettings.value(
        'preferences/editor/minimapMinOpacity', 0.1))
    SIZE_PROPORTION = float(qsettings.value(
        'preferences/editor/minimapSizeProportion', 0.17))
    INDENT = int(qsettings.value('preferences/editor/indent', 4))
    MARGIN_LINE = int(qsettings.value('preferences/editor/marginLine', 80))
    pep8mod.MAX_LINE_LENGTH = MARGIN_LINE
    REMOVE_TRAILING_SPACES = qsettings.value(
        'preferences/editor/removeTrailingSpaces', 'true') == 'true'
    SHOW_TABS_AND_SPACES = qsettings.value(
        'preferences/editor/showTabsAndSpaces', 'true') == 'true'
    USE_TABS = qsettings.value('preferences/editor/useTabs', 'false') == 'true'
    if USE_TABS:
        pep8mod.options.ignore.append("W191")
        pep8mod.refresh_checks()
    ALLOW_WORD_WRAP = qsettings.value(
        'preferences/editor/allowWordWrap', 'false') == 'true'
    COMPLETE_DECLARATIONS = qsettings.value(
        'preferences/editor/completeDeclarations', 'true') == 'true'
    HIGHLIGHT_WHOLE_LINE = qsettings.value(
        'preferences/editor/highlightWholeLine', 'true') == 'true'
    font_family = qsettings.value(
        'preferences/editor/fontFamily', "")
    if font_family:
        FONT_FAMILY = font_family
    font_size = int(qsettings.value('preferences/editor/fontSize', 0))
    if font_size != 0:
        FONT_SIZE = font_size
    SHOW_MARGIN_LINE = qsettings.value(
        'preferences/editor/showMarginLine', 'true') == 'true'
    FIND_ERRORS = qsettings.value('preferences/editor/errors',
        'true') == 'true'
    SHOW_MIGRATION_TIPS = qsettings.value(
        'preferences/editor/showMigrationTips', 'true') == 'true'
    ERRORS_HIGHLIGHT_LINE = qsettings.value(
        'preferences/editor/errorsInLine', 'true') == 'true'
    CHECK_STYLE = qsettings.value('preferences/editor/checkStyle',
        'true') == 'true'
    CHECK_HIGHLIGHT_LINE = qsettings.value(
        'preferences/editor/checkStyleInline', 'true') == 'true'
    CODE_COMPLETION = qsettings.value(
        'preferences/editor/codeCompletion', 'true') == 'true'
    CENTER_ON_SCROLL = qsettings.value(
        'preferences/editor/centerOnScroll', 'true') == 'true'
    parentheses = qsettings.value('preferences/editor/parentheses',
        'true') == 'true'
    if not parentheses:
        del BRACES['(']
    brackets = qsettings.value('preferences/editor/brackets', 'true') == 'true'
    if not brackets:
        del BRACES['[']
    keys = qsettings.value('preferences/editor/keys', 'true') == 'true'
    if not keys:
        del BRACES['{']
    simpleQuotes = qsettings.value('preferences/editor/simpleQuotes',
        'true') == 'true'
    if not simpleQuotes:
        del QUOTES["'"]
    doubleQuotes = qsettings.value('preferences/editor/doubleQuotes',
        'true') == 'true'
    if not doubleQuotes:
        del QUOTES['"']
    #Projects
    SHOW_PROJECT_EXPLORER = qsettings.value(
        'preferences/interface/showProjectExplorer', 'true') == 'true'
    SHOW_SYMBOLS_LIST = qsettings.value(
        'preferences/interface/showSymbolsList', 'true') == 'true'
    SHOW_WEB_INSPECTOR = qsettings.value(
        'preferences/interface/showWebInspector', 'false') == 'true'
    SHOW_ERRORS_LIST = qsettings.value(
        'preferences/interface/showErrorsList', 'false') == 'true'
    SHOW_MIGRATION_LIST = qsettings.value(
        'preferences/interface/showMigrationList', 'true') == 'true'
    #Bookmarks and Breakpoints
    bookmarks = dict(qsettings.value('preferences/editor/bookmarks', {}))
    for key in bookmarks:
        if key:
            BOOKMARKS[key] = [int(i) for i in list(bookmarks[key])]
    breakpoints = dict(qsettings.value('preferences/editor/breakpoints', {}))
    for key in breakpoints:
        if key:
            BREAKPOINTS[key] = [int(i) for i in list(breakpoints[key])]
    # Checkers
    CHECK_FOR_DOCSTRINGS = qsettings.value(
        'preferences/editor/checkForDocstrings', 'false') == 'true'
    # Import introspection here, it not needed in the namespace of
    # the rest of the file.
    from ninja_ide.tools import introspection
    #Set Default Symbol Handler
    set_symbols_handler('py', introspection)