architecture expanded to support other types of packaging

This commit is contained in:
Vinícius Moreira
2019-07-10 11:31:57 -03:00
committed by GitHub
parent 925aa7cec6
commit ff8510153d
11 changed files with 326 additions and 133 deletions

View File

@@ -1,6 +1,8 @@
from abc import ABC
from abc import ABC, abstractmethod
from enum import Enum
from fpakman.core import resource
class ApplicationStatus(Enum):
READY = 1
@@ -26,6 +28,37 @@ class Application(ABC):
self.installed = installed
self.update = update
@abstractmethod
def has_history(self):
pass
@abstractmethod
def has_info(self):
pass
@abstractmethod
def can_be_downgraded(self):
pass
@abstractmethod
def can_be_uninstalled(self):
pass
@abstractmethod
def can_be_installed(self):
pass
@abstractmethod
def get_type(self):
pass
def get_default_logo_path(self):
return resource.get_path('img/logo.svg')
@abstractmethod
def is_library(self):
pass
class FlatpakApplication(Application):
@@ -40,3 +73,27 @@ class FlatpakApplication(Application):
def is_incomplete(self):
return self.base_data.description is None and self.base_data.icon_url
def has_history(self):
return True
def has_info(self):
return True
def can_be_downgraded(self):
return not self.runtime
def can_be_uninstalled(self):
return True
def can_be_installed(self):
return True
def get_type(self):
return 'flatpak'
def get_default_logo_path(self):
return resource.get_path('img/flathub.svg')
def is_library(self):
return self.runtime