本文整理汇总了Python中openlp.core.common.Settings.setValue方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.setValue方法的具体用法?Python Settings.setValue怎么用?Python Settings.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.common.Settings
的用法示例。
在下文中一共展示了Settings.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('background color', self.background_color)
settings.endGroup()
if self.initial_color != self.background_color:
self.settings_form.register_post_process('images_config_updated')
示例2: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the Dialog settings
"""
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('display footer', self.display_footer)
settings.setValue('add custom from service', self.update_load)
settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process('custom_config_updated')
self.tab_visited = False
示例3: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('display songbar', self.tool_bar)
settings.setValue('update service on edit', self.update_edit)
settings.setValue('add song from service', self.update_load)
settings.setValue('display songbook', self.display_songbook)
settings.setValue('display written by', self.display_written_by)
settings.setValue('display copyright symbol', self.display_copyright_symbol)
settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process('songs_config_updated')
self.tab_visited = False
示例4: check_latest_version
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [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
示例5: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the settings
"""
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('background color', self.background_color)
settings.endGroup()
old_players, override_player = get_media_players()
if self.used_players != old_players:
# clean old Media stuff
set_media_players(self.used_players, override_player)
self.settings_form.register_post_process('mediaitem_suffix_reset')
self.settings_form.register_post_process('mediaitem_media_rebuild')
self.settings_form.register_post_process('config_screen_changed')
示例6: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the shortcuts. **Note**, that we do not have to load the shortcuts, as they are loaded in
:class:`~openlp.core.utils.ActionList`.
"""
settings = Settings()
settings.beginGroup('shortcuts')
for category in self.action_list.categories:
# Check if the category is for internal use only.
if category.name is None:
continue
for action in category.actions:
if action in self.changed_actions:
old_shortcuts = list(map(self.get_shortcut_string, action.shortcuts()))
action.setShortcuts(self.changed_actions[action])
self.action_list.update_shortcut_map(action, old_shortcuts)
settings.setValue(action.objectName(), action.shortcuts())
settings.endGroup()
示例7: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the projector settings
"""
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('connect on start', self.connect_on_startup.isChecked())
settings.setValue('socket timeout', self.socket_timeout_spin_box.value())
settings.setValue('poll time', self.socket_poll_spin_box.value())
settings.setValue('source dialog type', self.dialog_type_combo_box.currentIndex())
settings.endGroup()
示例8: save_options
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save_options(self):
"""
Save the settings and close the dialog.
"""
# Save the settings for this dialog.
settings = Settings()
settings.beginGroup('advanced')
settings.setValue('print slide text', self.slide_text_check_box.isChecked())
settings.setValue('add page break', self.page_break_after_text.isChecked())
settings.setValue('print file meta data', self.meta_data_check_box.isChecked())
settings.setValue('print notes', self.notes_check_box.isChecked())
settings.endGroup()
示例9: display_size_changed
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def display_size_changed(self, display):
"""
The Zoom Combo box has changed so set up the size.
"""
if display == ZoomSize.Page:
self.preview_widget.fitInView()
elif display == ZoomSize.Width:
self.preview_widget.fitToWidth()
elif display == ZoomSize.OneHundred:
self.preview_widget.fitToWidth()
self.preview_widget.zoomIn(1)
elif display == ZoomSize.SeventyFive:
self.preview_widget.fitToWidth()
self.preview_widget.zoomIn(0.75)
elif display == ZoomSize.Fifty:
self.preview_widget.fitToWidth()
self.preview_widget.zoomIn(0.5)
elif display == ZoomSize.TwentyFive:
self.preview_widget.fitToWidth()
self.preview_widget.zoomIn(0.25)
settings = Settings()
settings.beginGroup('advanced')
settings.setValue('display size', display)
settings.endGroup()
示例10: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the settings
"""
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('theme level', self.theme_level)
settings.setValue('global theme', self.global_theme)
settings.setValue('wrap footer', self.wrap_footer_check_box.isChecked())
settings.endGroup()
self.renderer.set_theme_level(self.theme_level)
if self.tab_visited:
self.settings_form.register_post_process('theme_update_global')
self.tab_visited = False
示例11: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [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('single click service preview', self.single_click_service_preview_check_box.isChecked())
settings.setValue('expand service item', self.expand_service_item_check_box.isChecked())
slide_max_height_index = self.slide_max_height_combo_box.currentIndex()
slide_max_height_value = self.slide_max_height_combo_box.itemData(slide_max_height_index)
settings.setValue('slide max height', slide_max_height_value)
settings.setValue('autoscrolling', self.autoscroll_map[self.autoscroll_combo_box.currentIndex()])
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('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.setValue('search as type', self.is_search_as_you_type_enabled)
settings.endGroup()
示例12: main
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def main(args=None):
"""
The main function which parses command line options and then runs
:param args: Some args
"""
(options, args) = parse_options(args)
qt_args = []
if options.loglevel.lower() in ['d', 'debug']:
log.setLevel(logging.DEBUG)
elif options.loglevel.lower() in ['w', 'warning']:
log.setLevel(logging.WARNING)
else:
log.setLevel(logging.INFO)
if options.style:
qt_args.extend(['-style', options.style])
# Throw the rest of the arguments at Qt, just in case.
qt_args.extend(args)
# Bug #1018855: Set the WM_CLASS property in X11
if not is_win() and not is_macosx():
qt_args.append('OpenLP')
# Initialise the resources
qInitResources()
# Now create and actually run the application.
application = OpenLP(qt_args)
application.setOrganizationName('OpenLP')
application.setOrganizationDomain('openlp.org')
if options.portable:
application.setApplicationName('OpenLPPortable')
Settings.setDefaultFormat(Settings.IniFormat)
# Get location OpenLPPortable.ini
application_path = AppLocation.get_directory(AppLocation.AppDir)
set_up_logging(os.path.abspath(os.path.join(application_path, '..', '..', 'Other')))
log.info('Running portable')
portable_settings_file = os.path.abspath(os.path.join(application_path, '..', '..', 'Data', 'OpenLP.ini'))
# Make this our settings file
log.info('INI file: %s', portable_settings_file)
Settings.set_filename(portable_settings_file)
portable_settings = Settings()
# Set our data path
data_path = os.path.abspath(os.path.join(application_path, '..', '..', 'Data',))
log.info('Data path: %s', data_path)
# Point to our data path
portable_settings.setValue('advanced/data path', data_path)
portable_settings.setValue('advanced/is portable', True)
portable_settings.sync()
else:
application.setApplicationName('OpenLP')
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
Registry.create()
Registry().register('application', application)
application.setApplicationVersion(get_application_version()['version'])
# Instance check
if application.is_already_running():
sys.exit()
# Remove/convert obsolete settings.
Settings().remove_obsolete_settings()
# First time checks in settings
if not Settings().value('core/has run wizard'):
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()
# i18n Set Language
language = LanguageManager.get_language()
application_translator, default_translator = LanguageManager.get_translator(language)
if not application_translator.isEmpty():
application.installTranslator(application_translator)
if not default_translator.isEmpty():
application.installTranslator(default_translator)
else:
log.debug('Could not find default_translator.')
if not options.no_error_form:
sys.excepthook = application.hook_exception
sys.exit(application.run(qt_args))
示例13: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [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.setValue('reset to combined quick search', self.reset_to_combined_quick_search)
settings.setValue('hide combined quick error', self.hide_combined_quick_error)
settings.setValue('is search while typing enabled', self.bible_search_while_typing)
settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process('bibles_config_updated')
self.tab_visited = False
示例14: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the changes on exit of the Settings dialog.
"""
settings = Settings()
settings.beginGroup(self.settings_section)
# Check value has changed as no event handles this field
if settings.value("location") != self.vertical_combo_box.currentIndex():
self.changed = True
settings.setValue("background color", self.background_color)
settings.setValue("font color", self.font_color)
settings.setValue("font size", self.font_size)
self.font_face = self.font_combo_box.currentFont().family()
settings.setValue("font face", self.font_face)
settings.setValue("timeout", self.timeout)
self.location = self.vertical_combo_box.currentIndex()
settings.setValue("location", self.location)
settings.endGroup()
if self.changed:
self.settings_form.register_post_process("update_display_css")
self.changed = False
示例15: save
# 需要导入模块: from openlp.core.common import Settings [as 别名]
# 或者: from openlp.core.common.Settings import setValue [as 别名]
def save(self):
"""
Save the settings from the form
"""
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue('monitor', self.monitor_combo_box.currentIndex())
settings.setValue('display on monitor', self.display_on_monitor_check.isChecked())
settings.setValue('blank warning', self.warning_check_box.isChecked())
settings.setValue('auto open', self.auto_open_check_box.isChecked())
settings.setValue('show splash', self.show_splash_check_box.isChecked())
settings.setValue('update check', self.check_for_updates_check_box.isChecked())
settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
settings.setValue('loop delay', self.timeout_spin_box.value())
settings.setValue('ccli number', self.number_edit.displayText())
settings.setValue('songselect username', self.username_edit.displayText())
settings.setValue('songselect password', self.password_edit.displayText())
settings.setValue('x position', self.custom_X_value_edit.value())
settings.setValue('y position', self.custom_Y_value_edit.value())
settings.setValue('height', self.custom_height_value_edit.value())
settings.setValue('width', self.custom_width_value_edit.value())
settings.setValue('override position', self.override_radio_button.isChecked())
settings.setValue('audio start paused', self.start_paused_check_box.isChecked())
settings.setValue('audio repeat list', self.repeat_list_check_box.isChecked())
settings.endGroup()
# On save update the screens as well
self.post_set_up(True)