Разработка программного модуля информационной системы «Игра «Собачья академия» #3
23 changed files with 206 additions and 60 deletions
Binary file not shown.
16
config.py
16
config.py
|
|
@ -27,3 +27,19 @@ SETTINGS_IMG = "assets/settings.png"
|
|||
# Утилиты
|
||||
NOTIFICATION_LEVEL = "info" # Возможные значения: "info", "warning", "error"
|
||||
USE_DATABASE_LOGS = True
|
||||
|
||||
# ГЛАВНОЕ МЕНЮ
|
||||
BACKGROUND_COLOR_USER = "#bcabe5" # Основной фон
|
||||
TOP_PANEL_COLOR_USER = "#aa9bcd" # Цвет верхней панели
|
||||
BUTTON_COLOR_PROFILE_USER = "#a2c792" # Цвет кнопок "Профиль", "Магазин", "База знаний"
|
||||
BUTTON_COLOR_PLAY_USER = "#b4e1a1" # Цвет кнопки "Играть"
|
||||
BUTTON_COLOR_EXIT_USER = "#a2c792" # Цвет кнопки "Выход"
|
||||
|
||||
# Текст и шрифты
|
||||
BUTTON_TEXT_COLOR_USER = "white" # Цвет текста на кнопках
|
||||
FONT_USER = ("Comic Sans MS", 20) # Шрифт для текста кнопок
|
||||
BIG_FONT_USER = ("Comic Sans MS", 30) # Большой шрифт (например, для заголовков)
|
||||
|
||||
# Размеры кнопок
|
||||
BUTTON_RADIUS_USER = 50 # Радиус круглой кнопки
|
||||
EXIT_BUTTON_SIZE_USER = (80, 40) # Размер кнопки "Выход"
|
||||
Binary file not shown.
|
|
@ -1250,3 +1250,96 @@ FROM game_sessions
|
|||
FROM game_sessions
|
||||
2024-11-25 19:32:52 - [generated in 0.00016s] ()
|
||||
2024-11-25 19:32:52 - ROLLBACK
|
||||
2024-11-25 20:45:57 - BEGIN (implicit)
|
||||
2024-11-25 20:45:57 - SELECT count(*) AS count_1
|
||||
FROM (SELECT users.user_id AS users_user_id, users.dog_id AS users_dog_id, users.username AS users_username, users.level AS users_level, users.achievement AS users_achievement
|
||||
FROM users) AS anon_1
|
||||
2024-11-25 20:45:57 - [generated in 0.00031s] ()
|
||||
2024-11-25 20:45:57 - SELECT game_sessions.level AS game_sessions_level, count(game_sessions.session_id) AS count_1
|
||||
FROM game_sessions GROUP BY game_sessions.level
|
||||
2024-11-25 20:45:57 - [generated in 0.00021s] ()
|
||||
2024-11-25 20:45:57 - SELECT questions.question_text AS questions_question_text, questions.incorrect_attempts AS questions_incorrect_attempts
|
||||
FROM questions ORDER BY questions.incorrect_attempts DESC
|
||||
2024-11-25 20:45:57 - [generated in 0.00024s] ()
|
||||
2024-11-25 20:45:57 - SELECT avg(game_sessions.duration) AS avg_1
|
||||
FROM game_sessions
|
||||
2024-11-25 20:45:57 - [generated in 0.00016s] ()
|
||||
2024-11-25 20:45:57 - ROLLBACK
|
||||
2024-11-25 20:45:57 - BEGIN (implicit)
|
||||
2024-11-25 20:45:57 - SELECT game_sessions.start_time AS game_sessions_start_time
|
||||
FROM game_sessions
|
||||
2024-11-25 20:45:57 - [generated in 0.00014s] ()
|
||||
2024-11-25 20:45:57 - ROLLBACK
|
||||
2024-11-25 20:55:11 - BEGIN (implicit)
|
||||
2024-11-25 20:55:11 - INSERT INTO auth (login, password) VALUES (?, ?)
|
||||
2024-11-25 20:55:11 - [generated in 0.00024s] ('lubluNikitu', 'meow123')
|
||||
2024-11-25 20:55:11 - COMMIT
|
||||
2024-11-25 20:55:36 - BEGIN (implicit)
|
||||
2024-11-25 20:55:36 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 20:55:36 - [generated in 0.00019s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 20:55:36 - ROLLBACK
|
||||
2024-11-25 20:59:37 - BEGIN (implicit)
|
||||
2024-11-25 20:59:37 - SELECT count(*) AS count_1
|
||||
FROM (SELECT users.user_id AS users_user_id, users.dog_id AS users_dog_id, users.username AS users_username, users.level AS users_level, users.achievement AS users_achievement
|
||||
FROM users) AS anon_1
|
||||
2024-11-25 20:59:37 - [generated in 0.00023s] ()
|
||||
2024-11-25 20:59:37 - SELECT game_sessions.level AS game_sessions_level, count(game_sessions.session_id) AS count_1
|
||||
FROM game_sessions GROUP BY game_sessions.level
|
||||
2024-11-25 20:59:37 - [generated in 0.00014s] ()
|
||||
2024-11-25 20:59:37 - SELECT questions.question_text AS questions_question_text, questions.incorrect_attempts AS questions_incorrect_attempts
|
||||
FROM questions ORDER BY questions.incorrect_attempts DESC
|
||||
2024-11-25 20:59:37 - [generated in 0.00021s] ()
|
||||
2024-11-25 20:59:37 - SELECT avg(game_sessions.duration) AS avg_1
|
||||
FROM game_sessions
|
||||
2024-11-25 20:59:37 - [generated in 0.00012s] ()
|
||||
2024-11-25 20:59:37 - ROLLBACK
|
||||
2024-11-25 20:59:37 - BEGIN (implicit)
|
||||
2024-11-25 20:59:37 - SELECT game_sessions.start_time AS game_sessions_start_time
|
||||
FROM game_sessions
|
||||
2024-11-25 20:59:37 - [generated in 0.00014s] ()
|
||||
2024-11-25 20:59:37 - ROLLBACK
|
||||
2024-11-25 21:00:06 - BEGIN (implicit)
|
||||
2024-11-25 21:00:06 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 21:00:06 - [generated in 0.00024s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 21:00:06 - ROLLBACK
|
||||
2024-11-25 21:07:39 - BEGIN (implicit)
|
||||
2024-11-25 21:07:39 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 21:07:39 - [generated in 0.00032s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 21:07:39 - ROLLBACK
|
||||
2024-11-25 22:18:38 - BEGIN (implicit)
|
||||
2024-11-25 22:18:38 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 22:18:38 - [generated in 0.00021s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 22:18:38 - ROLLBACK
|
||||
2024-11-25 22:29:25 - BEGIN (implicit)
|
||||
2024-11-25 22:29:25 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 22:29:25 - [generated in 0.00026s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 22:29:25 - ROLLBACK
|
||||
2024-11-25 22:31:57 - BEGIN (implicit)
|
||||
2024-11-25 22:31:57 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 22:31:57 - [generated in 0.00027s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 22:31:57 - ROLLBACK
|
||||
2024-11-25 22:36:09 - BEGIN (implicit)
|
||||
2024-11-25 22:36:09 - SELECT auth.user_id AS auth_user_id, auth.login AS auth_login, auth.password AS auth_password
|
||||
FROM auth
|
||||
WHERE auth.login = ? AND auth.password = ?
|
||||
LIMIT ? OFFSET ?
|
||||
2024-11-25 22:36:09 - [generated in 0.00045s] ('lubluNikitu', 'meow123', 1, 0)
|
||||
2024-11-25 22:36:09 - ROLLBACK
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,7 +3,7 @@ from tkinter import messagebox
|
|||
from config import BACKGROUND_COLOR, PRIMARY_COLOR, BUTTON_COLOR, BUTTON_TEXT_COLOR, FONT, BIG_FONT, ADMIN_LOGIN, ADMIN_PASSWORD
|
||||
from src.ui.admin_ui import AdminApp # Импорт интерфейса администратора
|
||||
from database.db_events import create_user, check_user
|
||||
from src.ui.user_ui import UserApp
|
||||
from src.ui.user_ui.main_menu import UserApp
|
||||
|
||||
class DogAcademyApp:
|
||||
def __init__(self, root):
|
||||
|
|
@ -217,5 +217,6 @@ class DogAcademyApp:
|
|||
messagebox.showerror("Ошибка", "Пожалуйста, заполните все поля.")
|
||||
|
||||
def show_user_dashboard(self):
|
||||
self.clear_frame()
|
||||
"""Перейти к главному меню пользователя после авторизации."""
|
||||
UserApp(self.root, self)
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
import tkinter as tk
|
||||
from config import BACKGROUND_COLOR, PRIMARY_COLOR, BUTTON_COLOR, BUTTON_TEXT_COLOR, FONT
|
||||
|
||||
class UserApp:
|
||||
def __init__(self, root, dog_academy_app):
|
||||
self.root = root
|
||||
self.dog_academy_app = dog_academy_app # Сохраняем ссылку на DogAcademyApp
|
||||
self.show_user_dashboard()
|
||||
|
||||
def show_user_dashboard(self):
|
||||
"""Показать интерфейс пользователя."""
|
||||
self.clear_frame()
|
||||
self.current_frame = tk.Frame(self.root, bg=BACKGROUND_COLOR)
|
||||
self.current_frame.pack(expand=True)
|
||||
|
||||
# Заголовок
|
||||
title = tk.Label(
|
||||
self.current_frame,
|
||||
text="Главное меню",
|
||||
bg=BACKGROUND_COLOR,
|
||||
fg=PRIMARY_COLOR,
|
||||
font=FONT,
|
||||
)
|
||||
title.pack(pady=50)
|
||||
|
||||
# Кнопка "Играть"
|
||||
play_button = tk.Button(
|
||||
self.current_frame,
|
||||
text="Играть",
|
||||
bg=BUTTON_COLOR,
|
||||
fg=BUTTON_TEXT_COLOR,
|
||||
font=FONT,
|
||||
command=self.play_game,
|
||||
)
|
||||
play_button.pack(pady=20)
|
||||
|
||||
# Кнопка "Выход"
|
||||
logout_button = tk.Button(
|
||||
self.current_frame,
|
||||
text="Выход",
|
||||
bg=BUTTON_COLOR,
|
||||
fg=BUTTON_TEXT_COLOR,
|
||||
font=FONT,
|
||||
command=self.dog_academy_app.show_main_menu, # Вызываем метод из DogAcademyApp
|
||||
)
|
||||
logout_button.pack(pady=20)
|
||||
|
||||
def play_game(self):
|
||||
"""Запуск игры."""
|
||||
# TODO: Логика игры
|
||||
pass
|
||||
|
||||
def clear_frame(self):
|
||||
"""Очистить текущий фрейм."""
|
||||
if hasattr(self, 'current_frame') and self.current_frame:
|
||||
self.current_frame.destroy()
|
||||
BIN
src/ui/user_ui/__pycache__/main_menu.cpython-313.pyc
Normal file
BIN
src/ui/user_ui/__pycache__/main_menu.cpython-313.pyc
Normal file
Binary file not shown.
0
src/ui/user_ui/common_ui.py
Normal file
0
src/ui/user_ui/common_ui.py
Normal file
0
src/ui/user_ui/game_ui.py
Normal file
0
src/ui/user_ui/game_ui.py
Normal file
0
src/ui/user_ui/knowledge_ui.py
Normal file
0
src/ui/user_ui/knowledge_ui.py
Normal file
93
src/ui/user_ui/main_menu.py
Normal file
93
src/ui/user_ui/main_menu.py
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
import tkinter as tk
|
||||
from config import (
|
||||
BACKGROUND_COLOR_USER,
|
||||
TOP_PANEL_COLOR_USER,
|
||||
BUTTON_COLOR_PROFILE_USER,
|
||||
BUTTON_COLOR_PLAY_USER,
|
||||
BUTTON_COLOR_EXIT_USER,
|
||||
BUTTON_TEXT_COLOR_USER,
|
||||
FONT_USER,
|
||||
BIG_FONT_USER,
|
||||
BUTTON_RADIUS_USER,
|
||||
EXIT_BUTTON_SIZE_USER,
|
||||
)
|
||||
|
||||
|
||||
class UserApp:
|
||||
def __init__(self, root, auth_ui):
|
||||
self.root = root
|
||||
self.auth_ui = auth_ui
|
||||
self.root.configure(bg=BACKGROUND_COLOR_USER)
|
||||
self.root.geometry("1920x1080") # Разрешение окна
|
||||
self.root.title("Собачья академия")
|
||||
print("Главное меню активно") # Лог при открытии меню
|
||||
self.show_user_dashboard()
|
||||
|
||||
def show_user_dashboard(self):
|
||||
"""Показать интерфейс пользователя."""
|
||||
# Верхняя панель
|
||||
top_panel = tk.Frame(self.root, bg=TOP_PANEL_COLOR_USER, height=100)
|
||||
top_panel.pack(fill=tk.X, side=tk.TOP)
|
||||
|
||||
# Кнопки на верхней панели
|
||||
for text, command in [("Профиль", self.show_profile), ("Магазин", self.show_shop), ("База знаний", self.show_knowledge)]:
|
||||
button = tk.Button(
|
||||
top_panel,
|
||||
text=text,
|
||||
bg=BUTTON_COLOR_PROFILE_USER,
|
||||
fg=BUTTON_TEXT_COLOR_USER,
|
||||
font=FONT_USER,
|
||||
relief=tk.FLAT,
|
||||
padx=20,
|
||||
pady=10,
|
||||
command=command,
|
||||
)
|
||||
button.pack(side=tk.LEFT, padx=20)
|
||||
|
||||
# Кнопка "Играть" в центре
|
||||
play_button = tk.Button(
|
||||
self.root,
|
||||
text="Играть",
|
||||
bg=BUTTON_COLOR_PLAY_USER,
|
||||
fg=BUTTON_TEXT_COLOR_USER,
|
||||
font=BIG_FONT_USER,
|
||||
relief=tk.FLAT,
|
||||
height=2,
|
||||
width=10,
|
||||
command=self.play_game,
|
||||
)
|
||||
play_button.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
|
||||
|
||||
# Кнопка "Выход" в правом нижнем углу
|
||||
exit_button = tk.Button(
|
||||
self.root,
|
||||
text="Выход",
|
||||
bg=BUTTON_COLOR_EXIT_USER,
|
||||
fg=BUTTON_TEXT_COLOR_USER,
|
||||
font=FONT_USER,
|
||||
width=EXIT_BUTTON_SIZE_USER[0] // 10,
|
||||
height=EXIT_BUTTON_SIZE_USER[1] // 10,
|
||||
command=self.exit_app,
|
||||
)
|
||||
exit_button.place(relx=1.0, rely=1.0, x=-20, y=-20, anchor=tk.SE)
|
||||
|
||||
def play_game(self):
|
||||
"""Заглушка для игры."""
|
||||
print("Запуск игры...")
|
||||
|
||||
def exit_app(self):
|
||||
"""Заглушка для выхода."""
|
||||
print("Приложение закрыто")
|
||||
self.root.quit()
|
||||
|
||||
def show_profile(self):
|
||||
"""Заглушка для профиля."""
|
||||
print("Переход в профиль...")
|
||||
|
||||
def show_shop(self):
|
||||
"""Заглушка для магазина."""
|
||||
print("Переход в магазин...")
|
||||
|
||||
def show_knowledge(self):
|
||||
"""Заглушка для базы знаний."""
|
||||
print("Переход в базу знаний...")
|
||||
0
src/ui/user_ui/profile_ui.py
Normal file
0
src/ui/user_ui/profile_ui.py
Normal file
0
src/ui/user_ui/shop_ui.py
Normal file
0
src/ui/user_ui/shop_ui.py
Normal file
BIN
src/user_functions/__pycache__/menu_functions.cpython-313.pyc
Normal file
BIN
src/user_functions/__pycache__/menu_functions.cpython-313.pyc
Normal file
Binary file not shown.
0
src/user_functions/game_functions.py
Normal file
0
src/user_functions/game_functions.py
Normal file
0
src/user_functions/knowledge_functions.py
Normal file
0
src/user_functions/knowledge_functions.py
Normal file
0
src/user_functions/menu_functions.py
Normal file
0
src/user_functions/menu_functions.py
Normal file
0
src/user_functions/profile_functions.py
Normal file
0
src/user_functions/profile_functions.py
Normal file
0
src/user_functions/shop_functions.py
Normal file
0
src/user_functions/shop_functions.py
Normal file
|
|
@ -16,7 +16,6 @@ def feature_in_development(frame):
|
|||
font=("Comic Sans MS", 16)
|
||||
).pack(expand=True)
|
||||
|
||||
|
||||
def create_tooltip(widget, text):
|
||||
"""Создание подсказки для виджета."""
|
||||
tooltip = tk.Toplevel()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue