pyflutter-ui 0.1.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.
- pyflutter_ui-0.1.0/.python-version +1 -0
- pyflutter_ui-0.1.0/PKG-INFO +101 -0
- pyflutter_ui-0.1.0/README.md +93 -0
- pyflutter_ui-0.1.0/local_build/linux.sh +22 -0
- pyflutter_ui-0.1.0/local_build/send.sh +17 -0
- pyflutter_ui-0.1.0/main.py +6 -0
- pyflutter_ui-0.1.0/new-export_app.sh +56 -0
- pyflutter_ui-0.1.0/pyflutter_ui/__init__.py +89 -0
- pyflutter_ui-0.1.0/pyflutter_ui/app.py +295 -0
- pyflutter_ui-0.1.0/pyflutter_ui/config_app.py +185 -0
- pyflutter_ui-0.1.0/pyflutter_ui/file_picker.py +274 -0
- pyflutter_ui-0.1.0/pyflutter_ui/navigator.py +94 -0
- pyflutter_ui-0.1.0/pyflutter_ui/scheduler.py +154 -0
- pyflutter_ui-0.1.0/pyflutter_ui/system_theme.py +80 -0
- pyflutter_ui-0.1.0/pyflutter_ui/table_widget.py +160 -0
- pyflutter_ui-0.1.0/pyflutter_ui/theme.py +1066 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/__init__.py +78 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/buttons.py +351 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/container.py +125 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/core.py +890 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/list_builder.py +390 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/progress.py +123 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/tables.py +119 -0
- pyflutter_ui-0.1.0/pyflutter_ui/ui/widgets.py +1283 -0
- pyflutter_ui-0.1.0/pyproject.toml +26 -0
- pyflutter_ui-0.1.0/rm_pycache.sh +1 -0
- pyflutter_ui-0.1.0/uv.lock +809 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pyflutter_ui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: UI baseada em Tk
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: table-stream>=0.2.9.5
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# pyflutter_ui
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Getting started
|
|
14
|
+
|
|
15
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
16
|
+
|
|
17
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
18
|
+
|
|
19
|
+
## Add your files
|
|
20
|
+
|
|
21
|
+
* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
|
22
|
+
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
cd existing_repo
|
|
26
|
+
git remote add origin https://gitlab.com/bschaves/pyflutter_ui.git
|
|
27
|
+
git branch -M main
|
|
28
|
+
git push -uf origin main
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Integrate with your tools
|
|
32
|
+
|
|
33
|
+
* [Set up project integrations](https://gitlab.com/bschaves/pyflutter_ui/-/settings/integrations)
|
|
34
|
+
|
|
35
|
+
## Collaborate with your team
|
|
36
|
+
|
|
37
|
+
* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
|
38
|
+
* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
|
39
|
+
* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
|
40
|
+
* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
|
41
|
+
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
42
|
+
|
|
43
|
+
## Test and Deploy
|
|
44
|
+
|
|
45
|
+
Use the built-in continuous integration in GitLab.
|
|
46
|
+
|
|
47
|
+
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
|
48
|
+
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
|
49
|
+
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
|
50
|
+
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
|
51
|
+
* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
# Editing this README
|
|
56
|
+
|
|
57
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
58
|
+
|
|
59
|
+
## Suggestions for a good README
|
|
60
|
+
|
|
61
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
62
|
+
|
|
63
|
+
## Name
|
|
64
|
+
Choose a self-explaining name for your project.
|
|
65
|
+
|
|
66
|
+
## Description
|
|
67
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
68
|
+
|
|
69
|
+
## Badges
|
|
70
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
71
|
+
|
|
72
|
+
## Visuals
|
|
73
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
80
|
+
|
|
81
|
+
## Support
|
|
82
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
83
|
+
|
|
84
|
+
## Roadmap
|
|
85
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
89
|
+
|
|
90
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
91
|
+
|
|
92
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
93
|
+
|
|
94
|
+
## Authors and acknowledgment
|
|
95
|
+
Show your appreciation to those who have contributed to the project.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
For open source projects, say how it is licensed.
|
|
99
|
+
|
|
100
|
+
## Project status
|
|
101
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# pyflutter_ui
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
|
14
|
+
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin https://gitlab.com/bschaves/pyflutter_ui.git
|
|
19
|
+
git branch -M main
|
|
20
|
+
git push -uf origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
* [Set up project integrations](https://gitlab.com/bschaves/pyflutter_ui/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
|
30
|
+
* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
|
31
|
+
* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
|
32
|
+
* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
|
33
|
+
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
|
40
|
+
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
|
41
|
+
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
|
42
|
+
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
|
43
|
+
* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
|
|
53
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
|
+
|
|
55
|
+
## Name
|
|
56
|
+
Choose a self-explaining name for your project.
|
|
57
|
+
|
|
58
|
+
## Description
|
|
59
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
|
+
|
|
61
|
+
## Badges
|
|
62
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
63
|
+
|
|
64
|
+
## Visuals
|
|
65
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
72
|
+
|
|
73
|
+
## Support
|
|
74
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
75
|
+
|
|
76
|
+
## Roadmap
|
|
77
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
|
+
|
|
82
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
83
|
+
|
|
84
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
85
|
+
|
|
86
|
+
## Authors and acknowledgment
|
|
87
|
+
Show your appreciation to those who have contributed to the project.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
For open source projects, say how it is licensed.
|
|
91
|
+
|
|
92
|
+
## Project status
|
|
93
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Script para compilar o projeto localmente e preparar para enviar ao PyPI.
|
|
4
|
+
#
|
|
5
|
+
THIS_FILE=$(readlink -f "$0")
|
|
6
|
+
THIS_DIR=$(dirname "$THIS_FILE")
|
|
7
|
+
DIR_ROOT=$(cd "$THIS_DIR"; cd ..; pwd) # Raiz do projeto
|
|
8
|
+
LOCAL_DIR_VENV="${DIR_ROOT}/.venv"
|
|
9
|
+
VENV_ACTIVATE="${LOCAL_DIR_VENV}/bin/activate"
|
|
10
|
+
source "${VENV_ACTIVATE}" || exit 1
|
|
11
|
+
|
|
12
|
+
function main(){
|
|
13
|
+
uv sync || exit 1
|
|
14
|
+
# Executa o build usando o ambiente gerenciado pelo uv
|
|
15
|
+
uv run python -m build || exit 1
|
|
16
|
+
# pip3 install build
|
|
17
|
+
#python3 -m build
|
|
18
|
+
|
|
19
|
+
echo -e "\nPara enviar ao PyPI use ->> python3 -m twine upload dist/*"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main "$@"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
THIS_FILE=$(readlink -f "$0")
|
|
4
|
+
THIS_DIR=$(dirname "$THIS_FILE")
|
|
5
|
+
DIR_ROOT=$(cd "$THIS_DIR"; cd ..; pwd) # Raiz do projeto
|
|
6
|
+
LOCAL_DIR_VENV="${DIR_ROOT}/.venv"
|
|
7
|
+
VENV_ACTIVATE="${LOCAL_DIR_VENV}/bin/activate"
|
|
8
|
+
source "${VENV_ACTIVATE}" || exit 1
|
|
9
|
+
|
|
10
|
+
function main(){
|
|
11
|
+
# pip3 install twine
|
|
12
|
+
# uv add twine build
|
|
13
|
+
echo -e "Enviando ao PyPI"
|
|
14
|
+
python3 -m twine upload dist/* #
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
main "$@"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
THIS=$0
|
|
4
|
+
DIR_ROOT_PROJ=$(dirname $(readlink -f "$THIS"))
|
|
5
|
+
APPNAME='pyflutter_ui'
|
|
6
|
+
PREFIX_OUTDIR="Documentos/PROMPTS/${APPNAME}"
|
|
7
|
+
|
|
8
|
+
OUTPUT_DIR="${HOME}/${PREFIX_OUTDIR}"
|
|
9
|
+
DIR_APP="${DIR_ROOT_PROJ}/pyflutter_ui"
|
|
10
|
+
|
|
11
|
+
# 1. Declaração do Mapa: [Diretório de Origem]="Arquivo de Saída"
|
|
12
|
+
declare -A MODULOS=(
|
|
13
|
+
["${DIR_APP}"]="${OUTPUT_DIR}/pyflutter_ui.py"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
function start(){
|
|
17
|
+
mkdir -p "$OUTPUT_DIR"
|
|
18
|
+
|
|
19
|
+
# Limpa/cria todos os arquivos de saída mapeados antes do processamento
|
|
20
|
+
for output_file in "${MODULOS[@]}"; do
|
|
21
|
+
> "$output_file"
|
|
22
|
+
done
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function save_dir(){
|
|
26
|
+
local CURRENT_DIR=$1
|
|
27
|
+
local EXPORT_DIR=$2
|
|
28
|
+
|
|
29
|
+
[[ -z "$CURRENT_DIR" ]] && { echo "* save_dir: diretório nulo"; return 1; }
|
|
30
|
+
[[ -z "$EXPORT_DIR" ]] && { echo "* save_dir: arquivo nulo"; return 1; }
|
|
31
|
+
|
|
32
|
+
[[ ! -d "$CURRENT_DIR" ]] && { echo "* save_dir: diretório inexistente ... $CURRENT_DIR"; return 1; }
|
|
33
|
+
[[ ! -f "$EXPORT_DIR" ]] && { echo "* save_dir: arquivo inexistente ... $EXPORT_DIR"; return 1; }
|
|
34
|
+
|
|
35
|
+
echo -e "[*] Iniciando cópia dos arquivos *.py ... $CURRENT_DIR"
|
|
36
|
+
|
|
37
|
+
# Encontra todos os .py e concatena
|
|
38
|
+
find "$CURRENT_DIR" -type f -name "*.py" | sort | while read -r file; do
|
|
39
|
+
echo -e "#===[ $(date) FILE: $file ===]\n" >> "$EXPORT_DIR"
|
|
40
|
+
cat "$file" >> "$EXPORT_DIR"
|
|
41
|
+
echo -e "\n\n" >> "$EXPORT_DIR"
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
echo -e "[OK] arquivo gerado: $EXPORT_DIR"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function main(){
|
|
48
|
+
start
|
|
49
|
+
|
|
50
|
+
# 2. Percorre as chaves (diretórios) e acessa os valores (arquivos de saída)
|
|
51
|
+
for dir in "${!MODULOS[@]}"; do
|
|
52
|
+
save_dir "$dir" "${MODULOS[$dir]}"
|
|
53
|
+
done
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
main "$@"
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from .ui import (
|
|
2
|
+
BaseMaterialApp,
|
|
3
|
+
BuildContext,
|
|
4
|
+
PageApp,
|
|
5
|
+
ChangeNotifier,
|
|
6
|
+
CommandNotifier,
|
|
7
|
+
Consumer,
|
|
8
|
+
Element,
|
|
9
|
+
FlutterWidget,
|
|
10
|
+
ConsumerState,
|
|
11
|
+
LayoutData,
|
|
12
|
+
Navigator,
|
|
13
|
+
Provider,
|
|
14
|
+
StatefulWidget,
|
|
15
|
+
StatelessWidget,
|
|
16
|
+
State,
|
|
17
|
+
ValueNotifier,
|
|
18
|
+
ValueListenableBuilder,
|
|
19
|
+
Provider,
|
|
20
|
+
AlignElement,
|
|
21
|
+
Align,
|
|
22
|
+
AppBar,
|
|
23
|
+
BottomNavigationBar,
|
|
24
|
+
Center,
|
|
25
|
+
Card,
|
|
26
|
+
Checkbox,
|
|
27
|
+
CircularProgress,
|
|
28
|
+
Container,
|
|
29
|
+
Divider,
|
|
30
|
+
Drawer,
|
|
31
|
+
Column,
|
|
32
|
+
Row,
|
|
33
|
+
DropdownButton,
|
|
34
|
+
ElevatedButton,
|
|
35
|
+
Flexible,
|
|
36
|
+
Expanded,
|
|
37
|
+
FloatingActionButton,
|
|
38
|
+
Icon,
|
|
39
|
+
IconButton,
|
|
40
|
+
LinearProgress,
|
|
41
|
+
Provider,
|
|
42
|
+
Padding,
|
|
43
|
+
Image,
|
|
44
|
+
ListBuilder,
|
|
45
|
+
MainAxisAlignment,
|
|
46
|
+
CrossAxisAlignment,
|
|
47
|
+
TableView,
|
|
48
|
+
TkMaterialApp,
|
|
49
|
+
Scaffold,
|
|
50
|
+
Text,
|
|
51
|
+
SizedBox,
|
|
52
|
+
Alignment,
|
|
53
|
+
ScrollView,
|
|
54
|
+
GlobalKey,
|
|
55
|
+
TextEditingController,
|
|
56
|
+
TextInput,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
from .theme import (
|
|
60
|
+
ColorScheme,
|
|
61
|
+
CardTheme,
|
|
62
|
+
InputDecorationTheme,
|
|
63
|
+
TextStyle,
|
|
64
|
+
Theme,
|
|
65
|
+
ThemeData,
|
|
66
|
+
ThemeMode,
|
|
67
|
+
ThemeProvider,
|
|
68
|
+
TextTheme,
|
|
69
|
+
make_themed_app,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
from .file_picker import (
|
|
73
|
+
FilePickerController,
|
|
74
|
+
FilePickerResult,
|
|
75
|
+
FilePickerType,
|
|
76
|
+
PlatformFile,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
from pyflutter_ui.ui.list_builder import (
|
|
80
|
+
ScrollableColumn,
|
|
81
|
+
ScrollableColumnElement,
|
|
82
|
+
ScrollableColumnOrProgress,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
from .navigator import NavigatorApp, PageRoute, Route
|
|
86
|
+
from .app import run_app, SnackBar, SnackBarType
|
|
87
|
+
|
|
88
|
+
from .table_widget import TableOrProgress
|
|
89
|
+
from .config_app import AppConfigNotifier, FactoryMapConfig, MapConfig
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# app.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
from enum import Enum, auto
|
|
4
|
+
from tkinter import Tk
|
|
5
|
+
import tkinter as tk
|
|
6
|
+
from typing import Callable, Optional
|
|
7
|
+
|
|
8
|
+
from pyflutter_ui.ui import BuildContext, TkMaterialApp
|
|
9
|
+
from pyflutter_ui.theme import ThemeData, ThemeMode, ThemeProvider, ColorScheme
|
|
10
|
+
from pyflutter_ui.config_app import AppConfigNotifier
|
|
11
|
+
|
|
12
|
+
# ============================================================
|
|
13
|
+
# SNACKBAR
|
|
14
|
+
# ============================================================
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SnackBarType(Enum):
|
|
18
|
+
INFO = auto()
|
|
19
|
+
SUCCESS = auto()
|
|
20
|
+
WARNING = auto()
|
|
21
|
+
ERROR = auto()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SnackBar:
|
|
25
|
+
"""
|
|
26
|
+
Exibe uma mensagem temporária na parte inferior da janela,
|
|
27
|
+
similar ao SnackBar do Flutter.
|
|
28
|
+
|
|
29
|
+
Uso via contexto (recomendado):
|
|
30
|
+
SnackBar.of(context).show("Arquivo salvo!", type=SnackBarType.SUCCESS)
|
|
31
|
+
|
|
32
|
+
Uso direto com root Tk:
|
|
33
|
+
SnackBar.show_on(root, "Erro ao carregar", type=SnackBarType.ERROR)
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
# cores por tipo — funcionam tanto em tema claro quanto escuro
|
|
37
|
+
_COLORS = {
|
|
38
|
+
SnackBarType.INFO: {"bg": "#323232", "fg": "#FFFFFF", "accent": "#90CAF9"},
|
|
39
|
+
SnackBarType.SUCCESS: {"bg": "#1B5E20", "fg": "#FFFFFF", "accent": "#A5D6A7"},
|
|
40
|
+
SnackBarType.WARNING: {"bg": "#E65100", "fg": "#FFFFFF", "accent": "#FFE082"},
|
|
41
|
+
SnackBarType.ERROR: {"bg": "#B71C1C", "fg": "#FFFFFF", "accent": "#EF9A9A"},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_ICONS = {
|
|
45
|
+
SnackBarType.INFO: "ℹ",
|
|
46
|
+
SnackBarType.SUCCESS: "✓",
|
|
47
|
+
SnackBarType.WARNING: "⚠",
|
|
48
|
+
SnackBarType.ERROR: "✕",
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def __init__(self, root: tk.Tk) -> None:
|
|
52
|
+
self._root = root
|
|
53
|
+
self._current: Optional[tk.Toplevel] = None
|
|
54
|
+
self._after_id: Optional[str] = None
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def of(cls, context: BuildContext) -> SnackBar:
|
|
58
|
+
"""Obtém o SnackBar a partir de um BuildContext."""
|
|
59
|
+
root = context.app.get_root()
|
|
60
|
+
# reutiliza instância já anexada ao root
|
|
61
|
+
if not hasattr(root, "_snackbar"):
|
|
62
|
+
root._snackbar = cls(root)
|
|
63
|
+
return root._snackbar
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def show_on(
|
|
67
|
+
cls,
|
|
68
|
+
root: tk.Tk,
|
|
69
|
+
message: str,
|
|
70
|
+
*,
|
|
71
|
+
type: SnackBarType = SnackBarType.INFO,
|
|
72
|
+
duration: int = 3000,
|
|
73
|
+
action_label: Optional[str] = None,
|
|
74
|
+
on_action: Optional[Callable[[], None]] = None,
|
|
75
|
+
) -> None:
|
|
76
|
+
"""Atalho estático: não precisa instanciar."""
|
|
77
|
+
if not hasattr(root, "_snackbar"):
|
|
78
|
+
root._snackbar = cls(root)
|
|
79
|
+
root._snackbar.show(
|
|
80
|
+
message,
|
|
81
|
+
type=type,
|
|
82
|
+
duration=duration,
|
|
83
|
+
action_label=action_label,
|
|
84
|
+
on_action=on_action,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def show(
|
|
88
|
+
self,
|
|
89
|
+
message: str,
|
|
90
|
+
*,
|
|
91
|
+
type: SnackBarType = SnackBarType.INFO,
|
|
92
|
+
duration: int = 3000,
|
|
93
|
+
action_label: Optional[str] = None,
|
|
94
|
+
on_action: Optional[Callable[[], None]] = None,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Exibe o SnackBar. Descarta o anterior se ainda estiver visível."""
|
|
97
|
+
self._dismiss()
|
|
98
|
+
|
|
99
|
+
colors = self._COLORS[type]
|
|
100
|
+
icon = self._ICONS[type]
|
|
101
|
+
|
|
102
|
+
# ── janela sem borda flutuando sobre o root ──────────
|
|
103
|
+
popup = tk.Toplevel(self._root)
|
|
104
|
+
popup.title("Aviso")
|
|
105
|
+
popup.geometry("400x50")
|
|
106
|
+
popup.overrideredirect(True) # sem barra de título
|
|
107
|
+
popup.attributes("-topmost", True)
|
|
108
|
+
popup.configure(bg=colors["bg"])
|
|
109
|
+
|
|
110
|
+
self._current = popup
|
|
111
|
+
|
|
112
|
+
# ── frame interno com padding ─────────────────────────
|
|
113
|
+
frame = tk.Frame(popup, bg=colors["bg"], padx=12, pady=10)
|
|
114
|
+
frame.pack(fill="both", expand=True)
|
|
115
|
+
|
|
116
|
+
# ícone
|
|
117
|
+
tk.Label(
|
|
118
|
+
frame,
|
|
119
|
+
text=icon,
|
|
120
|
+
bg=colors["bg"],
|
|
121
|
+
fg=colors["accent"],
|
|
122
|
+
font=("Helvetica", 14, "bold"),
|
|
123
|
+
).pack(side="left", padx=(0, 8))
|
|
124
|
+
|
|
125
|
+
# mensagem
|
|
126
|
+
tk.Label(
|
|
127
|
+
frame,
|
|
128
|
+
text=message,
|
|
129
|
+
bg=colors["bg"],
|
|
130
|
+
fg=colors["fg"],
|
|
131
|
+
font=("Helvetica", 10),
|
|
132
|
+
wraplength=360,
|
|
133
|
+
justify="left",
|
|
134
|
+
anchor="w",
|
|
135
|
+
).pack(side="left", fill="x", expand=True)
|
|
136
|
+
|
|
137
|
+
# botão de ação opcional (ex.: "DESFAZER")
|
|
138
|
+
if action_label and on_action:
|
|
139
|
+
|
|
140
|
+
def _action():
|
|
141
|
+
on_action()
|
|
142
|
+
self._dismiss()
|
|
143
|
+
|
|
144
|
+
tk.Button(
|
|
145
|
+
frame,
|
|
146
|
+
text=action_label.upper(),
|
|
147
|
+
bg=colors["bg"],
|
|
148
|
+
fg=colors["accent"],
|
|
149
|
+
font=("Helvetica", 9, "bold"),
|
|
150
|
+
relief="flat",
|
|
151
|
+
cursor="hand2",
|
|
152
|
+
bd=0,
|
|
153
|
+
highlightthickness=0,
|
|
154
|
+
command=_action,
|
|
155
|
+
).pack(side="right", padx=(12, 0))
|
|
156
|
+
|
|
157
|
+
# botão X para fechar manualmente
|
|
158
|
+
tk.Button(
|
|
159
|
+
frame,
|
|
160
|
+
text="✕",
|
|
161
|
+
bg=colors["bg"],
|
|
162
|
+
fg=colors["fg"],
|
|
163
|
+
font=("Helvetica", 8),
|
|
164
|
+
relief="flat",
|
|
165
|
+
cursor="hand2",
|
|
166
|
+
bd=0,
|
|
167
|
+
highlightthickness=0,
|
|
168
|
+
command=self._dismiss,
|
|
169
|
+
).pack(side="right", padx=(8, 0))
|
|
170
|
+
|
|
171
|
+
# ── posicionamento: canto inferior esquerdo do root ──
|
|
172
|
+
popup.update_idletasks()
|
|
173
|
+
self._reposition(popup)
|
|
174
|
+
|
|
175
|
+
# reposiciona se o root for movido ou redimensionado
|
|
176
|
+
self._root.bind("<Configure>", lambda e: self._reposition(popup), add="+")
|
|
177
|
+
|
|
178
|
+
# ── animação de entrada (slide up) ───────────────────
|
|
179
|
+
self._animate_in(popup)
|
|
180
|
+
|
|
181
|
+
# ── auto-dismiss ──────────────────────────────────────
|
|
182
|
+
if duration > 0:
|
|
183
|
+
self._after_id = self._root.after(duration, self._dismiss)
|
|
184
|
+
|
|
185
|
+
def _reposition(self, popup: tk.Toplevel) -> None:
|
|
186
|
+
if popup is None or not popup.winfo_exists():
|
|
187
|
+
return
|
|
188
|
+
|
|
189
|
+
root = self._root
|
|
190
|
+
rx = root.winfo_x()
|
|
191
|
+
ry = root.winfo_y()
|
|
192
|
+
rw = root.winfo_width()
|
|
193
|
+
rh = root.winfo_height()
|
|
194
|
+
|
|
195
|
+
pw = popup.winfo_width()
|
|
196
|
+
ph = popup.winfo_height()
|
|
197
|
+
|
|
198
|
+
margin = 16
|
|
199
|
+
x = rx + margin
|
|
200
|
+
y = ry + rh - ph - margin
|
|
201
|
+
|
|
202
|
+
popup.geometry(f"+{x}+{y}")
|
|
203
|
+
|
|
204
|
+
def _animate_in(self, popup: tk.Toplevel, steps: int = 8) -> None:
|
|
205
|
+
"""Desliza o popup de baixo para cima em `steps` passos."""
|
|
206
|
+
if not popup.winfo_exists():
|
|
207
|
+
return
|
|
208
|
+
|
|
209
|
+
root = self._root
|
|
210
|
+
rh = root.winfo_height()
|
|
211
|
+
ry = root.winfo_y()
|
|
212
|
+
ph = popup.winfo_reqheight()
|
|
213
|
+
margin = 16
|
|
214
|
+
|
|
215
|
+
target_y = ry + rh - ph - margin
|
|
216
|
+
start_y = ry + rh # começa fora da janela
|
|
217
|
+
|
|
218
|
+
def _step(current_y: int, step: int) -> None:
|
|
219
|
+
if not popup.winfo_exists():
|
|
220
|
+
return
|
|
221
|
+
if step >= steps:
|
|
222
|
+
popup.geometry(f"+{popup.winfo_x()}+{target_y}")
|
|
223
|
+
return
|
|
224
|
+
new_y = current_y + (target_y - current_y) // 2
|
|
225
|
+
popup.geometry(f"+{popup.winfo_x()}+{new_y}")
|
|
226
|
+
popup.after(16, lambda: _step(new_y, step + 1))
|
|
227
|
+
|
|
228
|
+
popup.geometry(f"+{popup.winfo_x()}+{start_y}")
|
|
229
|
+
_step(start_y, 0)
|
|
230
|
+
|
|
231
|
+
def _dismiss(self) -> None:
|
|
232
|
+
if self._after_id:
|
|
233
|
+
self._root.after_cancel(self._after_id)
|
|
234
|
+
self._after_id = None
|
|
235
|
+
|
|
236
|
+
if self._current and self._current.winfo_exists():
|
|
237
|
+
self._animate_out(self._current)
|
|
238
|
+
self._current = None
|
|
239
|
+
|
|
240
|
+
def _animate_out(self, popup: tk.Toplevel, steps: int = 6) -> None:
|
|
241
|
+
"""Desliza o popup para baixo antes de destruir."""
|
|
242
|
+
if not popup.winfo_exists():
|
|
243
|
+
return
|
|
244
|
+
|
|
245
|
+
root = self._root
|
|
246
|
+
rh = root.winfo_height()
|
|
247
|
+
ry = root.winfo_y()
|
|
248
|
+
target = ry + rh + 10 # fora da janela
|
|
249
|
+
|
|
250
|
+
def _step(current_y: int, step: int) -> None:
|
|
251
|
+
if not popup.winfo_exists():
|
|
252
|
+
return
|
|
253
|
+
if step >= steps:
|
|
254
|
+
popup.destroy()
|
|
255
|
+
return
|
|
256
|
+
new_y = current_y + (target - current_y) // 2 + 2
|
|
257
|
+
popup.geometry(f"+{popup.winfo_x()}+{new_y}")
|
|
258
|
+
popup.after(16, lambda: _step(new_y, step + 1))
|
|
259
|
+
|
|
260
|
+
_step(popup.winfo_y(), 0)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def create_theme_provider(mode: ThemeMode = ThemeMode.DARK) -> ThemeProvider:
|
|
264
|
+
|
|
265
|
+
return ThemeProvider(
|
|
266
|
+
light_theme=ThemeData.light(color_scheme=ColorScheme.light()),
|
|
267
|
+
dark_theme=ThemeData.dark(color_scheme=ColorScheme.dark()),
|
|
268
|
+
mode=mode,
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def include_theme_app(app: TkMaterialApp) -> TkMaterialApp:
|
|
273
|
+
|
|
274
|
+
if app._root is None:
|
|
275
|
+
app._root = Tk()
|
|
276
|
+
|
|
277
|
+
try:
|
|
278
|
+
notifier: ThemeProvider = app.read_state(ThemeProvider)
|
|
279
|
+
notifier.attach_root(app.get_root())
|
|
280
|
+
except KeyError as e:
|
|
281
|
+
print(f"ThemeProvider não registrado: {e}")
|
|
282
|
+
|
|
283
|
+
# NÃO fazer push(app.home) aqui: TkMaterialApp.run() já faz.
|
|
284
|
+
return app
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def run_app(app: TkMaterialApp) -> None:
|
|
288
|
+
mode = ThemeMode.DARK
|
|
289
|
+
try:
|
|
290
|
+
mode = app.read_state(AppConfigNotifier).value.theme_mode
|
|
291
|
+
except KeyError:
|
|
292
|
+
pass # config não registrado: usa o padrão
|
|
293
|
+
|
|
294
|
+
app.register_notifier(create_theme_provider(mode))
|
|
295
|
+
include_theme_app(app).run()
|