verynicegui 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.
- verynicegui-1.0.0/PKG-INFO +278 -0
- verynicegui-1.0.0/README.md +267 -0
- verynicegui-1.0.0/pyproject.toml +27 -0
- verynicegui-1.0.0/setup.cfg +4 -0
- verynicegui-1.0.0/verynicegui/__init__.py +31 -0
- verynicegui-1.0.0/verynicegui/__main__.py +4 -0
- verynicegui-1.0.0/verynicegui/admin.py +351 -0
- verynicegui-1.0.0/verynicegui/app.py +209 -0
- verynicegui-1.0.0/verynicegui/auth.py +119 -0
- verynicegui-1.0.0/verynicegui/card.py +74 -0
- verynicegui-1.0.0/verynicegui/cli.py +204 -0
- verynicegui-1.0.0/verynicegui/i18n.py +55 -0
- verynicegui-1.0.0/verynicegui/layout.py +349 -0
- verynicegui-1.0.0/verynicegui/table.py +155 -0
- verynicegui-1.0.0/verynicegui/templates.py +177 -0
- verynicegui-1.0.0/verynicegui.egg-info/PKG-INFO +278 -0
- verynicegui-1.0.0/verynicegui.egg-info/SOURCES.txt +19 -0
- verynicegui-1.0.0/verynicegui.egg-info/dependency_links.txt +1 -0
- verynicegui-1.0.0/verynicegui.egg-info/entry_points.txt +2 -0
- verynicegui-1.0.0/verynicegui.egg-info/requires.txt +1 -0
- verynicegui-1.0.0/verynicegui.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: verynicegui
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A premium component-based SaaS framework built on top of NiceGUI
|
|
5
|
+
Author-email: Developer <developer@example.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: nicegui>=1.4.0
|
|
11
|
+
|
|
12
|
+
# 🌟 verynicegui
|
|
13
|
+
|
|
14
|
+
A premium, component-based SaaS boilerplate framework built on top of **NiceGUI**.
|
|
15
|
+
|
|
16
|
+
`verynicegui` empowers developers to focus entirely on building business logic and page content, automating layout structures, dynamic navigations, session authentication, role-based access control (RBAC), theme switching, multi-keyword tables, and seamless i18n localizations.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🚀 Key Features
|
|
21
|
+
|
|
22
|
+
* 🛡️ **Out-of-the-Box Session Auth & RBAC**: Session-based login/logout guards with category-based page access checks.
|
|
23
|
+
* 📱 **Premium Responsive Layout (`VeryNiceGUI` / `VeryNiceLayout`)**: Complete SaaS layout including a Header, dynamic Left Drawer, Footer, and interactive Right Detail Drawer.
|
|
24
|
+
* 🌍 **Zero-Flash Theme & i18n Switching**: Anti-flash dynamic HTML theme classes and quick "TR / EN" segment button toggle in the drawer.
|
|
25
|
+
* 🏗️ **One-Command CLI Scaffolding**: Setup your entire project directory and files instantly using the built-in CLI.
|
|
26
|
+
* 📊 **Enhanced Data Table (`VeryNiceTable`)**: Paging bounds (`max_row`), custom 12-column spans, row click triggers, and comma/space separated multi-keyword AND-logic search.
|
|
27
|
+
* 🎴 **Justified Typography Cards (`VeryNiceCard`)**: Standalone stat cards or context manager wrapper cards with dynamic border strips and justified block text.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 📦 Installation
|
|
32
|
+
|
|
33
|
+
To install `verynicegui` in your environment, run the following command:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install verynicegui
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
*(For local/editable development)*:
|
|
40
|
+
```bash
|
|
41
|
+
pip install -e . --break-system-packages
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🏗️ Quick Project Scaffold (CLI)
|
|
47
|
+
|
|
48
|
+
Get a fully structured, modular SaaS project up and running in seconds. Open an empty folder in your terminal and run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
verynicegui-init
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
or alternatively:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python -m verynicegui
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Generated Project Structure:
|
|
61
|
+
```text
|
|
62
|
+
my_saas_app/
|
|
63
|
+
│
|
|
64
|
+
├── main.py # App settings, Header, Footer, Drawer configuration & Launcher
|
|
65
|
+
├── translations.py # Separate dictionary file for multi-language terms
|
|
66
|
+
├── assets/ # Holds static files (e.g. logos, graphics)
|
|
67
|
+
│ └── logo.svg # Default premium SVG logo
|
|
68
|
+
├── pages/ # Directory for modular page layouts
|
|
69
|
+
│ ├── __init__.py # Exports all pages
|
|
70
|
+
│ ├── home.py # Home page module
|
|
71
|
+
│ └── sales.py # Sales page module (featuring VeryNiceTable)
|
|
72
|
+
└── data/
|
|
73
|
+
└── users.json # Built-in database file (automatically created on first run)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🛠️ API & Component Reference
|
|
79
|
+
|
|
80
|
+
### 1. `VeryNiceGUI` (App Configuration)
|
|
81
|
+
Used in `main.py` to bootstrap the application drawer, header, footer, static assets, and localization parameters.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# main.py
|
|
85
|
+
import sys
|
|
86
|
+
# Alias the entrypoint namespace as 'main' to prevent duplicate execution during circular imports
|
|
87
|
+
sys.modules['main'] = sys.modules[__name__]
|
|
88
|
+
|
|
89
|
+
from verynicegui import VeryNiceGUI
|
|
90
|
+
from translations import TRANSLATIONS
|
|
91
|
+
|
|
92
|
+
app = VeryNiceGUI(
|
|
93
|
+
title="My SaaS App",
|
|
94
|
+
header={
|
|
95
|
+
"logo": "assets/logo.svg", # SVG/PNG file path or Material Icon name
|
|
96
|
+
"title": "SaaSApp",
|
|
97
|
+
"show_theme_toggle": True
|
|
98
|
+
},
|
|
99
|
+
left_drawer={
|
|
100
|
+
"title": "Navigation Menu",
|
|
101
|
+
"menu": [
|
|
102
|
+
{"category": "home", "title": "Home", "icon": "home", "route": "/"},
|
|
103
|
+
{
|
|
104
|
+
"category": "sales",
|
|
105
|
+
"title": "Sales",
|
|
106
|
+
"icon": "payments",
|
|
107
|
+
"subcategories": [
|
|
108
|
+
{"title": "Daily", "route": "/sales/daily", "icon": "today"},
|
|
109
|
+
{"title": "Monthly", "route": "/sales/monthly", "icon": "calendar_month"}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
footer={
|
|
115
|
+
"left": "© 2026 SaaSApp Inc.",
|
|
116
|
+
"middle": "All Rights Reserved",
|
|
117
|
+
"right": "System Status: Online"
|
|
118
|
+
},
|
|
119
|
+
translations=TRANSLATIONS
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
import pages
|
|
123
|
+
|
|
124
|
+
if __name__ in {"__main__", "__mp_main__"}:
|
|
125
|
+
app.run(port=8080)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 2. `@app.page` (Route & Guard Decorator)
|
|
131
|
+
Registers routes and applies RBAC categories to restrict pages to authorized users.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
# pages/home.py
|
|
135
|
+
from nicegui import ui
|
|
136
|
+
from verynicegui import get_current_user, tr
|
|
137
|
+
from main import app
|
|
138
|
+
|
|
139
|
+
# Restricts this page to users having the 'home' category permission
|
|
140
|
+
@app.page("/", title="Home Page", allowed_categories=["home"])
|
|
141
|
+
def home_page():
|
|
142
|
+
user = get_current_user()
|
|
143
|
+
display_name = user.get("display_name") if user else "Guest"
|
|
144
|
+
|
|
145
|
+
ui.label(tr("welcome", "Welcome, {name}!").format(name=display_name))
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### 3. `VeryNiceCard` (Justified Content Cards)
|
|
151
|
+
A premium card container. Can be instantiated on a single line or as a context manager block.
|
|
152
|
+
|
|
153
|
+
#### A) Single-line Statistic Card
|
|
154
|
+
```python
|
|
155
|
+
from verynicegui import VeryNiceCard
|
|
156
|
+
|
|
157
|
+
VeryNiceCard(title="Total Revenue", body="$124,500", column=4)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### B) Context Manager Block Card
|
|
161
|
+
```python
|
|
162
|
+
from verynicegui import VeryNiceCard
|
|
163
|
+
from nicegui import ui
|
|
164
|
+
|
|
165
|
+
with VeryNiceCard(title="Important Announcement", column=12, color="var(--mn-brand)"):
|
|
166
|
+
ui.label("This paragraph text inside the card is automatically justified (aligned left and right).")
|
|
167
|
+
ui.button("Read More")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Parameters:**
|
|
171
|
+
* `title`: Title text. Shows smaller and grey in stats mode, bold and primary in content mode.
|
|
172
|
+
* `body` *(Optional)*: Value string. Triggers immediate stats card formatting if provided.
|
|
173
|
+
* `column` *(Optional)*: Width span in 12-column grids (e.g. `4` spans 1/3 of the row).
|
|
174
|
+
* `color` *(Optional)*: Brand color for the decorative left border strip (e.g. `"#3b82f6"`, `"red"`).
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 4. `VeryNiceTable` (Advanced Paginated Grid)
|
|
179
|
+
Features scrollable headers, page pagination, multi-keyword search parsing, and custom action callbacks.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
# pages/sales.py
|
|
183
|
+
from nicegui import ui
|
|
184
|
+
from verynicegui import VeryNiceTable, tr
|
|
185
|
+
from main import app
|
|
186
|
+
|
|
187
|
+
@app.page("/sales/daily", title="Daily Sales", allowed_categories=["sales"])
|
|
188
|
+
def daily_sales_page(drawer):
|
|
189
|
+
transactions = [
|
|
190
|
+
{"id": "#1001", "product": "Pro License", "amount": "99 USD", "desc": "Premium subscription key"},
|
|
191
|
+
{"id": "#1002", "product": "Enterprise Setup", "amount": "1200 USD", "desc": "Custom server migration consulting"}
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
VeryNiceTable(
|
|
195
|
+
table_name="Transactions",
|
|
196
|
+
columns=[
|
|
197
|
+
{"name": "id", "label": "ID", "field": "id", "align": "left"},
|
|
198
|
+
{"name": "product", "label": "Product", "field": "product", "align": "left"},
|
|
199
|
+
{"name": "amount", "label": "Amount", "field": "amount", "align": "right"}
|
|
200
|
+
],
|
|
201
|
+
rows=transactions,
|
|
202
|
+
max_row=5, # Maximum rows per page before paginating
|
|
203
|
+
column=8, # Span in the 12-column parent layout
|
|
204
|
+
font_size="m", # Options: 's', 'm', 'l'
|
|
205
|
+
font_family="Outfit", # Options: 'Outfit', 'Inter'
|
|
206
|
+
on_row_click=lambda row: drawer.toggle(row["desc"]) # Drawer action on row click
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### 🔍 Multi-Keyword Search AND Filter
|
|
211
|
+
The search box supports multiple keyword arguments separated by **spaces** (` `) or **commas** (`,`). For example, searching for `Pro Premium` matches records containing *both* "Pro" and "Premium".
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### 5. `RightDrawer` (Details sidebar)
|
|
216
|
+
To instantiate the interactive right drawer, declare a parameter named `drawer` or `right_drawer` in your page function. The decorator will automatically inject the drawer.
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
# drawer control commands:
|
|
220
|
+
drawer.open("Content String or callback")
|
|
221
|
+
drawer.close()
|
|
222
|
+
drawer.toggle("Details info here...") # Toggles open if closed, or updates current drawer content
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🌍 Localization & Multi-Language (i18n)
|
|
228
|
+
|
|
229
|
+
Define translation mappings in `translations.py` and supply them to `VeryNiceGUI`.
|
|
230
|
+
|
|
231
|
+
### `translations.py` Schema:
|
|
232
|
+
```python
|
|
233
|
+
TRANSLATIONS = {
|
|
234
|
+
"tr": {
|
|
235
|
+
"welcome": "Hoş geldiniz, {name}! 👋",
|
|
236
|
+
"home_title": "Ana Sayfa",
|
|
237
|
+
"btn_save": "Kaydet"
|
|
238
|
+
},
|
|
239
|
+
"en": {
|
|
240
|
+
"welcome": "Welcome, {name}! 👋",
|
|
241
|
+
"home_title": "Home Page",
|
|
242
|
+
"btn_save": "Save"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Usage:
|
|
248
|
+
Use the `tr` helper function inside pages to fetch translations for the user's active language choice.
|
|
249
|
+
```python
|
|
250
|
+
from verynicegui import tr
|
|
251
|
+
|
|
252
|
+
# Simple translate
|
|
253
|
+
ui.label(tr("btn_save", "Save"))
|
|
254
|
+
|
|
255
|
+
# Formatted dynamic translate
|
|
256
|
+
ui.label(tr("welcome", "Welcome, {name}!").format(name=display_name))
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 🔑 Authentication Database (`data/users.json`)
|
|
262
|
+
|
|
263
|
+
On the first application launch, the directory `data/` and `users.json` are created automatically. It contains default accounts:
|
|
264
|
+
|
|
265
|
+
* **Admin** (`username: admin`, `password: admin123`) -> Full access to all categories and `/admin` user management panels.
|
|
266
|
+
* Custom accounts can be registered and configured with page access permissions directly via the Admin panel.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 🎨 Theme & Styles Override
|
|
271
|
+
|
|
272
|
+
Style overrides and color schemas are defined inside CSS variables in [verynicegui/layout.py](file:///Users/ilkermansur/Desktop/nice_agent/verynicegui/layout.py):
|
|
273
|
+
|
|
274
|
+
* `--mn-bg`: Master app background color.
|
|
275
|
+
* `--mn-header-bg`: Header navbar color.
|
|
276
|
+
* `--mn-drawer-bg`: Navigation sidebar color.
|
|
277
|
+
* `--mn-card-bg`: Card container background.
|
|
278
|
+
* `--mn-brand`: Brand indicator color (defaults to indigo purple).
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# 🌟 verynicegui
|
|
2
|
+
|
|
3
|
+
A premium, component-based SaaS boilerplate framework built on top of **NiceGUI**.
|
|
4
|
+
|
|
5
|
+
`verynicegui` empowers developers to focus entirely on building business logic and page content, automating layout structures, dynamic navigations, session authentication, role-based access control (RBAC), theme switching, multi-keyword tables, and seamless i18n localizations.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Key Features
|
|
10
|
+
|
|
11
|
+
* 🛡️ **Out-of-the-Box Session Auth & RBAC**: Session-based login/logout guards with category-based page access checks.
|
|
12
|
+
* 📱 **Premium Responsive Layout (`VeryNiceGUI` / `VeryNiceLayout`)**: Complete SaaS layout including a Header, dynamic Left Drawer, Footer, and interactive Right Detail Drawer.
|
|
13
|
+
* 🌍 **Zero-Flash Theme & i18n Switching**: Anti-flash dynamic HTML theme classes and quick "TR / EN" segment button toggle in the drawer.
|
|
14
|
+
* 🏗️ **One-Command CLI Scaffolding**: Setup your entire project directory and files instantly using the built-in CLI.
|
|
15
|
+
* 📊 **Enhanced Data Table (`VeryNiceTable`)**: Paging bounds (`max_row`), custom 12-column spans, row click triggers, and comma/space separated multi-keyword AND-logic search.
|
|
16
|
+
* 🎴 **Justified Typography Cards (`VeryNiceCard`)**: Standalone stat cards or context manager wrapper cards with dynamic border strips and justified block text.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
To install `verynicegui` in your environment, run the following command:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install verynicegui
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
*(For local/editable development)*:
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e . --break-system-packages
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🏗️ Quick Project Scaffold (CLI)
|
|
36
|
+
|
|
37
|
+
Get a fully structured, modular SaaS project up and running in seconds. Open an empty folder in your terminal and run:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
verynicegui-init
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
or alternatively:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m verynicegui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Generated Project Structure:
|
|
50
|
+
```text
|
|
51
|
+
my_saas_app/
|
|
52
|
+
│
|
|
53
|
+
├── main.py # App settings, Header, Footer, Drawer configuration & Launcher
|
|
54
|
+
├── translations.py # Separate dictionary file for multi-language terms
|
|
55
|
+
├── assets/ # Holds static files (e.g. logos, graphics)
|
|
56
|
+
│ └── logo.svg # Default premium SVG logo
|
|
57
|
+
├── pages/ # Directory for modular page layouts
|
|
58
|
+
│ ├── __init__.py # Exports all pages
|
|
59
|
+
│ ├── home.py # Home page module
|
|
60
|
+
│ └── sales.py # Sales page module (featuring VeryNiceTable)
|
|
61
|
+
└── data/
|
|
62
|
+
└── users.json # Built-in database file (automatically created on first run)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🛠️ API & Component Reference
|
|
68
|
+
|
|
69
|
+
### 1. `VeryNiceGUI` (App Configuration)
|
|
70
|
+
Used in `main.py` to bootstrap the application drawer, header, footer, static assets, and localization parameters.
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# main.py
|
|
74
|
+
import sys
|
|
75
|
+
# Alias the entrypoint namespace as 'main' to prevent duplicate execution during circular imports
|
|
76
|
+
sys.modules['main'] = sys.modules[__name__]
|
|
77
|
+
|
|
78
|
+
from verynicegui import VeryNiceGUI
|
|
79
|
+
from translations import TRANSLATIONS
|
|
80
|
+
|
|
81
|
+
app = VeryNiceGUI(
|
|
82
|
+
title="My SaaS App",
|
|
83
|
+
header={
|
|
84
|
+
"logo": "assets/logo.svg", # SVG/PNG file path or Material Icon name
|
|
85
|
+
"title": "SaaSApp",
|
|
86
|
+
"show_theme_toggle": True
|
|
87
|
+
},
|
|
88
|
+
left_drawer={
|
|
89
|
+
"title": "Navigation Menu",
|
|
90
|
+
"menu": [
|
|
91
|
+
{"category": "home", "title": "Home", "icon": "home", "route": "/"},
|
|
92
|
+
{
|
|
93
|
+
"category": "sales",
|
|
94
|
+
"title": "Sales",
|
|
95
|
+
"icon": "payments",
|
|
96
|
+
"subcategories": [
|
|
97
|
+
{"title": "Daily", "route": "/sales/daily", "icon": "today"},
|
|
98
|
+
{"title": "Monthly", "route": "/sales/monthly", "icon": "calendar_month"}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
footer={
|
|
104
|
+
"left": "© 2026 SaaSApp Inc.",
|
|
105
|
+
"middle": "All Rights Reserved",
|
|
106
|
+
"right": "System Status: Online"
|
|
107
|
+
},
|
|
108
|
+
translations=TRANSLATIONS
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
import pages
|
|
112
|
+
|
|
113
|
+
if __name__ in {"__main__", "__mp_main__"}:
|
|
114
|
+
app.run(port=8080)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### 2. `@app.page` (Route & Guard Decorator)
|
|
120
|
+
Registers routes and applies RBAC categories to restrict pages to authorized users.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# pages/home.py
|
|
124
|
+
from nicegui import ui
|
|
125
|
+
from verynicegui import get_current_user, tr
|
|
126
|
+
from main import app
|
|
127
|
+
|
|
128
|
+
# Restricts this page to users having the 'home' category permission
|
|
129
|
+
@app.page("/", title="Home Page", allowed_categories=["home"])
|
|
130
|
+
def home_page():
|
|
131
|
+
user = get_current_user()
|
|
132
|
+
display_name = user.get("display_name") if user else "Guest"
|
|
133
|
+
|
|
134
|
+
ui.label(tr("welcome", "Welcome, {name}!").format(name=display_name))
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 3. `VeryNiceCard` (Justified Content Cards)
|
|
140
|
+
A premium card container. Can be instantiated on a single line or as a context manager block.
|
|
141
|
+
|
|
142
|
+
#### A) Single-line Statistic Card
|
|
143
|
+
```python
|
|
144
|
+
from verynicegui import VeryNiceCard
|
|
145
|
+
|
|
146
|
+
VeryNiceCard(title="Total Revenue", body="$124,500", column=4)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### B) Context Manager Block Card
|
|
150
|
+
```python
|
|
151
|
+
from verynicegui import VeryNiceCard
|
|
152
|
+
from nicegui import ui
|
|
153
|
+
|
|
154
|
+
with VeryNiceCard(title="Important Announcement", column=12, color="var(--mn-brand)"):
|
|
155
|
+
ui.label("This paragraph text inside the card is automatically justified (aligned left and right).")
|
|
156
|
+
ui.button("Read More")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Parameters:**
|
|
160
|
+
* `title`: Title text. Shows smaller and grey in stats mode, bold and primary in content mode.
|
|
161
|
+
* `body` *(Optional)*: Value string. Triggers immediate stats card formatting if provided.
|
|
162
|
+
* `column` *(Optional)*: Width span in 12-column grids (e.g. `4` spans 1/3 of the row).
|
|
163
|
+
* `color` *(Optional)*: Brand color for the decorative left border strip (e.g. `"#3b82f6"`, `"red"`).
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### 4. `VeryNiceTable` (Advanced Paginated Grid)
|
|
168
|
+
Features scrollable headers, page pagination, multi-keyword search parsing, and custom action callbacks.
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
# pages/sales.py
|
|
172
|
+
from nicegui import ui
|
|
173
|
+
from verynicegui import VeryNiceTable, tr
|
|
174
|
+
from main import app
|
|
175
|
+
|
|
176
|
+
@app.page("/sales/daily", title="Daily Sales", allowed_categories=["sales"])
|
|
177
|
+
def daily_sales_page(drawer):
|
|
178
|
+
transactions = [
|
|
179
|
+
{"id": "#1001", "product": "Pro License", "amount": "99 USD", "desc": "Premium subscription key"},
|
|
180
|
+
{"id": "#1002", "product": "Enterprise Setup", "amount": "1200 USD", "desc": "Custom server migration consulting"}
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
VeryNiceTable(
|
|
184
|
+
table_name="Transactions",
|
|
185
|
+
columns=[
|
|
186
|
+
{"name": "id", "label": "ID", "field": "id", "align": "left"},
|
|
187
|
+
{"name": "product", "label": "Product", "field": "product", "align": "left"},
|
|
188
|
+
{"name": "amount", "label": "Amount", "field": "amount", "align": "right"}
|
|
189
|
+
],
|
|
190
|
+
rows=transactions,
|
|
191
|
+
max_row=5, # Maximum rows per page before paginating
|
|
192
|
+
column=8, # Span in the 12-column parent layout
|
|
193
|
+
font_size="m", # Options: 's', 'm', 'l'
|
|
194
|
+
font_family="Outfit", # Options: 'Outfit', 'Inter'
|
|
195
|
+
on_row_click=lambda row: drawer.toggle(row["desc"]) # Drawer action on row click
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### 🔍 Multi-Keyword Search AND Filter
|
|
200
|
+
The search box supports multiple keyword arguments separated by **spaces** (` `) or **commas** (`,`). For example, searching for `Pro Premium` matches records containing *both* "Pro" and "Premium".
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### 5. `RightDrawer` (Details sidebar)
|
|
205
|
+
To instantiate the interactive right drawer, declare a parameter named `drawer` or `right_drawer` in your page function. The decorator will automatically inject the drawer.
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
# drawer control commands:
|
|
209
|
+
drawer.open("Content String or callback")
|
|
210
|
+
drawer.close()
|
|
211
|
+
drawer.toggle("Details info here...") # Toggles open if closed, or updates current drawer content
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 🌍 Localization & Multi-Language (i18n)
|
|
217
|
+
|
|
218
|
+
Define translation mappings in `translations.py` and supply them to `VeryNiceGUI`.
|
|
219
|
+
|
|
220
|
+
### `translations.py` Schema:
|
|
221
|
+
```python
|
|
222
|
+
TRANSLATIONS = {
|
|
223
|
+
"tr": {
|
|
224
|
+
"welcome": "Hoş geldiniz, {name}! 👋",
|
|
225
|
+
"home_title": "Ana Sayfa",
|
|
226
|
+
"btn_save": "Kaydet"
|
|
227
|
+
},
|
|
228
|
+
"en": {
|
|
229
|
+
"welcome": "Welcome, {name}! 👋",
|
|
230
|
+
"home_title": "Home Page",
|
|
231
|
+
"btn_save": "Save"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Usage:
|
|
237
|
+
Use the `tr` helper function inside pages to fetch translations for the user's active language choice.
|
|
238
|
+
```python
|
|
239
|
+
from verynicegui import tr
|
|
240
|
+
|
|
241
|
+
# Simple translate
|
|
242
|
+
ui.label(tr("btn_save", "Save"))
|
|
243
|
+
|
|
244
|
+
# Formatted dynamic translate
|
|
245
|
+
ui.label(tr("welcome", "Welcome, {name}!").format(name=display_name))
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 🔑 Authentication Database (`data/users.json`)
|
|
251
|
+
|
|
252
|
+
On the first application launch, the directory `data/` and `users.json` are created automatically. It contains default accounts:
|
|
253
|
+
|
|
254
|
+
* **Admin** (`username: admin`, `password: admin123`) -> Full access to all categories and `/admin` user management panels.
|
|
255
|
+
* Custom accounts can be registered and configured with page access permissions directly via the Admin panel.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 🎨 Theme & Styles Override
|
|
260
|
+
|
|
261
|
+
Style overrides and color schemas are defined inside CSS variables in [verynicegui/layout.py](file:///Users/ilkermansur/Desktop/nice_agent/verynicegui/layout.py):
|
|
262
|
+
|
|
263
|
+
* `--mn-bg`: Master app background color.
|
|
264
|
+
* `--mn-header-bg`: Header navbar color.
|
|
265
|
+
* `--mn-drawer-bg`: Navigation sidebar color.
|
|
266
|
+
* `--mn-card-bg`: Card container background.
|
|
267
|
+
* `--mn-brand`: Brand indicator color (defaults to indigo purple).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "verynicegui"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A premium component-based SaaS framework built on top of NiceGUI"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Developer", email = "developer@example.com" }
|
|
12
|
+
]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"nicegui>=1.4.0",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
verynicegui-init = "verynicegui.cli:main"
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.packages.find]
|
|
26
|
+
where = ["."]
|
|
27
|
+
include = ["verynicegui*"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from verynicegui.app import VeryNiceGUI
|
|
2
|
+
from verynicegui.layout import VeryNiceLayout, RightDrawer
|
|
3
|
+
from verynicegui.table import VeryNiceTable
|
|
4
|
+
from verynicegui.card import VeryNiceCard
|
|
5
|
+
from verynicegui.i18n import tr, set_language
|
|
6
|
+
from verynicegui.auth import (
|
|
7
|
+
get_current_user,
|
|
8
|
+
is_admin,
|
|
9
|
+
has_permission,
|
|
10
|
+
do_login,
|
|
11
|
+
do_logout,
|
|
12
|
+
load_users,
|
|
13
|
+
save_users,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"VeryNiceGUI",
|
|
18
|
+
"VeryNiceLayout",
|
|
19
|
+
"RightDrawer",
|
|
20
|
+
"VeryNiceTable",
|
|
21
|
+
"VeryNiceCard",
|
|
22
|
+
"tr",
|
|
23
|
+
"set_language",
|
|
24
|
+
"get_current_user",
|
|
25
|
+
"is_admin",
|
|
26
|
+
"has_permission",
|
|
27
|
+
"do_login",
|
|
28
|
+
"do_logout",
|
|
29
|
+
"load_users",
|
|
30
|
+
"save_users",
|
|
31
|
+
]
|