當前位置: 首頁>>代碼示例>>Python>>正文


Python Settings.setDefaultFormat方法代碼示例

本文整理匯總了Python中openlp.core.common.Settings.setDefaultFormat方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.setDefaultFormat方法的具體用法?Python Settings.setDefaultFormat怎麽用?Python Settings.setDefaultFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在openlp.core.common.Settings的用法示例。


在下文中一共展示了Settings.setDefaultFormat方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: build_settings

# 需要導入模塊: from openlp.core.common import Settings [as 別名]
# 或者: from openlp.core.common.Settings import setDefaultFormat [as 別名]
 def build_settings(self):
     """
     Build the settings Object and initialise it
     """
     Settings.setDefaultFormat(Settings.IniFormat)
     self.fd, self.ini_file = mkstemp('.ini')
     Settings().set_filename(self.ini_file)
開發者ID:crossroadchurch,項目名稱:paul,代碼行數:9,代碼來源:testmixin.py

示例2: setUp

# 需要導入模塊: from openlp.core.common import Settings [as 別名]
# 或者: from openlp.core.common.Settings import setDefaultFormat [as 別名]
 def setUp(self):
     """
     Some pre-test setup required.
     """
     Settings.setDefaultFormat(Settings.IniFormat)
     self.build_settings()
     self.temp_dir = mkdtemp('openlp')
     Settings().setValue('advanced/data path', self.temp_dir)
     Registry.create()
     Registry().register('service_list', MagicMock())
     self.setup_application()
     self.main_window = QtGui.QMainWindow()
     Registry().register('main_window', self.main_window)
開發者ID:crossroadchurch,項目名稱:paul,代碼行數:15,代碼來源:test_pluginmanager.py

示例3: main

# 需要導入模塊: from openlp.core.common import Settings [as 別名]
# 或者: from openlp.core.common.Settings import setDefaultFormat [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))
開發者ID:crossroadchurch,項目名稱:paul,代碼行數:76,代碼來源:__init__.py


注:本文中的openlp.core.common.Settings.setDefaultFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。