Skip to content

Commit

Permalink
Добавлен кастомный моддальный диалог управления установленными прилож…
Browse files Browse the repository at this point in the history
…ениями
  • Loading branch information
Kexi8BiT committed Mar 26, 2024
1 parent 0a5e681 commit e07e265
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 12 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ llamareq.py - лол я сам хз что это
client_storage:
```python
on_sound: bool # Настройка - обозначает проигрывается ли звуки в лаунчере
dnd: bool # Не беспокоить
catalog_games: str # Каталог (Диск) на котором хранятся игры
cdn_url: str # Базовый апи с которым работает лаунчер
```




дальше ебитесь сами, мой лс всегда открыт а также есть issues или как там их
Binary file modified assets/games/sovapidor2/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/games/sovapidor2/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Sover Pidoras",
"color": "red",
"tags": ["Совер", "Пидорас", "Ебаный", "И", "Терпила"]
}
1 change: 1 addition & 0 deletions assets/games/sovapidor2/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Вот совер пидорас блять, забанил низа что(( А я ведь просто срался с килдумом, ну с кем не бываает
Binary file modified assets/games/sovapidor2/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/eaprsmolo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 80 additions & 3 deletions expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import os
import psutil
from sound_effect import BoopSound
import json
from ui import interface_button

def get_available_drives():
return [drive for drive in string.ascii_uppercase if os.path.exists(drive + ':\\')]

Expand All @@ -21,13 +24,18 @@ def disk_select(page: ft.Page):
catalog = "C"
page.client_storage.set("catalog_games", catalog)

def close(e):
page.overlay.remove(message)
page.update()

def on_bg_click(e):
print("on_bg_click")
def change_disk(disk):
boop.play()
catalog = disk
page.client_storage.set("catalog_games", catalog)
page.overlay.remove(message)
page.update()
close(disk)

def prew_change_disk(e):
boop.play()
disk = e.control.value
Expand Down Expand Up @@ -70,7 +78,7 @@ def prew_change_disk(e):
btn
])
),
bgcolor=ft.colors.with_opacity(0.5, ft.colors.BLACK), alignment=ft.alignment.center)
bgcolor=ft.colors.with_opacity(0.5, ft.colors.BLACK), alignment=ft.alignment.center, blur=ft.Blur(10, 10))

],

Expand All @@ -80,3 +88,72 @@ def prew_change_disk(e):
page.update()


def installed_games(page: ft.Page):
boop = BoopSound(page)
def get_game_object(game_id):
with open(f"assets/games/{game_id}/config.json", "r", encoding="utf-8") as f:
config = json.load(f)

object = ft.Container(
ft.Row(
[
ft.Container(
ft.Row(
[
ft.Image(height=50, width=50, src=f"assets/games/{game_id}/icon.png", border_radius=10),
ft.Container(ft.Column([ft.Text(config["name"], weight=ft.FontWeight.BOLD), ft.Text("214 MB", color="#585858")], spacing=2))
]
)
),
ft.Container(ft.Row([ft.IconButton(icon=ft.icons.RESTART_ALT, icon_color=ft.colors.WHITE, style=ft.ButtonStyle(bgcolor=ft.colors.GREEN, shape=ft.RoundedRectangleBorder(radius=15))), ft.IconButton(ft.icons.FOLDER, icon_color=ft.colors.WHITE, style=ft.ButtonStyle(bgcolor=ft.colors.AMBER_900, shape=ft.RoundedRectangleBorder(radius=15))), ft.IconButton(ft.icons.DELETE_FOREVER, icon_color=ft.colors.WHITE, style=ft.ButtonStyle(bgcolor=ft.colors.RED_700, shape=ft.RoundedRectangleBorder(radius=15)))]))

], alignment=ft.MainAxisAlignment.SPACE_BETWEEN
)
)
return object

files = os.listdir(f"assets/games")
def close(e):
boop.play()
page.overlay.remove(content)
page.update()
content = ft.Stack([
ft.Container(
ft.Container(
ft.Column([
ft.Container(
ft.Column([
get_game_object(file) for file in files
], spacing=50, scroll=ft.ScrollMode.HIDDEN),
height=400,
border_radius=20
),
ft.Container(
ft.ElevatedButton("Назад", on_click=close, **interface_button, width=150),
alignment=ft.alignment.center
)
], alignment=ft.MainAxisAlignment.SPACE_BETWEEN),
bgcolor="#1E1E1E",
height=500,
width=900,
border_radius=20,
shadow=ft.BoxShadow(
spread_radius=0,
blur_radius=10,
color='black',
offset=ft.Offset(0, 10),
blur_style=ft.ShadowBlurStyle.NORMAL,

),
padding=20
),
alignment=ft.alignment.center,
bgcolor=ft.colors.with_opacity(0.5, ft.colors.BLACK),
blur=ft.Blur(10, 10)
)
])
page.overlay.append(
content
)
page.update()

