EasyPythonUI 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

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.
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: easypythonui
3
+ Version: 0.1.1
4
+ Summary: Простая и быстрая UI-библиотека для Python
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: pygame-ce
@@ -0,0 +1,8 @@
1
+ epUI/__init__.py,sha256=rjBoMRui11Bib9GILNbd7FXKj7ckkMQTJbZQ7ahOVKM,994
2
+ epUI/core.py,sha256=JUkr4PoBPWRJNlw16x4HeJj5ClOtQXDQ2sGfFsYRuUE,2216
3
+ epUI/parser.py,sha256=tgSsTtWZiaBNLEQIimh2HSpCIBQt-3GUW24kHMXtVnI,1945
4
+ epUI/widgets.py,sha256=0bbOiGPJcI6IYfDjLzf4HDJ2tLhc9q6ofLvYoa9ScqY,2755
5
+ easypythonui-0.1.1.dist-info/METADATA,sha256=20HqHjVtcV3YmtE4PLWh7Vg9xXfn3aJ8KHRXZSuaXqY,190
6
+ easypythonui-0.1.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
+ easypythonui-0.1.1.dist-info/top_level.txt,sha256=uxDkbLFNTwSt5ghkAjJXAI-IdXlkKPodCOZW3yEJynE,5
8
+ easypythonui-0.1.1.dist-info/RECORD,,
@@ -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="NovaUI", size="500 x 500", color="white"):
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):
epUI/core.py ADDED
@@ -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()
@@ -1,6 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: EasyPythonUI
3
- Version: 0.1.0
4
- Summary: UI-библиотека для Python
5
- Requires-Python: >=3.8
6
- Requires-Dist: pygame-ce
@@ -1,8 +0,0 @@
1
- novaui/__init__.py,sha256=X7NxM8hwIu0vLuR2kW-jsyxYznIwInYaw_mcxYKtC4E,1315
2
- novaui/core.py,sha256=vcrmiBNel7z4nVT3F1CtmjUZgptuf86bBeh41k6r2Oc,1438
3
- novaui/parser.py,sha256=tgSsTtWZiaBNLEQIimh2HSpCIBQt-3GUW24kHMXtVnI,1945
4
- novaui/widgets.py,sha256=0bbOiGPJcI6IYfDjLzf4HDJ2tLhc9q6ofLvYoa9ScqY,2755
5
- easypythonui-0.1.0.dist-info/METADATA,sha256=ytN4jy1YSMZVVwjL7JzhZvNGDybJfzlN8F2oZBb5CRU,157
6
- easypythonui-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
- easypythonui-0.1.0.dist-info/top_level.txt,sha256=Pxkeo1lDG86GAvpQxhixaiUn8KauwKFyCHWKbJOUvwk,7
8
- easypythonui-0.1.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- novaui
novaui/core.py 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()
File without changes
File without changes