Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

QXImageSequenceDB.py 832 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  1. from pathlib import Path
  2. from PyQt6.QtCore import *
  3. from PyQt6.QtGui import *
  4. from xlib import path as lib_path
  5. from xlib.qt.gui.from_file import QXImage_from_file
  6. from xlib.qt.gui.QXImageSequence import QXImageSequence
  7. class QXImageSequenceDB:
  8. cached = {}
  9. def _get(dir_path : Path, fps, color=None):
  10. key = (dir_path, fps, color)
  11. result = QXImageSequenceDB.cached.get(key, None)
  12. if result is None:
  13. image_paths = lib_path.get_files_paths(dir_path)
  14. result = QXImageSequenceDB.cached[key] = QXImageSequence(frames=[QXImage_from_file (image_path, color) for image_path in image_paths], fps=fps)
  15. return result
  16. def icon_loading(color=None) -> QXImageSequence: return QXImageSequenceDB._get(Path(__file__).parent / 'sequences' / 'icon_loading', fps=30, color=color)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...