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


Python Settings.value方法代码示例

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


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

示例1: __init__

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def __init__(self):
     """
     Constructor
     """
     super(PrintServiceForm, self).__init__(Registry().get('main_window'))
     self.printer = QtGui.QPrinter()
     self.print_dialog = QtGui.QPrintDialog(self.printer, self)
     self.document = QtGui.QTextDocument()
     self.zoom = 0
     self.setupUi(self)
     # Load the settings for the dialog.
     settings = Settings()
     settings.beginGroup('advanced')
     self.slide_text_check_box.setChecked(settings.value('print slide text'))
     self.page_break_after_text.setChecked(settings.value('add page break'))
     if not self.slide_text_check_box.isChecked():
         self.page_break_after_text.setDisabled(True)
     self.meta_data_check_box.setChecked(settings.value('print file meta data'))
     self.notes_check_box.setChecked(settings.value('print notes'))
     self.zoom_combo_box.setCurrentIndex(settings.value('display size'))
     settings.endGroup()
     # Signals
     self.print_button.triggered.connect(self.print_service_order)
     self.zoom_out_button.clicked.connect(self.zoom_out)
     self.zoom_in_button.clicked.connect(self.zoom_in)
     self.zoom_original_button.clicked.connect(self.zoom_original)
     self.preview_widget.paintRequested.connect(self.paint_requested)
     self.zoom_combo_box.currentIndexChanged.connect(self.display_size_changed)
     self.plain_copy.triggered.connect(self.copy_text)
     self.html_copy.triggered.connect(self.copy_html_text)
     self.slide_text_check_box.stateChanged.connect(self.on_slide_text_check_box_changed)
     self.update_preview_text()
开发者ID:crossroadchurch,项目名称:paul,代码行数:34,代码来源:printserviceform.py

示例2: update_reference_separators

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
def update_reference_separators():
    """
    Updates separators and matches for parsing and formating scripture references.
    """
    default_separators = [
        '|'.join([
            translate('BiblesPlugin', ':', 'Verse identifier e.g. Genesis 1 : 1 = Genesis Chapter 1 Verse 1'),
            translate('BiblesPlugin', 'v', 'Verse identifier e.g. Genesis 1 v 1 = Genesis Chapter 1 Verse 1'),
            translate('BiblesPlugin', 'V', 'Verse identifier e.g. Genesis 1 V 1 = Genesis Chapter 1 Verse 1'),
            translate('BiblesPlugin', 'verse', 'Verse identifier e.g. Genesis 1 verse 1 = Genesis Chapter 1 Verse 1'),
            translate('BiblesPlugin', 'verses',
                      'Verse identifier e.g. Genesis 1 verses 1 - 2 = Genesis Chapter 1 Verses 1 to 2')]),
        '|'.join([
            translate('BiblesPlugin', '-',
                      'range identifier e.g. Genesis 1 verse 1 - 2 = Genesis Chapter 1 Verses 1 To 2'),
            translate('BiblesPlugin', 'to',
                      'range identifier e.g. Genesis 1 verse 1 - 2 = Genesis Chapter 1 Verses 1 To 2')]),
        '|'.join([
            translate('BiblesPlugin', ',', 'connecting identifier e.g. Genesis 1 verse 1 - 2, 4 - 5 = '
                                           'Genesis Chapter 1 Verses 1 To 2 And Verses 4 To 5'),
            translate('BiblesPlugin', 'and', 'connecting identifier e.g. Genesis 1 verse 1 - 2 and 4 - 5 = '
                                             'Genesis Chapter 1 Verses 1 To 2 And Verses 4 To 5')]),
        '|'.join([translate('BiblesPlugin', 'end', 'ending identifier e.g. Genesis 1 verse 1 - end = '
                                                   'Genesis Chapter 1 Verses 1 To The Last Verse')])]
    settings = Settings()
    settings.beginGroup('bibles')
    custom_separators = [
        settings.value('verse separator'),
        settings.value('range separator'),
        settings.value('list separator'),
        settings.value('end separator')]
    settings.endGroup()
    for index, role in enumerate(['v', 'r', 'l', 'e']):
        if custom_separators[index].strip('|') == '':
            source_string = default_separators[index].strip('|')
        else:
            source_string = custom_separators[index].strip('|')
        while '||' in source_string:
            source_string = source_string.replace('||', '|')
        if role != 'e':
            REFERENCE_SEPARATORS['sep_%s_display' % role] = source_string.split('|')[0]
        # escape reserved characters
        for character in '\\.^$*+?{}[]()':
            source_string = source_string.replace(character, '\\' + character)
        # add various unicode alternatives
        source_string = source_string.replace('-', '(?:[-\u00AD\u2010\u2011\u2012\u2014\u2014\u2212\uFE63\uFF0D])')
        source_string = source_string.replace(',', '(?:[,\u201A])')
        REFERENCE_SEPARATORS['sep_%s' % role] = '\s*(?:%s)\s*' % source_string
        REFERENCE_SEPARATORS['sep_%s_default' % role] = default_separators[index]
    # verse range match: (<chapter>:)?<verse>(-((<chapter>:)?<verse>|end)?)?
    range_regex = '(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?' \
        '(?P<from_verse>[0-9]+)(?P<range_to>%(sep_r)s(?:(?:(?P<to_chapter>' \
        '[0-9]+)%(sep_v)s)?(?P<to_verse>[0-9]+)|%(sep_e)s)?)?' % REFERENCE_SEPARATORS
    REFERENCE_MATCHES['range'] = re.compile('^\s*%s\s*$' % range_regex, re.UNICODE)
    REFERENCE_MATCHES['range_separator'] = re.compile(REFERENCE_SEPARATORS['sep_l'], re.UNICODE)
    # full reference match: <book>(<range>(,(?!$)|(?=$)))+
    REFERENCE_MATCHES['full'] = \
        re.compile('^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
                   '(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$'
                   % dict(list(REFERENCE_SEPARATORS.items()) + [('range_regex', range_regex)]), re.UNICODE)
