bx-ui 1.0.0__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.
bx_ui-1.0.0/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BXCode
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files, to deal in the Software
7
+ without restriction, including without limitation the rights to use, copy,
8
+ modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
+ Software, and to permit persons to whom the Software is furnished to do so.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
bx_ui-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: bx-ui
3
+ Version: 1.0.0
4
+ Summary: Modern Arabic and English terminal UI toolkit for Python
5
+ Author: BXCode
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # bx-ui
13
+
14
+ Modern Arabic and English terminal UI toolkit for Python.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install bx-ui
20
+ ```
21
+
22
+ ## Example
23
+
24
+ ```python
25
+ from bx_ui import (
26
+ عرض,
27
+ نجاح,
28
+ قائمة,
29
+ جدول,
30
+ تقدم,
31
+ )
32
+
33
+ عرض("لوحة التحكم")
34
+
35
+ اختيار = قائمة(
36
+ "اختر العملية:",
37
+ [
38
+ "إضافة مستخدم",
39
+ "عرض المستخدمين",
40
+ "خروج",
41
+ ],
42
+ )
43
+
44
+ if اختيار == 1:
45
+ نجاح("تمت إضافة المستخدم")
46
+
47
+ elif اختيار == 2:
48
+ جدول(
49
+ ["ID", "الاسم", "العمر"],
50
+ [
51
+ [1, "حسين", 20],
52
+ [2, "علي", 19],
53
+ ],
54
+ )
55
+
56
+ تقدم(total=20, delay=0.03)
57
+ ```
58
+
59
+ ## English API
60
+
61
+ ```python
62
+ from bx_ui import title, success, menu, table, progress
63
+
64
+ title("Dashboard")
65
+
66
+ choice = menu(
67
+ "Choose an action:",
68
+ ["Add user", "Users", "Exit"],
69
+ )
70
+
71
+ success("Done")
72
+ ```
73
+
74
+ ## Features
75
+
76
+ - Arabic API aliases
77
+ - English API
78
+ - Menus
79
+ - Tables
80
+ - Success, info, warning and error messages
81
+ - Confirm prompts
82
+ - Progress bars
83
+ - Spinners
84
+ - Boxes and sections
85
+ - Terminal clearing
86
+ - Works with Python 3.9+
87
+ - No third-party runtime dependencies
88
+
89
+ ## Arabic API
90
+
91
+ | Arabic | English |
92
+ |---|---|
93
+ | عرض | title |
94
+ | قسم | section |
95
+ | معلومة | info |
96
+ | نجاح | success |
97
+ | تحذير | warning |
98
+ | خطأ | error |
99
+ | قائمة | menu |
100
+ | تأكيد | confirm |
101
+ | جدول | table |
102
+ | تقدم | progress |
103
+ | تحميل | spinner |
104
+ | صندوق | box |
105
+ | مسح | clear |
106
+ | توقف | pause |
107
+ | اسأل | ask |
108
+ | لغة | set_language |
109
+
110
+ ## License
111
+
112
+ MIT
bx_ui-1.0.0/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # bx-ui
2
+
3
+ Modern Arabic and English terminal UI toolkit for Python.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install bx-ui
9
+ ```
10
+
11
+ ## Example
12
+
13
+ ```python
14
+ from bx_ui import (
15
+ عرض,
16
+ نجاح,
17
+ قائمة,
18
+ جدول,
19
+ تقدم,
20
+ )
21
+
22
+ عرض("لوحة التحكم")
23
+
24
+ اختيار = قائمة(
25
+ "اختر العملية:",
26
+ [
27
+ "إضافة مستخدم",
28
+ "عرض المستخدمين",
29
+ "خروج",
30
+ ],
31
+ )
32
+
33
+ if اختيار == 1:
34
+ نجاح("تمت إضافة المستخدم")
35
+
36
+ elif اختيار == 2:
37
+ جدول(
38
+ ["ID", "الاسم", "العمر"],
39
+ [
40
+ [1, "حسين", 20],
41
+ [2, "علي", 19],
42
+ ],
43
+ )
44
+
45
+ تقدم(total=20, delay=0.03)
46
+ ```
47
+
48
+ ## English API
49
+
50
+ ```python
51
+ from bx_ui import title, success, menu, table, progress
52
+
53
+ title("Dashboard")
54
+
55
+ choice = menu(
56
+ "Choose an action:",
57
+ ["Add user", "Users", "Exit"],
58
+ )
59
+
60
+ success("Done")
61
+ ```
62
+
63
+ ## Features
64
+
65
+ - Arabic API aliases
66
+ - English API
67
+ - Menus
68
+ - Tables
69
+ - Success, info, warning and error messages
70
+ - Confirm prompts
71
+ - Progress bars
72
+ - Spinners
73
+ - Boxes and sections
74
+ - Terminal clearing
75
+ - Works with Python 3.9+
76
+ - No third-party runtime dependencies
77
+
78
+ ## Arabic API
79
+
80
+ | Arabic | English |
81
+ |---|---|
82
+ | عرض | title |
83
+ | قسم | section |
84
+ | معلومة | info |
85
+ | نجاح | success |
86
+ | تحذير | warning |
87
+ | خطأ | error |
88
+ | قائمة | menu |
89
+ | تأكيد | confirm |
90
+ | جدول | table |
91
+ | تقدم | progress |
92
+ | تحميل | spinner |
93
+ | صندوق | box |
94
+ | مسح | clear |
95
+ | توقف | pause |
96
+ | اسأل | ask |
97
+ | لغة | set_language |
98
+
99
+ ## License
100
+
101
+ MIT
@@ -0,0 +1,17 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "bx-ui"
7
+ version = "1.0.0"
8
+ description = "Modern Arabic and English terminal UI toolkit for Python"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ authors = [
13
+ {name = "BXCode"}
14
+ ]
15
+
16
+ [tool.setuptools.packages.find]
17
+ where = ["src"]
bx_ui-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ from .core import (
2
+ title,
3
+ section,
4
+ info,
5
+ success,
6
+ warning,
7
+ error,
8
+ menu,
9
+ confirm,
10
+ table,
11
+ progress,
12
+ spinner,
13
+ box,
14
+ clear,
15
+ pause,
16
+ ask,
17
+ set_language,
18
+ )
19
+
20
+ __version__ = "1.0.0"
21
+
22
+ # Arabic API
23
+ عرض = title
24
+ قسم = section
25
+ معلومة = info
26
+ نجاح = success
27
+ تحذير = warning
28
+ خطأ = error
29
+ قائمة = menu
30
+ تأكيد = confirm
31
+ جدول = table
32
+ تقدم = progress
33
+ تحميل = spinner
34
+ صندوق = box
35
+ مسح = clear
36
+ توقف = pause
37
+ اسأل = ask
38
+ لغة = set_language
@@ -0,0 +1,178 @@
1
+ import os
2
+ import sys
3
+ import time
4
+ from shutil import get_terminal_size
5
+
6
+ _LANG = "ar"
7
+
8
+
9
+ def set_language(language="ar"):
10
+ global _LANG
11
+ language = str(language).lower()
12
+ if language not in ("ar", "en"):
13
+ raise ValueError("language must be 'ar' or 'en'")
14
+ _LANG = language
15
+
16
+
17
+ def _t(ar, en):
18
+ return ar if _LANG == "ar" else en
19
+
20
+
21
+ def _width():
22
+ return max(40, get_terminal_size((80, 20)).columns)
23
+
24
+
25
+ def _line(char="─"):
26
+ return char * min(_width(), 80)
27
+
28
+
29
+ def clear():
30
+ os.system("cls" if os.name == "nt" else "clear")
31
+
32
+
33
+ def title(text, icon="✦"):
34
+ width = min(_width(), 80)
35
+ inner = max(10, width - 4)
36
+ text = str(text)
37
+ print("╔" + "═" * (inner + 2) + "╗")
38
+ print(f"║ {icon} {text[:inner - 2]:<{inner - 2}} ║")
39
+ print("╚" + "═" * (inner + 2) + "╝")
40
+
41
+
42
+ def section(text):
43
+ print()
44
+ print(f"── {text} " + "─" * max(0, min(_width() - len(str(text)) - 5, 60)))
45
+
46
+
47
+ def _message(icon, label, text):
48
+ print(f"{icon} {label}: {text}")
49
+
50
+
51
+ def info(text):
52
+ _message("ℹ", _t("معلومة", "Info"), text)
53
+
54
+
55
+ def success(text):
56
+ _message("✓", _t("نجاح", "Success"), text)
57
+
58
+
59
+ def warning(text):
60
+ _message("⚠", _t("تحذير", "Warning"), text)
61
+
62
+
63
+ def error(text):
64
+ _message("✗", _t("خطأ", "Error"), text)
65
+
66
+
67
+ def ask(prompt, default=None):
68
+ suffix = f" [{default}]" if default is not None else ""
69
+ value = input(f"? {prompt}{suffix}: ")
70
+ if not value and default is not None:
71
+ return default
72
+ return value
73
+
74
+
75
+ def confirm(prompt, default=False):
76
+ hint = "Y/n" if default else "y/N"
77
+ value = input(f"? {prompt} ({hint}): ").strip().lower()
78
+ if not value:
79
+ return default
80
+ return value in ("y", "yes", "نعم", "ن")
81
+
82
+
83
+ def menu(prompt, options, start=1):
84
+ options = list(options)
85
+ print()
86
+ print(f"╭─ {prompt}")
87
+ for index, option in enumerate(options, start):
88
+ print(f"│ {index}. {option}")
89
+ print("╰" + "─" * min(max(len(str(prompt)) + 3, 20), _width() - 1))
90
+
91
+ while True:
92
+ raw = input("> ").strip()
93
+ try:
94
+ choice = int(raw)
95
+ if start <= choice < start + len(options):
96
+ return choice
97
+ except ValueError:
98
+ pass
99
+ error(_t("اختيار غير صحيح، حاول مرة ثانية.", "Invalid choice, try again."))
100
+
101
+
102
+ def box(text, title_text=None, padding=1):
103
+ lines = str(text).splitlines() or [""]
104
+ longest = max(len(line) for line in lines)
105
+ width = min(max(longest + padding * 2, 20), min(_width(), 80) - 2)
106
+ if title_text:
107
+ print(f"╭─ {title_text} " + "─" * max(0, width - len(str(title_text)) - 4) + "╮")
108
+ else:
109
+ print("╭" + "─" * width + "╮")
110
+ for line in lines:
111
+ print("│" + " " * padding + line[:width - padding * 2].ljust(width - padding * 2) + " " * padding + "│")
112
+ print("╰" + "─" * width + "╯")
113
+
114
+
115
+ def table(headers, rows):
116
+ headers = [str(x) for x in headers]
117
+ rows = [[str(x) for x in row] for row in rows]
118
+ columns = len(headers)
119
+ if any(len(row) != columns for row in rows):
120
+ raise ValueError("Each row must have the same number of columns as headers.")
121
+
122
+ widths = [len(headers[i]) for i in range(columns)]
123
+ for row in rows:
124
+ for i, value in enumerate(row):
125
+ widths[i] = max(widths[i], len(value))
126
+
127
+ def sep(left, middle, right):
128
+ return left + middle.join("─" * (w + 2) for w in widths) + right
129
+
130
+ def row(values):
131
+ return "│" + "│".join(f" {values[i]:<{widths[i]}} " for i in range(columns)) + "│"
132
+
133
+ print(sep("┌", "┬", "┐"))
134
+ print(row(headers))
135
+ print(sep("├", "┼", "┤"))
136
+ for item in rows:
137
+ print(row(item))
138
+ print(sep("└", "┴", "┘"))
139
+
140
+
141
+ def progress(total=100, width=30, prefix=None, show_percent=True, delay=0):
142
+ total = max(1, int(total))
143
+ width = max(5, int(width))
144
+ prefix = prefix if prefix is not None else _t("التقدم", "Progress")
145
+
146
+ for current in range(total + 1):
147
+ ratio = current / total
148
+ filled = int(width * ratio)
149
+ bar = "█" * filled + "░" * (width - filled)
150
+ percent = f" {int(ratio * 100):3d}%" if show_percent else ""
151
+ print(f"\r{prefix}: [{bar}]{percent}", end="", flush=True)
152
+ if delay:
153
+ time.sleep(delay)
154
+
155
+ print()
156
+
157
+
158
+ def spinner(seconds=2, text_value=None, interval=0.1):
159
+ text_value = text_value or _t("جاري التحميل", "Loading")
160
+ frames = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
161
+ end = time.time() + max(0, seconds)
162
+
163
+ if seconds <= 0:
164
+ print(f"{text_value} ✓")
165
+ return
166
+
167
+ index = 0
168
+ while time.time() < end:
169
+ print(f"\r{frames[index % len(frames)]} {text_value}", end="", flush=True)
170
+ time.sleep(interval)
171
+ index += 1
172
+
173
+ print(f"\r✓ {text_value}" + " " * 10)
174
+
175
+
176
+ def pause(text=None):
177
+ text = text or _t("اضغط Enter للمتابعة...", "Press Enter to continue...")
178
+ input(text)
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: bx-ui
3
+ Version: 1.0.0
4
+ Summary: Modern Arabic and English terminal UI toolkit for Python
5
+ Author: BXCode
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # bx-ui
13
+
14
+ Modern Arabic and English terminal UI toolkit for Python.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install bx-ui
20
+ ```
21
+
22
+ ## Example
23
+
24
+ ```python
25
+ from bx_ui import (
26
+ عرض,
27
+ نجاح,
28
+ قائمة,
29
+ جدول,
30
+ تقدم,
31
+ )
32
+
33
+ عرض("لوحة التحكم")
34
+
35
+ اختيار = قائمة(
36
+ "اختر العملية:",
37
+ [
38
+ "إضافة مستخدم",
39
+ "عرض المستخدمين",
40
+ "خروج",
41
+ ],
42
+ )
43
+
44
+ if اختيار == 1:
45
+ نجاح("تمت إضافة المستخدم")
46
+
47
+ elif اختيار == 2:
48
+ جدول(
49
+ ["ID", "الاسم", "العمر"],
50
+ [
51
+ [1, "حسين", 20],
52
+ [2, "علي", 19],
53
+ ],
54
+ )
55
+
56
+ تقدم(total=20, delay=0.03)
57
+ ```
58
+
59
+ ## English API
60
+
61
+ ```python
62
+ from bx_ui import title, success, menu, table, progress
63
+
64
+ title("Dashboard")
65
+
66
+ choice = menu(
67
+ "Choose an action:",
68
+ ["Add user", "Users", "Exit"],
69
+ )
70
+
71
+ success("Done")
72
+ ```
73
+
74
+ ## Features
75
+
76
+ - Arabic API aliases
77
+ - English API
78
+ - Menus
79
+ - Tables
80
+ - Success, info, warning and error messages
81
+ - Confirm prompts
82
+ - Progress bars
83
+ - Spinners
84
+ - Boxes and sections
85
+ - Terminal clearing
86
+ - Works with Python 3.9+
87
+ - No third-party runtime dependencies
88
+
89
+ ## Arabic API
90
+
91
+ | Arabic | English |
92
+ |---|---|
93
+ | عرض | title |
94
+ | قسم | section |
95
+ | معلومة | info |
96
+ | نجاح | success |
97
+ | تحذير | warning |
98
+ | خطأ | error |
99
+ | قائمة | menu |
100
+ | تأكيد | confirm |
101
+ | جدول | table |
102
+ | تقدم | progress |
103
+ | تحميل | spinner |
104
+ | صندوق | box |
105
+ | مسح | clear |
106
+ | توقف | pause |
107
+ | اسأل | ask |
108
+ | لغة | set_language |
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/bx_ui/__init__.py
5
+ src/bx_ui/core.py
6
+ src/bx_ui.egg-info/PKG-INFO
7
+ src/bx_ui.egg-info/SOURCES.txt
8
+ src/bx_ui.egg-info/dependency_links.txt
9
+ src/bx_ui.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ bx_ui