codis 1.1.1__py3-none-any.whl
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.
- codis-1.1.1.dist-info/METADATA +194 -0
- codis-1.1.1.dist-info/RECORD +329 -0
- codis-1.1.1.dist-info/WHEEL +5 -0
- codis-1.1.1.dist-info/entry_points.txt +5 -0
- codis-1.1.1.dist-info/licenses/LICENSE +21 -0
- codis-1.1.1.dist-info/top_level.txt +2 -0
- run.py +190 -0
- src/__init__.py +1 -0
- src/__main__.py +81 -0
- src/_app_build.py +1507 -0
- src/_app_editor.py +1274 -0
- src/_app_kui.py +825 -0
- src/_app_lsp.py +625 -0
- src/_app_recovery.py +189 -0
- src/_app_settings.py +1385 -0
- src/_app_tools.py +2471 -0
- src/_app_webpreview.py +126 -0
- src/_font_safety.py +127 -0
- src/_shells.py +172 -0
- src/app.py +1488 -0
- src/chat/__init__.py +1 -0
- src/chat/adapters/__init__.py +33 -0
- src/chat/adapters/base.py +209 -0
- src/chat/adapters/discord.py +190 -0
- src/chat/adapters/http.py +78 -0
- src/chat/adapters/irc.py +360 -0
- src/chat/adapters/matrix.py +219 -0
- src/chat/adapters/mattermost.py +178 -0
- src/chat/adapters/mqtt.py +165 -0
- src/chat/adapters/slack.py +204 -0
- src/chat/adapters/telegram.py +117 -0
- src/chat/adapters/ws.py +154 -0
- src/chat/adapters/xmpp.py +337 -0
- src/chat/history.py +76 -0
- src/chat/models.py +207 -0
- src/chat/probe.py +79 -0
- src/chat/session.py +446 -0
- src/chat/util.py +125 -0
- src/collab/__init__.py +1 -0
- src/collab/net.py +411 -0
- src/collab/ot.py +311 -0
- src/collab/session.py +141 -0
- src/collab/tk_adapter.py +134 -0
- src/config.py +335 -0
- src/constants.py +2552 -0
- src/dep_catalog.py +446 -0
- src/diff/__init__.py +1 -0
- src/diff/engine.py +247 -0
- src/dpi.py +30 -0
- src/editor/__init__.py +1 -0
- src/editor/_pane_lsp.py +2937 -0
- src/editor/_pane_utils.py +171 -0
- src/editor/autocomplete.py +607 -0
- src/editor/code_folding.py +836 -0
- src/editor/color_preview.py +382 -0
- src/editor/complexity_lens.py +281 -0
- src/editor/diff_pane.py +623 -0
- src/editor/file_watcher.py +144 -0
- src/editor/focus_block.py +236 -0
- src/editor/heatmap.py +141 -0
- src/editor/inlay_hints.py +366 -0
- src/editor/inline_blame.py +429 -0
- src/editor/kdocs.py +3376 -0
- src/editor/large_file.py +488 -0
- src/editor/ligatures.py +180 -0
- src/editor/line_numbers.py +598 -0
- src/editor/minimap.py +691 -0
- src/editor/multi_cursor.py +269 -0
- src/editor/pane.py +2082 -0
- src/editor/rhythm.py +206 -0
- src/editor/save_hooks.py +43 -0
- src/editor/smart_selection.py +425 -0
- src/editor/smart_tips.py +719 -0
- src/editor/snippets.py +411 -0
- src/editor/sticky_note_gutter.py +410 -0
- src/editor/sticky_scroll.py +385 -0
- src/editor/suggest.py +464 -0
- src/editor/text_transforms.py +310 -0
- src/editor/vim_mode.py +1074 -0
- src/events/__init__.py +84 -0
- src/events/bus.py +427 -0
- src/events/correlator.py +244 -0
- src/events/kinds.py +125 -0
- src/events/pipeline.py +264 -0
- src/events/stream.py +416 -0
- src/events/window.py +204 -0
- src/extcompat/__init__.py +19 -0
- src/extcompat/code/__init__.py +13 -0
- src/extcompat/code/consent.py +162 -0
- src/extcompat/code/host.py +353 -0
- src/extcompat/code/hosts/py_host.py +763 -0
- src/extcompat/code/locate.py +105 -0
- src/extcompat/code/manager.py +325 -0
- src/extcompat/code/permissions.py +154 -0
- src/extcompat/code/sandbox.py +60 -0
- src/extcompat/colors.py +131 -0
- src/extcompat/common.py +184 -0
- src/extcompat/cson.py +269 -0
- src/extcompat/formats/__init__.py +22 -0
- src/extcompat/formats/_tm.py +189 -0
- src/extcompat/formats/_util.py +31 -0
- src/extcompat/formats/base16.py +66 -0
- src/extcompat/formats/brackets.py +172 -0
- src/extcompat/formats/eclipse.py +193 -0
- src/extcompat/formats/emacs.py +361 -0
- src/extcompat/formats/geany.py +147 -0
- src/extcompat/formats/generic.py +184 -0
- src/extcompat/formats/gtksource.py +117 -0
- src/extcompat/formats/helix.py +91 -0
- src/extcompat/formats/jetbrains.py +343 -0
- src/extcompat/formats/kate.py +130 -0
- src/extcompat/formats/micro.py +131 -0
- src/extcompat/formats/nano.py +111 -0
- src/extcompat/formats/notepadpp.py +140 -0
- src/extcompat/formats/pulsar.py +165 -0
- src/extcompat/formats/pyides.py +163 -0
- src/extcompat/formats/sublime.py +340 -0
- src/extcompat/jsonc.py +65 -0
- src/extcompat/lessish.py +128 -0
- src/extcompat/manager.py +122 -0
- src/extcompat/market/__init__.py +63 -0
- src/extcompat/market/sources.py +211 -0
- src/extcompat/model.py +88 -0
- src/extcompat/net.py +228 -0
- src/extcompat/openvsx.py +63 -0
- src/extcompat/readers.py +362 -0
- src/extcompat/registry.py +73 -0
- src/extcompat/safexml.py +63 -0
- src/extcompat/sexp.py +187 -0
- src/extcompat/sources.py +105 -0
- src/extcompat/store.py +276 -0
- src/extcompat/textmate.py +214 -0
- src/extcompat/themes.py +487 -0
- src/extcompat/yamlite.py +294 -0
- src/fileio.py +94 -0
- src/fs_ops.py +106 -0
- src/i18n.py +233 -0
- src/ia/__init__.py +1 -0
- src/ia/actions.py +295 -0
- src/ia/approval_gate.py +672 -0
- src/ia/checkpoints.py +308 -0
- src/ia/context_builder.py +921 -0
- src/ia/dialdiff.py +408 -0
- src/ia/iaspace.py +2078 -0
- src/ia/pair.py +296 -0
- src/ia/providers.py +954 -0
- src/ia/session.py +335 -0
- src/ia/toolbox.py +2524 -0
- src/launcher_actions.py +204 -0
- src/lint/__init__.py +1 -0
- src/lint/manager.py +1058 -0
- src/locales/.translate_manifest.json +64170 -0
- src/locales/de.json +4936 -0
- src/locales/en.json +4936 -0
- src/locales/es.json +4936 -0
- src/locales/fr.json +4936 -0
- src/locales/it.json +4936 -0
- src/locales/ja.json +4936 -0
- src/locales/ko.json +4936 -0
- src/locales/nl.json +4936 -0
- src/locales/pl.json +4936 -0
- src/locales/pt-BR.json +4936 -0
- src/locales/ru.json +4936 -0
- src/locales/tr.json +4936 -0
- src/locales/uk.json +4936 -0
- src/locales/zh-CN.json +4936 -0
- src/lsp/__init__.py +26 -0
- src/lsp/client.py +2300 -0
- src/lsp/dap_client.py +480 -0
- src/lsp/edits.py +84 -0
- src/lsp/framing.py +73 -0
- src/lsp/protocol.py +931 -0
- src/main.py +260 -0
- src/memtrim.py +91 -0
- src/plugins/__init__.py +1 -0
- src/plugins/api.py +1761 -0
- src/plugins/loader.py +571 -0
- src/plugins/process_runner.py +519 -0
- src/plugins/registry.py +342 -0
- src/plugins/safety.py +367 -0
- src/plugins/startup.py +195 -0
- src/plugins/store.py +1178 -0
- src/proc_registry.py +278 -0
- src/pyexec.py +394 -0
- src/recovery.py +259 -0
- src/stall_trace.py +92 -0
- src/standalone.py +1070 -0
- src/startup_profile.py +35 -0
- src/syntax/__init__.py +1 -0
- src/syntax/highlighter.py +776 -0
- src/syntax/patterns.py +584 -0
- src/system_profile.py +430 -0
- src/terminal/backends.py +658 -0
- src/terminal/internal.py +346 -0
- src/terminal/keys.py +138 -0
- src/terminal/palette.py +67 -0
- src/terminal/session.py +283 -0
- src/terminal/shells.py +79 -0
- src/terminal/view.py +489 -0
- src/terminal/vt.py +870 -0
- src/textfmt.py +22 -0
- src/theme/__init__.py +1 -0
- src/theme/base.py +1281 -0
- src/theme/colors.py +49 -0
- src/theme/manager.py +602 -0
- src/theme/utils.py +312 -0
- src/toolbox.py +329 -0
- src/trash_core.py +531 -0
- src/ui/__init__.py +1 -0
- src/ui/_perf_utils.py +285 -0
- src/ui/_persistence_utils.py +93 -0
- src/ui/accessibility.py +843 -0
- src/ui/activity_bar.py +860 -0
- src/ui/app_embed.py +434 -0
- src/ui/archive_panel.py +608 -0
- src/ui/bookmarks.py +314 -0
- src/ui/breadcrumb.py +383 -0
- src/ui/calculator_panel.py +982 -0
- src/ui/calendar_panel.py +1218 -0
- src/ui/chat_panel.py +1271 -0
- src/ui/chat_profile_dialog.py +278 -0
- src/ui/chat_render.py +128 -0
- src/ui/clock_panel.py +810 -0
- src/ui/code_outline.py +364 -0
- src/ui/code_runner.py +729 -0
- src/ui/code_stats.py +546 -0
- src/ui/collab_panel.py +1009 -0
- src/ui/color_picker.py +547 -0
- src/ui/command_palette.py +452 -0
- src/ui/cursor_manager.py +750 -0
- src/ui/custom_keywords_panel.py +413 -0
- src/ui/debug_panel.py +1037 -0
- src/ui/dependency_graph.py +692 -0
- src/ui/diff_panel.py +381 -0
- src/ui/docs_panel.py +514 -0
- src/ui/doom_embed.py +349 -0
- src/ui/dropdown.py +321 -0
- src/ui/easter_eggs.py +979 -0
- src/ui/env_manager.py +666 -0
- src/ui/extcode_bridge.py +215 -0
- src/ui/extcode_dialogs.py +412 -0
- src/ui/extcompat_dialog.py +583 -0
- src/ui/file_timeline.py +319 -0
- src/ui/file_tree.py +1208 -0
- src/ui/find_in_files.py +1355 -0
- src/ui/flowchart_panel.py +727 -0
- src/ui/formatter_panel.py +490 -0
- src/ui/git_auth.py +763 -0
- src/ui/git_clone_dialog.py +487 -0
- src/ui/git_panel.py +1483 -0
- src/ui/grab_safe.py +84 -0
- src/ui/internal_python_dialog.py +98 -0
- src/ui/k_ui/__init__.py +1305 -0
- src/ui/k_ui/_bgrenderer.py +317 -0
- src/ui/k_ui/_colors.py +213 -0
- src/ui/k_ui/_dock.py +545 -0
- src/ui/k_ui/_easter.py +290 -0
- src/ui/k_ui/_engine.py +5448 -0
- src/ui/k_ui/_perf.py +333 -0
- src/ui/k_ui/_tkutil.py +7 -0
- src/ui/k_ui/_tooltip.py +365 -0
- src/ui/k_ui/_widgets.py +1204 -0
- src/ui/k_ui/_world.py +837 -0
- src/ui/key_remapper.py +856 -0
- src/ui/launcher.py +1252 -0
- src/ui/lazy_panel.py +73 -0
- src/ui/macro_recorder.py +610 -0
- src/ui/menu_bar.py +898 -0
- src/ui/output_panel.py +321 -0
- src/ui/paint_canvas.py +1000 -0
- src/ui/paint_engine.py +535 -0
- src/ui/paint_panel.py +888 -0
- src/ui/panel_detach.py +112 -0
- src/ui/performance_panel.py +861 -0
- src/ui/pip_manager.py +1758 -0
- src/ui/plugin_panel.py +1586 -0
- src/ui/pomodoro_panel.py +447 -0
- src/ui/problems.py +566 -0
- src/ui/process_manager.py +1657 -0
- src/ui/project_templates.py +775 -0
- src/ui/recovery_dialog.py +122 -0
- src/ui/regex_playground.py +304 -0
- src/ui/remote_adapters.py +1398 -0
- src/ui/remote_browser.py +1224 -0
- src/ui/remote_profile_dialog.py +342 -0
- src/ui/render_panel.py +1293 -0
- src/ui/rest_client.py +549 -0
- src/ui/scratchpad.py +548 -0
- src/ui/search_bar.py +1274 -0
- src/ui/settings_editor.py +3349 -0
- src/ui/settings_window.py +1554 -0
- src/ui/snippets_panel.py +597 -0
- src/ui/sql_studio.py +1815 -0
- src/ui/status_bar.py +438 -0
- src/ui/tab_bar.py +654 -0
- src/ui/task_manager.py +1773 -0
- src/ui/terminal.py +525 -0
- src/ui/theme_preview_panel.py +851 -0
- src/ui/thread_safe_tk.py +152 -0
- src/ui/time_tracker.py +574 -0
- src/ui/tkbind.py +43 -0
- src/ui/todo_panel.py +358 -0
- src/ui/toolbox_panels.py +658 -0
- src/ui/trash_manager.py +657 -0
- src/ui/ui_scale.py +294 -0
- src/ui/ux_enhancements.py +41 -0
- src/ui/web_preview.py +397 -0
- src/ui/webdev.py +630 -0
- src/ui/welcome.py +567 -0
- src/ui/window_embed.py +1500 -0
- src/ui/wizard.py +1550 -0
- src/ui/workspace_switcher.py +418 -0
- src/ui/workspace_trust.py +370 -0
- src/ui/zen_audio.py +354 -0
- src/ui/zen_media.py +2271 -0
- src/ui/zen_media_client.py +303 -0
- src/ui/zen_media_host.py +329 -0
- src/ui/zen_player.py +907 -0
- src/ui/zen_player_widgets.py +700 -0
- src/updater/__init__.py +11 -0
- src/updater/assets.py +145 -0
- src/updater/backup.py +101 -0
- src/updater/channel.py +221 -0
- src/updater/dialog.py +492 -0
- src/updater/integrity.py +111 -0
- src/updater/manager.py +727 -0
- src/updater/result.py +114 -0
- src/venv_runtime.py +531 -0
- src/workspace_state.py +25 -0
src/ui/k_ui/_perf.py
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"""
|
|
2
|
+
K-UI - Perfis de performance da animação cósmica.
|
|
3
|
+
|
|
4
|
+
Cada perfil controla FPS alvo, quantidade de objetos animados,
|
|
5
|
+
efeitos habilitados e configurações do renderizador PIL de fundo.
|
|
6
|
+
|
|
7
|
+
Perfis disponíveis:
|
|
8
|
+
quantum Máximo absoluto - para GPUs dedicadas / Linux.
|
|
9
|
+
ultra Alta qualidade com auto_fps ativo.
|
|
10
|
+
high Boa qualidade, adequado para a maioria dos PCs.
|
|
11
|
+
balanced Padrão seguro multi-plataforma.
|
|
12
|
+
windows Otimizado para o GDI do Windows (padrão no win32).
|
|
13
|
+
cosmic_lite Visual rico com custo mínimo de canvas calls.
|
|
14
|
+
Usa batch rendering e menos primitivas por frame;
|
|
15
|
+
recomendado quando o KUI trava a UI.
|
|
16
|
+
low Mínimo funcional.
|
|
17
|
+
minimal Alias de low.
|
|
18
|
+
power_saver Alias de windows (preserva bateria).
|
|
19
|
+
ultra_plus Alias de quantum.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import collections as _collections
|
|
25
|
+
import concurrent.futures as _cf
|
|
26
|
+
import multiprocessing as _mp
|
|
27
|
+
import sys
|
|
28
|
+
|
|
29
|
+
_PERF: dict[str, dict] = {
|
|
30
|
+
"quantum": {
|
|
31
|
+
"stars": 240,
|
|
32
|
+
"star_layers": 3,
|
|
33
|
+
"fps": 120,
|
|
34
|
+
"particles": True,
|
|
35
|
+
"n_particles": 120,
|
|
36
|
+
"rings": True,
|
|
37
|
+
"scan": True,
|
|
38
|
+
"meteors": True,
|
|
39
|
+
"solar_system": True,
|
|
40
|
+
"black_holes": True,
|
|
41
|
+
"time_dilation": True,
|
|
42
|
+
"subatomic": True,
|
|
43
|
+
"n_subatomic": 50,
|
|
44
|
+
"screensaver": True,
|
|
45
|
+
"screensaver_idle_s": 90,
|
|
46
|
+
"quantum_tooltips": True,
|
|
47
|
+
"auto_fps": False,
|
|
48
|
+
"bg_fps": 120,
|
|
49
|
+
"bg_nebula_clouds": 6,
|
|
50
|
+
"bg_nebula_blur": 50,
|
|
51
|
+
"bg_aurora_bands": 7,
|
|
52
|
+
"bg_aurora_blur": 18,
|
|
53
|
+
"bg_rays": True,
|
|
54
|
+
"vignette_steps": 14,
|
|
55
|
+
"batch_stars": False,
|
|
56
|
+
"canvas_item_cap": 0,
|
|
57
|
+
"pulsars": True,
|
|
58
|
+
"spiral_galaxies": True,
|
|
59
|
+
"supernovas": True,
|
|
60
|
+
"binary_stars": True,
|
|
61
|
+
"aurora_curtain": True,
|
|
62
|
+
},
|
|
63
|
+
"ultra": {
|
|
64
|
+
"stars": 200,
|
|
65
|
+
"star_layers": 2,
|
|
66
|
+
"fps": 60,
|
|
67
|
+
"particles": True,
|
|
68
|
+
"n_particles": 60,
|
|
69
|
+
"rings": True,
|
|
70
|
+
"scan": True,
|
|
71
|
+
"meteors": True,
|
|
72
|
+
"solar_system": True,
|
|
73
|
+
"black_holes": True,
|
|
74
|
+
"time_dilation": True,
|
|
75
|
+
"subatomic": True,
|
|
76
|
+
"n_subatomic": 25,
|
|
77
|
+
"screensaver": True,
|
|
78
|
+
"screensaver_idle_s": 150,
|
|
79
|
+
"quantum_tooltips": True,
|
|
80
|
+
"auto_fps": True,
|
|
81
|
+
"bg_fps": 60,
|
|
82
|
+
"bg_nebula_clouds": 5,
|
|
83
|
+
"bg_nebula_blur": 46,
|
|
84
|
+
"bg_aurora_bands": 6,
|
|
85
|
+
"bg_aurora_blur": 16,
|
|
86
|
+
"bg_rays": True,
|
|
87
|
+
"vignette_steps": 10,
|
|
88
|
+
"batch_stars": False,
|
|
89
|
+
"canvas_item_cap": 0,
|
|
90
|
+
"pulsars": True,
|
|
91
|
+
"spiral_galaxies": True,
|
|
92
|
+
"supernovas": True,
|
|
93
|
+
"binary_stars": True,
|
|
94
|
+
"aurora_curtain": True,
|
|
95
|
+
},
|
|
96
|
+
"high": {
|
|
97
|
+
"stars": 120,
|
|
98
|
+
"star_layers": 2,
|
|
99
|
+
"fps": 45,
|
|
100
|
+
"particles": True,
|
|
101
|
+
"n_particles": 35,
|
|
102
|
+
"rings": True,
|
|
103
|
+
"scan": True,
|
|
104
|
+
"meteors": True,
|
|
105
|
+
"solar_system": True,
|
|
106
|
+
"black_holes": True,
|
|
107
|
+
"time_dilation": True,
|
|
108
|
+
"subatomic": False,
|
|
109
|
+
"n_subatomic": 0,
|
|
110
|
+
"screensaver": False,
|
|
111
|
+
"screensaver_idle_s": 300,
|
|
112
|
+
"quantum_tooltips": True,
|
|
113
|
+
"auto_fps": True,
|
|
114
|
+
"bg_fps": 45,
|
|
115
|
+
"bg_nebula_clouds": 4,
|
|
116
|
+
"bg_nebula_blur": 42,
|
|
117
|
+
"bg_aurora_bands": 5,
|
|
118
|
+
"bg_aurora_blur": 14,
|
|
119
|
+
"bg_rays": False,
|
|
120
|
+
"vignette_steps": 7,
|
|
121
|
+
"batch_stars": False,
|
|
122
|
+
"canvas_item_cap": 0,
|
|
123
|
+
"pulsars": True,
|
|
124
|
+
"spiral_galaxies": True,
|
|
125
|
+
"supernovas": True,
|
|
126
|
+
"binary_stars": True,
|
|
127
|
+
"aurora_curtain": True,
|
|
128
|
+
},
|
|
129
|
+
"balanced": {
|
|
130
|
+
"stars": 70,
|
|
131
|
+
"star_layers": 1,
|
|
132
|
+
"fps": 40,
|
|
133
|
+
"particles": True,
|
|
134
|
+
"n_particles": 25,
|
|
135
|
+
"rings": True,
|
|
136
|
+
"scan": True,
|
|
137
|
+
"meteors": True,
|
|
138
|
+
"solar_system": True,
|
|
139
|
+
"black_holes": True,
|
|
140
|
+
"time_dilation": False,
|
|
141
|
+
"subatomic": False,
|
|
142
|
+
"n_subatomic": 0,
|
|
143
|
+
"screensaver": False,
|
|
144
|
+
"screensaver_idle_s": 600,
|
|
145
|
+
"quantum_tooltips": True,
|
|
146
|
+
"auto_fps": True,
|
|
147
|
+
"bg_fps": 30,
|
|
148
|
+
"bg_nebula_clouds": 3,
|
|
149
|
+
"bg_nebula_blur": 40,
|
|
150
|
+
"bg_aurora_bands": 4,
|
|
151
|
+
"bg_aurora_blur": 12,
|
|
152
|
+
"bg_rays": False,
|
|
153
|
+
"vignette_steps": 0,
|
|
154
|
+
"batch_stars": False,
|
|
155
|
+
"canvas_item_cap": 0,
|
|
156
|
+
"pulsars": True,
|
|
157
|
+
"spiral_galaxies": True,
|
|
158
|
+
"supernovas": True,
|
|
159
|
+
"binary_stars": True,
|
|
160
|
+
"aurora_curtain": True,
|
|
161
|
+
},
|
|
162
|
+
"windows": {
|
|
163
|
+
"stars": 50,
|
|
164
|
+
"star_layers": 1,
|
|
165
|
+
"fps": 36,
|
|
166
|
+
"particles": True,
|
|
167
|
+
"n_particles": 15,
|
|
168
|
+
"rings": True,
|
|
169
|
+
"scan": False,
|
|
170
|
+
"meteors": True,
|
|
171
|
+
"solar_system": True,
|
|
172
|
+
"black_holes": True,
|
|
173
|
+
"time_dilation": False,
|
|
174
|
+
"subatomic": False,
|
|
175
|
+
"n_subatomic": 0,
|
|
176
|
+
"screensaver": False,
|
|
177
|
+
"screensaver_idle_s": 9999,
|
|
178
|
+
"quantum_tooltips": False,
|
|
179
|
+
"auto_fps": True,
|
|
180
|
+
"bg_fps": 10,
|
|
181
|
+
"bg_nebula_clouds": 2,
|
|
182
|
+
"bg_nebula_blur": 30,
|
|
183
|
+
"bg_aurora_bands": 2,
|
|
184
|
+
"bg_aurora_blur": 8,
|
|
185
|
+
"bg_rays": False,
|
|
186
|
+
"vignette_steps": 0,
|
|
187
|
+
"batch_stars": True,
|
|
188
|
+
"canvas_item_cap": 180,
|
|
189
|
+
"pulsars": False,
|
|
190
|
+
"spiral_galaxies": False,
|
|
191
|
+
"supernovas": False,
|
|
192
|
+
"binary_stars": False,
|
|
193
|
+
"aurora_curtain": False,
|
|
194
|
+
},
|
|
195
|
+
"cosmic_lite": {
|
|
196
|
+
"stars": 40,
|
|
197
|
+
"star_layers": 1,
|
|
198
|
+
"fps": 24,
|
|
199
|
+
"particles": True,
|
|
200
|
+
"n_particles": 12,
|
|
201
|
+
"rings": True,
|
|
202
|
+
"scan": False,
|
|
203
|
+
"meteors": True,
|
|
204
|
+
"solar_system": True,
|
|
205
|
+
"black_holes": True,
|
|
206
|
+
"time_dilation": False,
|
|
207
|
+
"subatomic": False,
|
|
208
|
+
"n_subatomic": 0,
|
|
209
|
+
"screensaver": False,
|
|
210
|
+
"screensaver_idle_s": 9999,
|
|
211
|
+
"quantum_tooltips": True,
|
|
212
|
+
"auto_fps": True,
|
|
213
|
+
"bg_fps": 8,
|
|
214
|
+
"bg_nebula_clouds": 2,
|
|
215
|
+
"bg_nebula_blur": 32,
|
|
216
|
+
"bg_aurora_bands": 2,
|
|
217
|
+
"bg_aurora_blur": 8,
|
|
218
|
+
"bg_rays": False,
|
|
219
|
+
"vignette_steps": 0,
|
|
220
|
+
"batch_stars": True,
|
|
221
|
+
"canvas_item_cap": 140,
|
|
222
|
+
"pulsars": True,
|
|
223
|
+
"spiral_galaxies": False,
|
|
224
|
+
"supernovas": False,
|
|
225
|
+
"binary_stars": True,
|
|
226
|
+
"aurora_curtain": False,
|
|
227
|
+
},
|
|
228
|
+
"low": {
|
|
229
|
+
"stars": 30,
|
|
230
|
+
"star_layers": 1,
|
|
231
|
+
"fps": 24,
|
|
232
|
+
"particles": True,
|
|
233
|
+
"n_particles": 12,
|
|
234
|
+
"rings": False,
|
|
235
|
+
"scan": False,
|
|
236
|
+
"meteors": True,
|
|
237
|
+
"solar_system": True,
|
|
238
|
+
"black_holes": False,
|
|
239
|
+
"time_dilation": False,
|
|
240
|
+
"subatomic": False,
|
|
241
|
+
"n_subatomic": 0,
|
|
242
|
+
"screensaver": False,
|
|
243
|
+
"screensaver_idle_s": 9999,
|
|
244
|
+
"quantum_tooltips": False,
|
|
245
|
+
"auto_fps": False,
|
|
246
|
+
"bg_fps": 8,
|
|
247
|
+
"bg_nebula_clouds": 0,
|
|
248
|
+
"bg_nebula_blur": 0,
|
|
249
|
+
"bg_aurora_bands": 2,
|
|
250
|
+
"bg_aurora_blur": 8,
|
|
251
|
+
"bg_rays": False,
|
|
252
|
+
"vignette_steps": 0,
|
|
253
|
+
"batch_stars": True,
|
|
254
|
+
"canvas_item_cap": 100,
|
|
255
|
+
"pulsars": False,
|
|
256
|
+
"spiral_galaxies": False,
|
|
257
|
+
"supernovas": False,
|
|
258
|
+
"binary_stars": False,
|
|
259
|
+
"aurora_curtain": False,
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
_PERF["minimal"] = _PERF["low"]
|
|
264
|
+
_PERF["power_saver"] = _PERF["windows"]
|
|
265
|
+
_PERF["ultra_plus"] = _PERF["quantum"]
|
|
266
|
+
|
|
267
|
+
if sys.platform == "win32":
|
|
268
|
+
_DEFAULT_PERF = "windows"
|
|
269
|
+
else:
|
|
270
|
+
_DEFAULT_PERF = "balanced"
|
|
271
|
+
|
|
272
|
+
_PHYSICS_WORKERS = min(4, max(1, (_mp.cpu_count() or 2) - 1))
|
|
273
|
+
|
|
274
|
+
_physics_executor: _cf.ThreadPoolExecutor | None = None
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def shutdown_physics_executor() -> None:
|
|
278
|
+
"""Para o executor de física. Chamado no shutdown do app."""
|
|
279
|
+
global _physics_executor
|
|
280
|
+
if _physics_executor is not None:
|
|
281
|
+
_physics_executor.shutdown(wait=False, cancel_futures=True)
|
|
282
|
+
_physics_executor = None
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class FrameBudget:
|
|
286
|
+
"""Mede o tempo real de cada frame e calcula o wait_ms ideal.
|
|
287
|
+
|
|
288
|
+
Mantém uma janela deslizante de N amostras e usa o percentil 90
|
|
289
|
+
(em vez da média simples) para evitar que frames rápidos mascarem
|
|
290
|
+
travamentos ocasionais.
|
|
291
|
+
|
|
292
|
+
Uso::
|
|
293
|
+
|
|
294
|
+
budget = FrameBudget(target_fps=30)
|
|
295
|
+
# ... dentro do _tick():
|
|
296
|
+
t0 = time.monotonic()
|
|
297
|
+
render()
|
|
298
|
+
wait_ms = budget.update(time.monotonic() - t0)
|
|
299
|
+
widget.after(wait_ms, _tick)
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
_WINDOW = 20
|
|
303
|
+
|
|
304
|
+
def __init__(self, target_fps: int = 30) -> None:
|
|
305
|
+
self.target_fps = max(1, target_fps)
|
|
306
|
+
self._target_ms = 1000.0 / self.target_fps
|
|
307
|
+
self._samples: _collections.deque[float] = _collections.deque(
|
|
308
|
+
maxlen=self._WINDOW
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
def update(self, frame_ms: float) -> int:
|
|
312
|
+
"""Registra a duração do frame atual e retorna o wait_ms para o próximo."""
|
|
313
|
+
self._samples.append(frame_ms)
|
|
314
|
+
if len(self._samples) < 3:
|
|
315
|
+
return max(4, int(self._target_ms))
|
|
316
|
+
|
|
317
|
+
sorted_s = sorted(self._samples)
|
|
318
|
+
p90_idx = max(0, int(len(sorted_s) * 0.90) - 1)
|
|
319
|
+
p90_ms = sorted_s[p90_idx]
|
|
320
|
+
|
|
321
|
+
if p90_ms > self._target_ms * 1.2:
|
|
322
|
+
ratio = min(3.0, p90_ms / max(1.0, self._target_ms))
|
|
323
|
+
wait_ms = max(8, int(self._target_ms * ratio * 0.80))
|
|
324
|
+
else:
|
|
325
|
+
wait_ms = max(4, int(self._target_ms - frame_ms))
|
|
326
|
+
|
|
327
|
+
return wait_ms
|
|
328
|
+
|
|
329
|
+
def reset(self, target_fps: int) -> None:
|
|
330
|
+
"""Atualiza o FPS alvo e limpa o histórico."""
|
|
331
|
+
self.target_fps = max(1, target_fps)
|
|
332
|
+
self._target_ms = 1000.0 / self.target_fps
|
|
333
|
+
self._samples.clear()
|
src/ui/k_ui/_tkutil.py
ADDED
src/ui/k_ui/_tooltip.py
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"""Tooltip hover da KUI do Codis.
|
|
2
|
+
|
|
3
|
+
Implementa ``KHoverTooltip``, o widget de tooltip contextual utilizado
|
|
4
|
+
pela interface KEngine para exibir informações sobre elementos
|
|
5
|
+
visuais ao passar o mouse.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import contextlib
|
|
11
|
+
import math
|
|
12
|
+
import tkinter as tk
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from ._colors import _pal
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
from src.i18n import _t as _i18n_t
|
|
19
|
+
except ImportError:
|
|
20
|
+
|
|
21
|
+
def _i18n_t(key: str, **kw) -> str:
|
|
22
|
+
|
|
23
|
+
return key.split(".")[-1]
|
|
24
|
+
|
|
25
|
+
_TAU = math.tau
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class KHoverTooltip:
|
|
29
|
+
"""Sistema de aprendizado do Cosmos Engine.
|
|
30
|
+
|
|
31
|
+
- Tooltip fixo no canto inferior esquerdo (não segue objeto)
|
|
32
|
+
- Delay de 1.5s para aparecer, permanece 10s
|
|
33
|
+
- Botões ◀ ▶ / teclas <- -> para navegar entre fatos
|
|
34
|
+
- Suporte a áreas circulares e retangulares
|
|
35
|
+
- 100% i18n via _i18n_t()
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
_DELAY_MS = 1500
|
|
39
|
+
_SHOW_MS = 10000
|
|
40
|
+
_PANEL_W = 420
|
|
41
|
+
_PANEL_H = 100
|
|
42
|
+
|
|
43
|
+
def __init__(self, canvas: tk.Canvas, dark: bool = True) -> None:
|
|
44
|
+
self._cv = canvas
|
|
45
|
+
self._dark = dark
|
|
46
|
+
self._areas: list[dict] = []
|
|
47
|
+
self._hover_key: str | None = None
|
|
48
|
+
self._hover_kw: dict = {}
|
|
49
|
+
self._tip_id: int | None = None
|
|
50
|
+
self._hide_id: int | None = None
|
|
51
|
+
self._visible = False
|
|
52
|
+
self._tip_items: list[int] = []
|
|
53
|
+
self._fact_keys: list[str] = []
|
|
54
|
+
self._fact_idx: int = 0
|
|
55
|
+
self._fixed_mx: float = 0.0
|
|
56
|
+
self._fixed_my: float = 0.0
|
|
57
|
+
|
|
58
|
+
def clear_areas(self) -> None:
|
|
59
|
+
"""Remove todas as áreas registradas e oculta o painel."""
|
|
60
|
+
self._areas.clear()
|
|
61
|
+
self._hide()
|
|
62
|
+
|
|
63
|
+
def register_circle(
|
|
64
|
+
self,
|
|
65
|
+
cx: float,
|
|
66
|
+
cy: float,
|
|
67
|
+
r: float,
|
|
68
|
+
i18n_key: str,
|
|
69
|
+
kw: dict | None = None,
|
|
70
|
+
on_click: Any = None,
|
|
71
|
+
extra_keys: list[str] | None = None,
|
|
72
|
+
) -> None:
|
|
73
|
+
"""Registra área circular para hover/clique."""
|
|
74
|
+
self._areas.append(
|
|
75
|
+
{
|
|
76
|
+
"kind": "circle",
|
|
77
|
+
"cx": cx,
|
|
78
|
+
"cy": cy,
|
|
79
|
+
"r": r,
|
|
80
|
+
"key": i18n_key,
|
|
81
|
+
"kw": kw or {},
|
|
82
|
+
"on_click": on_click,
|
|
83
|
+
"extra_keys": extra_keys or [],
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def on_click(self, e: tk.Event) -> None:
|
|
88
|
+
"""Trata evento de clique para reposicionar ou ocultar o tooltip."""
|
|
89
|
+
mx, my = e.x, e.y
|
|
90
|
+
if self._visible and self._tip_items:
|
|
91
|
+
self._handle_nav_click(mx, my)
|
|
92
|
+
return
|
|
93
|
+
for area in self._areas:
|
|
94
|
+
cb = area.get("on_click")
|
|
95
|
+
if cb and self._in_area(mx, my, area):
|
|
96
|
+
with contextlib.suppress(tk.TclError):
|
|
97
|
+
cb()
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
def on_motion(self, e: tk.Event) -> None:
|
|
101
|
+
"""Trata movimento do mouse para atualizar a posição do tooltip."""
|
|
102
|
+
mx, my = e.x, e.y
|
|
103
|
+
hit_key = None
|
|
104
|
+
hit_kw: dict = {}
|
|
105
|
+
hit_extra: list[str] = []
|
|
106
|
+
for area in self._areas:
|
|
107
|
+
if self._in_area(mx, my, area):
|
|
108
|
+
hit_key = area["key"]
|
|
109
|
+
hit_kw = area["kw"]
|
|
110
|
+
hit_extra = area.get("extra_keys", [])
|
|
111
|
+
break
|
|
112
|
+
|
|
113
|
+
if hit_key != self._hover_key:
|
|
114
|
+
self._hover_key = hit_key
|
|
115
|
+
self._hover_kw = hit_kw
|
|
116
|
+
self._cancel_timers()
|
|
117
|
+
self._hide()
|
|
118
|
+
if hit_key:
|
|
119
|
+
self._fixed_mx = mx
|
|
120
|
+
self._fixed_my = my
|
|
121
|
+
self._fact_keys = [hit_key] + hit_extra
|
|
122
|
+
self._fact_idx = 0
|
|
123
|
+
self._tip_id = self._cv.after(
|
|
124
|
+
self._DELAY_MS, lambda k=hit_key, kw=hit_kw: self._show(
|
|
125
|
+
k, kw)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def on_leave(self) -> None:
|
|
129
|
+
"""Mouse saiu do canvas."""
|
|
130
|
+
self._hover_key = None
|
|
131
|
+
self._cancel_timers()
|
|
132
|
+
self._hide()
|
|
133
|
+
|
|
134
|
+
def nav_prev(self) -> None:
|
|
135
|
+
"""Navega para o fato anterior ( <- )."""
|
|
136
|
+
n = len(self._fact_keys)
|
|
137
|
+
if n > 1 and self._visible:
|
|
138
|
+
self._fact_idx = (self._fact_idx - 1) % n
|
|
139
|
+
self._cancel_timers()
|
|
140
|
+
self._render_panel()
|
|
141
|
+
self._hide_id = self._cv.after(self._SHOW_MS, self._hide)
|
|
142
|
+
|
|
143
|
+
def nav_next(self) -> None:
|
|
144
|
+
"""Navega para o próximo fato ( -> )."""
|
|
145
|
+
n = len(self._fact_keys)
|
|
146
|
+
if n > 1 and self._visible:
|
|
147
|
+
self._fact_idx = (self._fact_idx + 1) % n
|
|
148
|
+
self._cancel_timers()
|
|
149
|
+
self._render_panel()
|
|
150
|
+
self._hide_id = self._cv.after(self._SHOW_MS, self._hide)
|
|
151
|
+
|
|
152
|
+
def _show(self, key: str, kw: dict) -> None:
|
|
153
|
+
"""Exibe o componente ou conteúdo indicado.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
key: Chave de identificação.
|
|
157
|
+
"""
|
|
158
|
+
if not self._cv.winfo_exists():
|
|
159
|
+
return
|
|
160
|
+
self._hide()
|
|
161
|
+
self._visible = True
|
|
162
|
+
self._render_panel()
|
|
163
|
+
self._hide_id = self._cv.after(self._SHOW_MS, self._hide)
|
|
164
|
+
|
|
165
|
+
def _render_panel(self) -> None:
|
|
166
|
+
"""Desenha o painel de fatos no canto inferior esquerdo."""
|
|
167
|
+
if not self._cv.winfo_exists() or not self._fact_keys:
|
|
168
|
+
return
|
|
169
|
+
for item in self._tip_items:
|
|
170
|
+
with contextlib.suppress(tk.TclError):
|
|
171
|
+
self._cv.delete(item)
|
|
172
|
+
self._tip_items = []
|
|
173
|
+
|
|
174
|
+
W = self._cv.winfo_width()
|
|
175
|
+
H = self._cv.winfo_height()
|
|
176
|
+
key = self._fact_keys[self._fact_idx]
|
|
177
|
+
kw = self._hover_kw
|
|
178
|
+
try:
|
|
179
|
+
text = _i18n_t(key, **kw)
|
|
180
|
+
except (KeyError, AttributeError):
|
|
181
|
+
text = key
|
|
182
|
+
|
|
183
|
+
if "|" in text:
|
|
184
|
+
title, body = text.split("|", 1)
|
|
185
|
+
else:
|
|
186
|
+
title = ""
|
|
187
|
+
body = text
|
|
188
|
+
|
|
189
|
+
pal = _pal(self._dark)
|
|
190
|
+
p_glass = pal["glass"]
|
|
191
|
+
p_accent = pal["accent"]
|
|
192
|
+
p_fg = pal["fg"]
|
|
193
|
+
p_dim = pal["fg_dim"]
|
|
194
|
+
p_nav = pal["accent2"]
|
|
195
|
+
|
|
196
|
+
PW = min(self._PANEL_W, W - 20)
|
|
197
|
+
PH = self._PANEL_H
|
|
198
|
+
bx = 12
|
|
199
|
+
by = H - PH - 12
|
|
200
|
+
ids: list[int] = []
|
|
201
|
+
|
|
202
|
+
ids.append(
|
|
203
|
+
self._cv.create_rectangle(
|
|
204
|
+
bx + 3,
|
|
205
|
+
by + 3,
|
|
206
|
+
bx + PW + 3,
|
|
207
|
+
by + PH + 3,
|
|
208
|
+
fill="#000000",
|
|
209
|
+
outline="",
|
|
210
|
+
stipple="gray25",
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
ids.append(
|
|
215
|
+
self._cv.create_rectangle(
|
|
216
|
+
bx, by, bx + PW, by + PH, fill=p_glass, outline=p_accent, width=1
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
ids.append(
|
|
221
|
+
self._cv.create_rectangle(
|
|
222
|
+
bx, by, bx + PW, by + 3, fill=p_accent, outline=""
|
|
223
|
+
)
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
n_facts = len(self._fact_keys)
|
|
227
|
+
nav_text = f"{self._fact_idx + 1}/{n_facts}" if n_facts > 1 else ""
|
|
228
|
+
if nav_text:
|
|
229
|
+
ids.append(
|
|
230
|
+
self._cv.create_text(
|
|
231
|
+
bx + PW - 8,
|
|
232
|
+
by + 12,
|
|
233
|
+
text=nav_text,
|
|
234
|
+
fill=p_dim,
|
|
235
|
+
font=("Segoe UI", 7),
|
|
236
|
+
anchor="e",
|
|
237
|
+
)
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
tx = bx + 10
|
|
241
|
+
ty = by + 10
|
|
242
|
+
if title.strip():
|
|
243
|
+
ids.append(
|
|
244
|
+
self._cv.create_text(
|
|
245
|
+
tx,
|
|
246
|
+
ty,
|
|
247
|
+
text=title.strip(),
|
|
248
|
+
fill=p_accent,
|
|
249
|
+
font=("Segoe UI", 9, "bold"),
|
|
250
|
+
anchor="nw",
|
|
251
|
+
)
|
|
252
|
+
)
|
|
253
|
+
ty += 18
|
|
254
|
+
|
|
255
|
+
words = body.strip().split()
|
|
256
|
+
lines_: list[str] = []
|
|
257
|
+
cur = ""
|
|
258
|
+
max_chars = max(10, (PW - 24) // 7)
|
|
259
|
+
for w in words:
|
|
260
|
+
test = (cur + " " + w).strip()
|
|
261
|
+
if len(test) > max_chars and cur:
|
|
262
|
+
lines_.append(cur)
|
|
263
|
+
cur = w
|
|
264
|
+
else:
|
|
265
|
+
cur = test
|
|
266
|
+
if cur:
|
|
267
|
+
lines_.append(cur)
|
|
268
|
+
for i, line in enumerate(lines_[:4]):
|
|
269
|
+
ids.append(
|
|
270
|
+
self._cv.create_text(
|
|
271
|
+
tx,
|
|
272
|
+
ty + i * 14,
|
|
273
|
+
text=line,
|
|
274
|
+
fill=p_fg,
|
|
275
|
+
font=("Segoe UI", 8),
|
|
276
|
+
anchor="nw",
|
|
277
|
+
)
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
if n_facts > 1:
|
|
281
|
+
btn_y = by + PH - 16
|
|
282
|
+
self._nav_prev_box = (bx + 8, btn_y - 8, bx + 30, btn_y + 8)
|
|
283
|
+
ids.append(
|
|
284
|
+
self._cv.create_text(
|
|
285
|
+
bx + 19,
|
|
286
|
+
btn_y,
|
|
287
|
+
text=_i18n_t("kui.nav_prev"),
|
|
288
|
+
fill=p_nav,
|
|
289
|
+
font=("Segoe UI", 7),
|
|
290
|
+
anchor="center",
|
|
291
|
+
tags="nav_prev",
|
|
292
|
+
)
|
|
293
|
+
)
|
|
294
|
+
self._nav_next_box = (bx + PW - 48, btn_y -
|
|
295
|
+
8, bx + PW - 8, btn_y + 8)
|
|
296
|
+
ids.append(
|
|
297
|
+
self._cv.create_text(
|
|
298
|
+
bx + PW - 28,
|
|
299
|
+
btn_y,
|
|
300
|
+
text=_i18n_t("kui.nav_next"),
|
|
301
|
+
fill=p_nav,
|
|
302
|
+
font=("Segoe UI", 7),
|
|
303
|
+
anchor="center",
|
|
304
|
+
tags="nav_next",
|
|
305
|
+
)
|
|
306
|
+
)
|
|
307
|
+
else:
|
|
308
|
+
self._nav_prev_box = None
|
|
309
|
+
self._nav_next_box = None
|
|
310
|
+
|
|
311
|
+
self._tip_items = ids
|
|
312
|
+
self._panel_bx = bx
|
|
313
|
+
self._panel_by = by
|
|
314
|
+
self._panel_bw = PW
|
|
315
|
+
self._panel_bh = PH
|
|
316
|
+
|
|
317
|
+
def _handle_nav_click(self, mx: float, my: float) -> None:
|
|
318
|
+
"""Clique nos botões ◀ ▶."""
|
|
319
|
+
n = len(self._fact_keys)
|
|
320
|
+
if n <= 1:
|
|
321
|
+
return
|
|
322
|
+
prev = getattr(self, "_nav_prev_box", None)
|
|
323
|
+
nxt = getattr(self, "_nav_next_box", None)
|
|
324
|
+
if prev and prev[0] <= mx <= prev[2] and prev[1] <= my <= prev[3]:
|
|
325
|
+
self.nav_prev()
|
|
326
|
+
elif nxt and nxt[0] <= mx <= nxt[2] and nxt[1] <= my <= nxt[3]:
|
|
327
|
+
self.nav_next()
|
|
328
|
+
else:
|
|
329
|
+
bx = getattr(self, "_panel_bx", -1)
|
|
330
|
+
by = getattr(self, "_panel_by", -1)
|
|
331
|
+
bw = getattr(self, "_panel_bw", 0)
|
|
332
|
+
bh = getattr(self, "_panel_bh", 0)
|
|
333
|
+
if not (bx <= mx <= bx + bw and by <= my <= by + bh):
|
|
334
|
+
for area in self._areas:
|
|
335
|
+
cb = area.get("on_click")
|
|
336
|
+
if cb and self._in_area(mx, my, area):
|
|
337
|
+
with contextlib.suppress(tk.TclError):
|
|
338
|
+
cb()
|
|
339
|
+
return
|
|
340
|
+
|
|
341
|
+
@staticmethod
|
|
342
|
+
def _in_area(mx: float, my: float, area: dict) -> bool:
|
|
343
|
+
if area["kind"] == "circle":
|
|
344
|
+
dx = mx - area["cx"]
|
|
345
|
+
dy = my - area["cy"]
|
|
346
|
+
return dx * dx + dy * dy <= area["r"] ** 2
|
|
347
|
+
return area["x1"] <= mx <= area["x2"] and area["y1"] <= my <= area["y2"]
|
|
348
|
+
|
|
349
|
+
def _cancel_timers(self) -> None:
|
|
350
|
+
"""Cancela todos os timers pendentes de show e hide do tooltip."""
|
|
351
|
+
for attr in ("_tip_id", "_hide_id"):
|
|
352
|
+
job = getattr(self, attr, None)
|
|
353
|
+
if job is not None:
|
|
354
|
+
with contextlib.suppress(tk.TclError):
|
|
355
|
+
self._cv.after_cancel(job)
|
|
356
|
+
setattr(self, attr, None)
|
|
357
|
+
|
|
358
|
+
def _hide(self) -> None:
|
|
359
|
+
"""Oculta o componente ou elemento."""
|
|
360
|
+
self._cancel_timers()
|
|
361
|
+
for item in self._tip_items:
|
|
362
|
+
with contextlib.suppress(tk.TclError):
|
|
363
|
+
self._cv.delete(item)
|
|
364
|
+
self._tip_items = []
|
|
365
|
+
self._visible = False
|