Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.4.0~RC #17

Merged
merged 52 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2043576
Spiner before startup store
s384 Jun 27, 2024
46fea3a
Merge branch 'flatpak' into spiner
s384 Jun 28, 2024
0bbdd67
Tab by spaces and rename instaladas by installed
s384 Jun 28, 2024
3774254
Spinner working
s384 Jun 28, 2024
9408abb
visual changes requested by the salami of @xhafas
s384 Jul 1, 2024
6c0ad1b
Install with progress
s384 Jul 2, 2024
f4664de
Uninstall in main window
s384 Jul 3, 2024
24820f9
List show app temp
s384 Jul 4, 2024
4d32e29
Color about
s384 Jul 4, 2024
47c9baf
Radius Corner by system settings
s384 Jul 4, 2024
02391ce
Text install or uninstall in process
s384 Jul 5, 2024
30be458
Changed ContextName in .ts
s384 Jul 8, 2024
d013747
Change spinner by deepines
s384 Jul 8, 2024
c65aba3
visual adjustments
s384 Jul 8, 2024
07a727b
Center window
s384 Jul 8, 2024
6b94e86
Revert "Center window"
xoascf Aug 3, 2024
2cf73af
Revert "Changed ContextName in .ts"
xoascf Aug 3, 2024
bfef209
Merge branch 'nightly' into update
xoascf Aug 3, 2024
1a8a772
Merge branch 'nightly' into update
xoascf Aug 3, 2024
2e74241
Use system frame (supports blur with rounded corners)
xoascf Aug 3, 2024
719d273
Add SVG icon for installed category
xoascf Aug 3, 2024
73b8336
Update Spanish translation
xoascf Aug 3, 2024
d02c7e9
Add python3-apt to dependencies
xoascf Aug 3, 2024
ff8dab2
Fix Flathub repository not being installed
xoascf Aug 3, 2024
a93e024
Fix position when dragging LoadingScreen
xoascf Aug 3, 2024
dbc3050
Update Flatpak AppStream for first time setup
xoascf Aug 3, 2024
0eafc35
Spaces to tabs
xoascf Aug 3, 2024
148e795
Update minimum size of MainWindow to 960x960
xoascf Aug 3, 2024
ab5311c
Center on the screen where the cursor is located with center_window
xoascf Aug 3, 2024
b88dd34
Use system scrollbar and add a small border
xoascf Aug 3, 2024
ed44e9e
Simplify minimize and maximize actions
xoascf Aug 4, 2024
0a545fd
Update mouse event handling for draggable windows
xoascf Aug 4, 2024
592ea62
Update event handling for draggable windows
xoascf Aug 4, 2024
b93d4bf
Update version label visibility in Card class
xoascf Aug 4, 2024
10f81d6
Update drag position handling in EventsMixin
xoascf Aug 4, 2024
824f9ed
Update deepinesStore/core.py to exclude 'XDG_RUNTIME_DIR' from defaul…
xoascf Aug 4, 2024
b82cd6f
Update flathub remote URL to use dl.flathub.org and install Deepin GT…
xoascf Aug 4, 2024
2588ac8
Update translation lines
xoascf Aug 4, 2024
b9cb6fc
Update deepinesStore/core.py to use concurrent.futures for downloadin…
xoascf Aug 4, 2024
6b64460
Update deepinesStore/store.py to handle window resizing and refresh t…
xoascf Aug 4, 2024
ec8b4ef
Update center_window function to use QApplication.instance() for obta…
xoascf Aug 4, 2024
2503d94
Rename repo-fix.sh to deepines-preinstall-fix.sh
xoascf Aug 4, 2024
a76bd49
Add execute permissions to scripts
xoascf Aug 4, 2024
109e1b0
Update drag position handling in EventsMixin
xoascf Aug 4, 2024
cad89bc
Update deepinesStore/store.py to improve app card status handling
xoascf Aug 4, 2024
a910a61
Revert "Update deepinesStore/core.py to use concurrent.futures for do…
xoascf Aug 5, 2024
3bfe44f
Update deepinesStore/app_info.py to use "other" instead of "otros" fo…
xoascf Aug 5, 2024
52f18c1
Update deepinesStore/store.py to handle window resizing and refresh t…
xoascf Aug 5, 2024
5f10776
Update deepinesStore/flatpak/get_apps_flatpak.py to improve app list …
xoascf Aug 5, 2024
4717737
Improve font size adjustment in cardg.py
xoascf Aug 5, 2024
015ddd5
Update CreditsListWidget
xoascf Aug 5, 2024
cfc4b6e
Flatpak banners loading
xoascf Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
13 changes: 0 additions & 13 deletions deepinesStore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
#!/usr/bin/env python3
from deepinesStore.store import run_gui
from deepinesStore.svg import threading_svg
from deepinesStore.core import get_dl, get_res, write, get_deepines_uri


