Metadata-Version: 2.4
Name: saad-almikhlafi
Version: 0.1.2
Summary: A concise Python UI toolkit by Saad Al-Mikhlafi
Author: Saad Al-Mikhlafi
License: MIT License
        
        Copyright (c) 2026 Saad Al-Mikhlafi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: saad-almikhlafi,python,gui,android,ui
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygame<3.0,>=2.1.3
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Provides-Extra: arabic
Requires-Dist: arabic-reshaper>=3.0.0; extra == "arabic"
Requires-Dist: python-bidi>=0.4.2; extra == "arabic"
Dynamic: license-file

# saad-almikhlafi

**إطار واجهات Python مختصر، ببنية وأدوات واجهة من تنفيذ المشروع نفسه.**

اسم التوزيعة `saad-almikhlafi` واسم الاستيراد `saad_almikhlafi`. هذا مشروع مستقل: نظام العناصر والتخطيط والأحداث والرسم مكتوب لهذا الإطار، ويستعمل Pygame فقط كطبقة منخفضة المستوى للنافذة والرسم والإدخال؛ لا يعتمد على إطار واجهات Python آخر.

> الإصدار `0.1.1` منشور على PyPI. الإصدار `0.1.2` تعديل محلي للاختبار فقط، غير منشور، لمراجعة ترتيب بدء SDL على Android.

## التثبيت والتجربة

ثبّت الإصدار المنشور الحالي:

```bash
python -m pip install --upgrade saad-almikhlafi==0.1.1
```

للتطوير وتشغيل الاختبارات من مجلد المشروع:

```bash
python -m pip install -e ".[test]"
```

يتطلب Python 3.10+ وPygame 2.1.3+.

لتشكيل النص العربي واتجاهه، ثبّت الإضافات الاختيارية من مجلد المشروع:

```bash
pip install -e ".[test,arabic]"
```

تستخدم عناصر النص الخط الافتراضي إن لم تحدد `font_path`. لعرض العربية على الجهاز، مرّر مسار ملف خط يدعم العربية، مثل `text("مرحبًا", font_path="/مسار/الخط.ttf")` أو `app(root, font_path="/مسار/الخط.ttf")`.

## مثال سريع

```python
from saad_almikhlafi import app, btn, col, field, text

app(
    col(
        text("Welcome!", font=28),
        field(hint="Your name"),
        btn("Say hello", on=lambda widget: print("Hello!")),
        spacing=12,
        padding=20,
    ),
    title="تطبيقي الأول",
)
```

يعمل المثال في بيئة سطح المكتب، وعلى Android داخل Pydroid 3 عند توافر Pygame 2 وتهيئة SDL للفيديو في البيئة. على Android يفتح الإطار شاشة كاملة باستخدام الدقة الأصلية للجهاز، مع الاحتفاظ بالمقاس المحدد كاحتياط. تحقق من Pygame نفسه باختبار مستقل عند استكشاف مشاكل العرض:

```python
import pygame

pygame.init()
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
print("Pygame fullscreen ready:", pygame.version.ver, screen.get_size())
```

إذا فشل `set_mode` في هذا الاختبار أيضًا، فالمشكلة في توافق/تهيئة Pygame أو SDL داخل Pydroid وليست في كود الواجهة؛ أصلح تثبيت Pydroid/حزمة Pygame المتوافقة ثم أعد الاختبار. وجود `pygame` وإظهار رقم إصدار لا يثبت وحده أن SDL استطاع إنشاء نافذة Android. يذكر [وصف Pydroid 3 الرسمي](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3&hl=en_US) دعم Pygame 2. في الإصدار المحلي 0.1.2، استدعاء `set_mode` يسبق ضبط العنوان وتهيئة الخط؛ اختبره في Pydroid قبل اعتماد أي إصدار منشور.

## عناصر الواجهة

| الاستدعاء | الوظيفة |
|---|---|
| `col(...)` / `column(...)` | ترتيب العناصر رأسيًا |
| `row(...)` | ترتيب العناصر أفقيًا |
| `text("...")` / `label("...")` | نص مع حجم ولون ومحاذاة |
| `btn("...")` / `button("...")` | زر مع دالة `on` عند النقر |
| `field(...)` / `input(...)` | حقل إدخال نص أحادي السطر |
| `image(path)` | عرض ملف صورة محلي |
| `spacer()` | مساحة تتمدد داخل الصف أو العمود |
| `scroll(content)` | مساحة تمرير رأسية |
| `screen_manager({name: widget})` | تبديل بين شاشات مسماة مع سجل رجوع |
| `app(root, ...)` / `run(root, ...)` | تشغيل نافذة التطبيق |

تقبل التخطيطات `spacing`, `padding`, `background`, `width`, `height`, `align`. وتقبل العناصر خصائصها الخاصة مثل `font`, `color`, `hint`, `secure`, `on_change` و`on_submit`. استخدم `manager.show("settings")` للتبديل و`manager.back()` للعودة.

## المرحلة الحالية

**المراحل 1–3:** نواة العناصر والتخطيطات والأحداث والرسم، تمرير رأسي، شاشات مسماة وسجل رجوع، مع معالجة عربية اختيارية وخطوط مخصصة. نجحت اختبارات الرسم واللمس الاصطناعي والعربية على Linux؛ لم يجر التشغيل على جهاز Android بعد.

**المرحلة التالية:** تشغيل `examples/pydroid_smoke.py` على Pydroid والتحقق على الجهاز من اللمس ولوحة المفاتيح والاتجاه؛ ثم تحسين السمات وإتاحة الوصول والتوافق قبل إصدار مستقر. لا يُنشر أي إصدار قبل اكتمال المراجعة وموافقة المستخدم.

## English

`saad-almikhlafi` is a standalone Python UI toolkit with its own widget tree, layout, event handling, scrolling, screens, and drawing code. It uses Pygame as a low-level graphics/input backend. Optional Arabic shaping and custom fonts are available. Import it as `saad_almikhlafi`. Version 0.1.1 is published on PyPI. Version 0.1.2 is an unpublished local test build that calls `pygame.display.set_mode` before setting the caption or initializing fonts.