开发者ID:crossroadchurch,项目名称:paul,代码行数:62,代码来源:__init__.py

示例3: set_defaults

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def set_defaults(self):
     """
     Set default values for the wizard pages.
     """
     settings = Settings()
     settings.beginGroup(self.plugin.settings_section)
     self.restart()
     self.finish_button.setVisible(False)
     self.cancel_button.setVisible(True)
     self.setField("source_format", 0)
     self.setField("osis_location", "")
     self.setField("csv_booksfile", "")
     self.setField("csv_versefile", "")
     self.setField("opensong_file", "")
     self.setField("zefania_file", "")
     self.setField("web_location", WebDownload.Crosswalk)
     self.setField("web_biblename", self.web_translation_combo_box.currentIndex())
     self.setField("proxy_server", settings.value("proxy address"))
     self.setField("proxy_username", settings.value("proxy username"))
     self.setField("proxy_password", settings.value("proxy password"))
     self.setField("license_version", self.version_name_edit.text())
     self.setField("license_copyright", self.copyright_edit.text())
     self.setField("license_permissions", self.permissions_edit.text())
     self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
     settings.endGroup()
开发者ID:crossroadchurch,项目名称:paul,代码行数:27,代码来源:bibleimportform.py

示例4: load

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def load(self):
     """
     Load the projector settings on startup
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     self.connect_on_startup.setChecked(settings.value('connect on start'))
     self.socket_timeout_spin_box.setValue(settings.value('socket timeout'))
     self.socket_poll_spin_box.setValue(settings.value('poll time'))
     self.dialog_type_combo_box.setCurrentIndex(settings.value('source dialog type'))
     settings.endGroup()
开发者ID:imkernel,项目名称:openlp,代码行数:13,代码来源:tab.py

示例5: get_settings

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def get_settings(self):
     """
     Retrieve the saved settings
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     self.autostart = settings.value('connect on start')
     self.poll_time = settings.value('poll time')
     self.socket_timeout = settings.value('socket timeout')
     self.source_select_dialog_type = settings.value('source dialog type')
     settings.endGroup()
     del settings
