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


Python CONF.set方法代码示例

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


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

示例1: set_option

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
 def set_option(self, option, value):
     """
     Set a plugin option in configuration file
     Use a SIGNAL to call it, e.g.:
     plugin.sig_option_changed.emit('show_all', checked)
     """
     CONF.set(self.CONF_SECTION, str(option), value)
开发者ID:DLlearn,项目名称:spyder,代码行数:9,代码来源:__init__.py

示例2: _get_run_configurations

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [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:ChunHungLiu,项目名称:spyder,代码行数:11,代码来源:runconfig.py

示例3: set_color_scheme

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
def set_color_scheme(name, color_scheme, replace=True):
    """Set syntax color scheme"""
    section = "color_schemes"
    names = CONF.get("color_schemes", "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:erpangwang01,项目名称:spyder,代码行数:13,代码来源:gui.py

示例4: __init__

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.main = parent

        # Widgets
        self.pages_widget = QStackedWidget()
        self.contents_widget = QListWidget()
        self.button_reset = QPushButton(_('Reset to defaults'))

        bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
                                QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)

        # Widgets setup
        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle(_('Preferences'))
        self.setWindowIcon(ima.icon('configure'))
        self.contents_widget.setMovement(QListView.Static)
        self.contents_widget.setSpacing(1)
        self.contents_widget.setCurrentRow(0)

        # Layout
        hsplitter = QSplitter()
        hsplitter.addWidget(self.contents_widget)
        hsplitter.addWidget(self.pages_widget)

        btnlayout = QHBoxLayout()
        btnlayout.addWidget(self.button_reset)
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(hsplitter)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)

        # Signals and slots
        self.button_reset.clicked.connect(self.main.reset_spyder)
        self.pages_widget.currentChanged.connect(self.current_page_changed)
        self.contents_widget.currentRowChanged.connect(
                                             self.pages_widget.setCurrentIndex)
        bbox.accepted.connect(self.accept)
        bbox.rejected.connect(self.reject)
        bbox.clicked.connect(self.button_clicked)

        # Ensures that the config is present on spyder first run
        CONF.set('main', 'interface_language', load_lang_conf())
开发者ID:gyenney,项目名称:Tools,代码行数:55,代码来源:configdialog.py

示例5: set_font

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
def set_font(font, section='main', option='font'):
    """Set font"""
    CONF.set(section, option+'/family', to_text_string(font.family()))
    CONF.set(section, option+'/size', float(font.pointSize()))
    CONF.set(section, option+'/italic', int(font.italic()))
    CONF.set(section, option+'/bold', int(font.bold()))
    FONT_CACHE[(section, option)] = font
开发者ID:erpangwang01,项目名称:spyder,代码行数:9,代码来源:gui.py

示例6: set_font

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
def set_font(font, section, option=None):
    """Set font"""
    if option is None:
        option = 'font'
    else:
        option += '/font'
    CONF.set(section, option+'/family', to_text_string(font.family()))
    CONF.set(section, option+'/size', float(font.pointSize()))
    CONF.set(section, option+'/italic', int(font.italic()))
    CONF.set(section, option+'/bold', int(font.bold()))
    FONT_CACHE[(section, option)] = font
开发者ID:AungWinnHtut,项目名称:spyder,代码行数:13,代码来源:gui.py

示例7: save_historylog

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
 def save_historylog(self):
     """Save current history log (all text in console)"""
     title = _("Save history log")
     self.redirect_stdio.emit(False)
     filename, _selfilter = getsavefilename(self, title,
                 self.historylog_filename, "%s (*.log)" % _("History logs"))
     self.redirect_stdio.emit(True)
     if filename:
         filename = osp.normpath(filename)
         try:
             encoding.write(to_text_string(self.get_text_with_eol()),
                            filename)
             self.historylog_filename = filename
             CONF.set('main', 'historylog_filename', filename)
         except EnvironmentError as error:
             QMessageBox.critical(self, title,
                                  _("<b>Unable to save file '%s'</b>"
                                    "<br><br>Error message:<br>%s"
                                    ) % (osp.basename(filename),
                                         to_text_string(error)))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:22,代码来源:shell.py

示例8: set_option

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
 def set_option(self, option, value):
     CONF.set(self.CONF_SECTION, option, value)
开发者ID:gyenney,项目名称:Tools,代码行数:4,代码来源:configdialog.py

示例9: set_shortcut

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
def set_shortcut(context, name, keystr):
    """Set keyboard shortcut (key sequence string)"""
    CONF.set('shortcuts', '%s/%s' % (context, name), keystr)
开发者ID:erpangwang01,项目名称:spyder,代码行数:5,代码来源:gui.py

示例10: set_firstrun_o

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
 def set_firstrun_o(self):
     CONF.set("run", ALWAYS_OPEN_FIRST_RUN_OPTION, self.firstrun_cb.isChecked())
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:4,代码来源:runconfig.py

示例11: _set_run_configurations

# 需要导入模块: from spyderlib.config.main import CONF [as 别名]
# 或者: from spyderlib.config.main.CONF import set [as 别名]
def _set_run_configurations(configurations):
    history_count = CONF.get("run", "history", 20)
    CONF.set("run", "configurations", configurations[:history_count])
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:5,代码来源:runconfig.py


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