pyflutter-app 0.3.6__tar.gz → 0.3.10__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_app-0.3.6 → pyflutter_app-0.3.10}/PKG-INFO +1 -1
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/cartas/__init__.py +1 -1
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/cartas/origin.py +1 -1
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/config_app.py +24 -28
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/home_page/view.py +187 -143
- pyflutter_app-0.3.10/converter/page_circuit/__init__.py +20 -0
- pyflutter_app-0.3.10/converter/page_circuit/common.py +99 -0
- pyflutter_app-0.3.10/converter/page_circuit/controller_circuit.py +359 -0
- pyflutter_app-0.3.10/converter/page_circuit/model_circuit.py +110 -0
- pyflutter_app-0.3.10/converter/page_circuit/service.py +356 -0
- pyflutter_app-0.3.10/converter/page_circuit/view_circuit.py +208 -0
- pyflutter_app-0.3.10/converter/page_image/__init__.py +4 -0
- pyflutter_app-0.3.10/converter/page_image/common.py +130 -0
- pyflutter_app-0.3.10/converter/page_image/controller_image.py +285 -0
- pyflutter_app-0.3.10/converter/page_image/model_image.py +95 -0
- pyflutter_app-0.3.10/converter/page_image/renderer.py +92 -0
- pyflutter_app-0.3.10/converter/page_image/view_image.py +188 -0
- pyflutter_app-0.3.10/converter/page_image/widgets.py +363 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/run_app_convert.py +13 -11
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/util.py +13 -17
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/new-export_app.sh +10 -3
- {pyflutter_app-0.3.6/ocrlib → pyflutter_app-0.3.10/ocr_stream}/__init__.py +3 -3
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyproject.toml +1 -1
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/uv.lock +1 -1
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/whatsapp_files/__init__.py +1 -1
- pyflutter_app-0.3.6/test_claude.py +0 -505
- pyflutter_app-0.3.6/teste_ocr.py +0 -28
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.gitignore +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/.gitignore +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/inspectionProfiles/Project_Default.xml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/misc.xml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/modules.xml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/pyflutter_app.iml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/.idea/vcs.xml +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/README.md +0 -0
- {pyflutter_app-0.3.6/pdflib → pyflutter_app-0.3.10/convert_stream}/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/__main__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/assets/forms_config.json +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/home_page/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/home_page/_page_edit.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/home_page/controller.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/home_page/model.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/lib_toi.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/Diagnorstico.txt +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/common.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/config.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/controller_forms.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/diagnose_forms.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/master_forms.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/model_forms.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/service.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/page_forms/view_forms.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/table_widget.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/whatsapp/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/converter/whatsapp/model.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/local_build/linux.sh +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/local_build/send.sh +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/main.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/mvc/controller.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/mvc/model.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/mvc/view.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/app.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/file_picker.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/navigator.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/scheduler.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/theme.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/buttons.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/container.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/core.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/list_builder.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/progress.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/tables.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/pyflutter_ui/ui/widgets.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/table_stream/__init__.py +0 -0
- {pyflutter_app-0.3.6 → pyflutter_app-0.3.10}/update.sh +0 -0
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from dataclasses import dataclass
|
|
3
|
-
|
|
4
|
-
from table_stream.sysfiles import File, Directory, UserFileSystem, JsonConvert
|
|
5
|
-
from table_stream import HashMapDict
|
|
3
|
+
from table_stream import File, Directory, UserFileSystem, JsonConvert, HashMapDict
|
|
6
4
|
from pyflutter_ui.theme import ThemeMode
|
|
7
5
|
from pyflutter_ui.ui.core import ValueNotifier
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
@dataclass
|
|
11
9
|
class MapConfig:
|
|
12
|
-
|
|
13
|
-
initial_dir: Directory
|
|
10
|
+
|
|
11
|
+
initial_dir: Directory
|
|
14
12
|
last_dir: Directory
|
|
15
13
|
work_dir: Directory
|
|
16
14
|
documents_dir: Directory
|
|
17
15
|
theme_mode: ThemeMode
|
|
18
|
-
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
|
|
21
18
|
class FactoryMapConfig(object):
|
|
22
|
-
|
|
19
|
+
|
|
23
20
|
def __init__(self) -> None:
|
|
24
21
|
self._conf: MapConfig = MapConfig(
|
|
25
22
|
initial_dir=UserFileSystem().get_user_downloads(),
|
|
@@ -28,10 +25,10 @@ class FactoryMapConfig(object):
|
|
|
28
25
|
documents_dir=UserFileSystem().get_user_downloads().concat("RFA", True),
|
|
29
26
|
theme_mode=ThemeMode.DARK,
|
|
30
27
|
)
|
|
31
|
-
|
|
28
|
+
|
|
32
29
|
def create_default(self) -> MapConfig:
|
|
33
30
|
return self._conf
|
|
34
|
-
|
|
31
|
+
|
|
35
32
|
def create_from_dict(self, h: HashMapDict[str, str]) -> MapConfig:
|
|
36
33
|
if h.header().contains("initial_dir"):
|
|
37
34
|
self._conf.initial_dir = Directory(h["initial_dir"])
|
|
@@ -47,36 +44,36 @@ class FactoryMapConfig(object):
|
|
|
47
44
|
else:
|
|
48
45
|
self._conf.theme_mode = ThemeMode.SYSTEM
|
|
49
46
|
return self._conf
|
|
50
|
-
|
|
47
|
+
|
|
51
48
|
def create_from_file(self, file_json: File) -> MapConfig:
|
|
52
49
|
converter = JsonConvert.from_file(file_json)
|
|
53
50
|
map_data = converter.data.to_dict()
|
|
54
51
|
return self.create_from_dict(HashMapDict(map_data))
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
|
|
53
|
+
|
|
57
54
|
class AppConfigNotifier(ValueNotifier[MapConfig]):
|
|
58
|
-
|
|
55
|
+
|
|
59
56
|
file_config: File = UserFileSystem().cache_dir().join_file("RFA-config.json")
|
|
60
|
-
|
|
57
|
+
|
|
61
58
|
def __init__(self, value: MapConfig = FactoryMapConfig().create_default()) -> None:
|
|
62
59
|
super().__init__(value)
|
|
63
|
-
#self._file_config: File = self.value.work_dir.concat("config", True).join_file("app_config.json")
|
|
64
|
-
|
|
60
|
+
# self._file_config: File = self.value.work_dir.concat("config", True).join_file("app_config.json")
|
|
61
|
+
|
|
65
62
|
def set_work_dir(self, d: Directory):
|
|
66
63
|
self._value.work_dir = d
|
|
67
64
|
self.notify_listeners()
|
|
68
|
-
|
|
65
|
+
|
|
69
66
|
def set_initial_dir(self, d: Directory):
|
|
70
67
|
self._value.initial_dir = d
|
|
71
68
|
self.notify_listeners()
|
|
72
|
-
|
|
69
|
+
|
|
73
70
|
def set_documents_dir(self, d: Directory):
|
|
74
71
|
self._value.documents_dir = d
|
|
75
72
|
self.notify_listeners()
|
|
76
|
-
|
|
73
|
+
|
|
77
74
|
def get_file_config(self) -> File:
|
|
78
75
|
return AppConfigNotifier.file_config
|
|
79
|
-
|
|
76
|
+
|
|
80
77
|
def get_dict_config(self) -> dict[str, str]:
|
|
81
78
|
final = dict()
|
|
82
79
|
final["initial_dir"] = self.value.initial_dir.absolute()
|
|
@@ -85,29 +82,28 @@ class AppConfigNotifier(ValueNotifier[MapConfig]):
|
|
|
85
82
|
final["documents_dir"] = self.value.documents_dir.absolute()
|
|
86
83
|
final["theme_mode"] = self.value.theme_mode.value
|
|
87
84
|
return final
|
|
88
|
-
|
|
85
|
+
|
|
89
86
|
def save_config(self):
|
|
90
87
|
converter = JsonConvert.from_dict(self.get_dict_config())
|
|
91
88
|
converter.data.to_file(self.get_file_config())
|
|
92
|
-
print(f
|
|
89
|
+
print(f"Configurações salvas em ... {self.get_file_config().absolute()}")
|
|
93
90
|
|
|
94
91
|
def notify_listeners(self) -> None:
|
|
95
92
|
"""
|
|
96
|
-
|
|
93
|
+
Salvar a nova configuração em arquivo local e notificar os observadores.
|
|
97
94
|
"""
|
|
98
95
|
self.save_config()
|
|
99
96
|
return super().notify_listeners()
|
|
100
|
-
|
|
97
|
+
|
|
101
98
|
@classmethod
|
|
102
99
|
def create(cls) -> AppConfigNotifier:
|
|
103
100
|
src = Directory(cls.file_config.dirname())
|
|
104
101
|
src.mkdir()
|
|
105
|
-
|
|
102
|
+
|
|
106
103
|
config: MapConfig
|
|
107
104
|
if cls.file_config.exists():
|
|
108
|
-
print(f
|
|
105
|
+
print(f"Lendo configração em ... {cls.file_config.absolute()}")
|
|
109
106
|
config = FactoryMapConfig().create_from_file(cls.file_config)
|
|
110
107
|
else:
|
|
111
108
|
config = FactoryMapConfig().create_default()
|
|
112
109
|
return cls(config)
|
|
113
|
-
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
from pyflutter_ui import (
|
|
2
|
-
ChangeNotifier,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
ChangeNotifier,
|
|
3
|
+
BuildContext,
|
|
4
|
+
FlutterWidget,
|
|
5
|
+
LinearProgress,
|
|
6
|
+
StatelessWidget,
|
|
7
|
+
Consumer,
|
|
8
|
+
Column,
|
|
9
|
+
Row,
|
|
10
|
+
ElevatedButton,
|
|
11
|
+
Expanded,
|
|
12
|
+
Divider,
|
|
13
|
+
MainAxisAlignment,
|
|
14
|
+
Scaffold,
|
|
15
|
+
Text,
|
|
16
|
+
ValueListenableBuilder,
|
|
17
|
+
Provider,
|
|
18
|
+
DropdownButton,
|
|
19
|
+
FilePickerController,
|
|
20
|
+
FilePickerResult,
|
|
21
|
+
FilePickerType,
|
|
22
|
+
PlatformFile,
|
|
7
23
|
)
|
|
8
24
|
|
|
9
25
|
from tkinter import messagebox
|
|
@@ -12,22 +28,29 @@ import pandas as pd
|
|
|
12
28
|
from pandas import DataFrame
|
|
13
29
|
|
|
14
30
|
|
|
15
|
-
from table_stream
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
from table_stream import (
|
|
32
|
+
ArrayList,
|
|
33
|
+
HashMapDict,
|
|
34
|
+
csvEncoding,
|
|
35
|
+
csvSeparator,
|
|
36
|
+
File,
|
|
37
|
+
Directory,
|
|
38
|
+
)
|
|
18
39
|
|
|
19
40
|
from converter.home_page.controller import ControllerHomePage
|
|
20
41
|
from converter.table_widget import TableOrProgress
|
|
21
42
|
from converter.home_page._page_edit import PageEditExcel
|
|
22
43
|
|
|
23
|
-
# Páginas
|
|
44
|
+
# Páginas para navegação.
|
|
24
45
|
from converter.page_forms import PageRespondsForms
|
|
25
46
|
from converter.page_forms import ControllerForms
|
|
26
47
|
from converter.config_app import MapConfig, AppConfigNotifier
|
|
48
|
+
from converter.page_image import PageImage
|
|
49
|
+
from converter.page_circuit import PageCircuit
|
|
27
50
|
|
|
28
51
|
|
|
29
52
|
class HomePage(StatelessWidget):
|
|
30
|
-
|
|
53
|
+
|
|
31
54
|
def __init__(self, key: str | None = None) -> None:
|
|
32
55
|
super().__init__(key)
|
|
33
56
|
|
|
@@ -36,20 +59,20 @@ class HomePage(StatelessWidget):
|
|
|
36
59
|
|
|
37
60
|
|
|
38
61
|
class _HomePageState(StatelessWidget):
|
|
39
|
-
|
|
62
|
+
|
|
40
63
|
def __init__(self, key: str | None = None) -> None:
|
|
41
64
|
super().__init__(key)
|
|
42
65
|
self.context: BuildContext = None
|
|
43
|
-
|
|
44
|
-
initial_dir: Directory = self.app_config.value.initial_dir
|
|
45
|
-
|
|
66
|
+
|
|
67
|
+
initial_dir: Directory = self.app_config.value.initial_dir
|
|
68
|
+
|
|
46
69
|
self._pick = FilePickerController(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
type=FilePickerType.spreadsheet,
|
|
71
|
+
allow_multiple=True,
|
|
72
|
+
dialog_title="Escolha Planilhas",
|
|
73
|
+
initial_directory=initial_dir.absolute() if initial_dir.exists() else None,
|
|
74
|
+
)
|
|
75
|
+
|
|
53
76
|
self.mapping_csv_sep = HashMapDict[str, csvSeparator](
|
|
54
77
|
{
|
|
55
78
|
"tabulação": "\t",
|
|
@@ -58,102 +81,106 @@ class _HomePageState(StatelessWidget):
|
|
|
58
81
|
"virgula": ",",
|
|
59
82
|
}
|
|
60
83
|
)
|
|
61
|
-
self.mapping_csv_enc = HashMapDict[str, csvEncoding](
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
84
|
+
self.mapping_csv_enc = HashMapDict[str, csvEncoding](
|
|
85
|
+
{
|
|
86
|
+
"utf8": "utf-8",
|
|
87
|
+
"cp1252": "cp1252",
|
|
88
|
+
"iso-8859-1": "iso-8859-1",
|
|
89
|
+
"latin": "latin1",
|
|
90
|
+
}
|
|
91
|
+
)
|
|
67
92
|
|
|
68
93
|
self.controller.show_error = self.show_error
|
|
69
94
|
self.controller.show_msg = self.show_message
|
|
70
|
-
|
|
95
|
+
|
|
71
96
|
@property
|
|
72
97
|
def app_config(self) -> AppConfigNotifier:
|
|
73
98
|
state = Provider.read(AppConfigNotifier)
|
|
74
99
|
return state
|
|
75
|
-
|
|
100
|
+
|
|
76
101
|
@property
|
|
77
102
|
def controller(self) -> ControllerHomePage:
|
|
78
103
|
return Provider.read(ControllerHomePage)
|
|
79
|
-
|
|
104
|
+
|
|
80
105
|
def file_picker_excel(self, controller: ControllerHomePage):
|
|
81
106
|
"""
|
|
82
107
|
Selecionar um ou mais arquivos/planilhas e empilhar junto com
|
|
83
108
|
os arquivos escolhidos anteriormente.
|
|
84
109
|
"""
|
|
85
|
-
|
|
110
|
+
|
|
86
111
|
result: FilePickerResult = self._pick.pick_files()
|
|
87
112
|
if result is None:
|
|
88
113
|
return
|
|
89
|
-
|
|
114
|
+
|
|
90
115
|
self.app_config.set_initial_dir(Directory(self._pick.initial_directory))
|
|
91
|
-
|
|
116
|
+
|
|
92
117
|
files: list[PlatformFile] = result.files
|
|
93
118
|
final_files: ArrayList[File] = ArrayList()
|
|
94
|
-
|
|
119
|
+
|
|
95
120
|
f: PlatformFile
|
|
96
121
|
for f in files:
|
|
97
122
|
final_files.append(File(f.path))
|
|
98
123
|
controller.add_files(final_files)
|
|
99
|
-
|
|
124
|
+
|
|
100
125
|
if controller.get_file_sheet() is None:
|
|
101
126
|
controller.set_file_sheet(controller.files.get_first())
|
|
102
|
-
|
|
127
|
+
|
|
103
128
|
def show_message(self, txt: str):
|
|
104
129
|
messagebox.showinfo("Aviso", txt)
|
|
105
130
|
|
|
106
131
|
def show_error(self, e: str):
|
|
107
132
|
messagebox.showerror("Erro", e)
|
|
108
|
-
|
|
133
|
+
|
|
109
134
|
def action_selected_file(self, name: str):
|
|
110
135
|
"""Alterar o arquivo selecionado no controller"""
|
|
111
136
|
if self.controller.running:
|
|
112
137
|
self.show_error("Existe outra operação em andamento")
|
|
113
138
|
return
|
|
114
|
-
|
|
139
|
+
|
|
115
140
|
value: HashMapDict = self.controller.files_notifier.value
|
|
116
141
|
|
|
117
142
|
if not value.header().contains(name):
|
|
118
|
-
msg = f
|
|
143
|
+
msg = f"O arquivo {name} NÃO foi importado!"
|
|
119
144
|
self.show_message(msg)
|
|
120
145
|
return
|
|
121
|
-
|
|
146
|
+
|
|
122
147
|
current_file = value.get_value(name)
|
|
123
|
-
self.controller.set_file_sheet(current_file)
|
|
124
|
-
|
|
148
|
+
self.controller.set_file_sheet(current_file)
|
|
149
|
+
|
|
125
150
|
def action_selected_sheet_name(self, name: str):
|
|
126
151
|
if self.controller.running:
|
|
127
152
|
messagebox.showerror("Erro", "Existe outra operação em andamento")
|
|
128
153
|
controller: ControllerHomePage = self.controller
|
|
129
154
|
controller.sheet_name = name
|
|
130
|
-
|
|
155
|
+
|
|
131
156
|
def action_clear_data(self, context: BuildContext):
|
|
132
157
|
self.controller.data_notifier.clear()
|
|
133
158
|
self.controller.notify_listeners()
|
|
134
|
-
|
|
159
|
+
|
|
135
160
|
def action_btn_load_data(self, context: BuildContext):
|
|
136
161
|
"""
|
|
137
|
-
|
|
162
|
+
Ação do botão para ler Dados
|
|
138
163
|
"""
|
|
139
164
|
if self.controller.running:
|
|
140
165
|
messagebox.showerror("Erro", "Existe outra operação em andamento")
|
|
141
|
-
|
|
166
|
+
|
|
142
167
|
if self.controller.get_file_sheet() is None:
|
|
143
168
|
messagebox.showerror("Falha", "Selecione planilhas para prosseguir")
|
|
144
169
|
return
|
|
145
|
-
|
|
170
|
+
|
|
146
171
|
self.controller.command_load_data()
|
|
147
|
-
|
|
172
|
+
|
|
148
173
|
def action_csv_separator(self, name: str):
|
|
149
174
|
self.controller.csv_options.separator = self.mapping_csv_sep.get_value(name)
|
|
150
|
-
|
|
175
|
+
|
|
151
176
|
def action_csv_enc(self, name: str):
|
|
152
177
|
self.controller.csv_options.encoding = self.mapping_csv_enc.get_value(name)
|
|
153
|
-
|
|
154
|
-
def _builder_list_files(
|
|
178
|
+
|
|
179
|
+
def _builder_list_files(
|
|
180
|
+
self, context: BuildContext, map_files: HashMapDict[str, File]
|
|
181
|
+
):
|
|
155
182
|
"""Gerar o widget que exibe a lista de arquivos selecionados"""
|
|
156
|
-
|
|
183
|
+
|
|
157
184
|
if map_files.header().size() < 1:
|
|
158
185
|
return Text("Nenhum arquivo selecionado")
|
|
159
186
|
|
|
@@ -166,73 +193,79 @@ class _HomePageState(StatelessWidget):
|
|
|
166
193
|
|
|
167
194
|
return Row(
|
|
168
195
|
children=[
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
def _builder_sheet_names(
|
|
196
|
+
Text(f"({map_files.header().size()})"),
|
|
197
|
+
Divider(orientation="horizontal"),
|
|
198
|
+
Expanded(
|
|
199
|
+
DropdownButton(
|
|
200
|
+
map_files.header(),
|
|
201
|
+
file_name,
|
|
202
|
+
on_changed=self.action_selected_file,
|
|
203
|
+
)
|
|
204
|
+
),
|
|
205
|
+
]
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
def _builder_sheet_names(
|
|
209
|
+
self, context: BuildContext, controller: ControllerHomePage
|
|
210
|
+
):
|
|
182
211
|
"""Exibe a lista de abas da planilha selecionada"""
|
|
183
212
|
if controller.sheet_name is None:
|
|
184
213
|
return Text("Nenhuma aba carregada!")
|
|
185
|
-
|
|
214
|
+
|
|
186
215
|
return DropdownButton(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def _build_table(
|
|
216
|
+
controller.sheet_names,
|
|
217
|
+
controller.sheet_name,
|
|
218
|
+
on_changed=self.action_selected_sheet_name,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
def _build_table(
|
|
222
|
+
self, context: BuildContext, controller: ControllerHomePage
|
|
223
|
+
) -> TableOrProgress:
|
|
193
224
|
"""Exibe os dados do DataFrame atual"""
|
|
194
|
-
|
|
195
|
-
|
|
225
|
+
|
|
196
226
|
data = controller.data_notifier.value
|
|
197
227
|
if data.empty:
|
|
198
|
-
data = pd.DataFrame({
|
|
199
|
-
|
|
228
|
+
data = pd.DataFrame({"A": ["Tabela vazia"]})
|
|
229
|
+
|
|
200
230
|
return TableOrProgress(
|
|
201
231
|
running=controller.data_notifier.running,
|
|
202
232
|
df=data.head(),
|
|
203
233
|
)
|
|
204
|
-
|
|
234
|
+
|
|
205
235
|
def action_open_forms(self, context: BuildContext, controller: ControllerHomePage):
|
|
206
236
|
"""
|
|
207
237
|
Seta o DataFrame() da página atual como propriedade do ControllerForms()
|
|
208
238
|
antes de carregar a página.
|
|
209
239
|
"""
|
|
210
|
-
#df = controller.data_notifier.value
|
|
211
|
-
#forms_controller: ControllerForms = context.read(ControllerForms)
|
|
212
|
-
#forms_controller.set_data(df)
|
|
213
|
-
#if not forms_controller.forms_state.data_is_valid():
|
|
240
|
+
# df = controller.data_notifier.value
|
|
241
|
+
# forms_controller: ControllerForms = context.read(ControllerForms)
|
|
242
|
+
# forms_controller.set_data(df)
|
|
243
|
+
# if not forms_controller.forms_state.data_is_valid():
|
|
214
244
|
# messagebox.showerror("Erro", "Tabela TOI inválida")
|
|
215
245
|
# return
|
|
216
|
-
|
|
246
|
+
|
|
217
247
|
context.navigator.push(PageRespondsForms())
|
|
218
|
-
|
|
219
|
-
def _builder_body(
|
|
248
|
+
|
|
249
|
+
def _builder_body(
|
|
250
|
+
self, context: BuildContext, controller: ControllerHomePage
|
|
251
|
+
) -> FlutterWidget:
|
|
220
252
|
self.context = context
|
|
221
|
-
|
|
253
|
+
|
|
222
254
|
filename = controller.get_file_sheet()
|
|
223
255
|
if filename is not None:
|
|
224
256
|
filename = filename.basename()
|
|
225
|
-
|
|
257
|
+
|
|
226
258
|
return Column(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
children=[
|
|
260
|
+
# -----------------------------------#
|
|
261
|
+
# Topo - importação de arquivos.
|
|
262
|
+
Row(
|
|
231
263
|
children=[
|
|
232
264
|
ElevatedButton(
|
|
233
|
-
"Selecionar planilha",
|
|
265
|
+
"Selecionar planilha",
|
|
266
|
+
on_pressed=lambda: self.file_picker_excel(controller),
|
|
234
267
|
),
|
|
235
|
-
Divider(orientation=
|
|
268
|
+
Divider(orientation="horizontal"),
|
|
236
269
|
# Lista de arquivos importados
|
|
237
270
|
ValueListenableBuilder[HashMapDict[str, File]](
|
|
238
271
|
controller.files_notifier, self._builder_list_files
|
|
@@ -240,67 +273,78 @@ class _HomePageState(StatelessWidget):
|
|
|
240
273
|
Divider(),
|
|
241
274
|
# Lista de abas da planilha selecionada.
|
|
242
275
|
Consumer(
|
|
243
|
-
ControllerHomePage,
|
|
276
|
+
ControllerHomePage,
|
|
277
|
+
self._builder_sheet_names,
|
|
244
278
|
),
|
|
245
279
|
],
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
280
|
+
), ## Row
|
|
281
|
+
# Limpar/Carregar dados - opções CSV.
|
|
282
|
+
Row(
|
|
283
|
+
[
|
|
284
|
+
ElevatedButton(
|
|
285
|
+
"Limpar", lambda: self.action_clear_data(context)
|
|
286
|
+
),
|
|
287
|
+
ElevatedButton(
|
|
288
|
+
"Carregar", lambda: self.action_btn_load_data(context)
|
|
289
|
+
),
|
|
290
|
+
Divider(orientation="horizontal"),
|
|
291
|
+
Column(
|
|
292
|
+
[
|
|
293
|
+
Text("Separador"),
|
|
294
|
+
DropdownButton(
|
|
257
295
|
self.mapping_csv_sep.header(),
|
|
258
296
|
"tabulação",
|
|
259
297
|
on_changed=self.action_csv_separator,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
298
|
+
),
|
|
299
|
+
]
|
|
300
|
+
), ## Column
|
|
301
|
+
Column(
|
|
302
|
+
[
|
|
303
|
+
Text("Encoding"),
|
|
304
|
+
DropdownButton(
|
|
267
305
|
self.mapping_csv_enc.header(),
|
|
268
306
|
"utf8",
|
|
269
307
|
on_changed=self.action_csv_enc,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
308
|
+
),
|
|
309
|
+
]
|
|
310
|
+
), ## Column
|
|
311
|
+
],
|
|
312
|
+
main_axis_alignment=MainAxisAlignment.START,
|
|
313
|
+
), ## Row
|
|
314
|
+
Divider(),
|
|
315
|
+
Expanded(Consumer(ControllerHomePage, self._build_table)),
|
|
316
|
+
Row(
|
|
317
|
+
[
|
|
318
|
+
Text("Ir para: "),
|
|
319
|
+
ElevatedButton(
|
|
320
|
+
"Edição de dados",
|
|
321
|
+
lambda: context.navigator.push(PageEditExcel()),
|
|
322
|
+
),
|
|
323
|
+
# ElevatedButton("Exportar dados", lambda: print()),
|
|
324
|
+
ElevatedButton(
|
|
325
|
+
"Responds Forms",
|
|
326
|
+
lambda: self.action_open_forms(context, controller),
|
|
327
|
+
),
|
|
328
|
+
ElevatedButton(
|
|
329
|
+
"Renomear imagens",
|
|
330
|
+
lambda: context.navigator.push(PageImage()),
|
|
331
|
+
),
|
|
332
|
+
ElevatedButton(
|
|
333
|
+
"Dividir base (QGIS)",
|
|
334
|
+
lambda: context.navigator.push(PageCircuit()),
|
|
335
|
+
),
|
|
336
|
+
],
|
|
337
|
+
main_axis_alignment=MainAxisAlignment.START,
|
|
338
|
+
),
|
|
339
|
+
]
|
|
340
|
+
)
|
|
341
|
+
|
|
298
342
|
def build(self, context: BuildContext) -> FlutterWidget:
|
|
299
343
|
self.context = context
|
|
300
|
-
|
|
344
|
+
|
|
301
345
|
return Scaffold(
|
|
302
|
-
|
|
346
|
+
Consumer(
|
|
347
|
+
ControllerHomePage,
|
|
348
|
+
builder=self._builder_body,
|
|
303
349
|
)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
350
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .common import (
|
|
2
|
+
ItemStatus,
|
|
3
|
+
SplitConfig,
|
|
4
|
+
SplitEvent,
|
|
5
|
+
SplitEventType,
|
|
6
|
+
SplitSummary,
|
|
7
|
+
)
|
|
8
|
+
from .service import (
|
|
9
|
+
ConsoleObserver,
|
|
10
|
+
CsvExporter,
|
|
11
|
+
DataFrameSplitService,
|
|
12
|
+
ExcelExporter,
|
|
13
|
+
ReportObserver,
|
|
14
|
+
SplitGroup,
|
|
15
|
+
SplitObserver,
|
|
16
|
+
SplitPlanner,
|
|
17
|
+
)
|
|
18
|
+
from .model_circuit import ModelCircuit
|
|
19
|
+
from .controller_circuit import ControllerCircuit
|
|
20
|
+
from .view_circuit import PageCircuit
|