mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 04:44:15 +02:00
Caching installed application data to disk
This commit is contained in:
@@ -8,6 +8,8 @@ from colorama import Fore
|
||||
|
||||
from fpakman import __version__
|
||||
from fpakman.core import resource
|
||||
from fpakman.core.disk import DiskCacheLoaderFactory
|
||||
from fpakman.core.structure import prepare_folder_structure
|
||||
from fpakman.util import util
|
||||
from fpakman.core.controller import FlatpakManager, GenericApplicationManager
|
||||
from fpakman.util.cache import Cache
|
||||
@@ -31,7 +33,8 @@ parser.add_argument('-e', '--cache-exp', action="store", default=int(os.getenv('
|
||||
parser.add_argument('-ie', '--icon-exp', action="store", default=int(os.getenv('FPAKMAN_ICON_EXPIRATION', 60 * 5)), type=int, help='cached icons expiration time in SECONDS. Default: %(default)s')
|
||||
parser.add_argument('-l', '--locale', action="store", default=os.getenv('FPAKMAN_LOCALE', 'en'), help='Translation key. Default: %(default)s')
|
||||
parser.add_argument('-i', '--check-interval', action="store", default=int(os.getenv('FPAKMAN_CHECK_INTERVAL', 60)), type=int, help='Updates check interval in SECONDS. Default: %(default)s')
|
||||
parser.add_argument('-n', '--update-notification', action="store", default=os.getenv('FPAKMAN_UPDATE_NOTIFICATION', 1), type=int, help='Enable/disable system notifications for new updates. Default: %(default)s')
|
||||
parser.add_argument('-n', '--update-notification', action="store", default=os.getenv('FPAKMAN_UPDATE_NOTIFICATION', 1), type=int, help='Enables / disables system notifications for new updates. Default: %(default)s')
|
||||
parser.add_argument('-dc', '--disk-cache', action="store", default=os.getenv('FPAKMAN_DISK_CACHE', 1), type=int, help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.cache_exp < 0:
|
||||
@@ -53,6 +56,8 @@ if args.update_notification == 0:
|
||||
|
||||
locale_keys = util.get_locale_keys(args.locale)
|
||||
|
||||
prepare_folder_structure(disk_cache=args.disk_cache)
|
||||
|
||||
caches = []
|
||||
flatpak_api_cache = Cache(expiration_time=args.cache_exp)
|
||||
caches.append(flatpak_api_cache)
|
||||
@@ -63,13 +68,15 @@ caches.append(icon_cache)
|
||||
app = QApplication(sys.argv)
|
||||
app.setWindowIcon(QIcon(resource.get_path('img/logo.svg')))
|
||||
|
||||
manager = GenericApplicationManager([FlatpakManager(flatpak_api_cache)])
|
||||
disk_loader_factory = DiskCacheLoaderFactory(disk_cache=args.disk_cache, flatpak_api_cache=flatpak_api_cache)
|
||||
manager = GenericApplicationManager([FlatpakManager(flatpak_api_cache, disk_cache=args.disk_cache)], disk_loader_factory=disk_loader_factory)
|
||||
|
||||
|
||||
trayIcon = TrayIcon(locale_keys=locale_keys,
|
||||
manager=manager,
|
||||
check_interval=args.check_interval,
|
||||
icon_cache=icon_cache,
|
||||
disk_cache=args.disk_cache,
|
||||
update_notification=bool(args.update_notification))
|
||||
trayIcon.show()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user