[view] improvement: displaying a tooltip with the missing dependencies for a supported packaging technology

This commit is contained in:
Vinicius Moreira
2021-11-22 15:48:48 -03:00
parent 5121bb40ef
commit c80845cde4
47 changed files with 525 additions and 47 deletions

View File

@@ -4,7 +4,7 @@ import shutil
from abc import ABC, abstractmethod
from enum import Enum
from pathlib import Path
from typing import List, Set, Type, Tuple, Optional
from typing import List, Set, Type, Tuple, Optional, Generator
import yaml
@@ -243,9 +243,9 @@ class SoftwareManager(ABC):
pass
@abstractmethod
def can_work(self) -> bool:
def can_work(self) -> Tuple[bool, Optional[str]]:
"""
:return: if the instance can work based on what is installed in the user's machine.
:return: if the instance can work based on what is installed in the user's machine. If not, an optional string as a reason.
"""
def cache_to_disk(self, pkg: SoftwarePackage, icon_bytes: Optional[bytes], only_icon: bool):

View File

@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import Iterable, List, Optional
from typing import Iterable, List, Optional, Tuple
from bauh.api.abstract.handler import ProcessWatcher
@@ -41,3 +41,7 @@ class FileDownloader(ABC):
@abstractmethod
def list_available_multithreaded_clients(self) -> List[str]:
pass
@abstractmethod
def get_supported_clients(self) -> tuple:
pass

View File

@@ -1,6 +1,6 @@
from abc import ABC
from enum import Enum
from typing import List, Set, Optional
from typing import List, Set, Optional, Dict
class MessageType(Enum):
@@ -46,13 +46,14 @@ class InputOption:
def __init__(self, label: str, value: object, tooltip: Optional[str] = None,
icon_path: Optional[str] = None, read_only: bool = False, id_: Optional[str] = None,
invalid: bool = False):
invalid: bool = False, extra_properties: Optional[Dict[str, str]] = None):
"""
:param label: the string that will be shown to the user
:param value: the option value (not shown)
:param tooltip: an optional tooltip
:param icon_path: an optional icon path
:param invalid: if this option is considered invalid
:param extra_properties: extra properties
"""
if not label:
raise Exception("'label' must be a not blank string")
@@ -64,6 +65,7 @@ class InputOption:
self.icon_path = icon_path
self.read_only = read_only
self.invalid = invalid
self.extra_properties = extra_properties
def __hash__(self):
return hash(self.label) + hash(self.value)