本文整理汇总了Python中openlp.core.lib.Settings.value方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.value方法的具体用法?Python Settings.value怎么用?Python Settings.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.lib.Settings
的用法示例。
在下文中一共展示了Settings.value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setDefaults
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def setDefaults(self):
"""
Set default values for the wizard pages.
"""
settings = Settings()
settings.beginGroup(self.plugin.settingsSection)
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
self.setField(u'source_format', 0)
self.setField(u'osis_location', '')
self.setField(u'csv_booksfile', '')
self.setField(u'csv_versefile', '')
self.setField(u'opensong_file', '')
self.setField(u'web_location', WebDownload.Crosswalk)
self.setField(u'web_biblename', self.webTranslationComboBox.currentIndex())
self.setField(u'proxy_server', settings.value(u'proxy address'))
self.setField(u'proxy_username', settings.value(u'proxy username'))
self.setField(u'proxy_password', settings.value(u'proxy password'))
self.setField(u'openlp1_location', '')
self.setField(u'license_version', self.versionNameEdit.text())
self.setField(u'license_copyright', self.copyrightEdit.text())
self.setField(u'license_permissions', self.permissionsEdit.text())
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
settings.endGroup()
示例2: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.displayFooter = settings.value(u'display footer')
self.update_load = settings.value(u'add custom from service')
self.displayFooterCheckBox.setChecked(self.displayFooter)
self.add_from_service_checkbox.setChecked(self.update_load)
settings.endGroup()
示例3: __init__
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def __init__(self, plugin_name, init_schema, db_file_name=None, upgrade_mod=None):
"""
Runs the initialisation process that includes creating the connection to the database and the tables if they do
not exist.
``plugin_name``
The name to setup paths and settings section names
``init_schema``
The init_schema function for this database
``upgrade_schema``
The upgrade_schema function for this database
``db_file_name``
The file name to use for this database. Defaults to None resulting in the plugin_name being used.
"""
settings = Settings()
settings.beginGroup(plugin_name)
self.db_url = ''
self.is_dirty = False
self.session = None
db_type = settings.value('db type')
if db_type == 'sqlite':
if db_file_name:
self.db_url = 'sqlite:///%s/%s' % (AppLocation.get_section_data_path(plugin_name), db_file_name)
else:
self.db_url = 'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name)
else:
self.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')))
if db_type == 'mysql':
db_encoding = settings.value('db encoding')
self.db_url += '?charset=%s' % urlquote(db_encoding)
settings.endGroup()
if upgrade_mod:
db_ver, up_ver = upgrade_db(self.db_url, upgrade_mod)
if db_ver > up_ver:
critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'),
translate('OpenLP.Manager', 'The database being loaded was created in a more recent version of '
'OpenLP. The database is version %d, while OpenLP expects version %d. The database will not '
'be loaded.\n\nDatabase: %s') % (db_ver, up_ver, self.db_url)
)
return
try:
self.session = init_schema(self.db_url)
except (SQLAlchemyError, DBAPIError):
log.exception('Error loading database: %s', self.db_url)
critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'),
translate('OpenLP.Manager', 'OpenLP cannot load your database.\n\nDatabase: %s') % self.db_url
)
示例4: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settings_section)
self.song_search = settings.value('search as type')
self.tool_bar = settings.value('display songbar')
self.update_edit = settings.value('update service on edit')
self.update_load = settings.value('add song from service')
self.search_as_type_check_box.setChecked(self.song_search)
self.tool_bar_active_check_box.setChecked(self.tool_bar)
self.update_on_edit_check_box.setChecked(self.update_edit)
self.add_from_service_check_box.setChecked(self.update_load)
settings.endGroup()
示例5: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.song_search = settings.value(u'search as type')
self.tool_bar = settings.value(u'display songbar')
self.update_edit = settings.value(u'update service on edit')
self.update_load = settings.value(u'add song from service')
self.searchAsTypeCheckBox.setChecked(self.song_search)
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
self.updateOnEditCheckBox.setChecked(self.update_edit)
self.addFromServiceCheckBox.setChecked(self.update_load)
settings.endGroup()
示例6: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settings_section)
self.show_new_chapters = settings.value('display new chapter')
self.display_style = settings.value('display brackets')
self.layout_style = settings.value('verse layout style')
self.bible_theme = settings.value('bible theme')
self.second_bibles = settings.value('second bibles')
self.new_chapters_check_box.setChecked(self.show_new_chapters)
self.display_style_combo_box.setCurrentIndex(self.display_style)
self.layout_style_combo_box.setCurrentIndex(self.layout_style)
self.bible_second_check_box.setChecked(self.second_bibles)
verse_separator = settings.value('verse separator')
if (verse_separator.strip('|') == '') or (verse_separator == get_reference_separator('sep_v_default')):
self.verse_separator_line_edit.setText(get_reference_separator('sep_v_default'))
self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.verse_separator_check_box.setChecked(False)
else:
self.verse_separator_line_edit.setText(verse_separator)
self.verse_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.verse_separator_check_box.setChecked(True)
range_separator = settings.value('range separator')
if (range_separator.strip('|') == '') or (range_separator == get_reference_separator('sep_r_default')):
self.range_separator_line_edit.setText(get_reference_separator('sep_r_default'))
self.range_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.range_separator_check_box.setChecked(False)
else:
self.range_separator_line_edit.setText(range_separator)
self.range_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.range_separator_check_box.setChecked(True)
list_separator = settings.value('list separator')
if (list_separator.strip('|') == '') or (list_separator == get_reference_separator('sep_l_default')):
self.list_separator_line_edit.setText(get_reference_separator('sep_l_default'))
self.list_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.list_separator_check_box.setChecked(False)
else:
self.list_separator_line_edit.setText(list_separator)
self.list_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.list_separator_check_box.setChecked(True)
end_separator = settings.value('end separator')
if (end_separator.strip('|') == '') or (end_separator == get_reference_separator('sep_e_default')):
self.end_separator_line_edit.setText(get_reference_separator('sep_e_default'))
self.end_separator_line_edit.setPalette(self.getGreyTextPalette(True))
self.end_separator_check_box.setChecked(False)
else:
self.end_separator_line_edit.setText(end_separator)
self.end_separator_line_edit.setPalette(self.getGreyTextPalette(False))
self.end_separator_check_box.setChecked(True)
self.language_selection = settings.value('book name language')
self.language_selection_combo_box.setCurrentIndex(self.language_selection)
settings.endGroup()
示例7: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.show_new_chapters = settings.value(u'display new chapter')
self.display_style = settings.value(u'display brackets')
self.layout_style = settings.value(u'verse layout style')
self.bible_theme = settings.value(u'bible theme')
self.second_bibles = settings.value(u'second bibles')
self.newChaptersCheckBox.setChecked(self.show_new_chapters)
self.displayStyleComboBox.setCurrentIndex(self.display_style)
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
self.bibleSecondCheckBox.setChecked(self.second_bibles)
verse_separator = settings.value(u'verse separator')
if (verse_separator.strip(u'|') == u'') or (verse_separator == get_reference_separator(u'sep_v_default')):
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default'))
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.verseSeparatorCheckBox.setChecked(False)
else:
self.verseSeparatorLineEdit.setText(verse_separator)
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.verseSeparatorCheckBox.setChecked(True)
range_separator = settings.value(u'range separator')
if (range_separator.strip(u'|') == u'') or (range_separator == get_reference_separator(u'sep_r_default')):
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default'))
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.rangeSeparatorCheckBox.setChecked(False)
else:
self.rangeSeparatorLineEdit.setText(range_separator)
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.rangeSeparatorCheckBox.setChecked(True)
list_separator = settings.value(u'list separator')
if (list_separator.strip(u'|') == u'') or (list_separator == get_reference_separator(u'sep_l_default')):
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default'))
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.listSeparatorCheckBox.setChecked(False)
else:
self.listSeparatorLineEdit.setText(list_separator)
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.listSeparatorCheckBox.setChecked(True)
end_separator = settings.value(u'end separator')
if (end_separator.strip(u'|') == u'') or (end_separator == get_reference_separator(u'sep_e_default')):
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default'))
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.endSeparatorCheckBox.setChecked(False)
else:
self.endSeparatorLineEdit.setText(end_separator)
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.endSeparatorCheckBox.setChecked(True)
self.language_selection = settings.value(u'book name language')
self.languageSelectionComboBox.setCurrentIndex(self.language_selection)
settings.endGroup()
示例8: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
"""
Load the theme settings into the tab
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
self.theme_level = settings.value(u'theme level')
self.global_theme = settings.value(u'global theme')
settings.endGroup()
if self.theme_level == ThemeLevel.Global:
self.GlobalLevelRadioButton.setChecked(True)
elif self.theme_level == ThemeLevel.Service:
self.ServiceLevelRadioButton.setChecked(True)
else:
self.SongLevelRadioButton.setChecked(True)
示例9: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.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')
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)
示例10: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.bg_color = settings.value(u'background color')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
示例11: save
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def save(self):
settings = Settings()
settings.beginGroup(self.settings_section)
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
示例12: save
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.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()
示例13: update_reference_separators
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def update_reference_separators():
"""
Updates separators and matches for parsing and formating scripture
references.
"""
default_separators = translate('BiblesPlugin',
':|v|V|verse|verses;;-|to;;,|and;;end Double-semicolon delimited separators for parsing references. '
'Consult the developers for further information.').split(u';;')
settings = Settings()
settings.beginGroup(u'bibles')
custom_separators = [
settings.value(u'verse separator'),
settings.value(u'range separator'),
settings.value(u'list separator'),
settings.value(u'end separator')]
settings.endGroup()
for index, role in enumerate([u'v', u'r', u'l', u'e']):
if custom_separators[index].strip(u'|') == u'':
source_string = default_separators[index].strip(u'|')
else:
source_string = custom_separators[index].strip(u'|')
while u'||' in source_string:
source_string = source_string.replace(u'||', u'|')
if role != u'e':
REFERENCE_SEPARATORS[u'sep_%s_display' % role] = source_string.split(u'|')[0]
# escape reserved characters
for character in u'\\.^$*+?{}[]()':
source_string = source_string.replace(character, u'\\' + character)
# add various unicode alternatives
source_string = source_string.replace(u'-',
u'(?:[-\u00AD\u2010\u2011\u2012\u2013\u2014\u2212\uFE63\uFF0D])')
source_string = source_string.replace(u',', u'(?:[,\u201A])')
REFERENCE_SEPARATORS[u'sep_%s' % role] = u'\s*(?:%s)\s*' % source_string
REFERENCE_SEPARATORS[u'sep_%s_default' % role] = default_separators[index]
# verse range match: (<chapter>:)?<verse>(-((<chapter>:)?<verse>|end)?)?
range_regex = u'(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?' \
u'(?P<from_verse>[0-9]+)(?P<range_to>%(sep_r)s(?:(?:(?P<to_chapter>' \
u'[0-9]+)%(sep_v)s)?(?P<to_verse>[0-9]+)|%(sep_e)s)?)?' % REFERENCE_SEPARATORS
REFERENCE_MATCHES[u'range'] = re.compile(u'^\s*%s\s*$' % range_regex, re.UNICODE)
REFERENCE_MATCHES[u'range_separator'] = re.compile(REFERENCE_SEPARATORS[u'sep_l'], re.UNICODE)
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
REFERENCE_MATCHES[u'full'] = re.compile(u'^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
u'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$' \
% dict(REFERENCE_SEPARATORS.items() + [(u'range_regex', range_regex)]), re.UNICODE)
示例14: load_screen_settings
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load_screen_settings(self):
"""
Loads the screen size and the monitor number from the settings.
"""
from openlp.core.lib import Settings
# Add the screen settings to the settings dict. This has to be done here due to crycle dependency.
# Do not do this anywhere else.
screen_settings = {
u'general/x position': self.current[u'size'].x(),
u'general/y position': self.current[u'size'].y(),
u'general/monitor': self.display_count - 1,
u'general/height': self.current[u'size'].height(),
u'general/width': self.current[u'size'].width()
}
Settings.extend_default_settings(screen_settings)
settings = Settings()
settings.beginGroup(u'general')
monitor = settings.value(u'monitor')
self.set_current_display(monitor)
self.display = settings.value(u'display on monitor')
override_display = settings.value(u'override position')
x = settings.value(u'x position')
y = settings.value(u'y position')
width = settings.value(u'width')
height = settings.value(u'height')
self.override[u'size'] = QtCore.QRect(x, y, width, height)
self.override[u'primary'] = False
settings.endGroup()
if override_display:
self.set_override_display()
else:
self.reset_current_display()
示例15: load
# 需要导入模块: from openlp.core.lib import Settings [as 别名]
# 或者: from openlp.core.lib.Settings import value [as 别名]
def load(self):
"""
Load the settings
"""
if self.savedUsedPlayers:
self.usedPlayers = self.savedUsedPlayers
self.usedPlayers = get_media_players()[0]
self.savedUsedPlayers = self.usedPlayers
settings = Settings()
settings.beginGroup(self.settingsSection)
self.updatePlayerList()
self.bg_color = settings.value(u'background color')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)