code release

This commit is contained in:
iperov 2021-07-23 17:34:49 +04:00
commit a902f11f74
354 changed files with 826570 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,89 @@
from pathlib import Path
from localization import Localization
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib import path as lib_path
class QXFontDB():
_cached = {}
_file_to_family = {}
_families_loaded = set()
@staticmethod
def _load_family(name : str):
if name in QXFontDB._families_loaded:
return
QXFontDB._families_loaded.add(name)
dir = Path(__file__).parent / name
if not dir.exists() or not dir.is_dir():
raise Exception(f'Font family directory is not found: {dir}')
filepaths = lib_path.get_files_paths(dir)
families_loaded = []
for filepath in filepaths:
id = QFontDatabase.addApplicationFont(str(filepath))
families_loaded += QFontDatabase.applicationFontFamilies(id)
families_loaded = list(set(families_loaded))
if len(families_loaded) > 1:
raise Exception(f'More than one font family loaded from {dir}:\n{families_loaded}\nRemove unnecessary files.')
if name != families_loaded[0]:
raise Exception(f'Loaded font family is different from requested: {name} != {families_loaded[0]}')
@staticmethod
def _get(name : str, size : int, weight=None, italic=False, bold=False):
key = (name, size, weight, italic)
result = QXFontDB._cached.get(key, None)
if result is None:
QXFontDB._load_family(name)
result = QFont(name, size)
if weight is not None:
result.setWeight(weight)
result.setItalic(italic)
result.setBold(bold)
QXFontDB._cached[key] = result
return result
@staticmethod
def get_default_font(size=8, italic=False, bold=False):
lang = Localization.lang
if lang == 'zh-CN':
return QXFontDB.Noto_Sans_SC(size, italic=italic, bold=bold)
else:
return QXFontDB.Noto_Sans(size, italic=italic, bold=bold)
@staticmethod
def get_fixedwidth_font(size=8):
return QXFontDB.Noto_Mono(size)
@staticmethod
def Digital7_Mono(size, italic=False, bold=False):
return QXFontDB._get('Digital-7 Mono', size, italic=italic, bold=bold)
@staticmethod
def Noto_Mono(size, italic=False, bold=False):
return QXFontDB._get('Noto Mono', size, italic=italic, bold=bold)
@staticmethod
def Noto_Sans(size, italic=False, bold=False):
return QXFontDB._get('Noto Sans', size, italic=italic, bold=bold)
@staticmethod
def Noto_Sans_SC(size, italic=False, bold=False):
return QXFontDB._get('Noto Sans SC', size, italic=italic, bold=bold)
@staticmethod
def Tahoma(size, italic=False, bold=False):
return QXFontDB._get('Tahoma', size, italic=italic, bold=bold)

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
from .QXFontDB import QXFontDB

View file

@ -0,0 +1,50 @@
from pathlib import Path
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib.qt.gui.from_file import QXImage_from_file
class QXImageDB:
cached = {}
def _get(filename : str, color=None):
if isinstance(color, QColor):
key = (filename, color.getRgb() )
else:
key = (filename, color)
result = QXImageDB.cached.get(key, None)
if result is None:
result = QXImageDB.cached[key] = QXImage_from_file ( Path(__file__).parent / 'images' / filename, color )
return result
def add_circle_outline(color='black'): return QXImageDB._get('add-circle-outline.png', color)
def close_outline(color='black'): return QXImageDB._get('close-outline.png', color)
def eye_outline(color='black'): return QXImageDB._get('eye-outline.png', color)
def folder_open_outline(color='black'): return QXImageDB._get('folder-open-outline.png', color)
def open_outline(color='black'): return QXImageDB._get('open-outline.png', color)
def information_circle_outline(color='black'): return QXImageDB._get('information-circle-outline.png', color)
def play_circle_outline(color='black'): return QXImageDB._get('play-circle-outline.png', color)
def play_back_circle_outline(color='black'): return QXImageDB._get('play-back-circle-outline.png', color)
def play_forward_circle_outline(color='black'): return QXImageDB._get('play-forward-circle-outline.png', color)
def play_skip_back_circle_outline(color='black'): return QXImageDB._get('play-skip-back-circle-outline.png', color)
def play_skip_forward_circle_outline(color='black'): return QXImageDB._get('play-skip-forward-circle-outline.png', color)
def pause_circle_outline(color='black'): return QXImageDB._get('pause-circle-outline.png', color)
def power_outline(color='black'): return QXImageDB._get('power-outline.png', color)
def reload_outline(color='black'): return QXImageDB._get('reload-outline.png', color)
def settings_outline(color='black'): return QXImageDB._get('settings-outline.png', color)
def settings_reset_outline(color='black'): return QXImageDB._get('settings-reset-outline.png', color)
def warning_outline(color='black'): return QXImageDB._get('warning-outline.png', color)
def app_icon(): return QXImageDB._get('app_icon.png', None)
def logo_barclay_stone(): return QXImageDB._get('logo_barclay_stone.png', None)
def logo_exmo(): return QXImageDB._get('logo_exmo.png', None)
def splash_deepfacelive(): return QXImageDB._get('splash_deepfacelive.png', None)

View file

@ -0,0 +1,21 @@
from pathlib import Path
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib import path as lib_path
from xlib.qt.gui.from_file import QXImage_from_file
from xlib.qt.gui.QXImageSequence import QXImageSequence
class QXImageSequenceDB:
cached = {}
def _get(dir_path : Path, fps, color=None):
key = (dir_path, fps, color)
result = QXImageSequenceDB.cached.get(key, None)
if result is None:
image_paths = lib_path.get_files_paths(dir_path)
result = QXImageSequenceDB.cached[key] = QXImageSequence(frames=[QXImage_from_file (image_path, color) for image_path in image_paths], fps=fps)
return result
def icon_loading(color=None) -> QXImageSequence: return QXImageSequenceDB._get(Path(__file__).parent / 'sequences' / 'icon_loading', fps=30, color=color)

View file

@ -0,0 +1,2 @@
from .QXImageDB import QXImageDB
from .QXImageSequenceDB import QXImageSequenceDB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B