[api] adding the app version to the context

This commit is contained in:
Vinicius Moreira
2022-03-10 16:41:20 -03:00
parent f6c8ad9553
commit 94ba539eb3
3 changed files with 8 additions and 3 deletions

View File

@@ -14,7 +14,8 @@ class ApplicationContext:
def __init__(self, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: I18n,
cache_factory: MemoryCacheFactory, disk_loader_factory: DiskCacheLoaderFactory,
logger: logging.Logger, file_downloader: FileDownloader, distro: str, app_name: str,
internet_checker: InternetChecker, root_user: bool, screen_width: int = -1, screen_height: int = -1):
app_version: str, internet_checker: InternetChecker, root_user: bool, screen_width: int = -1,
screen_height: int = -1):
"""
:param download_icons: if packages icons should be downloaded
:param http_client: a shared instance of http client
@@ -26,6 +27,7 @@ class ApplicationContext:
:param file_downloader
:param distro
:param app_name
:param app_version
:param internet_checker
:param screen_width
:param screen_height
@@ -43,6 +45,7 @@ class ApplicationContext:
self.default_categories = ('AudioVideo', 'Audio', 'Video', 'Development', 'Education', 'Game',
'Graphics', 'Network', 'Office', 'Science', 'Settings', 'System', 'Utility')
self.app_name = app_name
self.app_version = app_version
self.root_user = root_user
self.root_password = None
self.internet_checker = internet_checker

View File

@@ -2,7 +2,7 @@ import os
import urllib3
from bauh import ROOT_DIR
from bauh import ROOT_DIR, __version__
from bauh.api import user
from bauh.api.abstract.context import ApplicationContext
from bauh.api.http import HttpClient
@@ -46,6 +46,7 @@ def main():
file_downloader=AdaptableFileDownloader(logger, bool(app_config['download']['multithreaded']),
i18n, http_client, app_config['download']['multithreaded_client']),
app_name=__app_name__,
app_version=__version__,
internet_checker=InternetChecker(offline=False),
root_user=user.is_root())

View File

@@ -4,7 +4,7 @@ from typing import Tuple
from PyQt5.QtWidgets import QApplication, QWidget
from bauh import ROOT_DIR, __app_name__
from bauh import ROOT_DIR, __app_name__, __version__
from bauh.api import user
from bauh.api.abstract.context import ApplicationContext
from bauh.api.http import HttpClient
@@ -42,6 +42,7 @@ def new_manage_panel(app_args: Namespace, app_config: dict, logger: logging.Logg
file_downloader=AdaptableFileDownloader(logger, bool(app_config['download']['multithreaded']),
i18n, http_client, app_config['download']['multithreaded_client']),
app_name=__app_name__,
app_version=__version__,
internet_checker=InternetChecker(offline=app_args.offline),
root_user=user.is_root())