开发者ID:crossroadchurch,项目名称:paul,代码行数:14,代码来源:manager.py

示例6: load

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
    def load(self):
        """

        Load the settings into the dialog
        """
        settings = Settings()
        settings.beginGroup(self.settings_section)
        self.display_footer = settings.value('display footer')
        self.update_load = settings.value('add custom from service')
        self.display_footer_check_box.setChecked(self.display_footer)
        self.add_from_service_checkbox.setChecked(self.update_load)
        settings.endGroup()
开发者ID:crossroadchurch,项目名称:paul,代码行数:14,代码来源:customtab.py

示例7: save

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def save(self):
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('is verse number visible', self.is_verse_number_visible)
     settings.setValue('display new chapter', self.show_new_chapters)
     settings.setValue('display brackets', self.display_style)
     settings.setValue('verse layout style', self.layout_style)
     settings.setValue('second bibles', self.second_bibles)
     settings.setValue('bible theme', self.bible_theme)
     if self.verse_separator_check_box.isChecked():
         settings.setValue('verse separator', self.verse_separator_line_edit.text())
     else:
         settings.remove('verse separator')
     if self.range_separator_check_box.isChecked():
         settings.setValue('range separator', self.range_separator_line_edit.text())
     else:
         settings.remove('range separator')
     if self.list_separator_check_box.isChecked():
         settings.setValue('list separator', self.list_separator_line_edit.text())
     else:
         settings.remove('list separator')
     if self.end_separator_check_box.isChecked():
         settings.setValue('end separator', self.end_separator_line_edit.text())
     else:
         settings.remove('end separator')
     update_reference_separators()
     if self.language_selection != settings.value('book name language'):
         settings.setValue('book name language', self.language_selection)
         self.settings_form.register_post_process('bibles_load_list')
     settings.endGroup()
     if self.tab_visited:
         self.settings_form.register_post_process('bibles_config_updated')
     self.tab_visited = False
开发者ID:crossroadchurch,项目名称:paul,代码行数:35,代码来源:biblestab.py

示例8: save

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def save(self):
     """
     Save settings to disk.
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('default service enabled', self.service_name_check_box.isChecked())
     service_name = self.service_name_edit.text()
     preset_is_valid = self.generate_service_name_example()[0]
     if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
         settings.remove('default service name')
         self.service_name_edit.setText(service_name)
     else:
         settings.setValue('default service name', service_name)
     settings.setValue('default service day', self.service_name_day.currentIndex())
     settings.setValue('default service hour', self.service_name_time.time().hour())
     settings.setValue('default service minute', self.service_name_time.time().minute())
     settings.setValue('recent file count', self.recent_spin_box.value())
     settings.setValue('save current plugin', self.media_plugin_check_box.isChecked())
     settings.setValue('double click live', self.double_click_live_check_box.isChecked())
     settings.setValue('single click preview', self.single_click_preview_check_box.isChecked())
     settings.setValue('expand service item', self.expand_service_item_check_box.isChecked())
     settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked())
     settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())
     settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked())
     settings.setValue('default color', self.default_color)
     settings.setValue('default image', self.default_file_edit.text())
     settings.setValue('slide limits', self.slide_limits)
     if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'):
         settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked())
         self.settings_form.register_post_process('config_screen_changed')
     self.settings_form.register_post_process('slidecontroller_update_slide_limits')
     settings.endGroup()
开发者ID:crossroadchurch,项目名称:paul,代码行数:35,代码来源:advancedtab.py

示例9: load

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def load(self):
     settings = Settings()
     settings.beginGroup(self.settings_section)
     self.background_color = settings.value('background color')
     self.initial_color = self.background_color
     settings.endGroup()
     self.background_color_button.color = self.background_color
开发者ID:crossroadchurch,项目名称:paul,代码行数:9,代码来源:imagetab.py

示例10: load

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def load(self):
     """
     Load the theme settings into the tab
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     self.theme_level = settings.value('theme level')
     self.global_theme = settings.value('global theme')
     self.wrap_footer_check_box.setChecked(settings.value('wrap footer'))
     settings.endGroup()
     if self.theme_level == ThemeLevel.Global:
         self.global_level_radio_button.setChecked(True)
     elif self.theme_level == ThemeLevel.Service:
         self.service_level_radio_button.setChecked(True)
     else:
         self.song_level_radio_button.setChecked(True)
