-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathView_GearUI_TrainingOptions.py
More file actions
81 lines (68 loc) · 4.24 KB
/
View_GearUI_TrainingOptions.py
File metadata and controls
81 lines (68 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# © 2025 B.A.D. Black Apex Development LLC
# All rights reserved.
# This software and its associated name, logo, and branding are the intellectual property of
# B.A.D. Black Apex Development LLC — registered in the State of Ohio (Entity #5448030).
# Unauthorized use, reproduction, or distribution is prohibited and may violate
# copyright, trademark, and unfair competition laws.
# -----------------------------------------------------------------------------------------
import dearpygui.dearpygui as dpg
import View_GearUI_TrainingOptions_Track
import Control
# -----------------------------------------------------------------------------------------
GENERIC_MESSAGE_WINDOW_TAG = "generic_message_window"
GENERIC_MESSAGE_HANDLER_TAG = "generic_message_handler"
# -----------------------------------------------------------------------------------------
def _popup_generic_message(msg: str):
if dpg.does_item_exist(GENERIC_MESSAGE_WINDOW_TAG):
dpg.delete_item(GENERIC_MESSAGE_WINDOW_TAG)
if dpg.does_item_exist(GENERIC_MESSAGE_HANDLER_TAG):
dpg.delete_item(GENERIC_MESSAGE_HANDLER_TAG)
with dpg.window(label="Info", modal=True, no_collapse=True,
tag=GENERIC_MESSAGE_WINDOW_TAG, width=300, height=100):
dpg.add_text(msg)
vw, vh = dpg.get_viewport_client_width(), dpg.get_viewport_client_height()
dpg.set_item_pos(GENERIC_MESSAGE_WINDOW_TAG, [vw // 2 - 150, vh // 2 - 50])
with dpg.item_handler_registry(tag=GENERIC_MESSAGE_HANDLER_TAG):
dpg.add_item_clicked_handler(callback=lambda s, a, u: dpg.delete_item(GENERIC_MESSAGE_WINDOW_TAG))
try:
dpg.bind_item_handler_registry(GENERIC_MESSAGE_WINDOW_TAG, GENERIC_MESSAGE_HANDLER_TAG)
except Exception:
pass
# -----------------------------------------------------------------------------------------
def start(sender, app_data, user_data):
gear = user_data[0]
previous_window_tag = user_data[1]
window_tag = f"{gear}_window"
button_width = 200
child_width = 380
padding = (child_width - button_width) // 2
Control._check_window_exists(window_tag)
Control._hide_window(previous_window_tag)
Control.play_sound("assets/audio/ui_sound_01.wav", wait=False)
with dpg.window(label=f" Training Options For {gear}", tag=window_tag, width=445, height=570,
on_close=lambda: (Control._show_window(previous_window_tag), Control.play_sound("assets/audio/ui_sound_05.wav", wait=False), dpg.delete_item(window_tag)), no_move=True):
dpg.add_text("What would you like to do?")
# === Parent Window Theme ===
with dpg.theme() as parent_theme:
with dpg.theme_component(dpg.mvWindowAppItem):
# Transparent window background
dpg.add_theme_color(dpg.mvThemeCol_WindowBg, (0, 0, 0, 50))
# Title bar background (normal and active)
dpg.add_theme_color(dpg.mvThemeCol_TitleBg, (0, 0, 0, 250))
dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive, (0, 0, 0, 250))
# Optional: border color (dark grey)
dpg.add_theme_color(dpg.mvThemeCol_Border, (20, 20, 20, 150))
dpg.bind_item_theme(window_tag, parent_theme)
# === Red Button Highlight Theme ===
with dpg.theme() as red_button_theme:
with dpg.theme_component(dpg.mvButton):
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, (150, 0, 0, 255)) # Dark red hover
dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, (200, 0, 0, 255)) # Bright red active
with dpg.group(horizontal=True):
dpg.add_spacer(width=padding)
dpg.add_button(label="Graph",tag="performance_tracking_button", callback=View_GearUI_TrainingOptions_Track.show_training_graph, width=button_width, height=100, user_data=gear)
dpg.bind_item_theme("performance_tracking_button", red_button_theme)
with dpg.group(horizontal=True):
dpg.add_spacer(width=padding)
dpg.add_button(label="Train",tag = "train_button", callback=lambda s, a, u: Control._show_training_options_train_window(s, a, [gear, window_tag]), width=button_width, height=100)
dpg.bind_item_theme("train_button", red_button_theme)