当前位置: 首页>>代码示例>>Python>>正文


Python CONF.get方法代码示例

本文整理汇总了Python中spyder.config.main.CONF.get方法的典型用法代码示例。如果您正苦于以下问题:Python CONF.get方法的具体用法?Python CONF.get怎么用?Python CONF.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spyder.config.main.CONF的用法示例。


在下文中一共展示了CONF.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: argv

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def argv(self):
        """Command to start kernels"""
        # Python interpreter used to start kernels
        if CONF.get('main_interpreter', 'default'):
            pyexec = get_python_executable()
        else:
            # Avoid IPython adding the virtualenv on which Spyder is running
            # to the kernel sys.path
            os.environ.pop('VIRTUAL_ENV', None)
            pyexec = CONF.get('main_interpreter', 'executable')
            if not is_python_interpreter(pyexec):
                pyexec = get_python_executable()
                CONF.set('main_interpreter', 'executable', '')
                CONF.set('main_interpreter', 'default', True)
                CONF.set('main_interpreter', 'custom', False)

        # Fixes Issue #3427
        if os.name == 'nt':
            dir_pyexec = osp.dirname(pyexec)
            pyexec_w = osp.join(dir_pyexec, 'pythonw.exe')
            if osp.isfile(pyexec_w):
                pyexec = pyexec_w

        # Command used to start kernels
        kernel_cmd = [
            pyexec,
            '-m',
            'spyder_kernels.console',
            '-f',
            '{connection_file}'
        ]

        return kernel_cmd
开发者ID:impact27,项目名称:spyder,代码行数:35,代码来源:kernelspec.py

示例2: argv

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def argv(self):
        """Command to start kernels"""
        # Python interpreter used to start kernels
        if CONF.get('main_interpreter', 'default'):
            pyexec = get_python_executable()
        else:
            # Avoid IPython adding the virtualenv on which Spyder is running
            # to the kernel sys.path
            os.environ.pop('VIRTUAL_ENV', None)
            pyexec = CONF.get('main_interpreter', 'executable')

        # Fixes Issue #3427
        if os.name == 'nt':
            dir_pyexec = osp.dirname(pyexec)
            pyexec_w = osp.join(dir_pyexec, 'pythonw.exe')
            if osp.isfile(pyexec_w):
                pyexec = pyexec_w

        # Command used to start kernels
        utils_path = osp.join(self.spy_path, 'utils', 'ipython')
        kernel_cmd = [
            pyexec,
            osp.join("%s" % utils_path, "start_kernel.py"),
            '-f',
            '{connection_file}'
        ]

        return kernel_cmd
开发者ID:0xBADCA7,项目名称:spyder,代码行数:30,代码来源:kernelspec.py

示例3: update_preview

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def update_preview(self, index=None, scheme_name=None):
        """
        Update the color scheme of the preview editor and adds text.

        Note
        ----
        'index' is needed, because this is triggered by a signal that sends
        the selected index.
        """
        text = ('"""A string"""\n\n'
                '# A comment\n\n'
                '# %% A cell\n\n'
                'class Foo(object):\n'
                '    def __init__(self):\n'
                '        bar = 42\n'
                '        print(bar)\n'
                )
        show_blanks = CONF.get('editor', 'blank_spaces')
        update_scrollbar = CONF.get('editor', 'scroll_past_end')
        if scheme_name is None:
            scheme_name = self.current_scheme
        self.preview_editor.setup_editor(linenumbers=True,
                                         markers=True,
                                         tab_mode=False,
                                         font=get_font(),
                                         show_blanks=show_blanks,
                                         color_scheme=scheme_name,
                                         scroll_past_end=update_scrollbar)
        self.preview_editor.set_text(text)
        self.preview_editor.set_language('Python')
开发者ID:impact27,项目名称:spyder,代码行数:32,代码来源:appearance.py