def download_control():
ignore_index = get_dl(get_deepines_uri('/store/config/excluidos.txt'))
if ignore_index.status_code == 200:
write(ignore_index, to=get_res('excluidos', 'config', '.txt'))

deepines_index = get_dl(get_deepines_uri('/store/config/deepines.txt'))
if deepines_index.status_code == 200:
write(deepines_index, to=get_res('deepines', 'config', '.txt'))


def main():
threading_svg()
download_control()
run_gui()
8 changes: 4 additions & 4 deletions deepinesStore/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
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"),
G("Alvaro Samudio", "@G4SP3R"), G("José Siapo", "@jsiapodev"),
G("Oscar Ortiz", "@oscararg"), G("Edwinsiño C", "@Shokatsuo"),
]

class AboutDialog(QtWidgets.QDialog):
Expand Down Expand Up @@ -49,7 +48,8 @@ def __init__(self, parent=None):
self.description_lbl.setFont(font)
self.description_lbl.setAlignment(QtCore.Qt.AlignCenter)

list_ppl = CreditsListWidget()
list_ppl = CreditsListWidget(self)
list_ppl.setSpacing(2)
self.pplP = add_people_to_list(people, list_ppl)
fntLst = QtGui.QFont()
fntLst.setPointSize(11)
Expand Down
9 changes: 7 additions & 2 deletions deepinesStore/app_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ class AppState(Enum):
DEFAULT = 1
INSTALLED = 2
UNINSTALLED = 3
UNINSTALL = 4

class ProcessType(Enum):
INSTALL = 0
UNINSTALL = 1

class AppInfo:
def __init__(self, name: str, id: str, description: str, version = "0", category = "otros", type=AppType.DEB_PACKAGE, state=AppState.DEFAULT):
def __init__(self, name: str, id: str, description: str, version = None, category = "other", type=AppType.DEB_PACKAGE, state=AppState.DEFAULT, process=ProcessType.INSTALL):
self.name = name
self.id = id
self.description = description
self.version = version
self.category = category
self.state = state
self.type = type
self.type = type
self.process = process
18 changes: 17 additions & 1 deletion deepinesStore/cardg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def setupUi(self, Frame):
font.setPointSize(11)
font.setItalic(False)
self.lbl_name_app.setFont(font)
self.lbl_name_app.setWordWrap(True)
self.lbl_name_app.setWordWrap(False)
self.lbl_name_app.setObjectName("lbl_name_app")
self.verticalLayout.addWidget(self.lbl_name_app)
self.lbl_name_app.resizeEvent = self.adjust_font_size
self.lbl_version = ClickableLabel(Frame)
font = QtGui.QFont()
font.setPointSize(9)
Expand All @@ -51,6 +52,21 @@ def setupUi(self, Frame):
self.retranslateUi(Frame)
QMetaObject.connectSlotsByName(Frame)

def adjust_font_size(self, event):
label = self.lbl_name_app
font = label.font()
font_metrics = QtGui.QFontMetrics(font)
text = label.text()
label_width = label.width()

# Reduce the font size until the text fits within the label's width
while font_metrics.width(text) > label_width and font.pointSize() > 1:
font.setPointSize(font.pointSize() - 1)
font_metrics = QtGui.QFontMetrics(font)

label.setFont(font)
super(ClickableLabel, label).resizeEvent(event)

def __tr(self, txt, disambiguation=None, n=-1):
from deepinesStore.core import tr
return tr(self, txt, disambiguation, n)
Expand Down
10 changes: 3 additions & 7 deletions deepinesStore/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from enum import Enum
from os import environ as env, name
import argparse
import json
Expand Down Expand Up @@ -94,9 +93,6 @@ def write(b, to):
default_env = env.copy()

if args.env:
new_env = json.loads(args.env)
default_env.update(new_env)

class ProcessType(Enum):
INSTALL = 0
UNINSTALL = 1
new_env = json.loads(args.env)
default_env.update(new_env)
env.update({k: v for k, v in default_env.items() if k != 'XDG_RUNTIME_DIR'})
5 changes: 2 additions & 3 deletions deepinesStore/demoted_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ def get_flatpak_info_cmd():
return p

try:
p = check_output(['flatpak', '--user', 'remote-ls', 'flathub', '--app', '--columns=application,version'], text=True, env=DEF.env, preexec_fn=set(DEF.uid, DEF.gid))
p = check_output(['flatpak', 'remote-ls', 'flathub', '--app', '--columns=application,version'], text=True, env=DEF.env, preexec_fn=set(DEF.uid, DEF.gid))
except CalledProcessError:
print("Couldn't get flatpak app info: Error running flatpak command!")
# FIXME: Notify the user, or automatize this!!
print("You may need to run the following to enable the flathub repository:")
print("flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo")
print("flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo")
return p