7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from home_page import get_main_page_home
sound = True

launcher_name = "PixelLauncher"
launcher_name = "SovaLauncher"



Expand All @@ -30,7 +30,8 @@ def main(page: ft.Page):
page.theme_mode = ft.ThemeMode.DARK
page.spacing = 0
boop = BoopSound(page)
page.overlay.append(ft.Audio("assets/audio/start.mp3", autoplay=True, volume=0.2))
if page.client_storage.get("on_sound") != False:
page.overlay.append(ft.Audio("assets/audio/start.mp3", autoplay=True, volume=0.2))
content = ft.AnimatedSwitcher(
transition=ft.AnimatedSwitcherTransition.FADE,
duration=500,
Expand All @@ -43,7 +44,7 @@ def go_to_home(e):
HOME = ft.Container(get_main_page_home(page))
GAMES = ft.Container(get_games_page(page, content))
SETTINGS = ft.Container(get_settings_page(page))
content.content = SETTINGS
content.content = HOME



Expand Down
2 changes: 1 addition & 1 deletion navifation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io
import base64
from ui import navigation_button
launcher_name = "PixelLauncher"
launcher_name = "SovaLauncher"


def colorize_image(rgb, image_path):
Expand Down
33 changes: 29 additions & 4 deletions settings_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sound_effect import BoopSound
from ui import interface_button, interface_switch, interface_input
from internets import check_api
from expert import disk_select
from expert import disk_select, installed_games

def go_to_settings(content, page: ft.Page):
boop = BoopSound(page)
Expand Down Expand Up @@ -61,26 +61,51 @@ def on_off_sound(e):
page.client_storage.set("on_sound", e.control.value)
print("Звуки отключены" if e.control.value == False else "Звуки включены")
boop.play()

def on_dnd_change(e):
page.client_storage.set("dnd", e.control.value)
print("Не беспокоить выключен" if e.control.value == False else "Не беспокоить включен")
if e.control.value == True:
sound_switch.disabled = True
sound_switch.value = False
sound_switch.update()
page.client_storage.set("on_sound", False)
else:
sound_switch.disabled = True
sound_switch.value = True
sound_switch.update()
page.client_storage.set("on_sound", True)
boop.play()

on_sound = page.client_storage.get("on_sound")
if on_sound == None:
page.client_storage.set("on_sound", True)

dnd = page.client_storage.get("dnd")
if dnd == None:
page.client_storage.set("dnd", False)

def open_installers(e):
boop.play()
installed_games(page)

sound_switch = ft.Switch(**interface_switch, value=page.client_storage.get("on_sound"), on_change=on_off_sound, disabled=True if page.client_storage.get("dnd") == True else False)
settings = ft.Container(
ft.Column([
ft.Row([
ft.ElevatedButton("Поменять диск установки", **interface_button,
icon=ft.icons.DRIVE_FILE_RENAME_OUTLINE_ROUNDED, on_click=lambda _: disk_select(page)),
ft.ElevatedButton("Управление установками", **interface_button, icon=ft.icons.MEMORY,
on_click=boop.play_e),
on_click=open_installers),
ft.ElevatedButton("Отчистить кэш", **interface_button, icon=ft.icons.CLEAR, on_click=boop.play_e)]),
ft.Row([
ft.Container(content=ft.Row(
[ft.Icon(ft.icons.DO_NOT_DISTURB, color="white", size=20), ft.Text("Не беспокоить"),
ft.Switch(**interface_switch, on_change=boop.play_e)]), bgcolor="#1c2024", padding=10,
ft.Switch(**interface_switch, on_change=on_dnd_change, value=page.client_storage.get("dnd"))]), bgcolor="#1c2024", padding=10,
border_radius=10),
ft.Container(content=ft.Row(
[ft.Icon(ft.icons.AUDIOTRACK_SHARP, color="white", size=20), ft.Text("Звуки"),
ft.Switch(**interface_switch, value=page.client_storage.get("on_sound"), on_change=on_off_sound)]), bgcolor="#1c2024", padding=10,
sound_switch]), bgcolor="#1c2024", padding=10,
border_radius=10),
]),
ft.Row([
Expand Down

0 comments on commit e07e265

Please sign in to comment.