示例4: get_font

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def get_font(section='appearance', option='font', font_size_delta=0):
    """Get console font properties depending on OS and user options"""
    font = FONT_CACHE.get((section, option))

    if font is None:
        families = CONF.get(section, option+"/family", None)

        if families is None:
            return QFont()

        family = get_family(families)
        weight = QFont.Normal
        italic = CONF.get(section, option+'/italic', False)

        if CONF.get(section, option+'/bold', False):
            weight = QFont.Bold

        size = CONF.get(section, option+'/size', 9) + font_size_delta
        font = QFont(family, size, weight)
        font.setItalic(italic)
        FONT_CACHE[(section, option)] = font

    size = CONF.get(section, option+'/size', 9) + font_size_delta
    font.setPointSize(size)
    return font
开发者ID:cfanpc,项目名称:spyder,代码行数:27,代码来源:gui.py

示例5: update_margins

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
 def update_margins(self):
     layout = self.layout()
     if self.default_margins is None:
         self.default_margins = layout.getContentsMargins()
     if CONF.get('main', 'use_custom_margin'):
         margin = CONF.get('main', 'custom_margin')
         layout.setContentsMargins(*[margin]*4)
     else:
         layout.setContentsMargins(*self.default_margins)
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:11,代码来源:__init__.py

示例6: _get_credentials_from_settings

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def _get_credentials_from_settings(self):
        """Get the stored credentials if any."""
        remember_me = CONF.get('main', 'report_error/remember_me')
        remember_token = CONF.get('main', 'report_error/remember_token')
        username = CONF.get('main', 'report_error/username', '')
        if not remember_me:
            username = ''

        return username, remember_me, remember_token
开发者ID:burrbull,项目名称:spyder,代码行数:11,代码来源:backend.py

示例7: _get_run_configurations

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def _get_run_configurations():
    history_count = CONF.get('run', 'history', 20)
    try:
        return [(filename, options)
                for filename, options in CONF.get('run', 'configurations', [])
                if osp.isfile(filename)][:history_count]
    except ValueError:
        CONF.set('run', 'configurations', [])
        return []
开发者ID:burrbull,项目名称:spyder,代码行数:11,代码来源:runconfig.py

示例8: set_color_scheme

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def set_color_scheme(name, color_scheme, replace=True):
    """Set syntax color scheme"""
    section = "appearance"
    names = CONF.get("appearance", "names", [])
    for key in sh.COLOR_SCHEME_KEYS:
        option = "%s/%s" % (name, key)
        value = CONF.get(section, option, default=None)
        if value is None or replace or name not in names:
            CONF.set(section, option, color_scheme[key])
    names.append(to_text_string(name))
    CONF.set(section, "names", sorted(list(set(names))))
开发者ID:cfanpc,项目名称:spyder,代码行数:13,代码来源:gui.py

示例9: is_dark_interface

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def is_dark_interface():
    ui_theme = CONF.get('appearance', 'ui_theme')
    color_scheme = CONF.get('appearance', 'selected')
    if ui_theme == 'dark':
        return True
    elif ui_theme == 'automatic':
        if not is_dark_font_color(color_scheme):
            return True
        else:
            return False
    else:
        return False
开发者ID:cfanpc,项目名称:spyder,代码行数:14,代码来源:gui.py

示例10: external_editor

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
 def external_editor(self, filename, goto=-1):
     """Edit in an external editor
     Recommended: SciTE (e.g. to go to line where an error did occur)"""
     editor_path = CONF.get("internal_console", "external_editor/path")
     goto_option = CONF.get("internal_console", "external_editor/gotoline")
     try:
         args = [filename]
         if goto > 0 and goto_option:
             args.append("%s%d".format(goto_option, goto))
         programs.run_program(editor_path, args)
     except OSError:
         self.write_error("External editor was not found:" " %s\n" % editor_path)
开发者ID:jitseniesen,项目名称:spyder,代码行数:14,代码来源:internalshell.py

示例11: test_python_interpreter

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def test_python_interpreter(tmpdir):
    """Test the validation of the python interpreter."""
    # Set a non existing python interpreter
    interpreter = str(tmpdir.mkdir('interpreter').join('python'))
    CONF.set('main_interpreter', 'default', False)
    CONF.set('main_interpreter', 'custom', True)
    CONF.set('main_interpreter', 'executable', interpreter)

    # Create a kernel spec
    kernel_spec = SpyderKernelSpec()

    # Assert that the python interprerter is the default one
    assert interpreter not in kernel_spec.argv
    assert CONF.get('main_interpreter', 'default')
    assert not CONF.get('main_interpreter', 'custom')
