code release
BIN
resources/fonts/Digital-7 Mono/digital-7_mono_italic.ttf
Normal file
BIN
resources/fonts/Noto Mono/NotoMono-Regular.ttf
Normal file
BIN
resources/fonts/Noto Sans SC/NotoSansSC-Bold.otf
Normal file
BIN
resources/fonts/Noto Sans SC/NotoSansSC-Regular.otf
Normal file
BIN
resources/fonts/Noto Sans/NotoSans-Italic.ttf
Normal file
BIN
resources/fonts/Noto Sans/NotoSans-Regular.ttf
Normal file
89
resources/fonts/QXFontDB.py
Normal 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)
|
BIN
resources/fonts/Tahoma/tahoma.ttf
Normal file
BIN
resources/fonts/Tahoma/tahomabd.ttf
Normal file
1
resources/fonts/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from .QXFontDB import QXFontDB
|
50
resources/gfx/QXImageDB.py
Normal 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)
|
21
resources/gfx/QXImageSequenceDB.py
Normal 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)
|
2
resources/gfx/__init__.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
from .QXImageDB import QXImageDB
|
||||
from .QXImageSequenceDB import QXImageSequenceDB
|
BIN
resources/gfx/cursors/cross_blue.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
resources/gfx/cursors/cross_green.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
resources/gfx/cursors/cross_red.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
resources/gfx/images/add-circle-outline.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
resources/gfx/images/app_icon.png
Normal file
After Width: | Height: | Size: 193 KiB |
BIN
resources/gfx/images/close-outline.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/gfx/images/eye-outline.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
resources/gfx/images/folder-open-outline.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
resources/gfx/images/information-circle-outline.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
resources/gfx/images/logo_barclay_stone.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
resources/gfx/images/logo_exmo.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/gfx/images/open-outline.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
resources/gfx/images/pause-circle-outline.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
resources/gfx/images/play-back-circle-outline.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
resources/gfx/images/play-circle-outline.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
resources/gfx/images/play-forward-circle-outline.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
resources/gfx/images/play-skip-back-circle-outline.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
resources/gfx/images/play-skip-forward-circle-outline.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
resources/gfx/images/power-outline.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
resources/gfx/images/reload-outline.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
resources/gfx/images/settings-outline.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
resources/gfx/images/settings-reset-outline.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
resources/gfx/images/splash_deepfacelive.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
resources/gfx/images/warning-outline.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
resources/gfx/sequences/icon_loading/frame-01.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
resources/gfx/sequences/icon_loading/frame-02.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
resources/gfx/sequences/icon_loading/frame-03.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
resources/gfx/sequences/icon_loading/frame-04.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
resources/gfx/sequences/icon_loading/frame-05.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
resources/gfx/sequences/icon_loading/frame-06.png
Normal file
After Width: | Height: | Size: 632 B |
BIN
resources/gfx/sequences/icon_loading/frame-07.png
Normal file
After Width: | Height: | Size: 629 B |
BIN
resources/gfx/sequences/icon_loading/frame-08.png
Normal file
After Width: | Height: | Size: 613 B |
BIN
resources/gfx/sequences/icon_loading/frame-09.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
resources/gfx/sequences/icon_loading/frame-10.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
resources/gfx/sequences/icon_loading/frame-11.png
Normal file
After Width: | Height: | Size: 624 B |
BIN
resources/gfx/sequences/icon_loading/frame-12.png
Normal file
After Width: | Height: | Size: 623 B |
BIN
resources/gfx/sequences/icon_loading/frame-13.png
Normal file
After Width: | Height: | Size: 626 B |
BIN
resources/gfx/sequences/icon_loading/frame-14.png
Normal file
After Width: | Height: | Size: 629 B |
BIN
resources/gfx/sequences/icon_loading/frame-15.png
Normal file
After Width: | Height: | Size: 629 B |
BIN
resources/gfx/sequences/icon_loading/frame-16.png
Normal file
After Width: | Height: | Size: 636 B |
BIN
resources/gfx/sequences/icon_loading/frame-17.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
resources/gfx/sequences/icon_loading/frame-18.png
Normal file
After Width: | Height: | Size: 621 B |
BIN
resources/gfx/sequences/icon_loading/frame-19.png
Normal file
After Width: | Height: | Size: 623 B |
BIN
resources/gfx/sequences/icon_loading/frame-20.png
Normal file
After Width: | Height: | Size: 629 B |
BIN
resources/gfx/sequences/icon_loading/frame-21.png
Normal file
After Width: | Height: | Size: 623 B |
BIN
resources/gfx/sequences/icon_loading/frame-22.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
resources/gfx/sequences/icon_loading/frame-23.png
Normal file
After Width: | Height: | Size: 613 B |
BIN
resources/gfx/sequences/icon_loading/frame-24.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
resources/gfx/sequences/icon_loading/frame-25.png
Normal file
After Width: | Height: | Size: 631 B |
BIN
resources/gfx/sequences/icon_loading/frame-26.png
Normal file
After Width: | Height: | Size: 631 B |
BIN
resources/gfx/sequences/icon_loading/frame-27.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
resources/gfx/sequences/icon_loading/frame-28.png
Normal file
After Width: | Height: | Size: 635 B |
BIN
resources/gfx/sequences/icon_loading/frame-29.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
resources/gfx/sequences/icon_loading/frame-30.png
Normal file
After Width: | Height: | Size: 628 B |