mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
[wgem] adding category
This commit is contained in:
@@ -36,6 +36,8 @@ class ApplicationContext:
|
||||
self.file_downloader = file_downloader
|
||||
self.arch_x86_64 = sys.maxsize > 2**32
|
||||
self.distro = distro
|
||||
self.default_categories = ('AudioVideo', 'Audio', 'Video', 'Development', 'Education', 'Game',
|
||||
'Graphics', 'Network', 'Office', 'Science', 'Settings', 'System', 'Utility')
|
||||
|
||||
def is_system_x86_64(self):
|
||||
return self.arch_x86_64
|
||||
|
||||
@@ -5,6 +5,8 @@ from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
from typing import List, Set, Type
|
||||
|
||||
import yaml
|
||||
|
||||
from bauh.api.abstract.context import ApplicationContext
|
||||
from bauh.api.abstract.disk import DiskCacheLoader
|
||||
from bauh.api.abstract.handler import ProcessWatcher
|
||||
@@ -178,8 +180,15 @@ class SoftwareManager(ABC):
|
||||
data = pkg.get_data_to_cache()
|
||||
|
||||
if data:
|
||||
with open(pkg.get_disk_data_path(), 'w+') as f:
|
||||
f.write(json.dumps(data))
|
||||
disk_path = pkg.get_disk_data_path()
|
||||
ext = disk_path.split('.')[-1]
|
||||
|
||||
if ext == 'json':
|
||||
with open(disk_path, 'w+') as f:
|
||||
f.write(json.dumps(data))
|
||||
elif ext in ('yml', 'yaml'):
|
||||
with open(disk_path, 'w+') as f:
|
||||
f.write(yaml.dump(data))
|
||||
|
||||
if icon_bytes:
|
||||
Path(pkg.get_disk_cache_path()).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -67,7 +67,7 @@ class SingleSelectComponent(InputViewComponent):
|
||||
self.value = default_option
|
||||
self.max_per_line = max_per_line
|
||||
|
||||
def get_selected_value(self):
|
||||
def get_selected(self):
|
||||
if self.value:
|
||||
return self.value.value
|
||||
|
||||
@@ -102,12 +102,13 @@ class TextComponent(ViewComponent):
|
||||
|
||||
class TextInputComponent(ViewComponent):
|
||||
|
||||
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, id_: str = None):
|
||||
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False, id_: str = None):
|
||||
super(TextInputComponent, self).__init__(id_=id_)
|
||||
self.label = label
|
||||
self.value = value
|
||||
self.tooltip = tooltip
|
||||
self.placeholder = placeholder
|
||||
self.read_only = read_only
|
||||
|
||||
def get_value(self) -> str:
|
||||
if self.value is not None:
|
||||
|
||||
@@ -16,7 +16,7 @@ class HttpClient:
|
||||
self.sleep = sleep
|
||||
self.logger = logger
|
||||
|
||||
def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False):
|
||||
def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False, single_call: bool = False):
|
||||
cur_attempts = 1
|
||||
|
||||
while cur_attempts <= self.max_attempts:
|
||||
@@ -39,6 +39,9 @@ class HttpClient:
|
||||
if res.status_code == 200:
|
||||
return res
|
||||
|
||||
if single_call:
|
||||
return
|
||||
|
||||
if self.sleep > 0:
|
||||
time.sleep(self.sleep)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user