Skip to content

Commit

Permalink
Доделанна смена тем, тпеерь все 99% возможных элементов умеют менять …
Browse files Browse the repository at this point in the history
…цвет (остальное не меняется движеом, но это скоро будет исправленно)
  • Loading branch information
Kexi8BiT committed May 3, 2024
1 parent a4331a9 commit c41d298
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 38 deletions.
Binary file modified assets/Images/itsme2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def close(e):

def change_disk(disk):
btn.disabled = True
btn.content = ft.ProgressRing(width=20, height=20, color=ft.colors.RED_400, bgcolor=ft.colors.BLACK26)
btn.content = ft.ProgressRing(width=20, height=20, color=color_theme_1, bgcolor=color_2)
btn.update()
dd.disabled = True
dd.update()
Expand Down
20 changes: 10 additions & 10 deletions game_run_page.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import flet as ft
import json
from sound_effect import BoopSound
from ui import interface_button, interface_switch
from ui import interface_button, interface_switch, color_1, color_2, color_3, color_text, color_theme_1, button
from internets import get_updates
import time
from install_game import install_game
Expand Down Expand Up @@ -34,13 +34,13 @@ def __init__(self, id, web = False, config_start: {} = None, page: ft.Page = Non
for new in nes_col:
content_new = ft.Container(
ft.Column([
ft.Row([ft.Text(f"{new['name']}", weight=ft.FontWeight.W_900, size=20)], spacing=15),
ft.Row([ft.Container(ft.Text(f"v{new['version']}", size=11, color=ft.colors.WHITE24),
ft.Row([ft.Text(f"{new['name']}", weight=ft.FontWeight.W_900, size=20, color=color_text)], spacing=15),
ft.Row([ft.Container(ft.Text(f"v{new['version']}", size=11, color=color_1),
padding=ft.padding.only(top=1, bottom=1, left=5, right=5),
bgcolor=ft.colors.WHITE12, border_radius=5),
bgcolor=color_theme_1, border_radius=5),
ft.Text(f"{new['date']}", size=11, color=ft.colors.WHITE24)], spacing=5),
ft.Container(height=8),
ft.Markdown(f"{new['text']}")
ft.Text(f"{new['text']}", color=color_text)
], spacing=1),
padding=5
)
Expand All @@ -51,7 +51,7 @@ def __init__(self, id, web = False, config_start: {} = None, page: ft.Page = Non
pop_tags = ["Популярно", "Лецензия", "3D"]
for tag in self.config["tags"]:
c = ft.Container(ft.Text(tag, size=12, color=ft.colors.WHITE60),
padding=ft.padding.only(top=2, bottom=2, left=8, right=8), bgcolor=ft.colors.WHITE10 if not tag in pop_tags else ft.colors.RED_400,
padding=ft.padding.only(top=2, bottom=2, left=8, right=8), bgcolor=color_3 if not tag in pop_tags else color_theme_1,
border_radius=5)
tags.controls.append(c)

Expand All @@ -61,15 +61,15 @@ def __init__(self, id, web = False, config_start: {} = None, page: ft.Page = Non

ft.Container(
ft.Column([
ft.Text("Описание", weight=ft.FontWeight.W_600, color=ft.colors.WHITE24),
ft.Container(ft.Text(self.description, selectable=True, size=15))
ft.Text("Описание", weight=ft.FontWeight.W_600, color=color_3),
ft.Container(ft.Text(self.description, selectable=True, size=15, color=color_text))
]),
padding=10,
height=200, width=500, bgcolor=ft.colors.BLACK26, border_radius=15, margin=ft.margin.only(top=10)),

ft.Container(
ft.Column([
ft.Text("Новости", weight=ft.FontWeight.W_600, color=ft.colors.WHITE24),
ft.Text("Новости", weight=ft.FontWeight.W_600, color=color_3),
ft.Container(
news,
width=480, height=365)
Expand All @@ -82,7 +82,7 @@ def __init__(self, id, web = False, config_start: {} = None, page: ft.Page = Non
ft.Container(ft.Column([
ft.Container(image_src=f"{self.path}/icon.png", height=150, width=150,
image_fit=ft.ImageFit.COVER, margin=ft.margin.only(top=20), border_radius=10),
ft.Container(ft.Text(self.config["name"], size=30, weight=ft.FontWeight.BOLD, color=ft.colors.WHITE)),
ft.Container(ft.Text(self.config["name"], size=30, weight=ft.FontWeight.BOLD, color=color_text)),
tags,
], horizontal_alignment=ft.CrossAxisAlignment.CENTER),width=280, height=550),
ft.Container(self.start_button, width=280, margin=ft.margin.only(bottom=10))
Expand Down
9 changes: 5 additions & 4 deletions games_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from sound_effect import BoopSound
from game_run_page import GamesPage
import os
from ui import interface_button, color_1, color_2, color_3, color_text, color_theme_1, button
class Game_object(ft.UserControl):
id: str = None
web_content: bool = True
Expand Down Expand Up @@ -56,12 +57,12 @@ def build(self):
top=15, left=15
),
ft.Container(
ft.Text(config["name"], size=30, weight=ft.FontWeight.BOLD, color="white"),
ft.Text(config["name"], size=30, weight=ft.FontWeight.BOLD, color=color_text),
left=100,
top=25
),
ft.Container(
ft.Text(description, selectable=True, size=12),
ft.Text(description, selectable=True, size=12, color=color_text),
left=100,
top=70,
bgcolor='black',
Expand Down Expand Up @@ -118,8 +119,8 @@ def get_games_page(page, content):
[
ft.Container(
ft.Column([
ft.Text("Игры", size=30, weight=ft.FontWeight.BOLD, color="white"),
ft.Container(width=800, height=1, bgcolor="#5c5e60"),
ft.Text("Игры", size=30, weight=ft.FontWeight.BOLD, color=color_text),
ft.Container(width=800, height=1, bgcolor=color_2),
])
),
# Game_object(id="sovamine", web_content=False, page=page, content=content),
Expand Down
22 changes: 11 additions & 11 deletions install_game.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import flet as ft
from ui import interface_button, checkbox
from ui import interface_button, checkbox, color_1, color_2, color_3, color_text, color_theme_1, button
from expert import get_disk_usage, disk_select
from hashsystem import is_directory
from sound_effect import BoopSound, finish_sound
Expand Down Expand Up @@ -78,7 +78,7 @@ def files_update(path_to_games_dir: str, game_id: str, files_hashs, num) -> None
for file in files_hashs:
filesssss_num_installed += 1
print(f"- {game_id}/{file['name']}...", end="")
currect_file.color = ft.colors.WHITE
currect_file.color = color_text
currect_file.bgcolor = ft.colors.TRANSPARENT
currect_file.value = f"Проверка: {game_id}/{file['name']}..."
currect_file.update()
Expand All @@ -104,12 +104,12 @@ def files_update(path_to_games_dir: str, game_id: str, files_hashs, num) -> None
print("OK", file_hash)
else:
print("FAIL")
currect_file.bgcolor = ft.colors.RED_400
currect_file.bgcolor = color_theme_1
file['local_hash'] = file_hash
error_files.append(file)
else:
print("404")
currect_file.color = ft.colors.RED_400
currect_file.color = color_theme_1
error_files.append(file)

print("---------------------------")
Expand Down Expand Up @@ -183,7 +183,7 @@ def finished():
def error(error):
column.clear()
column.append(top_texts)
column.append(ft.Container(ft.Column([ft.Text("Ошибка: {}".format(error), color="red"), ft.ElevatedButton("Закрыть", on_click=lambda e: close(), **interface_button, width=150)], alignment=ft.MainAxisAlignment.CENTER, horizontal_alignment=ft.CrossAxisAlignment.CENTER), width=500, height=400))
column.append(ft.Container(ft.Column([ft.Text("Ошибка: {}".format(error), color=color_theme_1), ft.ElevatedButton("Закрыть", on_click=lambda e: close(), **interface_button, width=150)], alignment=ft.MainAxisAlignment.CENTER, horizontal_alignment=ft.CrossAxisAlignment.CENTER), width=500, height=400))
content.height = 500
content.update()
content.content.update()
Expand Down Expand Up @@ -238,18 +238,18 @@ def start():
change_catalog =ft.ElevatedButton("Поменять диск", on_click=change_disk, **interface_button, width=150)
dialog_button = install_button if free_space[1] > 1 else change_catalog

text_master = ft.Text("Мастер установки готов установить игру!") if free_space[1] > 1 else ft.Text("Недостаточно места на выбранном каталоге", color="red")
text_master = ft.Text("Мастер установки готов установить игру!", color=color_text) if free_space[1] > 1 else ft.Text("Недостаточно места на выбранном каталоге", color=color_theme_1)

top_texts = ft.Row([ft.Image(src=f"{g_s_path}/icon.png", height=50), ft.Text(config["name"], size=20)])
top_texts = ft.Row([ft.Image(src=f"{g_s_path}/icon.png", height=50), ft.Text(config["name"], size=20, color=color_text)])

pg = ft.ProgressBar(width=400, height=20, color=ft.colors.RED_400, bgcolor=ft.colors.BLACK26)
files_inout = ft.Text("[0/50]")
currect_file = ft.Text("Installing...")
pg = ft.ProgressBar(width=400, height=20, color=color_theme_1, bgcolor=color_2)
files_inout = ft.Text("[0/50]", color=color_text)
currect_file = ft.Text("Installing...", color=color_text)


column = []

content = ft.Container(height=100, width=500, content=ft.Column(column), bgcolor="#1E1E1E", border_radius=20, padding=20, animate=ft.Animation(400, ft.AnimationCurve.EASE_OUT_SINE))
content = ft.Container(height=100, width=500, content=ft.Column(column), bgcolor=color_2, border_radius=20, padding=20, animate=ft.Animation(400, ft.AnimationCurve.EASE_OUT_SINE), border=ft.border.all(1, color_1))
qweqwewqeqw = ft.Stack([ft.Container(content=content, bgcolor=ft.colors.with_opacity(0.2, ft.colors.BLACK), blur=ft.Blur(10, 10), alignment=ft.alignment.center)])
page.overlay.append(qweqwewqeqw)
page.update()
Expand Down
19 changes: 15 additions & 4 deletions navifation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from PIL import Image
import io
import base64
from ui import navigation_button, colors, color_1
from ui import navigation_button, colors, color_1, color_2, color_3
from random import randint
import time as t
launcher_name = "SovaLauncher"

def colorize_image(rgb, image_path):
Expand Down Expand Up @@ -33,22 +34,32 @@ def close(e):

def meow(e):
meows[randint(0, 8)].play()
its_me.image_src = "assets/Images/itsme2.png"
its_me.update()
t.sleep(0.7)
its_me.image_src = "assets/Images/itsme.webp"
its_me.update()


def meow_hover(e: ft.ControlEvent):
e.control.scale = 10 if e.data == "true" else 1
e.control.offset = ft.Offset(2, 0) if e.data == "true" else ft.Offset(0, 0)
e.control.update()


its_me = ft.Container(height=100, width=100, image_src="assets/Images/itsme.webp", image_fit=ft.ImageFit.FILL, on_click=meow, offset=ft.Offset(0, 0), on_hover=meow_hover, animate_scale=ft.Animation(duration=600, curve=ft.AnimationCurve.EASE_IN_OUT), animate_offset=ft.Animation(duration=600, curve=ft.AnimationCurve.EASE_IN_OUT))
image_base64 = colorize_image(rgb, logo_path)
navigation = ft.Container(ft.Column([ft.Column([ft.Container(
ft.Image(src=logo_path, width=150, border_radius=30),
margin=ft.margin.only(bottom=40, top=20), on_click=lambda _: page.launch_url("https://www.sovagroup.one"), tooltip="site:https://www.sovagroup.one"),
ft.ElevatedButton("Главная", **navigation_button, on_click=main),
ft.ElevatedButton("Библиотека", **navigation_button, on_click=library),
ft.ElevatedButton("Настройки", **navigation_button, on_click=settings),
ft.ElevatedButton("ахах hyee", **navigation_button, on_click=hyen),
# ft.ElevatedButton("ахах hyee", **navigation_button, on_click=hyen),
ft.Divider(color=color_1),
ft.ElevatedButton("Оффициальный лаунчер", **navigation_button, icon=ft.icons.OPEN_IN_NEW, on_click=lambda _: page.launch_url("https://www.sovagroup.one/sovalaucher"), tooltip="sovagroup:official-launcher"),
], spacing=0,
horizontal_alignment=ft.CrossAxisAlignment.CENTER), ft.Row([ft.Container(height=100, width=100, image_src="assets/Images/itsme.webp", image_fit=ft.ImageFit.COVER, on_click=meow)], alignment=ft.MainAxisAlignment.CENTER)], alignment=ft.MainAxisAlignment.SPACE_BETWEEN), bgcolor=colors["navigation_bar_bgcolor"], width=250,
horizontal_alignment=ft.CrossAxisAlignment.CENTER), ft.Row([its_me], alignment=ft.MainAxisAlignment.CENTER)], alignment=ft.MainAxisAlignment.SPACE_BETWEEN), bgcolor=colors["navigation_bar_bgcolor"], width=250,
height=height)

window_drag = ft.Row(
Expand All @@ -57,7 +68,7 @@ def meow(e):
ft.Container(ft.Row([ft.Row([ft.Container(height=17, width=17, bgcolor=ft.colors.RED_400, border_radius=15,
on_click=lambda _: page.window_destroy()),
ft.Container(height=17, width=17, bgcolor=ft.colors.AMBER_300, border_radius=15,
on_click=close)]), ft.Text(launcher_name, size=12, weight=ft.FontWeight.BOLD, color="#565656"), ft.Container()], alignment=ft.MainAxisAlignment.SPACE_BETWEEN), bgcolor="#151515", padding=10), expand=True, maximizable=False)
on_click=close)]), ft.Text(launcher_name, size=12, weight=ft.FontWeight.BOLD, color=color_3), ft.Container()], alignment=ft.MainAxisAlignment.SPACE_BETWEEN), bgcolor=color_2, padding=10), expand=True, maximizable=False)
]
)

Expand Down
17 changes: 9 additions & 8 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ def nega(hex_color):
color_3 = "#252729"
color_text = "#ffffff"

# color_1 = "#560EAD"
# color_2 = "#360570"
# color_3 = ft.colors.PINK_400
# color_text = "#8643D6"
color_theme_1 = ft.colors.RED_400
# color_1 = "#3ba29b"
# color_2 = "#256256"
# color_3 = "#52d0ca"
# color_text = "#ffffff"


negative_color = nega(color_1)
button = {
Expand All @@ -39,12 +40,12 @@ def nega(hex_color):

}
interface_switch = {
"active_color": negative_color,
"active_color": color_text,
"active_track_color": color_theme_1,
"inactive_track_color": color_2,
"thumb_color": negative_color,
"inactive_thumb_color" : negative_color,
"focus_color" : negative_color
"thumb_color": color_text,
"inactive_thumb_color" : color_3,
"focus_color" : color_3
}

navigation_button = {
Expand Down

0 comments on commit c41d298

Please sign in to comment.