开发者ID:crossroadchurch,项目名称:paul,代码行数:18,代码来源:themestab.py

示例11: add_action

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
    def add_action(self, action, category=None, weight=None):
        """
        Add an action to the list of actions.

        **Note**: The action's objectName must be set when you want to add it!

        :param action: The action to add (QAction). **Note**, the action must not have an empty ``objectName``.
        :param category: The category this action belongs to. The category has to be a python string. . **Note**,
            if the category is ``None``, the category and its actions are being hidden in the shortcut dialog. However,
            if they are added, it is possible to avoid assigning shortcuts twice, which is important.
        :param weight: The weight specifies how important a category is. However, this only has an impact on the order
            the categories are displayed.
        """
        if category not in self.categories:
            self.categories.append(category)
        settings = Settings()
        settings.beginGroup('shortcuts')
        # Get the default shortcut from the config.
        action.default_shortcuts = settings.get_default_value(action.objectName())
        if weight is None:
            self.categories[category].actions.append(action)
        else:
            self.categories[category].actions.add(action, weight)
        # Load the shortcut from the config.
        shortcuts = settings.value(action.objectName())
        settings.endGroup()
        if not shortcuts:
            action.setShortcuts([])
            return
        # We have to do this to ensure that the loaded shortcut list e. g. STRG+O (German) is converted to CTRL+O,
        # which is only done when we convert the strings in this way (QKeySequencet -> uncode).
        shortcuts = list(map(QtGui.QKeySequence.toString, list(map(QtGui.QKeySequence, shortcuts))))
        # Check the alternate shortcut first, to avoid problems when the alternate shortcut becomes the primary shortcut
        #  after removing the (initial) primary shortcut due to conflicts.
        if len(shortcuts) == 2:
            existing_actions = ActionList.shortcut_map.get(shortcuts[1], [])
            # Check for conflicts with other actions considering the shortcut context.
            if self._is_shortcut_available(existing_actions, action):
                actions = ActionList.shortcut_map.get(shortcuts[1], [])
                actions.append(action)
                ActionList.shortcut_map[shortcuts[1]] = actions
            else:
                log.warning('Shortcut "{shortcut}" is removed from "{action}" because another '
                            'action already uses this shortcut.'.format(shortcut=shortcuts[1],
                                                                        action=action.objectName()))
                shortcuts.remove(shortcuts[1])
        # Check the primary shortcut.
        existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
        # Check for conflicts with other actions considering the shortcut context.
        if self._is_shortcut_available(existing_actions, action):
            actions = ActionList.shortcut_map.get(shortcuts[0], [])
            actions.append(action)
            ActionList.shortcut_map[shortcuts[0]] = actions
        else:
            log.warning('Shortcut "{shortcut}" is removed from "{action}" '
                        'because another action already uses this shortcut.'.format(shortcut=shortcuts[0],
                                                                                    action=action.objectName()))
            shortcuts.remove(shortcuts[0])
        action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
开发者ID:imkernel,项目名称:openlp,代码行数:61,代码来源:actions.py

示例12: init_url

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
def init_url(plugin_name, db_file_name=None):
    """
    Return the database URL.

    :param plugin_name: The name of the plugin for the database creation.
    :param db_file_name: The database file name. Defaults to None resulting in the plugin_name being used.
    """
    settings = Settings()
    settings.beginGroup(plugin_name)
    db_type = settings.value('db type')
    if db_type == 'sqlite':
        db_url = get_db_path(plugin_name, db_file_name)
    else:
        db_url = '%s://%s:%[email protected]%s/%s' % (db_type, urlquote(settings.value('db username')),
                                       urlquote(settings.value('db password')),
                                       urlquote(settings.value('db hostname')),
                                       urlquote(settings.value('db database')))
    settings.endGroup()
    return db_url
