def __init__(self): LOGGING_LEVEL = logging.DEBUG if proxy.prefValue_('DebugMode') else logging.WARNING logging.basicConfig(level=LOGGING_LEVEL, format='%(levelname)s %(message)s') install_exception_hook() install_cocoa_logger() logging.debug('started in debug mode') cache_path = op.join(proxy.getCachePath(), 'moneyGuru') appdata_path = op.join(proxy.getAppdataPath(), 'moneyGuru') plugin_model_path = op.join(proxy.getResourcePath(), 'plugin_examples') currency_code = nonone(proxy.systemCurrency(), 'USD') logging.info('Currency code: {0}'.format(currency_code)) try: system_currency = Currency(currency_code) except ValueError: # currency does not exist logging.warning('System currency {0} is not supported. Falling back to USD.'.format(currency_code)) system_currency = USD date_format = proxy.systemShortDateFormat() logging.info('System date format: %s' % date_format) date_format = clean_format(date_format) logging.info('Cleaned date format: %s' % date_format) decimal_sep = proxy.systemNumberDecimalSeparator() grouping_sep = proxy.systemNumberGroupingSeparator() logging.info('System numeric separators: %s and %s' % (grouping_sep, decimal_sep)) model = Application(self, date_format=date_format, decimal_sep=decimal_sep, grouping_sep=grouping_sep, default_currency=system_currency, cache_path=cache_path, appdata_path=appdata_path, plugin_model_path=plugin_model_path) PyBaseApp.__init__(self, model)
def install_gettext_trans_under_cocoa(): from cocoa import proxy resFolder = proxy.getResourcePath() baseFolder = op.join(resFolder, 'locale') currentLang = proxy.systemLang() install_gettext_trans(baseFolder, currentLang) localename = get_locale_name(currentLang) if localename is not None: locale.setlocale(locale.LC_ALL, localename)
def install_gettext_trans_under_cocoa(): from cocoa import proxy res_folder = proxy.getResourcePath() base_folder = op.join(res_folder, "locale") current_lang = proxy.systemLang() install_gettext_trans(base_folder, current_lang) localename = get_locale_name(current_lang) if localename is not None: locale.setlocale(locale.LC_ALL, localename)