def browse(uri: str):
Expand Down
113 changes: 55 additions & 58 deletions deepinesStore/flatpak/get_apps_flatpak.py
Original file line number Diff line number Diff line change
@@ -1,72 +1,69 @@
import deepinesStore.demoted_actions as actions
from deepinesStore.app_info import AppInfo, AppType
from deepinesStore.core import get_dl
from lxml import etree
import locale

# Categorias de app en flathub
# Flathub appstream.xml file location
appstream_file = "/var/lib/flatpak/appstream/flathub/x86_64/active/appstream.xml"

# Flathub app categories
categories = [
"AudioVideo", "Development", "Education", "Games", "Game", "Productivity",
"Graphics", "Network", "Office", "Science", "System", "Utility"
]

# Obtenemos las apps desde el api de flathub
def fetch_list_app_flatpak():
api_url = "https://flathub.org/api/v1/apps"
try:
request = get_dl(api_url, timeout=20)
app_list = list()
for app in request.json():
name = app['name']
description = app['summary']
category = "None"
state = 1
appID = app['flatpakAppId']
app_info = [name, description, 'None', category, state, appID]
app_list.append(app_info)

except Exception as e:
print("Error fetching apps:", e)
return []
return app_list
def get_preferred_text(element, tag, preferred_lang):
nsmap = {"xml": "http://www.w3.org/XML/1998/namespace"}
# Try to find the element with the full preferred xml:lang attribute
full_lang_xpath = f'{tag}[@xml:lang="{preferred_lang}"]'
full_lang_elem = element.find(full_lang_xpath, namespaces=nsmap)
if full_lang_elem is not None:
return full_lang_elem.text

# If not found, try to find the element with the base language (e.g., 'en' from 'en_US')
base_lang = preferred_lang.split('_')[0]
base_lang_xpath = f'{tag}[@xml:lang="{base_lang}"]'
base_lang_elem = element.find(base_lang_xpath, namespaces=nsmap)
if base_lang_elem is not None:
return base_lang_elem.text

# If neither is found, try to find the element without xml:lang attribute (default language)
default_lang_elem = element.find(tag)
if default_lang_elem is not None and 'xml:lang' not in default_lang_elem.attrib:
return default_lang_elem.text

# If none of the above is found, return None
return None

def app_list_flatpak() -> list[AppInfo]:
# Get the system language
system_lang = locale.getdefaultlocale()[0]

def fetch_apps_by_category(category):
try:
api_url = f"https://flathub.org/api/v1/apps/category/{category}"
request = get_dl(api_url, timeout=20)
return request.json() if request.status_code == 200 else []
except Exception as e:
print(f"Error fetching apps in category {category}:", e)
return []
# Parse the appstream file with lxml
tree = etree.parse(appstream_file)
root = tree.getroot()
app_list = []

def two_columns_split(output: str):
lines = output.split('\n')
result = {}
for line in lines:
columns = line.split(maxsplit=1)
if len(columns) == 2:
result[columns[0]] = columns[1].strip()
for component in root.findall('component'):
if component.get('type') in ['runtime', 'addon']:
continue

return result
app_id = component.find('id').text
app_name = get_preferred_text(component, 'name', system_lang)
app_summary = get_preferred_text(component, 'summary', system_lang)
app_version = None
releases = component.find('releases')
if releases is not None and releases.findall('release'):
app_version = releases.findall('release')[-1].get('version')

app_id_ver_dict = two_columns_split(actions.get_flatpak_info_cmd())
app_category = "other"
app_categories = component.find('categories')
if app_categories is not None:
for category in app_categories.findall('category'):
if category.text in categories:
app_category = category.text
break

def add_apps_dict_by_categories():
app_data = {}
for category in categories:
app_data[category] = fetch_apps_by_category(category)
return app_data
app_info = AppInfo(name=app_name, id=app_id, description=app_summary, version=app_version, category=app_category, type=AppType.FLATPAK_APP)
app_list.append(app_info)

def apps_flatpak_in_categories() -> list[AppInfo]:
app_data = add_apps_dict_by_categories()
fp_app_info = list()
already_added = list()
for category in categories:
for app in app_data[category]: # FIXME: This is not adding some "uncategorized" apps
app_id = app['flatpakAppId']
if not app_id in already_added:
version = app_id_ver_dict.get(app_id) or "No version"
app_info = AppInfo(app['name'], app_id, app['summary'], version, category, AppType.FLATPAK_APP)
already_added.append(app_id)
fp_app_info.append(app_info)

return fp_app_info
return app_list
Loading