-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from deepin-espanol/flatpak
Add Flatpak support without banners
- Loading branch information
Showing
34 changed files
with
2,418 additions
and
1,524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
|
||
[*.py] | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
__pycache__ | ||
venv | ||
virtualenv | ||
.venv | ||
.virtualenv | ||
*.pyc | ||
db.sqlite3 | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,78 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
from PyQt5.Qt import Qt | ||
from PyQt5 import QtWidgets, QtGui | ||
from deepinesStore.core import tr, site, set_blur, get_app_icon | ||
from deepinesStore.widgets import G, ContactListWidget, add_people_to_list | ||
from PyQt5 import QtCore, QtGui, QtWidgets | ||
|
||
authors = [G("Sebastian", "@SebTrujillo"), G("Amaro", "@xoascf")] | ||
from deepinesStore.core import tr, get_app_icon, get_text_link, STORE_VERSION | ||
from deepinesStore.widgets import G, add_people_to_list, LinkLabel, CreditsListWidget | ||
|
||
design = [G("Freddy", "@Akibaillusion"), G("jhalo", "@jhalo"), G("André")] | ||
|
||
people = [G("Car", "@Xhafas"), | ||
G("Isaías", "@igatjens"), G("Jose", "@fenoll"), G("Hugo", "@geekmidget"), | ||
G("Eli", "@RealAct"), G("Diego", "@s_d1112"), G("Filho", "@filhoarrais"), G("Bruno", "@bigbruno"), | ||
G("Alvaro", "@G4SP3R"), G("Omi", "@peteromio"), G("Opik", "@Prophaniti"), G("Jose", "@jsiapodev"), | ||
G("Jorge", "@seiyukaras"), G("N1coc4colA", "@n1coc4cola"), G("Oscar", "@oscararg"), G("Jorge", "@jotakenobi"), | ||
G("Tomás", "@TomasWarynyca"), G("Edwinsiño", "@Shokatsuo"), | ||
people = [G("Car", "@Xhafas"), G("Sebastian Trujillo", "@SebTrujillo"), G("Amaro Martínez", "@xoascf"), | ||
G("Freddy", "@Akibaillusion"), G("jhalo", "@jhalo"), | ||
G("Isaías Gätjens M", "@igatjens"), G("Jose Fenoll", "@fenoll"), G("Hugo Florentino", "@geekmidget"), | ||
G("Eli", "@RealAct"), G("Diego", "@s_d1112"), G("Filho Arrais", "@filhoarrais"), | ||
G("Alvaro Samudio", "@G4SP3R"), G("Omi", "@peteromio"), G("Opik", "@Prophaniti"), G("José Siapo", "@jsiapodev"), | ||
G("Jorge Cabrera", "@seiyukaras"), G("N1coc4colA", "@n1coc4cola"), G("Oscar Ortiz", "@oscararg"), G("Jorge", "@jotakenobi"), | ||
G("Tomás Warynyca", "@TomasWarynyca"), G("Edwinsiño C", "@Shokatsuo"), | ||
] | ||
|
||
class AboutDialog(QtWidgets.QDialog): | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
self.resize(580, 480) | ||
self.resize(380, 460) | ||
icon = get_app_icon() | ||
self.setWindowIcon(icon) | ||
self.setModal(True) | ||
self.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint, False) | ||
self.setAutoFillBackground(True) | ||
self.app_icon_btn = QtWidgets.QPushButton(self) | ||
self.app_icon_btn.setEnabled(True) | ||
self.app_icon_btn.setIconSize(QtCore.QSize(120, 120)) | ||
self.app_icon_btn.setFlat(True) | ||
self.app_icon_btn.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) | ||
self.app_icon_btn.setIcon(icon) | ||
self.app_icon_btn.setStyleSheet("background-color: transparent;") | ||
|
||
self.app_icon_btn.installEventFilter(self) | ||
self.app_name_lbl = QtWidgets.QLabel(self) | ||
self.version_lbl = QtWidgets.QLabel(self) | ||
self.version_lbl.setAlignment(QtCore.Qt.AlignCenter) | ||
self.web_lbl = LinkLabel(self) | ||
self.web_lbl.setAlignment(QtCore.Qt.AlignCenter) | ||
self.web_lbl.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) | ||
font = QtGui.QFont() | ||
font.setBold(True) | ||
font.setPointSize(10) | ||
self.app_name_lbl.setFont(font) | ||
self.app_name_lbl.setAlignment(QtCore.Qt.AlignCenter) | ||
self.description_lbl = QtWidgets.QLabel(self) | ||
font.setBold(False) | ||
self.description_lbl.setFont(font) | ||
self.description_lbl.setAlignment(QtCore.Qt.AlignCenter) | ||
|
||
list_ppl = CreditsListWidget() | ||
self.pplP = add_people_to_list(people, list_ppl) | ||
fntLst = QtGui.QFont() | ||
fntLst.setPointSize(11) | ||
layout = QtWidgets.QHBoxLayout() | ||
list_dev = ContactListWidget() | ||
list_des = ContactListWidget() | ||
list_ppl = ContactListWidget() | ||
self.devP = add_people_to_list(authors, list_dev) | ||
self.desP = add_people_to_list(design, list_des) | ||
self.pplP = add_people_to_list(people, list_ppl) | ||
self.devP.setFont(fntLst) | ||
self.desP.setFont(fntLst) | ||
self.pplP.setFont(fntLst) | ||
layout.addWidget(self.devP) | ||
layout.addWidget(self.desP) | ||
layout.addWidget(self.pplP) | ||
list_ppl.setFont(fntLst) | ||
|
||
layout = QtWidgets.QVBoxLayout(self) | ||
layout.addWidget(self.app_icon_btn) | ||
layout.addWidget(self.app_name_lbl) | ||
layout.addWidget(self.version_lbl) | ||
layout.addWidget(list_ppl) | ||
layout.addWidget(self.web_lbl) | ||
layout.addWidget(self.description_lbl) | ||
self.setLayout(layout) | ||
self.setStyleSheet("background-color: rgba(20, 20, 20, 100)") | ||
self.setAttribute(Qt.WA_TranslucentBackground) | ||
self.retranslateUi(self) | ||
|
||
def showEvent(self, event): | ||
set_blur(self) | ||
self.retranslateUi(self) # TODO: Add translator credits. | ||
QtCore.QMetaObject.connectSlotsByName(self) | ||
|
||
def __tr(self, txt, disambiguation=None, n=-1): | ||
return tr(self, txt, disambiguation, n) | ||
|
||
def retranslateUi(self, AboutDialog): | ||
self.setWindowTitle(self.__tr("About")) | ||
self.devP.setTitle(self.__tr("Authors")) | ||
self.desP.setTitle(self.__tr("Design")) | ||
self.pplP.setTitle(self.__tr("Collaborators")) | ||
self.app_name_lbl.setText(AboutDialog.parent().windowTitle()) | ||
self.version_lbl.setText(self.__tr("Version {version}").format(version=STORE_VERSION)) | ||
self.web_lbl.setText(get_text_link("deepinenespañol.org")) | ||
self.description_lbl.setText(self.__tr("The App Store of Deepin en Español")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from enum import Enum | ||
|
||
|
||
class AppType(Enum): | ||
DEB_PACKAGE = 0 | ||
FLATPAK_APP = 1 | ||
|
||
|
||
class AppState(Enum): | ||
SELECTED = 0 | ||
DEFAULT = 1 | ||
INSTALLED = 2 | ||
UNINSTALLED = 3 | ||
|
||
|
||
class AppInfo: | ||
def __init__(self, name: str, id: str, description: str, version = "0", category = "otros", type=AppType.DEB_PACKAGE, state=AppState.DEFAULT): | ||
self.name = name | ||
self.id = id | ||
self.description = description | ||
self.version = version | ||
self.category = category | ||
self.state = state | ||
self.type = type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from lxml import html | ||
import re | ||
|
||
from deepinesStore.app_info import AppInfo | ||
from deepinesStore.core import get_deepines_uri, get_dl | ||
|
||
|
||
def get_repo_url(): | ||
fallback_url = get_deepines_uri("/5/paquetes.html") | ||
repo_file = "/etc/apt/sources.list.d/deepines.list" | ||
try: | ||
repo_text = open(repo_file).read() | ||
url = re.search( | ||
"(?P<url>https?://[^\s]+)", repo_text).group("url") + "paquetes.html" | ||
return url | ||
except: | ||
return fallback_url | ||
|
||
|
||
def fetch_list_app_deb(list_ignored: list[str]) -> list[AppInfo]: | ||
repo_url = get_repo_url() | ||
request = get_dl(repo_url, timeout=10) | ||
|
||
if request.status_code == 200: | ||
html_tree = html.fromstring(request.content.decode("utf-8")) | ||
entries = html_tree.xpath('//tr') | ||
deb_app_info = [] | ||
|
||
def from_cell(entry, class_name: str): | ||
return entry.xpath(f'.//td[@class="{class_name}"]/text()')[0].strip() | ||
|
||
for entry in entries: | ||
app_title = from_cell(entry, 'package') | ||
if app_title not in list_ignored: | ||
app_info = AppInfo(app_title, app_title, from_cell( | ||
entry, 'description'), from_cell(entry, 'version'), from_cell(entry, 'section')) | ||
deb_app_info.append(app_info) | ||
|
||
return deb_app_info | ||
else: | ||
print( | ||
f"App list fetch request has failed with status code {request.status_code}") | ||
return [] |
Oops, something went wrong.