mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[config] finished moving
This commit is contained in:
22
bauh/app.py
22
bauh/app.py
@@ -34,28 +34,27 @@ def main():
|
||||
app_args.validate(args, logger)
|
||||
|
||||
local_config = config.read_config(update_file=True)
|
||||
config.validate(local_config, logger)
|
||||
|
||||
i18n_key, current_i18n = translation.get_locale_keys(local_config.locale)
|
||||
i18n_key, current_i18n = translation.get_locale_keys(local_config['locale'])
|
||||
default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {}
|
||||
i18n = I18n(i18n_key, current_i18n, DEFAULT_I18N_KEY, default_i18n)
|
||||
|
||||
cache_cleaner = CacheCleaner()
|
||||
cache_factory = DefaultMemoryCacheFactory(expiration_time=local_config.cache_exp, cleaner=cache_cleaner)
|
||||
icon_cache = cache_factory.new(local_config.icon_exp)
|
||||
cache_factory = DefaultMemoryCacheFactory(expiration_time=int(local_config['memory_cache']['data_expiration']), cleaner=cache_cleaner)
|
||||
icon_cache = cache_factory.new(int(local_config['memory_cache']['icon_expiration']))
|
||||
|
||||
http_client = HttpClient(logger)
|
||||
|
||||
context = ApplicationContext(i18n=i18n,
|
||||
http_client=http_client,
|
||||
disk_cache=local_config.disk_cache,
|
||||
download_icons=local_config.download_icons,
|
||||
disk_cache=bool(local_config['disk_cache']['enabled']),
|
||||
download_icons=bool(local_config['download']['icons']),
|
||||
app_root_dir=ROOT_DIR,
|
||||
cache_factory=cache_factory,
|
||||
disk_loader_factory=DefaultDiskCacheLoaderFactory(disk_cache_enabled=local_config.disk_cache, logger=logger),
|
||||
disk_loader_factory=DefaultDiskCacheLoaderFactory(disk_cache_enabled=bool(local_config['disk_cache']['enabled']), logger=logger),
|
||||
logger=logger,
|
||||
distro=util.get_distro(),
|
||||
file_downloader=AdaptableFileDownloader(logger, local_config.download_mthread,
|
||||
file_downloader=AdaptableFileDownloader(logger, bool(local_config['download']['multithreaded']),
|
||||
i18n, http_client))
|
||||
|
||||
managers = gems.load_managers(context=context, locale=i18n_key, config=local_config, default_locale=DEFAULT_I18N_KEY)
|
||||
@@ -72,8 +71,8 @@ def main():
|
||||
app.setApplicationVersion(__version__)
|
||||
app.setWindowIcon(QIcon(resource.get_path('img/logo.svg')))
|
||||
|
||||
if local_config.style:
|
||||
app.setStyle(local_config.style)
|
||||
if local_config['ui']['style']:
|
||||
app.setStyle(str(local_config['ui']['style']))
|
||||
else:
|
||||
if app.style().objectName().lower() not in {'fusion', 'breeze'}:
|
||||
app.setStyle('Fusion')
|
||||
@@ -91,8 +90,7 @@ def main():
|
||||
tray_icon = TrayIcon(i18n=i18n,
|
||||
manager=manager,
|
||||
manage_window=manage_window,
|
||||
check_interval=local_config.update_check_interval,
|
||||
update_notification=local_config.system_notifications)
|
||||
config=local_config)
|
||||
manage_window.set_tray_icon(tray_icon)
|
||||
tray_icon.show()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user