开发者ID:impact27,项目名称:spyder,代码行数:17,代码来源:test_spyder_kernel.py

示例12: __init__

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def __init__(self, parent, history_filename, profile=False,
                 initial_message=None, default_foreground_color=None,
                 error_foreground_color=None, traceback_foreground_color=None,
                 prompt_foreground_color=None, background_color=None):
        """
        parent : specifies the parent widget
        """
        ConsoleBaseWidget.__init__(self, parent)
        SaveHistoryMixin.__init__(self, history_filename)
        BrowseHistoryMixin.__init__(self)
                
        # Prompt position: tuple (line, index)
        self.current_prompt_pos = None
        self.new_input_line = True
        
        # History
        assert is_text_string(history_filename)
        self.history = self.load_history()
        
        # Session
        self.historylog_filename = CONF.get('main', 'historylog_filename',
                                            get_conf_path('history.log'))
        
        # Context menu
        self.menu = None
        self.setup_context_menu()

        # Simple profiling test
        self.profile = profile
        
        # Buffer to increase performance of write/flush operations
        self.__buffer = []
        if initial_message:
            self.__buffer.append(initial_message)

        self.__timestamp = 0.0
        self.__flushtimer = QTimer(self)
        self.__flushtimer.setSingleShot(True)
        self.__flushtimer.timeout.connect(self.flush)

        # Give focus to widget
        self.setFocus()

        # Cursor width
        self.setCursorWidth(CONF.get('main', 'cursor/width'))

        # Adjustments to completion_widget to use it here
        self.completion_widget.currentRowChanged.disconnect()
开发者ID:impact27,项目名称:spyder,代码行数:50,代码来源:shell.py

示例13: send_args_to_spyder

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def send_args_to_spyder(args):
    """
    Simple socket client used to send the args passed to the Spyder 
    executable to an already running instance.

    Args can be Python scripts or files with these extensions: .spydata, .mat,
    .npy, or .h5, which can be imported by the Variable Explorer.
    """
    port = CONF.get('main', 'open_files_port')

    # Wait ~50 secs for the server to be up
    # Taken from https://stackoverflow.com/a/4766598/438386
    for _x in range(200):
        try:
            for arg in args:
                client = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
                                       socket.IPPROTO_TCP)
                client.connect(("127.0.0.1", port))
                if is_unicode(arg):
                    arg = arg.encode('utf-8')
                client.send(osp.abspath(arg))
                client.close()
        except socket.error:
            time.sleep(0.25)
            continue
        break
开发者ID:burrbull,项目名称:spyder,代码行数:28,代码来源:start.py

示例14: _load_all_bookmarks

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
def _load_all_bookmarks():
    """Load all bookmarks from config."""
    slots = CONF.get('editor', 'bookmarks', {})
    for slot_num in list(slots.keys()):
        if not osp.isfile(slots[slot_num][0]):
            slots.pop(slot_num)
    return slots
开发者ID:impact27,项目名称:spyder,代码行数:9,代码来源:bookmarks.py

示例15: load_history

# 需要导入模块: from spyder.config.main import CONF [as 别名]
# 或者: from spyder.config.main.CONF import get [as 别名]
    def load_history(self):
        """Load history from a .py file in user home directory"""
        if osp.isfile(self.history_filename):
            rawhistory, _ = encoding.readlines(self.history_filename)
            rawhistory = [line.replace('\n', '') for line in rawhistory]
            if rawhistory[1] != self.INITHISTORY[1]:
                rawhistory[1] = self.INITHISTORY[1]
        else:
            rawhistory = self.INITHISTORY
        history = [line for line in rawhistory \
                   if line and not line.startswith('#')]

        # Truncating history to X entries:
        while len(history) >= CONF.get('historylog', 'max_entries'):
            del history[0]
            while rawhistory[0].startswith('#'):
                del rawhistory[0]
            del rawhistory[0]

        # Saving truncated history:
        try:
            encoding.writelines(rawhistory, self.history_filename)
        except EnvironmentError:
            pass

        return history
开发者ID:cfanpc,项目名称:spyder,代码行数:28,代码来源:shell.py


注:本文中的spyder.config.main.CONF.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。