开发者ID:crossroadchurch,项目名称:paul,代码行数:21,代码来源:db.py

示例13: init_url

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
def init_url(plugin_name, db_file_name=None):
    """
    Return the database URL.

    :param plugin_name: The name of the plugin for the database creation.
    :param db_file_name: The database file name. Defaults to None resulting in the plugin_name being used.
    """
    settings = Settings()
    settings.beginGroup(plugin_name)
    db_type = settings.value('db type')
    if db_type == 'sqlite':
        db_url = get_db_path(plugin_name, db_file_name)
    else:
        db_url = '{type}://{user}:{password}@{host}/{db}'.format(type=db_type,
                                                                 user=urlquote(settings.value('db username')),
                                                                 password=urlquote(settings.value('db password')),
                                                                 host=urlquote(settings.value('db hostname')),
                                                                 db=urlquote(settings.value('db database')))
    settings.endGroup()
    return db_url
开发者ID:imkernel,项目名称:openlp,代码行数:22,代码来源:db.py

示例14: load_screen_settings

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
 def load_screen_settings(self):
     """
     Loads the screen size and the monitor number from the settings.
     """
     # Add the screen settings to the settings dict. This has to be done here due to cyclic dependency.
     # Do not do this anywhere else.
     screen_settings = {
         'core/x position': self.current['size'].x(),
         'core/y position': self.current['size'].y(),
         'core/monitor': self.display_count - 1,
         'core/height': self.current['size'].height(),
         'core/width': self.current['size'].width()
     }
     Settings.extend_default_settings(screen_settings)
     settings = Settings()
     settings.beginGroup('core')
     monitor = settings.value('monitor')
     self.set_current_display(monitor)
     self.display = settings.value('display on monitor')
     override_display = settings.value('override position')
     x = settings.value('x position')
     y = settings.value('y position')
     width = settings.value('width')
     height = settings.value('height')
     self.override['size'] = QtCore.QRect(x, y, width, height)
     self.override['primary'] = False
     settings.endGroup()
     if override_display:
         self.set_override_display()
     else:
         self.reset_current_display()
开发者ID:crossroadchurch,项目名称:paul,代码行数:33,代码来源:screen.py

示例15: check_latest_version

# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import value [as 别名]
def check_latest_version(current_version):
    """
    Check the latest version of OpenLP against the version file on the OpenLP
    site.

    **Rules around versions and version files:**

    * If a version number has a build (i.e. -bzr1234), then it is a nightly.
    * If a version number's minor version is an odd number, it is a development release.
    * If a version number's minor version is an even number, it is a stable release.

    :param current_version: The current version of OpenLP.
    """
    version_string = current_version["full"]
    # set to prod in the distribution config file.
    settings = Settings()
    settings.beginGroup("core")
    last_test = settings.value("last version test")
    this_test = str(datetime.now().date())
    settings.setValue("last version test", this_test)
    settings.endGroup()
    if last_test != this_test:
        if current_version["build"]:
            req = urllib.request.Request("http://www.openlp.org/files/nightly_version.txt")
        else:
            version_parts = current_version["version"].split(".")
            if int(version_parts[1]) % 2 != 0:
                req = urllib.request.Request("http://www.openlp.org/files/dev_version.txt")
            else:
                req = urllib.request.Request("http://www.openlp.org/files/version.txt")
        req.add_header(
            "User-Agent", "OpenLP/%s %s/%s; " % (current_version["full"], platform.system(), platform.release())
        )
        remote_version = None
        retries = 0
        while True:
            try:
                remote_version = str(
                    urllib.request.urlopen(req, None, timeout=CONNECTION_TIMEOUT).read().decode()
                ).strip()
            except (urllib.error.URLError, ConnectionError):
                if retries > CONNECTION_RETRIES:
                    log.exception("Failed to download the latest OpenLP version file")
                else:
                    retries += 1
                    time.sleep(0.1)
                    continue
            break
        if remote_version:
            version_string = remote_version
    return version_string
开发者ID:crossroadchurch,项目名称:paul,代码行数:53,代码来源:__init__.py


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