frontengine-dev 0.0.53__py3-none-any.whl → 0.0.71__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- frontengine/__init__.py +13 -15
- frontengine/show/clicker/clicker_scene.py +7 -0
- frontengine/show/clicker/clicker_ui.py +30 -0
- frontengine/show/gif/paint_gif.py +5 -2
- frontengine/show/image/paint_image.py +5 -2
- frontengine/show/particle/particle_scene.py +71 -0
- frontengine/show/particle/particle_ui.py +39 -0
- frontengine/show/particle/particle_utils.py +61 -0
- frontengine/show/scene/extend_graphic_scene.py +0 -1
- frontengine/show/scene/extend_graphic_view.py +2 -1
- frontengine/show/scene/scene.py +23 -42
- frontengine/show/sound_player/sound_effect.py +1 -2
- frontengine/show/sound_player/sound_player.py +1 -2
- frontengine/show/text/draw_text.py +31 -4
- frontengine/show/video/video_player.py +4 -5
- frontengine/show/web/webview.py +16 -5
- frontengine/{ui/main/system_tray → system_tray}/extend_system_tray.py +1 -3
- frontengine/ui/dialog/choose_file_dialog.py +19 -43
- frontengine/ui/{main/main_ui.py → main_ui.py} +57 -63
- frontengine/ui/menu/help_menu.py +44 -0
- frontengine/ui/menu/how_to_menu.py +25 -0
- frontengine/ui/menu/language_menu.py +88 -0
- frontengine/ui/{setting → page}/control_center/control_center_ui.py +14 -18
- frontengine/ui/{setting → page}/gif/gif_setting_ui.py +25 -10
- frontengine/ui/{setting → page}/image/image_setting_ui.py +25 -9
- frontengine/ui/page/particle/particle_setting_ui.py +175 -0
- frontengine/ui/page/scene_setting/scene_manager.py +102 -0
- frontengine/ui/page/scene_setting/scene_page/gif.py +102 -0
- frontengine/ui/page/scene_setting/scene_page/image.py +83 -0
- frontengine/ui/page/scene_setting/scene_page/sound.py +84 -0
- frontengine/ui/page/scene_setting/scene_page/text.py +93 -0
- frontengine/ui/page/scene_setting/scene_page/video.py +122 -0
- frontengine/ui/page/scene_setting/scene_page/web.py +66 -0
- frontengine/ui/page/scene_setting/scene_setting_ui.py +55 -0
- frontengine/ui/{setting → page}/sound_player/sound_player_setting_ui.py +0 -1
- frontengine/ui/{setting → page}/text/text_setting_ui.py +39 -11
- frontengine/ui/page/utils.py +43 -0
- frontengine/ui/{setting → page}/video/video_setting_ui.py +28 -11
- frontengine/ui/{setting → page}/web/web_setting_ui.py +23 -9
- frontengine/user_setting/scene_setting.py +34 -0
- frontengine/user_setting/user_setting_file.py +2 -1
- frontengine/utils/browser/browser.py +5 -0
- frontengine/utils/critical_exit/check_key_is_press.py +11 -0
- frontengine/utils/critical_exit/critical_exit.py +52 -0
- frontengine/utils/critical_exit/win32_vk.py +368 -0
- frontengine/utils/multi_language/english.py +30 -2
- frontengine/utils/multi_language/france.py +147 -0
- frontengine/utils/multi_language/germany.py +147 -0
- frontengine/utils/multi_language/italy.py +147 -0
- frontengine/utils/multi_language/language_wrapper.py +17 -2
- frontengine/utils/multi_language/russian.py +147 -0
- frontengine/utils/multi_language/simplified_chinese.py +147 -0
- frontengine/utils/multi_language/traditional_chinese.py +31 -2
- frontengine/worker/qthread_worker.py +34 -0
- {frontengine_dev-0.0.53.dist-info → frontengine_dev-0.0.71.dist-info}/METADATA +9 -55
- frontengine_dev-0.0.71.dist-info/RECORD +112 -0
- {frontengine_dev-0.0.53.dist-info → frontengine_dev-0.0.71.dist-info}/WHEEL +1 -1
- frontengine/show/chat/chat_toast.py +0 -55
- frontengine/show/image_generation/image_generation_show.py +0 -43
- frontengine/ui/main/language_menu.py +0 -43
- frontengine/ui/setting/chat/chat_model.py +0 -65
- frontengine/ui/setting/chat/chat_scene_input.py +0 -69
- frontengine/ui/setting/chat/chat_scene_setting.py +0 -176
- frontengine/ui/setting/chat/chatthread.py +0 -78
- frontengine/ui/setting/chat/speech_to_text.py +0 -70
- frontengine/ui/setting/image_generation/generation_image_thread.py +0 -32
- frontengine/ui/setting/image_generation/image_generation_input.py +0 -62
- frontengine/ui/setting/scene_setting/scene_setting_ui.py +0 -47
- frontengine/ui/setting/scene_setting/scene_tabs/Image.py +0 -61
- frontengine/ui/setting/scene_setting/scene_tabs/gif.py +0 -74
- frontengine/ui/setting/scene_setting/scene_tabs/scene_control.py +0 -77
- frontengine/ui/setting/scene_setting/scene_tabs/sound.py +0 -44
- frontengine/ui/setting/scene_setting/scene_tabs/tableview_model.py +0 -65
- frontengine/ui/setting/scene_setting/scene_tabs/text.py +0 -77
- frontengine/ui/setting/scene_setting/scene_tabs/ui.py +0 -56
- frontengine/ui/setting/scene_setting/scene_tabs/video.py +0 -88
- frontengine/ui/setting/scene_setting/scene_tabs/web.py +0 -74
- frontengine/user_setting/gif/gif_setting.py +0 -5
- frontengine/user_setting/image/image_setting.py +0 -4
- frontengine/user_setting/sound/sound_setting.py +0 -4
- frontengine/user_setting/text/__init__.py +0 -0
- frontengine/user_setting/text/text_setting.py +0 -5
- frontengine/user_setting/video/__init__.py +0 -0
- frontengine/user_setting/video/video_setting.py +0 -6
- frontengine/user_setting/web/__init__.py +0 -0
- frontengine/user_setting/web/web_setting.py +0 -4
- frontengine_dev-0.0.53.dist-info/RECORD +0 -112
- /frontengine/{show/chat → gl_widget}/__init__.py +0 -0
- /frontengine/show/{image_generation → clicker}/__init__.py +0 -0
- /frontengine/{ui/main → show/particle}/__init__.py +0 -0
- /frontengine/{ui/main/system_tray → system_tray}/__init__.py +0 -0
- /frontengine/ui/{setting → menu}/__init__.py +0 -0
- /frontengine/ui/{setting/chat → page}/__init__.py +0 -0
- /frontengine/ui/{setting → page}/control_center/__init__.py +0 -0
- /frontengine/ui/{setting → page}/gif/__init__.py +0 -0
- /frontengine/ui/{setting → page}/image/__init__.py +0 -0
- /frontengine/ui/{setting/image_generation → page/particle}/__init__.py +0 -0
- /frontengine/ui/{setting → page}/scene_setting/__init__.py +0 -0
- /frontengine/ui/{setting/scene_setting/scene_tabs → page/scene_setting/scene_page}/__init__.py +0 -0
- /frontengine/ui/{setting → page}/sound_player/__init__.py +0 -0
- /frontengine/ui/{setting → page}/text/__init__.py +0 -0
- /frontengine/ui/{setting → page}/video/__init__.py +0 -0
- /frontengine/ui/{setting → page}/web/__init__.py +0 -0
- /frontengine/{user_setting/gif → utils/browser}/__init__.py +0 -0
- /frontengine/{user_setting/image → utils/critical_exit}/__init__.py +0 -0
- /frontengine/{user_setting/sound → worker}/__init__.py +0 -0
- {frontengine_dev-0.0.53.dist-info → frontengine_dev-0.0.71.dist-info}/LICENSE +0 -0
- {frontengine_dev-0.0.53.dist-info → frontengine_dev-0.0.71.dist-info}/top_level.txt +0 -0
frontengine/__init__.py
CHANGED
@@ -7,26 +7,24 @@ from frontengine.show.sound_player.sound_player import SoundPlayer
|
|
7
7
|
from frontengine.show.text.draw_text import TextWidget
|
8
8
|
from frontengine.show.video.video_player import VideoWidget
|
9
9
|
from frontengine.show.web.webview import WebWidget
|
10
|
-
from frontengine.ui.
|
10
|
+
from frontengine.ui.main_ui import start_front_engine
|
11
11
|
from frontengine.utils.multi_language.language_wrapper import language_wrapper
|
12
|
-
from frontengine.ui.
|
13
|
-
from frontengine.ui.
|
14
|
-
from frontengine.ui.
|
15
|
-
from frontengine.ui.
|
16
|
-
from frontengine.ui.
|
17
|
-
from frontengine.ui.
|
18
|
-
from frontengine.ui.
|
19
|
-
from frontengine.ui.
|
20
|
-
from frontengine.ui.
|
21
|
-
from frontengine.ui.
|
22
|
-
from frontengine.ui.setting.chat.chat_scene_setting import ChatSceneUI
|
23
|
-
from frontengine.ui.main.main_ui import FrontEngine_EXTEND_TAB
|
12
|
+
from frontengine.ui.page.text.text_setting_ui import TextSettingUI
|
13
|
+
from frontengine.ui.page.web.web_setting_ui import WEBSettingUI
|
14
|
+
from frontengine.ui.page.gif.gif_setting_ui import GIFSettingUI
|
15
|
+
from frontengine.ui.page.image.image_setting_ui import ImageSettingUI
|
16
|
+
from frontengine.ui.page.sound_player.sound_player_setting_ui import SoundPlayerSettingUI
|
17
|
+
from frontengine.ui.page.video.video_setting_ui import VideoSettingUI
|
18
|
+
from frontengine.ui.page.control_center.control_center_ui import ControlCenterUI
|
19
|
+
from frontengine.ui.page.scene_setting.scene_setting_ui import SceneSettingUI
|
20
|
+
from frontengine.ui.main_ui import FrontEngineMainUI
|
21
|
+
from frontengine.ui.main_ui import FrontEngine_EXTEND_TAB
|
24
22
|
from frontengine.utils.redirect_manager.redirect_manager_class import RedirectManager
|
25
23
|
|
26
24
|
__all__ = [
|
27
25
|
"start_front_engine", "GifWidget", "SoundPlayer", "SoundEffectWidget", "TextWidget",
|
28
26
|
"WebWidget", "ImageWidget", "VideoWidget", "language_wrapper", "load_extend_ui_file", "load_ui_file",
|
29
27
|
"TextSettingUI", "WEBSettingUI", "GIFSettingUI", "ImageSettingUI", "SoundPlayerSettingUI",
|
30
|
-
"VideoSettingUI", "ControlCenterUI", "SceneSettingUI", "FrontEngineMainUI",
|
31
|
-
"
|
28
|
+
"VideoSettingUI", "ControlCenterUI", "SceneSettingUI", "FrontEngineMainUI",
|
29
|
+
"FrontEngine_EXTEND_TAB", "RedirectManager"
|
32
30
|
]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from PySide6.QtCore import Qt
|
2
|
+
from PySide6.QtWidgets import QWidget, QGridLayout
|
3
|
+
|
4
|
+
from frontengine.show.clicker.clicker_scene import ClickerGraphicScene
|
5
|
+
from frontengine.show.scene.extend_graphic_view import ExtendGraphicView
|
6
|
+
|
7
|
+
|
8
|
+
class ClickerWidget(QWidget):
|
9
|
+
|
10
|
+
def __init__(self):
|
11
|
+
super().__init__()
|
12
|
+
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
13
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
14
|
+
self.clicker_view = ExtendGraphicView()
|
15
|
+
self.clicker_scene = ClickerGraphicScene()
|
16
|
+
self.clicker_view.setScene(self.clicker_scene)
|
17
|
+
self.grid_layout = QGridLayout()
|
18
|
+
self.grid_layout.addWidget(self.clicker_view, 0, 0, -1, -1)
|
19
|
+
self.setLayout(self.grid_layout)
|
20
|
+
|
21
|
+
def set_ui_window_flag(self, show_on_bottom: bool = False) -> None:
|
22
|
+
self.setWindowFlag(
|
23
|
+
Qt.WindowType.WindowTransparentForInput |
|
24
|
+
Qt.WindowType.FramelessWindowHint |
|
25
|
+
Qt.WindowType.Tool
|
26
|
+
)
|
27
|
+
if not show_on_bottom:
|
28
|
+
self.setWindowFlag(Qt.WindowType.WindowStaysOnTopHint)
|
29
|
+
else:
|
30
|
+
self.setWindowFlag(Qt.WindowType.WindowStaysOnBottomHint)
|
@@ -10,8 +10,10 @@ from frontengine.utils.multi_language.language_wrapper import language_wrapper
|
|
10
10
|
|
11
11
|
class GifWidget(QWidget):
|
12
12
|
|
13
|
-
def __init__(self, gif_image_path: str):
|
13
|
+
def __init__(self, gif_image_path: str, draw_location_x: int = 0, draw_location_y: int = 0):
|
14
14
|
super().__init__()
|
15
|
+
self.draw_location_x = draw_location_x
|
16
|
+
self.draw_location_y = draw_location_y
|
15
17
|
self.opacity: float = 0.2
|
16
18
|
self.speed: int = 100
|
17
19
|
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
@@ -26,6 +28,7 @@ class GifWidget(QWidget):
|
|
26
28
|
self.movie.frameChanged.connect(self.repaint)
|
27
29
|
self.gif_label.setMovie(self.movie)
|
28
30
|
self.movie.start()
|
31
|
+
self.resize(self.movie.frameRect().size())
|
29
32
|
else:
|
30
33
|
message_box: QMessageBox = QMessageBox(self)
|
31
34
|
message_box.setText(
|
@@ -61,7 +64,7 @@ class GifWidget(QWidget):
|
|
61
64
|
painter.setOpacity(self.opacity)
|
62
65
|
painter.drawPixmap(
|
63
66
|
QRect(
|
64
|
-
self.
|
67
|
+
self.draw_location_x, self.draw_location_y, self.width(), self.height()
|
65
68
|
),
|
66
69
|
current_gif_frame
|
67
70
|
)
|
@@ -10,13 +10,16 @@ from frontengine.utils.multi_language.language_wrapper import language_wrapper
|
|
10
10
|
|
11
11
|
class ImageWidget(QWidget):
|
12
12
|
|
13
|
-
def __init__(self, image_path: str):
|
13
|
+
def __init__(self, image_path: str, draw_location_x: int = 0, draw_location_y: int = 0):
|
14
14
|
super().__init__()
|
15
|
+
self.draw_location_x = draw_location_x
|
16
|
+
self.draw_location_y = draw_location_y
|
15
17
|
self.opacity: float = 0.2
|
16
18
|
self.image_path: Path = Path(image_path)
|
17
19
|
if self.image_path.exists() and self.image_path.is_file():
|
18
20
|
print(f"Origin file {str(self.image_path)}")
|
19
21
|
self.image = QImage(str(self.image_path))
|
22
|
+
self.resize(self.image.size())
|
20
23
|
else:
|
21
24
|
message_box: QMessageBox = QMessageBox(self)
|
22
25
|
message_box.setText(
|
@@ -48,7 +51,7 @@ class ImageWidget(QWidget):
|
|
48
51
|
painter = QPainter(self)
|
49
52
|
painter.setOpacity(self.opacity)
|
50
53
|
painter.drawImage(
|
51
|
-
QRect(self.
|
54
|
+
QRect(self.draw_location_x, self.draw_location_y, self.width(), self.height()),
|
52
55
|
self.image)
|
53
56
|
painter.restore()
|
54
57
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import random
|
2
|
+
from typing import Callable
|
3
|
+
|
4
|
+
from PySide6.QtCore import QTimer, QPoint, QRect
|
5
|
+
from PySide6.QtGui import QPixmap
|
6
|
+
from PySide6.QtWidgets import QGraphicsScene
|
7
|
+
|
8
|
+
from frontengine.show.particle.particle_utils import particle_down, particle_up, particle_left, particle_right, \
|
9
|
+
particle_left_down, particle_left_up, particle_right_down, particle_right_up, particle_random_minus, \
|
10
|
+
particle_random_add, particle_random
|
11
|
+
|
12
|
+
|
13
|
+
class ParticleGraphicScene(QGraphicsScene):
|
14
|
+
|
15
|
+
def __init__(self, particle_pixmap: QPixmap, particle_direction: str,
|
16
|
+
particle_count: int = 500,
|
17
|
+
screen_height: int = 1920, screen_width: int = 1080, opacity: float = 0.2,
|
18
|
+
particle_speed: int = 1):
|
19
|
+
super().__init__()
|
20
|
+
self.particle_pixmap: QPixmap = particle_pixmap
|
21
|
+
self.particle_direction: str = particle_direction
|
22
|
+
self.particle_count: int = particle_count
|
23
|
+
self.opacity: float = opacity
|
24
|
+
self.particle_dict: dict = {}
|
25
|
+
self.particle_speed: int = particle_speed
|
26
|
+
self.screen_height: int = screen_height
|
27
|
+
self.screen_width: int = screen_width
|
28
|
+
self.create_particle()
|
29
|
+
self.update_function: Callable = {
|
30
|
+
"down": particle_down,
|
31
|
+
"up": particle_up,
|
32
|
+
"left": particle_left,
|
33
|
+
"right": particle_right,
|
34
|
+
"left_down": particle_left_down,
|
35
|
+
"left_up": particle_left_up,
|
36
|
+
"right_down": particle_right_down,
|
37
|
+
"right_up": particle_right_up,
|
38
|
+
"random_minus": particle_random_minus,
|
39
|
+
"random_add": particle_random_add,
|
40
|
+
"random": particle_random
|
41
|
+
}.get(self.particle_direction)
|
42
|
+
self.setSceneRect(QRect(0, 0, screen_width, screen_height))
|
43
|
+
self.update_timer: QTimer = QTimer()
|
44
|
+
self.update_timer.setInterval(100)
|
45
|
+
self.update_timer.timeout.connect(self.update_particle_xy)
|
46
|
+
self.update_timer.start()
|
47
|
+
|
48
|
+
def create_particle(self):
|
49
|
+
self.particle_dict = {}
|
50
|
+
for count in range(self.particle_count):
|
51
|
+
item = self.addPixmap(self.particle_pixmap)
|
52
|
+
item.setOpacity(self.opacity)
|
53
|
+
self.particle_dict.update({
|
54
|
+
f"particle_{count}": {
|
55
|
+
"x": random.randint(0, self.screen_width),
|
56
|
+
"y": random.randint(0, self.screen_height),
|
57
|
+
"height": self.screen_height,
|
58
|
+
"width": self.screen_width,
|
59
|
+
"pixmap_item": item,
|
60
|
+
}
|
61
|
+
})
|
62
|
+
|
63
|
+
def update_particle_xy(self):
|
64
|
+
self.update_function(self.particle_dict, self.particle_speed)
|
65
|
+
for particle_key, particle in self.particle_dict.items():
|
66
|
+
pixmap_item = particle.get("pixmap_item")
|
67
|
+
pixmap_item.setPos(particle.get("x"), particle.get("y"))
|
68
|
+
if not self.sceneRect().contains(QPoint(particle.get("x"), particle.get("y"))):
|
69
|
+
self.removeItem(particle.get("pixmap_item"))
|
70
|
+
if len(self.items()) == 0:
|
71
|
+
self.create_particle()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from PySide6.QtCore import QSize
|
2
|
+
from PySide6.QtGui import QPixmap, Qt
|
3
|
+
from PySide6.QtWidgets import QWidget, QGridLayout
|
4
|
+
|
5
|
+
from frontengine.show.particle.particle_scene import ParticleGraphicScene
|
6
|
+
from frontengine.show.scene.extend_graphic_view import ExtendGraphicView
|
7
|
+
|
8
|
+
|
9
|
+
class ParticleWidget(QWidget):
|
10
|
+
|
11
|
+
def __init__(self, pixmap: QPixmap, particle_size: int, particle_direction: str, particle_count: int = 50,
|
12
|
+
screen_height: int = 1080, screen_width: int = 1920, opacity: float = 0.2,
|
13
|
+
particle_speed: int = 1):
|
14
|
+
super().__init__()
|
15
|
+
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
16
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
17
|
+
if particle_size:
|
18
|
+
self.pixmap = pixmap.scaled(QSize(particle_size, particle_size), Qt.AspectRatioMode.KeepAspectRatio)
|
19
|
+
else:
|
20
|
+
self.pixmap = pixmap.scaled(QSize(pixmap.width(), pixmap.height()), Qt.AspectRatioMode.KeepAspectRatio)
|
21
|
+
self.particle_view = ExtendGraphicView()
|
22
|
+
self.particle_scene = ParticleGraphicScene(
|
23
|
+
self.pixmap, particle_direction, particle_count,
|
24
|
+
screen_height, screen_width, opacity, particle_speed)
|
25
|
+
self.particle_view.setScene(self.particle_scene)
|
26
|
+
self.grid_layout = QGridLayout()
|
27
|
+
self.grid_layout.addWidget(self.particle_view, 0, 0, -1, -1)
|
28
|
+
self.setLayout(self.grid_layout)
|
29
|
+
|
30
|
+
def set_ui_window_flag(self, show_on_bottom: bool = False) -> None:
|
31
|
+
self.setWindowFlag(
|
32
|
+
Qt.WindowType.WindowTransparentForInput |
|
33
|
+
Qt.WindowType.FramelessWindowHint |
|
34
|
+
Qt.WindowType.Tool
|
35
|
+
)
|
36
|
+
if not show_on_bottom:
|
37
|
+
self.setWindowFlag(Qt.WindowType.WindowStaysOnTopHint)
|
38
|
+
else:
|
39
|
+
self.setWindowFlag(Qt.WindowType.WindowStaysOnBottomHint)
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import random
|
2
|
+
from typing import Dict, Callable
|
3
|
+
|
4
|
+
|
5
|
+
def particle_down(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
6
|
+
for particle in particle_dict.values():
|
7
|
+
particle.update({"y": particle.get("y") + random.randint(0, particle_speed)})
|
8
|
+
|
9
|
+
|
10
|
+
def particle_up(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
11
|
+
for particle in particle_dict.values():
|
12
|
+
particle.update({"y": particle.get("y") - random.randint(0, particle_speed)})
|
13
|
+
|
14
|
+
|
15
|
+
def particle_left(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
16
|
+
for particle in particle_dict.values():
|
17
|
+
particle.update({"x": particle.get("x") - random.randint(0, particle_speed)})
|
18
|
+
|
19
|
+
|
20
|
+
def particle_right(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
21
|
+
for particle in particle_dict.values():
|
22
|
+
particle.update({"x": particle.get("x") + random.randint(0, particle_speed)})
|
23
|
+
|
24
|
+
|
25
|
+
def particle_left_down(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
26
|
+
particle_left(particle_dict, particle_speed)
|
27
|
+
particle_down(particle_dict, particle_speed)
|
28
|
+
|
29
|
+
|
30
|
+
def particle_left_up(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
31
|
+
particle_left(particle_dict, particle_speed)
|
32
|
+
particle_up(particle_dict, particle_speed)
|
33
|
+
|
34
|
+
|
35
|
+
def particle_right_down(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
36
|
+
particle_right(particle_dict, particle_speed)
|
37
|
+
particle_down(particle_dict, particle_speed)
|
38
|
+
|
39
|
+
|
40
|
+
def particle_right_up(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
41
|
+
particle_right(particle_dict, particle_speed)
|
42
|
+
particle_up(particle_dict, particle_speed)
|
43
|
+
|
44
|
+
|
45
|
+
def particle_random_minus(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
46
|
+
for particle in particle_dict.values():
|
47
|
+
particle.update({"y": particle.get("y") + random.randint(0, particle_speed)})
|
48
|
+
particle.update({"x": particle.get("x") - random.randint(0, particle_speed)})
|
49
|
+
|
50
|
+
|
51
|
+
def particle_random_add(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
52
|
+
for particle in particle_dict.values():
|
53
|
+
particle.update({"y": particle.get("y") - random.randint(0, particle_speed)})
|
54
|
+
particle.update({"x": particle.get("x") + random.randint(0, particle_speed)})
|
55
|
+
|
56
|
+
|
57
|
+
def particle_random(particle_dict: Dict[str, dict], particle_speed: int = 30) -> None:
|
58
|
+
function: Callable = random.choice(
|
59
|
+
[particle_down, particle_up, particle_left, particle_right, particle_right_up, particle_left_down,
|
60
|
+
particle_left_up, particle_right_down, particle_random_add, particle_random_minus])
|
61
|
+
function(particle_dict, particle_speed)
|
@@ -12,6 +12,7 @@ class ExtendGraphicView(QGraphicsView):
|
|
12
12
|
Qt.WindowType.WindowType_Mask |
|
13
13
|
Qt.WindowType.Tool
|
14
14
|
)
|
15
|
+
self.setStyleSheet("background:transparent")
|
15
16
|
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
16
17
|
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
17
18
|
self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
@@ -23,7 +24,7 @@ class ExtendGraphicView(QGraphicsView):
|
|
23
24
|
pass
|
24
25
|
else:
|
25
26
|
current_position = event.position()
|
26
|
-
scene_position = self.mapToScene(QPoint(current_position.x(), current_position.y()))
|
27
|
+
scene_position = self.mapToScene(QPoint(int(current_position.x()), int(current_position.y())))
|
27
28
|
view_width = self.viewport().width()
|
28
29
|
view_height = self.viewport().height()
|
29
30
|
horizon_scale = current_position.x() / view_width
|
frontengine/show/scene/scene.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
from typing import List, Dict
|
2
2
|
|
3
|
-
from PySide6.QtWidgets import QGraphicsProxyWidget
|
3
|
+
from PySide6.QtWidgets import QGraphicsProxyWidget
|
4
|
+
from frontengine.show.scene.extend_graphic_view import ExtendGraphicView
|
4
5
|
|
5
6
|
from frontengine.show.gif.paint_gif import GifWidget
|
6
7
|
from frontengine.show.image.paint_image import ImageWidget
|
7
|
-
from frontengine.show.load.load_someone_make_ui import load_ui_file, read_extend_ui
|
8
8
|
from frontengine.show.scene.extend_graphic_scene import ExtendGraphicScene
|
9
|
-
from frontengine.show.scene.extend_graphic_view import ExtendGraphicView
|
10
9
|
from frontengine.show.sound_player.sound_player import SoundPlayer
|
11
10
|
from frontengine.show.text.draw_text import TextWidget
|
12
11
|
from frontengine.show.video.video_player import VideoWidget
|
@@ -20,26 +19,25 @@ class SceneManager(object):
|
|
20
19
|
):
|
21
20
|
super().__init__()
|
22
21
|
self.graphic_scene = ExtendGraphicScene()
|
23
|
-
self.graphic_view = ExtendGraphicView(self.graphic_scene)
|
24
|
-
self.graphic_view.showMaximized()
|
25
22
|
self.widget_list: List[QGraphicsProxyWidget] = list()
|
23
|
+
self.view_list: List[ExtendGraphicView] = []
|
26
24
|
|
27
|
-
def add_image(self,
|
28
|
-
image_path =
|
25
|
+
def add_image(self, setting_dict: Dict) -> QGraphicsProxyWidget:
|
26
|
+
image_path = setting_dict.get("file_path")
|
29
27
|
image_widget = ImageWidget(image_path)
|
30
|
-
opacity = float(
|
28
|
+
opacity = float(setting_dict.get("opacity")) / 100
|
31
29
|
opacity = opacity if opacity is not None else 0.2
|
32
30
|
image_widget.set_ui_variable(opacity)
|
33
31
|
proxy_widget = self.graphic_scene.addWidget(image_widget)
|
34
32
|
self.widget_list.append(proxy_widget)
|
35
33
|
return proxy_widget
|
36
34
|
|
37
|
-
def add_gif(self,
|
38
|
-
gif_image_path =
|
35
|
+
def add_gif(self, setting_dict: Dict) -> QGraphicsProxyWidget:
|
36
|
+
gif_image_path = setting_dict.get("file_path")
|
39
37
|
gif_widget = GifWidget(gif_image_path)
|
40
|
-
speed = int(
|
38
|
+
speed = int(setting_dict.get("speed"))
|
41
39
|
speed = speed if speed is not None else 100
|
42
|
-
opacity = float(
|
40
|
+
opacity = float(setting_dict.get("opacity")) / 100
|
43
41
|
opacity = opacity if opacity is not None else 0.2
|
44
42
|
gif_widget.set_gif_variable(speed)
|
45
43
|
gif_widget.set_ui_variable(opacity)
|
@@ -47,30 +45,32 @@ class SceneManager(object):
|
|
47
45
|
self.widget_list.append(proxy_widget)
|
48
46
|
return proxy_widget
|
49
47
|
|
50
|
-
def add_sound(self,
|
51
|
-
sound_path =
|
48
|
+
def add_sound(self, setting_dict: Dict) -> QGraphicsProxyWidget:
|
49
|
+
sound_path = setting_dict.get("file_path")
|
52
50
|
sound_widget = SoundPlayer(sound_path)
|
53
|
-
volume = float(
|
51
|
+
volume = float(setting_dict.get("volume")) / 100
|
54
52
|
volume = volume if volume is not None else 1
|
55
53
|
sound_widget.set_player_variable(volume)
|
56
54
|
proxy_widget = self.graphic_scene.addWidget(sound_widget)
|
57
55
|
self.widget_list.append(proxy_widget)
|
58
56
|
return proxy_widget
|
59
57
|
|
60
|
-
def add_text(self,
|
61
|
-
text =
|
58
|
+
def add_text(self, setting_dict: Dict) -> QGraphicsProxyWidget:
|
59
|
+
text = setting_dict.get("text")
|
62
60
|
text_widget = TextWidget(text)
|
63
|
-
font_size = int(
|
61
|
+
font_size = int(setting_dict.get("font_size"))
|
64
62
|
font_size = font_size if font_size is not None else 100
|
65
|
-
opacity = float(
|
63
|
+
opacity = float(setting_dict.get("opacity")) / 100
|
66
64
|
opacity = opacity if opacity is not None else 0.2
|
65
|
+
alignment = setting_dict.get("alignment", "Center")
|
67
66
|
text_widget.set_ui_variable(opacity)
|
68
67
|
text_widget.set_font_variable(font_size)
|
68
|
+
text_widget.set_alignment(alignment)
|
69
69
|
proxy_widget = self.graphic_scene.addWidget(text_widget)
|
70
70
|
self.widget_list.append(proxy_widget)
|
71
71
|
return proxy_widget
|
72
72
|
|
73
|
-
def add_video(self, video_setting: Dict
|
73
|
+
def add_video(self, video_setting: Dict) -> QGraphicsProxyWidget:
|
74
74
|
video_path = video_setting.get("file_path")
|
75
75
|
video_widget = VideoWidget(video_path)
|
76
76
|
opacity = float(video_setting.get("opacity")) / 100
|
@@ -85,31 +85,12 @@ class SceneManager(object):
|
|
85
85
|
self.widget_list.append(proxy_widget)
|
86
86
|
return proxy_widget
|
87
87
|
|
88
|
-
def add_web(self,
|
89
|
-
url =
|
88
|
+
def add_web(self, setting_dict: Dict) -> QGraphicsProxyWidget:
|
89
|
+
url = setting_dict.get("url")
|
90
90
|
web_widget = WebWidget(url)
|
91
|
-
opacity = float(
|
91
|
+
opacity = float(setting_dict.get("opacity")) / 100
|
92
92
|
opacity = opacity if opacity is not None else 0.2
|
93
|
-
enable_input = web_setting.get("enable_input")
|
94
|
-
enable_input = enable_input if enable_input is not None else False
|
95
93
|
web_widget.set_ui_variable(opacity)
|
96
|
-
web_widget.set_ui_window_flag(enable_input=enable_input)
|
97
94
|
proxy_widget = self.graphic_scene.addWidget(web_widget)
|
98
95
|
self.widget_list.append(proxy_widget)
|
99
96
|
return proxy_widget
|
100
|
-
|
101
|
-
def add_extend_ui_file(self, ui_setting_dict: Dict[str, str]) -> QGraphicsProxyWidget:
|
102
|
-
ui_path = ui_setting_dict.get("file_path")
|
103
|
-
extend_widget = load_ui_file(ui_path)
|
104
|
-
proxy_widget = self.graphic_scene.addWidget(extend_widget)
|
105
|
-
self.widget_list.append(proxy_widget)
|
106
|
-
return proxy_widget
|
107
|
-
|
108
|
-
def add_extend_ui(self, ui: QWidget) -> QGraphicsProxyWidget:
|
109
|
-
extend_widget = read_extend_ui(ui)
|
110
|
-
proxy_widget = self.graphic_scene.addWidget(extend_widget)
|
111
|
-
self.widget_list.append(proxy_widget)
|
112
|
-
return proxy_widget
|
113
|
-
|
114
|
-
def show(self):
|
115
|
-
self.graphic_view.showMaximized()
|
@@ -26,8 +26,7 @@ class SoundEffectWidget(QWidget):
|
|
26
26
|
self.sound_path = Path(sound_path)
|
27
27
|
if self.sound_path.exists() and self.sound_path.is_file():
|
28
28
|
# QUrl non ascii path encode, Avoid read wrong path and file name
|
29
|
-
source = QUrl.fromLocalFile(str(self.sound_path)
|
30
|
-
source = source.fromEncoded(source.toEncoded())
|
29
|
+
source = QUrl.fromLocalFile(str(self.sound_path))
|
31
30
|
print(f"Origin file {str(self.sound_path)}")
|
32
31
|
self.sound_player.setSource(source)
|
33
32
|
# -2 means loop forever
|
@@ -28,8 +28,7 @@ class SoundPlayer(QWidget):
|
|
28
28
|
self.media_player.setAudioOutput(self.media_player_audio)
|
29
29
|
self.media_player_audio = self.media_player.audioOutput()
|
30
30
|
# QUrl non ascii path encode, Avoid read wrong path and file name
|
31
|
-
source = QUrl.fromLocalFile(str(self.sound_path)
|
32
|
-
source = source.fromEncoded(source.toEncoded())
|
31
|
+
source = QUrl.fromLocalFile(str(self.sound_path))
|
33
32
|
print(f"Origin file {str(self.sound_path)}")
|
34
33
|
self.media_player.setSource(source)
|
35
34
|
self.media_player.setLoops(-1)
|
@@ -8,13 +8,26 @@ from PySide6.QtWidgets import QWidget
|
|
8
8
|
|
9
9
|
class TextWidget(QWidget):
|
10
10
|
|
11
|
-
def __init__(self, text: str
|
11
|
+
def __init__(self, text: str, draw_location_x: int = 0, draw_location_y: int = 0,
|
12
|
+
alignment: str = "Center"):
|
12
13
|
super().__init__()
|
14
|
+
self.draw_location_x = draw_location_x
|
15
|
+
self.draw_location_y = draw_location_y
|
13
16
|
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
14
17
|
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
15
18
|
self.text = text
|
16
19
|
self.font_size = 100
|
17
20
|
self.opacity = 0.2
|
21
|
+
if alignment == "TopLeft":
|
22
|
+
self.alignment = (Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft)
|
23
|
+
elif alignment == "TopRight":
|
24
|
+
self.alignment = (Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignRight)
|
25
|
+
elif alignment == "BottomLeft":
|
26
|
+
self.alignment = (Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft)
|
27
|
+
elif alignment == "BottomRight":
|
28
|
+
self.alignment = (Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignRight)
|
29
|
+
else:
|
30
|
+
self.alignment = Qt.AlignmentFlag.AlignCenter
|
18
31
|
self.draw_font = QFontDatabase.font(self.font().family(), "", self.font_size)
|
19
32
|
# Set Icon
|
20
33
|
self.icon_path = Path(os.getcwd() + "/je_driver_icon.ico")
|
@@ -38,6 +51,21 @@ class TextWidget(QWidget):
|
|
38
51
|
def set_ui_variable(self, opacity: float = 0.2) -> None:
|
39
52
|
self.opacity = opacity
|
40
53
|
|
54
|
+
def set_font(self):
|
55
|
+
self.draw_font = QFontDatabase.font(self.font().family(), "", self.font_size)
|
56
|
+
|
57
|
+
def set_alignment(self, alignment: str = "Center") -> None:
|
58
|
+
if alignment == "TopLeft":
|
59
|
+
self.alignment = (Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft)
|
60
|
+
elif alignment == "TopRight":
|
61
|
+
self.alignment = (Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignRight)
|
62
|
+
elif alignment == "BottomLeft":
|
63
|
+
self.alignment = (Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft)
|
64
|
+
elif alignment == "BottomRight":
|
65
|
+
self.alignment = (Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignRight)
|
66
|
+
else:
|
67
|
+
self.alignment = Qt.AlignmentFlag.AlignCenter
|
68
|
+
|
41
69
|
def paintEvent(self, event) -> None:
|
42
70
|
painter = QPainter(self)
|
43
71
|
painter.setFont(
|
@@ -46,8 +74,8 @@ class TextWidget(QWidget):
|
|
46
74
|
painter.setPen(Qt.GlobalColor.black)
|
47
75
|
painter.setOpacity(self.opacity)
|
48
76
|
painter.drawText(
|
49
|
-
QRect(self.
|
50
|
-
|
77
|
+
QRect(self.draw_location_x, self.draw_location_y, self.width(), self.height()),
|
78
|
+
int(self.alignment),
|
51
79
|
self.text
|
52
80
|
)
|
53
81
|
painter.restore()
|
@@ -60,4 +88,3 @@ class TextWidget(QWidget):
|
|
60
88
|
|
61
89
|
def mouseGrabber(self) -> None:
|
62
90
|
super().mouseGrabber()
|
63
|
-
|
@@ -7,6 +7,7 @@ from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
|
|
7
7
|
from PySide6.QtMultimediaWidgets import QVideoWidget
|
8
8
|
from PySide6.QtWidgets import QMessageBox
|
9
9
|
|
10
|
+
from frontengine.utils.logging.loggin_instance import front_engine_logger
|
10
11
|
from frontengine.utils.multi_language.language_wrapper import language_wrapper
|
11
12
|
|
12
13
|
|
@@ -17,18 +18,15 @@ class VideoWidget(QVideoWidget):
|
|
17
18
|
self.opacity: float = 0.2
|
18
19
|
self.volume: float = 1
|
19
20
|
self.play_rate: float = 1
|
20
|
-
self.setAttribute(
|
21
|
-
Qt.WidgetAttribute.WA_TranslucentBackground
|
22
|
-
)
|
23
21
|
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
24
22
|
self.media_player = QMediaPlayer()
|
25
23
|
self.video_path = Path(video_path)
|
26
24
|
if self.video_path.exists() and self.video_path.is_file():
|
25
|
+
front_engine_logger.info("start_play_video")
|
27
26
|
self.video_file_path = str(self.video_path)
|
28
27
|
self.audioOutput = QAudioOutput()
|
29
28
|
# QUrl non ascii path encode, Avoid read wrong path and file name
|
30
|
-
source = QUrl.fromLocalFile(str(self.video_file_path)
|
31
|
-
source = source.fromEncoded(source.toEncoded())
|
29
|
+
source = QUrl.fromLocalFile(str(self.video_file_path))
|
32
30
|
print(f"Origin file {str(self.video_file_path)}")
|
33
31
|
self.media_player.setSource(source)
|
34
32
|
self.media_player.setVideoOutput(self)
|
@@ -47,6 +45,7 @@ class VideoWidget(QVideoWidget):
|
|
47
45
|
if self.icon_path.exists() and self.icon_path.is_file():
|
48
46
|
self.setWindowIcon(QIcon(str(self.icon_path)))
|
49
47
|
|
48
|
+
|
50
49
|
def set_ui_window_flag(self, show_on_bottom: bool = False) -> None:
|
51
50
|
self.setWindowFlag(
|
52
51
|
Qt.WindowType.WindowTransparentForInput |
|
frontengine/show/web/webview.py
CHANGED
@@ -2,9 +2,9 @@ import os
|
|
2
2
|
from pathlib import Path
|
3
3
|
|
4
4
|
from PySide6.QtCore import Qt, QUrl
|
5
|
-
from PySide6.QtGui import QIcon
|
5
|
+
from PySide6.QtGui import QIcon, QAction
|
6
6
|
from PySide6.QtWebEngineWidgets import QWebEngineView
|
7
|
-
from PySide6.QtWidgets import QMessageBox
|
7
|
+
from PySide6.QtWidgets import QMessageBox, QMenu
|
8
8
|
|
9
9
|
from frontengine.utils.multi_language.language_wrapper import language_wrapper
|
10
10
|
|
@@ -13,6 +13,8 @@ class WebWidget(QWebEngineView):
|
|
13
13
|
|
14
14
|
def __init__(self, url: str, is_file: bool = False):
|
15
15
|
super().__init__()
|
16
|
+
self.menu = None
|
17
|
+
self.close_action = None
|
16
18
|
self.opacity: float = 0.2
|
17
19
|
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
18
20
|
if not is_file:
|
@@ -21,8 +23,7 @@ class WebWidget(QWebEngineView):
|
|
21
23
|
self.web_url = Path(url)
|
22
24
|
if self.web_url.exists() and self.web_url.is_file():
|
23
25
|
# QUrl non ascii path encode, Avoid read wrong path and file name
|
24
|
-
source = QUrl.fromLocalFile(str(self.web_url)
|
25
|
-
source = source.fromEncoded(source.toEncoded())
|
26
|
+
source = QUrl.fromLocalFile(str(self.web_url))
|
26
27
|
print(f"Origin file {str(self.web_url)}")
|
27
28
|
self.load(source)
|
28
29
|
else:
|
@@ -36,6 +37,15 @@ class WebWidget(QWebEngineView):
|
|
36
37
|
if self.icon_path.exists() and self.icon_path.is_file():
|
37
38
|
self.setWindowIcon(QIcon(str(self.icon_path)))
|
38
39
|
|
40
|
+
def contextMenuEvent(self, event):
|
41
|
+
if self.close_action is None:
|
42
|
+
self.close_action = QAction("Close")
|
43
|
+
self.close_action.triggered.connect(self.close)
|
44
|
+
if self.menu is None:
|
45
|
+
self.menu = QMenu(self)
|
46
|
+
self.menu.addAction(self.close_action)
|
47
|
+
self.menu.popup(event.globalPos())
|
48
|
+
|
39
49
|
def set_ui_variable(self, opacity: float = 0.2) -> None:
|
40
50
|
self.opacity = opacity
|
41
51
|
self.setWindowOpacity(opacity)
|
@@ -57,6 +67,8 @@ class WebWidget(QWebEngineView):
|
|
57
67
|
)
|
58
68
|
|
59
69
|
def mousePressEvent(self, event) -> None:
|
70
|
+
# if event.button() == Qt.MouseButton.MiddleButton:
|
71
|
+
print(event.button())
|
60
72
|
super().mousePressEvent(event)
|
61
73
|
|
62
74
|
def mouseDoubleClickEvent(self, event) -> None:
|
@@ -64,4 +76,3 @@ class WebWidget(QWebEngineView):
|
|
64
76
|
|
65
77
|
def mouseGrabber(self) -> None:
|
66
78
|
super().mouseGrabber()
|
67
|
-
|
@@ -3,8 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from typing import TYPE_CHECKING
|
4
4
|
|
5
5
|
if TYPE_CHECKING:
|
6
|
-
from frontengine.ui.
|
7
|
-
import sys
|
6
|
+
from frontengine.ui.main_ui import FrontEngineMainUI
|
8
7
|
|
9
8
|
from PySide6.QtGui import QAction
|
10
9
|
from PySide6.QtWidgets import QSystemTrayIcon, QMenu
|
@@ -34,7 +33,6 @@ class ExtendSystemTray(QSystemTrayIcon):
|
|
34
33
|
def close_all(self):
|
35
34
|
self.setVisible(False)
|
36
35
|
self.main_window.close()
|
37
|
-
sys.exit(0)
|
38
36
|
|
39
37
|
def clicked(self, reason):
|
40
38
|
if reason == self.ActivationReason.DoubleClick:
|