EasyPythonUI 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- easypythonui-0.1.1/PKG-INFO +6 -0
- easypythonui-0.1.1/easypythonui.egg-info/PKG-INFO +6 -0
- easypythonui-0.1.1/easypythonui.egg-info/SOURCES.txt +10 -0
- easypythonui-0.1.1/easypythonui.egg-info/top_level.txt +1 -0
- {easypythonui-0.1.0/novaui → easypythonui-0.1.1/epUI}/__init__.py +2 -8
- easypythonui-0.1.1/epUI/core.py +62 -0
- easypythonui-0.1.1/pyproject.toml +15 -0
- easypythonui-0.1.0/EasyPythonUI.egg-info/PKG-INFO +0 -6
- easypythonui-0.1.0/EasyPythonUI.egg-info/SOURCES.txt +0 -10
- easypythonui-0.1.0/EasyPythonUI.egg-info/top_level.txt +0 -1
- easypythonui-0.1.0/PKG-INFO +0 -6
- easypythonui-0.1.0/novaui/core.py +0 -41
- easypythonui-0.1.0/pyproject.toml +0 -12
- {easypythonui-0.1.0/EasyPythonUI.egg-info → easypythonui-0.1.1/easypythonui.egg-info}/dependency_links.txt +0 -0
- {easypythonui-0.1.0/EasyPythonUI.egg-info → easypythonui-0.1.1/easypythonui.egg-info}/requires.txt +0 -0
- {easypythonui-0.1.0/novaui → easypythonui-0.1.1/epUI}/parser.py +0 -0
- {easypythonui-0.1.0/novaui → easypythonui-0.1.1/epUI}/widgets.py +0 -0
- {easypythonui-0.1.0 → easypythonui-0.1.1}/setup.cfg +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
easypythonui.egg-info/PKG-INFO
|
|
3
|
+
easypythonui.egg-info/SOURCES.txt
|
|
4
|
+
easypythonui.egg-info/dependency_links.txt
|
|
5
|
+
easypythonui.egg-info/requires.txt
|
|
6
|
+
easypythonui.egg-info/top_level.txt
|
|
7
|
+
epUI/__init__.py
|
|
8
|
+
epUI/core.py
|
|
9
|
+
epUI/parser.py
|
|
10
|
+
epUI/widgets.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
epUI
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from . import core
|
|
2
2
|
from .widgets import Button, Text
|
|
3
3
|
|
|
4
|
-
def app(title="
|
|
5
|
-
return core.App(title, size, color)
|
|
4
|
+
def app(title="EasyPythonUI", size="500 x 500", color="white", icon=None):
|
|
5
|
+
return core.App(title, size, color, icon)
|
|
6
6
|
|
|
7
7
|
def btn(label, size="150 x 50", action=None, pos="left u 10", color="blue", text_color="white"):
|
|
8
8
|
widget = Button(label, size, action, pos, color, text_color)
|
|
@@ -17,13 +17,7 @@ def text(content, size="16", pos="left u 10", color="black"):
|
|
|
17
17
|
return widget
|
|
18
18
|
|
|
19
19
|
def set(target, new_value=None):
|
|
20
|
-
"""
|
|
21
|
-
Использование:
|
|
22
|
-
1) text = novaui.set(text, "Новый текст")
|
|
23
|
-
2) novaui.set("Новый текст") — обновит последний созданный текст
|
|
24
|
-
"""
|
|
25
20
|
if new_value is None and isinstance(target, str):
|
|
26
|
-
# Если передали только строку, ищем последний текстовый виджет
|
|
27
21
|
if core._active_app:
|
|
28
22
|
for w in reversed(core._active_app.widgets):
|
|
29
23
|
if isinstance(w, Text):
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pygame
|
|
3
|
+
from .parser import parse_size, parse_color
|
|
4
|
+
|
|
5
|
+
_active_app = None
|
|
6
|
+
|
|
7
|
+
class App:
|
|
8
|
+
def __init__(self, title="EasyPythonUI", size="500 x 500", color="white", icon=None):
|
|
9
|
+
global _active_app
|
|
10
|
+
pygame.init()
|
|
11
|
+
|
|
12
|
+
# Устанавливаем иконку, если передан путь к .png или .ico
|
|
13
|
+
if icon:
|
|
14
|
+
self.set_icon(icon)
|
|
15
|
+
|
|
16
|
+
self.width, self.height = parse_size(size)
|
|
17
|
+
self.screen = pygame.display.set_mode((self.width, self.height))
|
|
18
|
+
pygame.display.set_caption(title)
|
|
19
|
+
self.bg_color = parse_color(color)
|
|
20
|
+
self.clock = pygame.time.Clock()
|
|
21
|
+
self.widgets = []
|
|
22
|
+
self.last_bottom = 0
|
|
23
|
+
_active_app = self
|
|
24
|
+
|
|
25
|
+
def set_icon(self, icon_path):
|
|
26
|
+
# Убираем слово "icon " в начале, если пользователь написал icon="icon ./logo.png"
|
|
27
|
+
clean_path = icon_path.strip()
|
|
28
|
+
if clean_path.lower().startswith("icon "):
|
|
29
|
+
clean_path = clean_path[5:].strip()
|
|
30
|
+
|
|
31
|
+
if os.path.exists(clean_path):
|
|
32
|
+
try:
|
|
33
|
+
icon_surface = pygame.image.load(clean_path)
|
|
34
|
+
pygame.display.set_icon(icon_surface)
|
|
35
|
+
except pygame.error as e:
|
|
36
|
+
print(f"[epUI Warning] Не удалось загрузить иконку '{clean_path}': {e}")
|
|
37
|
+
else:
|
|
38
|
+
print(f"[epUI Warning] Файл иконки не найден: '{clean_path}'")
|
|
39
|
+
|
|
40
|
+
def add(self, widget):
|
|
41
|
+
widget.place(self.width, self.last_bottom)
|
|
42
|
+
self.last_bottom = widget.rect.bottom
|
|
43
|
+
self.widgets.append(widget)
|
|
44
|
+
return widget
|
|
45
|
+
|
|
46
|
+
def run(self):
|
|
47
|
+
running = True
|
|
48
|
+
while running:
|
|
49
|
+
for event in pygame.event.get():
|
|
50
|
+
if event.type == pygame.QUIT:
|
|
51
|
+
running = False
|
|
52
|
+
for widget in self.widgets:
|
|
53
|
+
widget.handle_event(event)
|
|
54
|
+
|
|
55
|
+
self.screen.fill(self.bg_color)
|
|
56
|
+
for widget in self.widgets:
|
|
57
|
+
widget.draw(self.screen)
|
|
58
|
+
|
|
59
|
+
pygame.display.flip()
|
|
60
|
+
self.clock.tick(60)
|
|
61
|
+
|
|
62
|
+
pygame.quit()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "easypythonui"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Простая и быстрая UI-библиотека для Python"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"pygame-ce"
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[tool.setuptools.packages.find]
|
|
15
|
+
include = ["epUI*"]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
pyproject.toml
|
|
2
|
-
EasyPythonUI.egg-info/PKG-INFO
|
|
3
|
-
EasyPythonUI.egg-info/SOURCES.txt
|
|
4
|
-
EasyPythonUI.egg-info/dependency_links.txt
|
|
5
|
-
EasyPythonUI.egg-info/requires.txt
|
|
6
|
-
EasyPythonUI.egg-info/top_level.txt
|
|
7
|
-
novaui/__init__.py
|
|
8
|
-
novaui/core.py
|
|
9
|
-
novaui/parser.py
|
|
10
|
-
novaui/widgets.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
novaui
|
easypythonui-0.1.0/PKG-INFO
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import pygame
|
|
2
|
-
from .parser import parse_size, parse_color
|
|
3
|
-
|
|
4
|
-
_active_app = None
|
|
5
|
-
|
|
6
|
-
class App:
|
|
7
|
-
def __init__(self, title="NovaUI", size="500 x 500", color="white"):
|
|
8
|
-
global _active_app
|
|
9
|
-
pygame.init()
|
|
10
|
-
self.width, self.height = parse_size(size)
|
|
11
|
-
self.screen = pygame.display.set_mode((self.width, self.height))
|
|
12
|
-
pygame.display.set_caption(title)
|
|
13
|
-
self.bg_color = parse_color(color)
|
|
14
|
-
self.clock = pygame.time.Clock()
|
|
15
|
-
self.widgets = []
|
|
16
|
-
self.last_bottom = 0 # Нижняя граница последнего добавленного элемента
|
|
17
|
-
_active_app = self
|
|
18
|
-
|
|
19
|
-
def add(self, widget):
|
|
20
|
-
widget.place(self.width, self.last_bottom)
|
|
21
|
-
self.last_bottom = widget.rect.bottom # Запоминаем низ для следующего элемента
|
|
22
|
-
self.widgets.append(widget)
|
|
23
|
-
return widget
|
|
24
|
-
|
|
25
|
-
def run(self):
|
|
26
|
-
running = True
|
|
27
|
-
while running:
|
|
28
|
-
for event in pygame.event.get():
|
|
29
|
-
if event.type == pygame.QUIT:
|
|
30
|
-
running = False
|
|
31
|
-
for widget in self.widgets:
|
|
32
|
-
widget.handle_event(event)
|
|
33
|
-
|
|
34
|
-
self.screen.fill(self.bg_color)
|
|
35
|
-
for widget in self.widgets:
|
|
36
|
-
widget.draw(self.screen)
|
|
37
|
-
|
|
38
|
-
pygame.display.flip()
|
|
39
|
-
self.clock.tick(60)
|
|
40
|
-
|
|
41
|
-
pygame.quit()
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "EasyPythonUI"
|
|
7
|
-
version = "0.1.0"
|
|
8
|
-
description = "UI-библиотека для Python"
|
|
9
|
-
requires-python = ">=3.8"
|
|
10
|
-
dependencies = [
|
|
11
|
-
"pygame-ce"
|
|
12
|
-
]
|
|
File without changes
|
{easypythonui-0.1.0/EasyPythonUI.egg-info → easypythonui-0.1.1/easypythonui.egg-info}/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|