mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
Migrate core config module to bearhub namespace
This commit is contained in:
@@ -1,76 +1 @@
|
|||||||
from bauh.api.paths import CONFIG_DIR
|
from bearhub.view.core.config import * # noqa: F401,F403
|
||||||
from bauh.commons.config import YAMLConfigManager
|
|
||||||
|
|
||||||
FILE_PATH = f'{CONFIG_DIR}/config.yml'
|
|
||||||
|
|
||||||
BACKUP_DEFAULT_REMOVE_METHOD = 'self'
|
|
||||||
BACKUP_REMOVE_METHODS = {BACKUP_DEFAULT_REMOVE_METHOD, 'all'}
|
|
||||||
|
|
||||||
|
|
||||||
class CoreConfigManager(YAMLConfigManager):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(CoreConfigManager, self).__init__(config_file_path=FILE_PATH)
|
|
||||||
|
|
||||||
def get_default_config(self) -> dict:
|
|
||||||
return {
|
|
||||||
'gems': None,
|
|
||||||
'memory_cache': {
|
|
||||||
'data_expiration': 60 * 60,
|
|
||||||
'icon_expiration': 60 * 5
|
|
||||||
},
|
|
||||||
'locale': None,
|
|
||||||
'updates': {
|
|
||||||
'check_interval': 5,
|
|
||||||
'ask_for_reboot': True
|
|
||||||
},
|
|
||||||
'system': {
|
|
||||||
'notifications': True,
|
|
||||||
'single_dependency_checking': False
|
|
||||||
},
|
|
||||||
'suggestions': {
|
|
||||||
'enabled': True,
|
|
||||||
'by_type': 15
|
|
||||||
},
|
|
||||||
'ui': {
|
|
||||||
'table': {
|
|
||||||
'max_displayed': 50
|
|
||||||
},
|
|
||||||
'tray': {
|
|
||||||
'default_icon': None,
|
|
||||||
'updates_icon': None
|
|
||||||
},
|
|
||||||
'qt_style': 'fusion',
|
|
||||||
'hdpi': True,
|
|
||||||
"auto_scale": False,
|
|
||||||
"scale_factor": 1.0,
|
|
||||||
'theme': 'light',
|
|
||||||
'system_theme': False
|
|
||||||
|
|
||||||
},
|
|
||||||
'download': {
|
|
||||||
'multithreaded': False,
|
|
||||||
'multithreaded_client': None,
|
|
||||||
'icons': True,
|
|
||||||
'check_ssl': True
|
|
||||||
},
|
|
||||||
'store_root_password': True,
|
|
||||||
'disk': {
|
|
||||||
'trim': {
|
|
||||||
'after_upgrade': False
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'backup': {
|
|
||||||
'enabled': True,
|
|
||||||
'install': None,
|
|
||||||
'uninstall': None,
|
|
||||||
'downgrade': None,
|
|
||||||
'upgrade': None,
|
|
||||||
'mode': 'incremental',
|
|
||||||
'type': 'rsync',
|
|
||||||
'remove_method': 'self'
|
|
||||||
},
|
|
||||||
'boot': {
|
|
||||||
'load_apps': True
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from PyQt5.QtCore import QCoreApplication, Qt
|
|||||||
|
|
||||||
from bearhub import __app_name__
|
from bearhub import __app_name__
|
||||||
from bearhub import app_args
|
from bearhub import app_args
|
||||||
from bauh.view.core.config import CoreConfigManager
|
from bearhub.view.core.config import CoreConfigManager
|
||||||
from bauh.view.util import logs
|
from bauh.view.util import logs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from bearhub.cli.controller import CLIManager
|
|||||||
from bauh.commons.internet import InternetChecker
|
from bauh.commons.internet import InternetChecker
|
||||||
from bearhub.context import generate_i18n, DEFAULT_I18N_KEY
|
from bearhub.context import generate_i18n, DEFAULT_I18N_KEY
|
||||||
from bauh.view.core import gems
|
from bauh.view.core import gems
|
||||||
from bauh.view.core.config import CoreConfigManager
|
from bearhub.view.core.config import CoreConfigManager
|
||||||
from bauh.view.core.controller import GenericSoftwareManager
|
from bauh.view.core.controller import GenericSoftwareManager
|
||||||
from bauh.view.core.downloader import AdaptableFileDownloader
|
from bauh.view.core.downloader import AdaptableFileDownloader
|
||||||
from bauh.view.util import logs, util, resource
|
from bauh.view.util import logs, util, resource
|
||||||
|
|||||||
3
bearhub/view/__init__.py
Normal file
3
bearhub/view/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
"""
|
||||||
|
Bearhub view namespace package (migration in progress).
|
||||||
|
"""
|
||||||
3
bearhub/view/core/__init__.py
Normal file
3
bearhub/view/core/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
"""
|
||||||
|
Bearhub view.core namespace package (migration in progress).
|
||||||
|
"""
|
||||||
76
bearhub/view/core/config.py
Normal file
76
bearhub/view/core/config.py
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
from bauh.api.paths import CONFIG_DIR
|
||||||
|
from bauh.commons.config import YAMLConfigManager
|
||||||
|
|
||||||
|
FILE_PATH = f'{CONFIG_DIR}/config.yml'
|
||||||
|
|
||||||
|
BACKUP_DEFAULT_REMOVE_METHOD = 'self'
|
||||||
|
BACKUP_REMOVE_METHODS = {BACKUP_DEFAULT_REMOVE_METHOD, 'all'}
|
||||||
|
|
||||||
|
|
||||||
|
class CoreConfigManager(YAMLConfigManager):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(CoreConfigManager, self).__init__(config_file_path=FILE_PATH)
|
||||||
|
|
||||||
|
def get_default_config(self) -> dict:
|
||||||
|
return {
|
||||||
|
'gems': None,
|
||||||
|
'memory_cache': {
|
||||||
|
'data_expiration': 60 * 60,
|
||||||
|
'icon_expiration': 60 * 5
|
||||||
|
},
|
||||||
|
'locale': None,
|
||||||
|
'updates': {
|
||||||
|
'check_interval': 5,
|
||||||
|
'ask_for_reboot': True
|
||||||
|
},
|
||||||
|
'system': {
|
||||||
|
'notifications': True,
|
||||||
|
'single_dependency_checking': False
|
||||||
|
},
|
||||||
|
'suggestions': {
|
||||||
|
'enabled': True,
|
||||||
|
'by_type': 15
|
||||||
|
},
|
||||||
|
'ui': {
|
||||||
|
'table': {
|
||||||
|
'max_displayed': 50
|
||||||
|
},
|
||||||
|
'tray': {
|
||||||
|
'default_icon': None,
|
||||||
|
'updates_icon': None
|
||||||
|
},
|
||||||
|
'qt_style': 'fusion',
|
||||||
|
'hdpi': True,
|
||||||
|
"auto_scale": False,
|
||||||
|
"scale_factor": 1.0,
|
||||||
|
'theme': 'light',
|
||||||
|
'system_theme': False
|
||||||
|
|
||||||
|
},
|
||||||
|
'download': {
|
||||||
|
'multithreaded': False,
|
||||||
|
'multithreaded_client': None,
|
||||||
|
'icons': True,
|
||||||
|
'check_ssl': True
|
||||||
|
},
|
||||||
|
'store_root_password': True,
|
||||||
|
'disk': {
|
||||||
|
'trim': {
|
||||||
|
'after_upgrade': False
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'backup': {
|
||||||
|
'enabled': True,
|
||||||
|
'install': None,
|
||||||
|
'uninstall': None,
|
||||||
|
'downgrade': None,
|
||||||
|
'upgrade': None,
|
||||||
|
'mode': 'incremental',
|
||||||
|
'type': 'rsync',
|
||||||
|
'remove_method': 'self'
|
||||||
|
},
|
||||||
|
'boot': {
|
||||||
|
'load_apps': True
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user