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.
Files changed (329) hide show
  1. codis-1.1.1.dist-info/METADATA +194 -0
  2. codis-1.1.1.dist-info/RECORD +329 -0
  3. codis-1.1.1.dist-info/WHEEL +5 -0
  4. codis-1.1.1.dist-info/entry_points.txt +5 -0
  5. codis-1.1.1.dist-info/licenses/LICENSE +21 -0
  6. codis-1.1.1.dist-info/top_level.txt +2 -0
  7. run.py +190 -0
  8. src/__init__.py +1 -0
  9. src/__main__.py +81 -0
  10. src/_app_build.py +1507 -0
  11. src/_app_editor.py +1274 -0
  12. src/_app_kui.py +825 -0
  13. src/_app_lsp.py +625 -0
  14. src/_app_recovery.py +189 -0
  15. src/_app_settings.py +1385 -0
  16. src/_app_tools.py +2471 -0
  17. src/_app_webpreview.py +126 -0
  18. src/_font_safety.py +127 -0
  19. src/_shells.py +172 -0
  20. src/app.py +1488 -0
  21. src/chat/__init__.py +1 -0
  22. src/chat/adapters/__init__.py +33 -0
  23. src/chat/adapters/base.py +209 -0
  24. src/chat/adapters/discord.py +190 -0
  25. src/chat/adapters/http.py +78 -0
  26. src/chat/adapters/irc.py +360 -0
  27. src/chat/adapters/matrix.py +219 -0
  28. src/chat/adapters/mattermost.py +178 -0
  29. src/chat/adapters/mqtt.py +165 -0
  30. src/chat/adapters/slack.py +204 -0
  31. src/chat/adapters/telegram.py +117 -0
  32. src/chat/adapters/ws.py +154 -0
  33. src/chat/adapters/xmpp.py +337 -0
  34. src/chat/history.py +76 -0
  35. src/chat/models.py +207 -0
  36. src/chat/probe.py +79 -0
  37. src/chat/session.py +446 -0
  38. src/chat/util.py +125 -0
  39. src/collab/__init__.py +1 -0
  40. src/collab/net.py +411 -0
  41. src/collab/ot.py +311 -0
  42. src/collab/session.py +141 -0
  43. src/collab/tk_adapter.py +134 -0
  44. src/config.py +335 -0
  45. src/constants.py +2552 -0
  46. src/dep_catalog.py +446 -0
  47. src/diff/__init__.py +1 -0
  48. src/diff/engine.py +247 -0
  49. src/dpi.py +30 -0
  50. src/editor/__init__.py +1 -0
  51. src/editor/_pane_lsp.py +2937 -0
  52. src/editor/_pane_utils.py +171 -0
  53. src/editor/autocomplete.py +607 -0
  54. src/editor/code_folding.py +836 -0
  55. src/editor/color_preview.py +382 -0
  56. src/editor/complexity_lens.py +281 -0
  57. src/editor/diff_pane.py +623 -0
  58. src/editor/file_watcher.py +144 -0
  59. src/editor/focus_block.py +236 -0
  60. src/editor/heatmap.py +141 -0
  61. src/editor/inlay_hints.py +366 -0
  62. src/editor/inline_blame.py +429 -0
  63. src/editor/kdocs.py +3376 -0
  64. src/editor/large_file.py +488 -0
  65. src/editor/ligatures.py +180 -0
  66. src/editor/line_numbers.py +598 -0
  67. src/editor/minimap.py +691 -0
  68. src/editor/multi_cursor.py +269 -0
  69. src/editor/pane.py +2082 -0
  70. src/editor/rhythm.py +206 -0
  71. src/editor/save_hooks.py +43 -0
  72. src/editor/smart_selection.py +425 -0
  73. src/editor/smart_tips.py +719 -0
  74. src/editor/snippets.py +411 -0
  75. src/editor/sticky_note_gutter.py +410 -0
  76. src/editor/sticky_scroll.py +385 -0
  77. src/editor/suggest.py +464 -0
  78. src/editor/text_transforms.py +310 -0
  79. src/editor/vim_mode.py +1074 -0
  80. src/events/__init__.py +84 -0
  81. src/events/bus.py +427 -0
  82. src/events/correlator.py +244 -0
  83. src/events/kinds.py +125 -0
  84. src/events/pipeline.py +264 -0
  85. src/events/stream.py +416 -0
  86. src/events/window.py +204 -0
  87. src/extcompat/__init__.py +19 -0
  88. src/extcompat/code/__init__.py +13 -0
  89. src/extcompat/code/consent.py +162 -0
  90. src/extcompat/code/host.py +353 -0
  91. src/extcompat/code/hosts/py_host.py +763 -0
  92. src/extcompat/code/locate.py +105 -0
  93. src/extcompat/code/manager.py +325 -0
  94. src/extcompat/code/permissions.py +154 -0
  95. src/extcompat/code/sandbox.py +60 -0
  96. src/extcompat/colors.py +131 -0
  97. src/extcompat/common.py +184 -0
  98. src/extcompat/cson.py +269 -0
  99. src/extcompat/formats/__init__.py +22 -0
  100. src/extcompat/formats/_tm.py +189 -0
  101. src/extcompat/formats/_util.py +31 -0
  102. src/extcompat/formats/base16.py +66 -0
  103. src/extcompat/formats/brackets.py +172 -0
  104. src/extcompat/formats/eclipse.py +193 -0
  105. src/extcompat/formats/emacs.py +361 -0
  106. src/extcompat/formats/geany.py +147 -0
  107. src/extcompat/formats/generic.py +184 -0
  108. src/extcompat/formats/gtksource.py +117 -0
  109. src/extcompat/formats/helix.py +91 -0
  110. src/extcompat/formats/jetbrains.py +343 -0
  111. src/extcompat/formats/kate.py +130 -0
  112. src/extcompat/formats/micro.py +131 -0
  113. src/extcompat/formats/nano.py +111 -0
  114. src/extcompat/formats/notepadpp.py +140 -0
  115. src/extcompat/formats/pulsar.py +165 -0
  116. src/extcompat/formats/pyides.py +163 -0
  117. src/extcompat/formats/sublime.py +340 -0
  118. src/extcompat/jsonc.py +65 -0
  119. src/extcompat/lessish.py +128 -0
  120. src/extcompat/manager.py +122 -0
  121. src/extcompat/market/__init__.py +63 -0
  122. src/extcompat/market/sources.py +211 -0
  123. src/extcompat/model.py +88 -0
  124. src/extcompat/net.py +228 -0
  125. src/extcompat/openvsx.py +63 -0
  126. src/extcompat/readers.py +362 -0
  127. src/extcompat/registry.py +73 -0
  128. src/extcompat/safexml.py +63 -0
  129. src/extcompat/sexp.py +187 -0
  130. src/extcompat/sources.py +105 -0
  131. src/extcompat/store.py +276 -0
  132. src/extcompat/textmate.py +214 -0
  133. src/extcompat/themes.py +487 -0
  134. src/extcompat/yamlite.py +294 -0
  135. src/fileio.py +94 -0
  136. src/fs_ops.py +106 -0
  137. src/i18n.py +233 -0
  138. src/ia/__init__.py +1 -0
  139. src/ia/actions.py +295 -0
  140. src/ia/approval_gate.py +672 -0
  141. src/ia/checkpoints.py +308 -0
  142. src/ia/context_builder.py +921 -0
  143. src/ia/dialdiff.py +408 -0
  144. src/ia/iaspace.py +2078 -0
  145. src/ia/pair.py +296 -0
  146. src/ia/providers.py +954 -0
  147. src/ia/session.py +335 -0
  148. src/ia/toolbox.py +2524 -0
  149. src/launcher_actions.py +204 -0
  150. src/lint/__init__.py +1 -0
  151. src/lint/manager.py +1058 -0
  152. src/locales/.translate_manifest.json +64170 -0
  153. src/locales/de.json +4936 -0
  154. src/locales/en.json +4936 -0
  155. src/locales/es.json +4936 -0
  156. src/locales/fr.json +4936 -0
  157. src/locales/it.json +4936 -0
  158. src/locales/ja.json +4936 -0
  159. src/locales/ko.json +4936 -0
  160. src/locales/nl.json +4936 -0
  161. src/locales/pl.json +4936 -0
  162. src/locales/pt-BR.json +4936 -0
  163. src/locales/ru.json +4936 -0
  164. src/locales/tr.json +4936 -0
  165. src/locales/uk.json +4936 -0
  166. src/locales/zh-CN.json +4936 -0
  167. src/lsp/__init__.py +26 -0
  168. src/lsp/client.py +2300 -0
  169. src/lsp/dap_client.py +480 -0
  170. src/lsp/edits.py +84 -0
  171. src/lsp/framing.py +73 -0
  172. src/lsp/protocol.py +931 -0
  173. src/main.py +260 -0
  174. src/memtrim.py +91 -0
  175. src/plugins/__init__.py +1 -0
  176. src/plugins/api.py +1761 -0
  177. src/plugins/loader.py +571 -0
  178. src/plugins/process_runner.py +519 -0
  179. src/plugins/registry.py +342 -0
  180. src/plugins/safety.py +367 -0
  181. src/plugins/startup.py +195 -0
  182. src/plugins/store.py +1178 -0
  183. src/proc_registry.py +278 -0
  184. src/pyexec.py +394 -0
  185. src/recovery.py +259 -0
  186. src/stall_trace.py +92 -0
  187. src/standalone.py +1070 -0
  188. src/startup_profile.py +35 -0
  189. src/syntax/__init__.py +1 -0
  190. src/syntax/highlighter.py +776 -0
  191. src/syntax/patterns.py +584 -0
  192. src/system_profile.py +430 -0
  193. src/terminal/backends.py +658 -0
  194. src/terminal/internal.py +346 -0
  195. src/terminal/keys.py +138 -0
  196. src/terminal/palette.py +67 -0
  197. src/terminal/session.py +283 -0
  198. src/terminal/shells.py +79 -0
  199. src/terminal/view.py +489 -0
  200. src/terminal/vt.py +870 -0
  201. src/textfmt.py +22 -0
  202. src/theme/__init__.py +1 -0
  203. src/theme/base.py +1281 -0
  204. src/theme/colors.py +49 -0
  205. src/theme/manager.py +602 -0
  206. src/theme/utils.py +312 -0
  207. src/toolbox.py +329 -0
  208. src/trash_core.py +531 -0
  209. src/ui/__init__.py +1 -0
  210. src/ui/_perf_utils.py +285 -0
  211. src/ui/_persistence_utils.py +93 -0
  212. src/ui/accessibility.py +843 -0
  213. src/ui/activity_bar.py +860 -0
  214. src/ui/app_embed.py +434 -0
  215. src/ui/archive_panel.py +608 -0
  216. src/ui/bookmarks.py +314 -0
  217. src/ui/breadcrumb.py +383 -0
  218. src/ui/calculator_panel.py +982 -0
  219. src/ui/calendar_panel.py +1218 -0
  220. src/ui/chat_panel.py +1271 -0
  221. src/ui/chat_profile_dialog.py +278 -0
  222. src/ui/chat_render.py +128 -0
  223. src/ui/clock_panel.py +810 -0
  224. src/ui/code_outline.py +364 -0
  225. src/ui/code_runner.py +729 -0
  226. src/ui/code_stats.py +546 -0
  227. src/ui/collab_panel.py +1009 -0
  228. src/ui/color_picker.py +547 -0
  229. src/ui/command_palette.py +452 -0
  230. src/ui/cursor_manager.py +750 -0
  231. src/ui/custom_keywords_panel.py +413 -0
  232. src/ui/debug_panel.py +1037 -0
  233. src/ui/dependency_graph.py +692 -0
  234. src/ui/diff_panel.py +381 -0
  235. src/ui/docs_panel.py +514 -0
  236. src/ui/doom_embed.py +349 -0
  237. src/ui/dropdown.py +321 -0
  238. src/ui/easter_eggs.py +979 -0
  239. src/ui/env_manager.py +666 -0
  240. src/ui/extcode_bridge.py +215 -0
  241. src/ui/extcode_dialogs.py +412 -0
  242. src/ui/extcompat_dialog.py +583 -0
  243. src/ui/file_timeline.py +319 -0
  244. src/ui/file_tree.py +1208 -0
  245. src/ui/find_in_files.py +1355 -0
  246. src/ui/flowchart_panel.py +727 -0
  247. src/ui/formatter_panel.py +490 -0
  248. src/ui/git_auth.py +763 -0
  249. src/ui/git_clone_dialog.py +487 -0
  250. src/ui/git_panel.py +1483 -0
  251. src/ui/grab_safe.py +84 -0
  252. src/ui/internal_python_dialog.py +98 -0
  253. src/ui/k_ui/__init__.py +1305 -0
  254. src/ui/k_ui/_bgrenderer.py +317 -0
  255. src/ui/k_ui/_colors.py +213 -0
  256. src/ui/k_ui/_dock.py +545 -0
  257. src/ui/k_ui/_easter.py +290 -0
  258. src/ui/k_ui/_engine.py +5448 -0
  259. src/ui/k_ui/_perf.py +333 -0
  260. src/ui/k_ui/_tkutil.py +7 -0
  261. src/ui/k_ui/_tooltip.py +365 -0
  262. src/ui/k_ui/_widgets.py +1204 -0
  263. src/ui/k_ui/_world.py +837 -0
  264. src/ui/key_remapper.py +856 -0
  265. src/ui/launcher.py +1252 -0
  266. src/ui/lazy_panel.py +73 -0
  267. src/ui/macro_recorder.py +610 -0
  268. src/ui/menu_bar.py +898 -0
  269. src/ui/output_panel.py +321 -0
  270. src/ui/paint_canvas.py +1000 -0
  271. src/ui/paint_engine.py +535 -0
  272. src/ui/paint_panel.py +888 -0
  273. src/ui/panel_detach.py +112 -0
  274. src/ui/performance_panel.py +861 -0
  275. src/ui/pip_manager.py +1758 -0
  276. src/ui/plugin_panel.py +1586 -0
  277. src/ui/pomodoro_panel.py +447 -0
  278. src/ui/problems.py +566 -0
  279. src/ui/process_manager.py +1657 -0
  280. src/ui/project_templates.py +775 -0
  281. src/ui/recovery_dialog.py +122 -0
  282. src/ui/regex_playground.py +304 -0
  283. src/ui/remote_adapters.py +1398 -0
  284. src/ui/remote_browser.py +1224 -0
  285. src/ui/remote_profile_dialog.py +342 -0
  286. src/ui/render_panel.py +1293 -0
  287. src/ui/rest_client.py +549 -0
  288. src/ui/scratchpad.py +548 -0
  289. src/ui/search_bar.py +1274 -0
  290. src/ui/settings_editor.py +3349 -0
  291. src/ui/settings_window.py +1554 -0
  292. src/ui/snippets_panel.py +597 -0
  293. src/ui/sql_studio.py +1815 -0
  294. src/ui/status_bar.py +438 -0
  295. src/ui/tab_bar.py +654 -0
  296. src/ui/task_manager.py +1773 -0
  297. src/ui/terminal.py +525 -0
  298. src/ui/theme_preview_panel.py +851 -0
  299. src/ui/thread_safe_tk.py +152 -0
  300. src/ui/time_tracker.py +574 -0
  301. src/ui/tkbind.py +43 -0
  302. src/ui/todo_panel.py +358 -0
  303. src/ui/toolbox_panels.py +658 -0
  304. src/ui/trash_manager.py +657 -0
  305. src/ui/ui_scale.py +294 -0
  306. src/ui/ux_enhancements.py +41 -0
  307. src/ui/web_preview.py +397 -0
  308. src/ui/webdev.py +630 -0
  309. src/ui/welcome.py +567 -0
  310. src/ui/window_embed.py +1500 -0
  311. src/ui/wizard.py +1550 -0
  312. src/ui/workspace_switcher.py +418 -0
  313. src/ui/workspace_trust.py +370 -0
  314. src/ui/zen_audio.py +354 -0
  315. src/ui/zen_media.py +2271 -0
  316. src/ui/zen_media_client.py +303 -0
  317. src/ui/zen_media_host.py +329 -0
  318. src/ui/zen_player.py +907 -0
  319. src/ui/zen_player_widgets.py +700 -0
  320. src/updater/__init__.py +11 -0
  321. src/updater/assets.py +145 -0
  322. src/updater/backup.py +101 -0
  323. src/updater/channel.py +221 -0
  324. src/updater/dialog.py +492 -0
  325. src/updater/integrity.py +111 -0
  326. src/updater/manager.py +727 -0
  327. src/updater/result.py +114 -0
  328. src/venv_runtime.py +531 -0
  329. src/workspace_state.py +25 -0
@@ -0,0 +1,3349 @@
1
+ """Codis - SettingsEditor: editor de configurações em modo avançado (painel inline).
2
+
3
+ Exibe TODAS as configurações do Codis em um painel scrollável com busca em
4
+ tempo real, controles visuais (toggle, slider, combo, entry) e botão de
5
+ reset por item. Usado no modo "Advanced" acessível pela barra de atividades.
6
+
7
+ Este módulo também é a fonte de verdade do SETTINGS_SCHEMA - a lista
8
+ completa de todas as configurações disponíveis, seus tipos, valores padrão,
9
+ descrições e opções. O SettingsWindow consome este schema para popular
10
+ a janela flutuante de configurações categorizadas.
11
+
12
+ Extensível por plugins via ``PluginAPI.add_settings_section()``.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import contextlib
18
+ import logging
19
+ import tkinter as tk
20
+ from collections.abc import Callable
21
+ from tkinter import ttk
22
+ from typing import Any
23
+
24
+ from src._shells import SHELL_OPTIONS, get_default_shell
25
+ from src.config import ConfigManager
26
+ from src.constants import (
27
+ CONFIG_DIR,
28
+ FONT_MONO,
29
+ FONT_SIZE,
30
+ FONT_UI,
31
+ TAB_SIZE,
32
+ )
33
+ from src.i18n import I18n, _t
34
+ from src.theme.base import THEME_ORDER, Theme
35
+ from src.theme.base import _define_themes as _ensure_themes
36
+ from src.theme.manager import ThemeManager
37
+ from src.ui._perf_utils import (
38
+ BatchPacker,
39
+ debounce_canvas,
40
+ debounce_fn,
41
+ make_hover_highlight,
42
+ )
43
+ from src.ui.dropdown import DropDown
44
+
45
+ logger = logging.getLogger("Codis")
46
+
47
+ _BUILTIN_MONO_FONTS: list[str] = [
48
+ FONT_MONO,
49
+ "Courier New",
50
+ "Fira Code",
51
+ "JetBrains Mono",
52
+ "Source Code Pro",
53
+ "Cascadia Code",
54
+ "Cascadia Mono",
55
+ "Inconsolata",
56
+ "Hack",
57
+ "Victor Mono",
58
+ "Iosevka",
59
+ "Maple Mono",
60
+ "Monaspace Neon",
61
+ ]
62
+
63
+ _BUILTIN_UI_FONTS: list[str] = [
64
+ FONT_UI,
65
+ "Segoe UI",
66
+ "Helvetica",
67
+ "Arial",
68
+ "Calibri",
69
+ "Roboto",
70
+ "Inter",
71
+ "Ubuntu",
72
+ "Cantarell",
73
+ "Open Sans",
74
+ "Noto Sans",
75
+ "Source Sans Pro",
76
+ ]
77
+
78
+ _MONO_HINTS = (
79
+ "mono",
80
+ "code",
81
+ "courier",
82
+ "consol",
83
+ "fixed",
84
+ "terminal",
85
+ "hack",
86
+ "iosevka",
87
+ "inconsolata",
88
+ "fira",
89
+ "jetbrains",
90
+ "cascadia",
91
+ "source code",
92
+ "nerd",
93
+ "victor",
94
+ "maple",
95
+ "noto sans mono",
96
+ )
97
+
98
+
99
+ def _get_system_mono_fonts() -> list[str]:
100
+ """Retorna fontes monoespaçadas disponíveis no sistema + built-ins.
101
+
102
+ Combina fontes reconhecidas como monoespaçadas (via dicas de nome)
103
+ com todas as fontes do sistema, garantindo que qualquer fonte instalada
104
+ (incluindo Fira Code, Monaspace, etc.) apareça na lista.
105
+ Fontes monoespaçadas reconhecidas aparecem no início da lista.
106
+ """
107
+ try:
108
+ import tkinter.font as tkfont
109
+
110
+ all_families = tkfont.families()
111
+ except Exception:
112
+ return list(_BUILTIN_MONO_FONTS)
113
+
114
+ system_mono = sorted(
115
+ {f for f in all_families if any(h in f.lower() for h in _MONO_HINTS)},
116
+ key=str.casefold,
117
+ )
118
+ all_other = sorted(
119
+ {f for f in all_families if not any(
120
+ h in f.lower() for h in _MONO_HINTS)},
121
+ key=str.casefold,
122
+ )
123
+
124
+ merged: list[str] = list(_BUILTIN_MONO_FONTS)
125
+ for f in system_mono:
126
+ if f not in merged:
127
+ merged.append(f)
128
+ for f in all_other:
129
+ if f not in merged:
130
+ merged.append(f)
131
+ return merged
132
+
133
+
134
+ def _get_system_ui_fonts() -> list[str]:
135
+ """Retorna todas as fontes do sistema para uso na interface."""
136
+ try:
137
+ import tkinter.font as tkfont
138
+
139
+ all_families = tkfont.families()
140
+ except Exception:
141
+ return list(_BUILTIN_UI_FONTS)
142
+ system_all = sorted(set(all_families), key=str.casefold)
143
+ merged: list[str] = list(_BUILTIN_UI_FONTS)
144
+ for f in system_all:
145
+ if f not in merged:
146
+ merged.append(f)
147
+ return merged
148
+
149
+
150
+ def _get_language_options() -> list[str]:
151
+ """Retorna lista dinâmica de códigos de locale disponíveis.
152
+
153
+ Inclui automaticamente locales registrados por plugins via
154
+ ``api.extend_i18n()``, sem necessidade de reiniciar o editor.
155
+
156
+ Returns:
157
+ list[str]: Lista de códigos de locale (ex: ['en', 'pt-BR']).
158
+ """
159
+ return [code for code, _ in I18n.get_instance().AVAILABLE_LOCALES]
160
+
161
+
162
+ def _get_language_labels() -> dict[str, str]:
163
+ """
164
+ Returns:
165
+ dict[str, str]: Mapeamento código -> nome (ex: {'en': 'English'}).
166
+ """
167
+ return dict(I18n.get_instance().AVAILABLE_LOCALES)
168
+
169
+
170
+ def _schema_editor() -> list[tuple]:
171
+ """Itens da categoria ``editor`` das configurações."""
172
+ return [
173
+ (
174
+ "__sep_editor",
175
+ "✏ " + _t("setting.cat_editor", "Editor"),
176
+ "",
177
+ "sep",
178
+ None,
179
+ None,
180
+ None,
181
+ None,
182
+ ),
183
+ (
184
+ "font_family",
185
+ _t("setting.font_family", "Família da Fonte"),
186
+ _t(
187
+ "setting.desc.font_family",
188
+ "Fonte monoespaçada usada no editor de código.",
189
+ ),
190
+ "combo",
191
+ FONT_MONO,
192
+ _get_system_mono_fonts(),
193
+ "string",
194
+ f'"{FONT_MONO}"',
195
+ ),
196
+ (
197
+ "font_size",
198
+ _t("setting.font_size", "Tamanho da Fonte"),
199
+ _t("setting.desc.font_size",
200
+ "Tamanho da fonte do editor em pontos."),
201
+ "slider",
202
+ FONT_SIZE,
203
+ (8, 32),
204
+ "integer (8–32)",
205
+ "13",
206
+ ),
207
+ (
208
+ "font_ligatures",
209
+ _t("setting.font_ligatures", "Ligaturas de Fonte"),
210
+ _t(
211
+ "setting.desc.font_ligatures",
212
+ "Ativa ligaturas tipográficas (ex: -> vira →, != vira ≠) em fontes que suportam como Fira Code, JetBrains Mono, Cascadia Code. Requer Tk 8.6+ com HarfBuzz - suporte varia por SO e fonte.",
213
+ ),
214
+ "toggle",
215
+ False,
216
+ None,
217
+ "boolean",
218
+ "false",
219
+ ),
220
+ (
221
+ "ligature_mode",
222
+ _t("setting.ligature_mode", "Modo de Ligatura"),
223
+ _t(
224
+ "setting.desc.ligature_mode",
225
+ "'native' usa recursos OpenType da fonte (requer HarfBuzz). 'pseudo' substitui sequências comuns por caracteres Unicode equivalentes em todos os sistemas.",
226
+ ),
227
+ "combo",
228
+ "pseudo",
229
+ ["native", "pseudo", "both"],
230
+ "native | pseudo | both",
231
+ "pseudo",
232
+ ),
233
+ (
234
+ "tab_size",
235
+ _t("setting.tab_size", "Tamanho do Tab"),
236
+ _t(
237
+ "setting.desc.tab_size",
238
+ "Número de espaços por nível de indentação.",
239
+ ),
240
+ "slider",
241
+ TAB_SIZE,
242
+ (2, 8),
243
+ "integer (2–8)",
244
+ "4",
245
+ ),
246
+ (
247
+ "use_spaces",
248
+ _t("setting.use_spaces", "Usar Espaços"),
249
+ _t(
250
+ "setting.desc.use_spaces",
251
+ "Insere espaços ao pressionar Tab em vez de caractere de tabulação.",
252
+ ),
253
+ "toggle",
254
+ False,
255
+ None,
256
+ "boolean",
257
+ "false",
258
+ ),
259
+ (
260
+ "word_wrap",
261
+ _t("setting.word_wrap", "Quebra de Linha"),
262
+ _t(
263
+ "setting.desc.word_wrap",
264
+ "Quebra linhas longas na borda da janela em vez de rolar horizontalmente.",
265
+ ),
266
+ "toggle",
267
+ False,
268
+ None,
269
+ "boolean",
270
+ "false",
271
+ ),
272
+ (
273
+ "cursor_style",
274
+ _t("setting.cursor_style", "Estilo do Cursor"),
275
+ _t(
276
+ "setting.desc.cursor_style",
277
+ "Forma visual do cursor de inserção no editor.",
278
+ ),
279
+ "combo",
280
+ "line",
281
+ ["line", "block", "underline"],
282
+ "line | block | underline",
283
+ "line",
284
+ ),
285
+ (
286
+ "cursor_blinking",
287
+ _t("setting.cursor_blinking", "Piscada do Cursor"),
288
+ _t(
289
+ "setting.desc.cursor_blinking",
290
+ "Comportamento de piscada do cursor de inserção.",
291
+ ),
292
+ "combo",
293
+ "blink",
294
+ ["blink", "solid", "smooth", "phase", "expand"],
295
+ "blink | solid | smooth | phase | expand",
296
+ "blink",
297
+ ),
298
+ (
299
+ "smooth_scroll",
300
+ _t("setting.smooth_scroll", "Rolagem Suave"),
301
+ _t(
302
+ "setting.desc.smooth_scroll",
303
+ "Habilita animação de rolagem suave no editor.",
304
+ ),
305
+ "toggle",
306
+ True,
307
+ None,
308
+ "boolean",
309
+ "true",
310
+ ),
311
+ (
312
+ "scroll_speed",
313
+ _t("setting.scroll_speed", "Sensibilidade da Rolagem"),
314
+ _t(
315
+ "setting.desc.scroll_speed",
316
+ "Número de linhas roladas por cada passo do scroll do mouse. Valores maiores = rolagem mais rápida.",
317
+ ),
318
+ "slider",
319
+ 3,
320
+ (1, 15),
321
+ "integer (1–15)",
322
+ "3",
323
+ ),
324
+ (
325
+ "multicursor_lines",
326
+ _t("setting.multicursor_lines", "Multicursor por Linhas"),
327
+ _t(
328
+ "setting.desc.multicursor_lines",
329
+ "Alt+Clique no gutter marca linhas; teclas aplicam em todas simultaneamente. Esc limpa.",
330
+ ),
331
+ "toggle",
332
+ True,
333
+ None,
334
+ "boolean",
335
+ "true",
336
+ ),
337
+ (
338
+ "multi_cursor",
339
+ _t("setting.multi_cursor", "Multi-Cursor"),
340
+ _t(
341
+ "setting.desc.multi_cursor",
342
+ "Permite adicionar múltiplos cursores com Alt+Clique ou Ctrl+D.",
343
+ ),
344
+ "toggle",
345
+ True,
346
+ None,
347
+ "boolean",
348
+ "true",
349
+ ),
350
+ (
351
+ "render_whitespace",
352
+ _t("setting.render_whitespace", "Renderizar Espaços em Branco"),
353
+ _t(
354
+ "setting.desc.render_whitespace",
355
+ "Controla a visibilidade de caracteres de espaço em branco no editor.",
356
+ ),
357
+ "combo",
358
+ "none",
359
+ ["none", "boundary", "selection", "trailing", "all"],
360
+ "none | boundary | selection | trailing | all",
361
+ "none",
362
+ ),
363
+ (
364
+ "indent_guides",
365
+ _t("setting.indent_guides", "Guias de Indentação"),
366
+ _t(
367
+ "setting.desc.indent_guides",
368
+ "Exibe linhas verticais indicando os níveis de indentação.",
369
+ ),
370
+ "toggle",
371
+ True,
372
+ None,
373
+ "boolean",
374
+ "true",
375
+ ),
376
+ (
377
+ "bracket_matching",
378
+ _t("setting.bracket_match", "Correspondência de Colchetes"),
379
+ _t(
380
+ "setting.desc.bracket_matching",
381
+ "Destaca o par de colchete/parêntese/chave ao posicionar o cursor.",
382
+ ),
383
+ "toggle",
384
+ True,
385
+ None,
386
+ "boolean",
387
+ "true",
388
+ ),
389
+ (
390
+ "highlight_current_line",
391
+ _t("setting.highlight_current_line", "Destacar Linha Atual"),
392
+ _t(
393
+ "setting.desc.highlight_current_line",
394
+ "Destaca com fundo sutil a linha onde o cursor está posicionado.",
395
+ ),
396
+ "toggle",
397
+ True,
398
+ None,
399
+ "boolean",
400
+ "true",
401
+ ),
402
+ (
403
+ "line_numbers",
404
+ _t("setting.line_numbers", "Números de Linha"),
405
+ _t(
406
+ "setting.desc.line_numbers",
407
+ "Exibe numeração de linhas no gutter (painel lateral esquerdo).",
408
+ ),
409
+ "toggle",
410
+ True,
411
+ None,
412
+ "boolean",
413
+ "true",
414
+ ),
415
+ (
416
+ "relative_numbers",
417
+ _t("setting.relative_numbers", "Números Relativos"),
418
+ _t(
419
+ "setting.desc.relative_numbers",
420
+ "Exibe numeração relativa ao cursor (estilo Vim) em vez de absoluta.",
421
+ ),
422
+ "toggle",
423
+ False,
424
+ None,
425
+ "boolean",
426
+ "false",
427
+ ),
428
+ (
429
+ "breadcrumbs",
430
+ _t("setting.breadcrumbs", "Breadcrumbs"),
431
+ _t(
432
+ "setting.desc.breadcrumbs",
433
+ "Exibe a trilha de navegação (arquivo > símbolo) no topo do editor.",
434
+ ),
435
+ "toggle",
436
+ True,
437
+ None,
438
+ "boolean",
439
+ "true",
440
+ ),
441
+ (
442
+ "minimap",
443
+ _t("setting.minimap", "Minimapa"),
444
+ _t(
445
+ "setting.desc.minimap",
446
+ "Exibe o minimapa (visão geral do código) no lado direito do editor.",
447
+ ),
448
+ "toggle",
449
+ True,
450
+ None,
451
+ "boolean",
452
+ "true",
453
+ ),
454
+ (
455
+ "encoding",
456
+ _t("setting.encoding", "Codificação Padrão"),
457
+ _t(
458
+ "setting.desc.encoding",
459
+ "Codificação de caracteres padrão para arquivos novos e sem BOM.",
460
+ ),
461
+ "combo",
462
+ "utf-8",
463
+ ["utf-8", "utf-8-bom", "utf-16", "latin-1", "cp1252", "ascii"],
464
+ "string",
465
+ '"utf-8"',
466
+ ),
467
+ (
468
+ "eol",
469
+ _t("setting.eol", "Fim de Linha Padrão"),
470
+ _t(
471
+ "setting.desc.eol",
472
+ "Sequência de fim de linha padrão para arquivos novos.",
473
+ ),
474
+ "combo",
475
+ "lf",
476
+ ["lf", "crlf", "cr"],
477
+ "lf | crlf | cr",
478
+ "lf",
479
+ ),
480
+ ]
481
+
482
+ def _schema_advanced_editor() -> list[tuple]:
483
+ """Itens da categoria ``advanced_editor`` das configurações."""
484
+ return [
485
+ (
486
+ "__sep_advanced_editor",
487
+ _t("setting.cat_advanced_editor",
488
+ "Recursos Avançados do Editor"),
489
+ "",
490
+ "sep",
491
+ None,
492
+ None,
493
+ None,
494
+ None,
495
+ ),
496
+ (
497
+ "sticky_scroll",
498
+ _t("setting.sticky_scroll", "Rolagem Fixada"),
499
+ _t(
500
+ "setting.desc.sticky_scroll",
501
+ "Exibe cabeçalhos do escopo atual fixos no topo do editor ao rolar.",
502
+ ),
503
+ "toggle",
504
+ True,
505
+ None,
506
+ "boolean",
507
+ "true",
508
+ ),
509
+ (
510
+ "code_folding",
511
+ _t("setting.code_folding", "Dobramento de Código"),
512
+ _t(
513
+ "setting.desc.code_folding",
514
+ "Permite recolher blocos de código (funções, classes, regiões).",
515
+ ),
516
+ "toggle",
517
+ True,
518
+ None,
519
+ "boolean",
520
+ "true",
521
+ ),
522
+ (
523
+ "inline_blame",
524
+ _t("setting.inline_blame", "Blame Git Inline"),
525
+ _t(
526
+ "setting.desc.inline_blame",
527
+ "Exibe autoria Git (autor, hash, tempo relativo) ao lado de cada linha.",
528
+ ),
529
+ "toggle",
530
+ False,
531
+ None,
532
+ "boolean",
533
+ "false",
534
+ ),
535
+ (
536
+ "inline_blame_mode",
537
+ _t("setting.inline_blame_mode", "Modo do Blame Inline"),
538
+ _t(
539
+ "setting.desc.inline_blame_mode",
540
+ "'cursor' exibe blame só na linha atual. 'all' exibe em todas as linhas visíveis.",
541
+ ),
542
+ "combo",
543
+ "cursor",
544
+ ["cursor", "all"],
545
+ "cursor | all",
546
+ "cursor",
547
+ ),
548
+ (
549
+ "color_preview",
550
+ _t("setting.color_preview", "Prévia de Cor Inline"),
551
+ _t(
552
+ "setting.desc.color_preview",
553
+ "Exibe swatches de cor ao lado de valores CSS/hex/rgb/hsl no código.",
554
+ ),
555
+ "toggle",
556
+ True,
557
+ None,
558
+ "boolean",
559
+ "true",
560
+ ),
561
+ (
562
+ "inlay_hints",
563
+ _t("setting.inlay_hints", "Dicas Inline (Inlay Hints)"),
564
+ _t(
565
+ "setting.desc.inlay_hints",
566
+ "Exibe dicas de tipo e nome de parâmetro inline no código.",
567
+ ),
568
+ "toggle",
569
+ False,
570
+ None,
571
+ "boolean",
572
+ "false",
573
+ ),
574
+ (
575
+ "smart_tips",
576
+ _t("setting.smart_tips", "Dicas Flutuantes Inteligentes"),
577
+ _t(
578
+ "setting.desc.smart_tips",
579
+ "Exibe dicas contextuais sobre qualidade de código, tamanho de arquivo, segurança e boas práticas durante a edição.",
580
+ ),
581
+ "toggle",
582
+ True,
583
+ None,
584
+ "boolean",
585
+ "true",
586
+ ),
587
+ (
588
+ "smart_tips_interval",
589
+ _t("setting.smart_tips_interval",
590
+ "Intervalo entre Dicas (segundos)"),
591
+ _t(
592
+ "setting.desc.smart_tips_interval",
593
+ "Tempo mínimo entre duas dicas. Valores maiores fazem as dicas aparecerem com menos frequência.",
594
+ ),
595
+ "slider",
596
+ 30,
597
+ (10, 300),
598
+ "integer (10-300 s)",
599
+ "30",
600
+ ),
601
+ (
602
+ "smart_tips_large_file_lines",
603
+ _t(
604
+ "setting.smart_tips_large_file_lines",
605
+ "Dica: Arquivo Grande (linhas)",
606
+ ),
607
+ _t(
608
+ "setting.desc.smart_tips_large_file_lines",
609
+ "Número de linhas a partir do qual o arquivo é considerado 'grande' e exibe a dica de refatoração. Aumente para silenciar em arquivos grandes.",
610
+ ),
611
+ "slider",
612
+ 1000,
613
+ (100, 10000),
614
+ "integer (100–10000)",
615
+ "1000",
616
+ ),
617
+ (
618
+ "smart_tips_huge_file_lines",
619
+ _t(
620
+ "setting.smart_tips_huge_file_lines",
621
+ "Dica: Arquivo Enorme (linhas)",
622
+ ),
623
+ _t(
624
+ "setting.desc.smart_tips_huge_file_lines",
625
+ "Número de linhas a partir do qual o arquivo é considerado 'enorme' e exibe alerta de performance. Deve ser maior que o limite de arquivo grande.",
626
+ ),
627
+ "slider",
628
+ 2000,
629
+ (200, 50000),
630
+ "integer (200–50000)",
631
+ "2000",
632
+ ),
633
+ (
634
+ "smart_tips_big_function_lines",
635
+ _t(
636
+ "setting.smart_tips_big_function_lines",
637
+ "Dica: Função Grande (linhas)",
638
+ ),
639
+ _t(
640
+ "setting.desc.smart_tips_big_function_lines",
641
+ "Número de linhas a partir do qual uma função Python é considerada 'grande'. Valores maiores reduzem a frequência desta dica.",
642
+ ),
643
+ "slider",
644
+ 60,
645
+ (20, 500),
646
+ "integer (20–500)",
647
+ "60",
648
+ ),
649
+ (
650
+ "smart_tips_long_line_chars",
651
+ _t(
652
+ "setting.smart_tips_long_line_chars",
653
+ "Dica: Linha Longa (caracteres)",
654
+ ),
655
+ _t(
656
+ "setting.desc.smart_tips_long_line_chars",
657
+ "Largura máxima de linha antes de disparar a dica de 'linhas longas'. O padrão PEP8 é 79; muitos projetos usam 100 ou 120.",
658
+ ),
659
+ "slider",
660
+ 100,
661
+ (60, 300),
662
+ "integer (60–300)",
663
+ "100",
664
+ ),
665
+ (
666
+ "smart_tips_deep_nesting",
667
+ _t(
668
+ "setting.smart_tips_deep_nesting",
669
+ "Dica: Aninhamento Profundo (níveis)",
670
+ ),
671
+ _t(
672
+ "setting.desc.smart_tips_deep_nesting",
673
+ "Nível de indentação (blocos aninhados) a partir do qual a dica de complexidade é disparada. 4 espaços = 1 nível.",
674
+ ),
675
+ "slider",
676
+ 5,
677
+ (3, 15),
678
+ "integer (3–15)",
679
+ "5",
680
+ ),
681
+ (
682
+ "smart_tips_todo_threshold",
683
+ _t("setting.smart_tips_todo_threshold",
684
+ "Dica: Quantidade de TODOs"),
685
+ _t(
686
+ "setting.desc.smart_tips_todo_threshold",
687
+ "Número mínimo de comentários TODO/FIXME/HACK para disparar a dica. Aumente para projetos com muitos TODOs intencionais.",
688
+ ),
689
+ "slider",
690
+ 5,
691
+ (2, 50),
692
+ "integer (2–50)",
693
+ "5",
694
+ ),
695
+ (
696
+ "smart_tips_generic_var_threshold",
697
+ _t(
698
+ "setting.smart_tips_generic_var_threshold",
699
+ "Dica: Variáveis Genéricas (quantidade)",
700
+ ),
701
+ _t(
702
+ "setting.desc.smart_tips_generic_var_threshold",
703
+ "Número mínimo de variáveis com nomes genéricos (x, tmp, data...) para disparar a dica de nomenclatura.",
704
+ ),
705
+ "slider",
706
+ 4,
707
+ (2, 20),
708
+ "integer (2–20)",
709
+ "4",
710
+ ),
711
+ ]
712
+
713
+ def _schema_autocomplete() -> list[tuple]:
714
+ """Itens da categoria ``autocomplete`` das configurações."""
715
+ return [
716
+ (
717
+ "__sep_autocomplete",
718
+ "💬 " + _t("setting.cat_autocomplete", "Autocomplete & Hover"),
719
+ "",
720
+ "sep",
721
+ None,
722
+ None,
723
+ None,
724
+ None,
725
+ ),
726
+ (
727
+ "autocomplete",
728
+ _t("setting.autocomplete", "Autocomplete"),
729
+ _t(
730
+ "setting.desc.autocomplete",
731
+ "Habilita sugestões de autocomplete ao digitar.",
732
+ ),
733
+ "toggle",
734
+ True,
735
+ None,
736
+ "boolean",
737
+ "true",
738
+ ),
739
+ (
740
+ "autocomplete_delay",
741
+ _t("setting.autocomplete_delay", "Atraso do Autocomplete (ms)"),
742
+ _t(
743
+ "setting.desc.autocomplete_delay",
744
+ "Tempo de espera após digitar antes de exibir sugestões.",
745
+ ),
746
+ "slider",
747
+ 200,
748
+ (50, 1000),
749
+ "integer (50–1000 ms)",
750
+ "200",
751
+ ),
752
+ (
753
+ "snippets",
754
+ _t("setting.snippets", "Snippets"),
755
+ _t(
756
+ "setting.desc.snippets",
757
+ "Habilita expansão de snippets de código ao pressionar Tab.",
758
+ ),
759
+ "toggle",
760
+ True,
761
+ None,
762
+ "boolean",
763
+ "true",
764
+ ),
765
+ (
766
+ "parameter_hints",
767
+ _t("setting.parameter_hints", "Dicas de Parâmetro"),
768
+ _t(
769
+ "setting.desc.parameter_hints",
770
+ "Exibe dicas de parâmetros de função ao digitar chamadas.",
771
+ ),
772
+ "toggle",
773
+ True,
774
+ None,
775
+ "boolean",
776
+ "true",
777
+ ),
778
+ (
779
+ "hover_docs",
780
+ _t("setting.hover_docs", "Documentação ao Passar o Mouse"),
781
+ _t(
782
+ "setting.desc.hover_docs",
783
+ "Exibe documentação KDocs/JSDoc/LSP ao passar o mouse sobre um símbolo.",
784
+ ),
785
+ "toggle",
786
+ True,
787
+ None,
788
+ "boolean",
789
+ "true",
790
+ ),
791
+ ]
792
+
793
+ def _schema_appearance() -> list[tuple]:
794
+ """Itens da categoria ``appearance`` das configurações."""
795
+ return [
796
+ (
797
+ "__sep_appearance",
798
+ _t("setting.cat_appearance", "Aparência"),
799
+ "",
800
+ "sep",
801
+ None,
802
+ None,
803
+ None,
804
+ None,
805
+ ),
806
+ (
807
+ "theme",
808
+ _t("setting.theme", "Tema"),
809
+ _t(
810
+ "setting.desc.theme",
811
+ "Tema visual do editor. Alterne também via Ctrl+Shift+P → 'theme'.",
812
+ ),
813
+ "combo",
814
+ "catppuccin_mocha",
815
+ _ensure_themes() or THEME_ORDER,
816
+ "string",
817
+ '"catppuccin_mocha"',
818
+ ),
819
+ (
820
+ "language",
821
+ _t("setting.language", "Idioma da Interface"),
822
+ _t(
823
+ "setting.desc.language",
824
+ "Idioma das mensagens e menus do Codis. Requer reinicialização.",
825
+ ),
826
+ "combo",
827
+ "pt-BR",
828
+ _get_language_options(),
829
+ "string",
830
+ '"pt-BR"',
831
+ ),
832
+ (
833
+ "ui_font_family",
834
+ _t("setting.ui_font_family", "Fonte da Interface"),
835
+ _t(
836
+ "setting.desc.ui_font_family",
837
+ "Fonte usada em menus, painéis e textos da interface.",
838
+ ),
839
+ "combo",
840
+ "Segoe UI",
841
+ _get_system_ui_fonts(),
842
+ "string",
843
+ '"Segoe UI"',
844
+ ),
845
+ (
846
+ "ui_scale",
847
+ _t("setting.ui_scale", "Escala da Interface (%)"),
848
+ _t(
849
+ "setting.desc.ui_scale",
850
+ "Tamanho geral da interface em porcentagem. 0 = automático "
851
+ "(ajusta à resolução da tela); 50-250 = manual. Reduza em "
852
+ "telas pequenas, aumente em telas grandes.",
853
+ ),
854
+ "slider",
855
+ 0,
856
+ (0, 250),
857
+ "integer (0 ou 50–250)",
858
+ "0",
859
+ ),
860
+ (
861
+ "ui_font_size",
862
+ _t("setting.ui_font_size", "Tamanho da Fonte da Interface"),
863
+ _t(
864
+ "setting.desc.ui_font_size",
865
+ "Tamanho da fonte da interface em pontos.",
866
+ ),
867
+ "slider",
868
+ 10,
869
+ (8, 16),
870
+ "integer (8–16)",
871
+ "10",
872
+ ),
873
+ (
874
+ "activity_bar",
875
+ _t("setting.activity_bar", "Barra de Atividades"),
876
+ _t(
877
+ "setting.desc.activity_bar",
878
+ "Exibe a barra de atividades lateral com ícones de painel.",
879
+ ),
880
+ "toggle",
881
+ True,
882
+ None,
883
+ "boolean",
884
+ "true",
885
+ ),
886
+ (
887
+ "show_welcome",
888
+ _t("setting.show_welcome", "Tela de Boas-Vindas"),
889
+ _t(
890
+ "setting.desc.show_welcome",
891
+ "Exibe a tela de boas-vindas ao iniciar sem um projeto aberto.",
892
+ ),
893
+ "toggle",
894
+ True,
895
+ None,
896
+ "boolean",
897
+ "true",
898
+ ),
899
+ ]
900
+
901
+ def _schema_layout() -> list[tuple]:
902
+ """Itens da categoria ``layout`` das configurações."""
903
+ return [
904
+ (
905
+ "__sep_layout",
906
+ "🖥 " + _t("setting.cat_ui", "Interface & Layout"),
907
+ "",
908
+ "sep",
909
+ None,
910
+ None,
911
+ None,
912
+ None,
913
+ ),
914
+ (
915
+ "startup_screen",
916
+ _t("setting.startup_screen", "Tela ao Iniciar"),
917
+ _t(
918
+ "setting.desc.startup_screen",
919
+ "editor = abre o editor; launcher = abre a tela inicial com os atalhos das ferramentas.",
920
+ ),
921
+ "combo",
922
+ "editor",
923
+ ["editor", "launcher"],
924
+ "string",
925
+ '"launcher"',
926
+ ),
927
+ (
928
+ "sidebar_width",
929
+ _t("setting.sidebar_width", "Largura da Sidebar (px)"),
930
+ _t(
931
+ "setting.desc.sidebar_width",
932
+ "Largura inicial da barra lateral em pixels.",
933
+ ),
934
+ "slider",
935
+ 320,
936
+ (160, 600),
937
+ "integer (160–600 px)",
938
+ "320",
939
+ ),
940
+ (
941
+ "panel_height",
942
+ _t("setting.panel_height", "Altura do Painel Inferior (px)"),
943
+ _t(
944
+ "setting.desc.panel_height",
945
+ "Altura inicial do painel inferior (terminal, problemas, output).",
946
+ ),
947
+ "slider",
948
+ 240,
949
+ (120, 600),
950
+ "integer (120–600 px)",
951
+ "240",
952
+ ),
953
+ (
954
+ "minimap_width",
955
+ _t("setting.minimap_width", "Largura do Minimapa (px)"),
956
+ _t(
957
+ "setting.desc.minimap_width",
958
+ "Largura do painel de minimapa em pixels.",
959
+ ),
960
+ "slider",
961
+ 110,
962
+ (60, 200),
963
+ "integer (60–200 px)",
964
+ "110",
965
+ ),
966
+ (
967
+ "minimap_scale",
968
+ _t("setting.minimap_scale", "Escala do Minimapa"),
969
+ _t(
970
+ "setting.desc.minimap_scale",
971
+ "Pixels por coluna de caractere no minimapa. Maior = mais denso.",
972
+ ),
973
+ "slider",
974
+ 3,
975
+ (1, 6),
976
+ "integer (1–6)",
977
+ "3",
978
+ ),
979
+ (
980
+ "window_width",
981
+ _t("setting.window_width", "Largura da Janela (px)"),
982
+ _t(
983
+ "setting.desc.window_width",
984
+ "Largura inicial da janela principal em pixels.",
985
+ ),
986
+ "slider",
987
+ 1600,
988
+ (800, 3840),
989
+ "integer (800–3840 px)",
990
+ "1600",
991
+ ),
992
+ (
993
+ "window_height",
994
+ _t("setting.window_height", "Altura da Janela (px)"),
995
+ _t(
996
+ "setting.desc.window_height",
997
+ "Altura inicial da janela principal em pixels.",
998
+ ),
999
+ "slider",
1000
+ 960,
1001
+ (600, 2160),
1002
+ "integer (600–2160 px)",
1003
+ "960",
1004
+ ),
1005
+ (
1006
+ "max_recent",
1007
+ _t("setting.max_recent", "Máximo de Recentes"),
1008
+ _t(
1009
+ "setting.desc.max_recent",
1010
+ "Número máximo de arquivos e pastas recentes na lista.",
1011
+ ),
1012
+ "slider",
1013
+ 20,
1014
+ (5, 50),
1015
+ "integer (5–50)",
1016
+ "20",
1017
+ ),
1018
+ ]
1019
+
1020
+ def _schema_save() -> list[tuple]:
1021
+ """Itens da categoria ``save`` das configurações."""
1022
+ return [
1023
+ (
1024
+ "__sep_save",
1025
+ "💾 " + _t("setting.cat_save", "Salvamento & Sessão"),
1026
+ "",
1027
+ "sep",
1028
+ None,
1029
+ None,
1030
+ None,
1031
+ None,
1032
+ ),
1033
+ (
1034
+ "autosave",
1035
+ _t("setting.autosave", "Salvamento Automático"),
1036
+ _t(
1037
+ "setting.desc.autosave",
1038
+ "Salva automaticamente o arquivo após um período de inatividade.",
1039
+ ),
1040
+ "toggle",
1041
+ False,
1042
+ None,
1043
+ "boolean",
1044
+ "false",
1045
+ ),
1046
+ (
1047
+ "autosave_delay",
1048
+ _t("setting.autosave_delay", "Atraso do Autosave (s)"),
1049
+ _t(
1050
+ "setting.desc.autosave_delay",
1051
+ "Tempo de inatividade em segundos antes de salvar automaticamente.",
1052
+ ),
1053
+ "slider",
1054
+ 30,
1055
+ (5, 300),
1056
+ "integer (5–300 s)",
1057
+ "30",
1058
+ ),
1059
+ (
1060
+ "recovery_enabled",
1061
+ _t("setting.recovery_enabled", "Recuperar Alterações Não Salvas"),
1062
+ _t(
1063
+ "setting.desc.recovery_enabled",
1064
+ "Guarda cópias dos arquivos com alterações pendentes para restaurá-las se o Codis fechar de forma inesperada.",
1065
+ ),
1066
+ "toggle",
1067
+ True,
1068
+ None,
1069
+ "boolean",
1070
+ "true",
1071
+ ),
1072
+ (
1073
+ "recovery_interval",
1074
+ _t("setting.recovery_interval", "Intervalo da Recuperação (s)"),
1075
+ _t(
1076
+ "setting.desc.recovery_interval",
1077
+ "Tempo entre as cópias de segurança das alterações não salvas.",
1078
+ ),
1079
+ "slider",
1080
+ 20,
1081
+ (5, 300),
1082
+ "integer (5–300 s)",
1083
+ "20",
1084
+ ),
1085
+ (
1086
+ "format_on_save",
1087
+ _t("setting.format_on_save", "Formatar ao Salvar"),
1088
+ _t(
1089
+ "setting.desc.format_on_save",
1090
+ "Executa o formatador (Black/Prettier) automaticamente ao salvar.",
1091
+ ),
1092
+ "toggle",
1093
+ False,
1094
+ None,
1095
+ "boolean",
1096
+ "false",
1097
+ ),
1098
+ (
1099
+ "trim_trailing_whitespace",
1100
+ _t("setting.trim_trailing_whitespace",
1101
+ "Remover Espaços no Final"),
1102
+ _t(
1103
+ "setting.desc.trim_trailing",
1104
+ "Remove espaços em branco no final de cada linha ao salvar.",
1105
+ ),
1106
+ "toggle",
1107
+ True,
1108
+ None,
1109
+ "boolean",
1110
+ "true",
1111
+ ),
1112
+ (
1113
+ "insert_final_newline",
1114
+ _t("setting.insert_final_newline", "Inserir Nova Linha Final"),
1115
+ _t(
1116
+ "setting.desc.insert_newline",
1117
+ "Garante que o arquivo termine com uma linha vazia ao salvar.",
1118
+ ),
1119
+ "toggle",
1120
+ True,
1121
+ None,
1122
+ "boolean",
1123
+ "true",
1124
+ ),
1125
+ (
1126
+ "session_restore",
1127
+ _t("setting.session_restore", "Restaurar Sessão"),
1128
+ _t(
1129
+ "setting.desc.session_restore",
1130
+ "Reabre os arquivos e pastas da última sessão ao iniciar.",
1131
+ ),
1132
+ "toggle",
1133
+ False,
1134
+ None,
1135
+ "boolean",
1136
+ "false",
1137
+ ),
1138
+ (
1139
+ "exit_save_mode",
1140
+ _t("setting.exit_save_mode", "Ao Sair com Alterações"),
1141
+ _t("setting.desc.exit_save_mode", "ask = pergunta; save = sempre salva; discard = sai sem salvar nada."),
1142
+ "combo",
1143
+ "ask",
1144
+ ['ask', 'save', 'discard'],
1145
+ "string",
1146
+ '"ask"',
1147
+ ),
1148
+ (
1149
+ "session_save_on_exit",
1150
+ _t("setting.session_save_on_exit", "Lembrar Arquivos Abertos ao Sair"),
1151
+ _t("setting.desc.session_save_on_exit", "Grava a lista de abas/pasta ao sair. Desligado: o Codis abre limpo na próxima vez."),
1152
+ "toggle",
1153
+ True,
1154
+ None,
1155
+ "boolean",
1156
+ "true",
1157
+ ),
1158
+ ]
1159
+
1160
+ def _schema_trash() -> list[tuple]:
1161
+ """Itens da categoria ``trash`` das configurações."""
1162
+ return [
1163
+ (
1164
+ "__sep_trash",
1165
+ "🗑 " + _t("setting.cat_trash", "Lixeira & Exclusão"),
1166
+ "",
1167
+ "sep",
1168
+ None,
1169
+ None,
1170
+ None,
1171
+ None,
1172
+ ),
1173
+ (
1174
+ "confirm_delete",
1175
+ _t("setting.confirm_delete", "Confirmar Antes de Excluir"),
1176
+ _t("setting.desc.confirm_delete", "Pergunta antes de mover itens para a lixeira (Shift+Del sempre pergunta)."),
1177
+ "toggle",
1178
+ True,
1179
+ None,
1180
+ "boolean",
1181
+ "true",
1182
+ ),
1183
+ (
1184
+ "trash_backend",
1185
+ _t("setting.trash_backend", "Destino da Lixeira"),
1186
+ _t("setting.desc.trash_backend", "workspace = pasta .codis_trash do projeto (instantâneo, mesmo disco); system = lixeira do SO."),
1187
+ "combo",
1188
+ "workspace",
1189
+ ['workspace', 'system'],
1190
+ "string",
1191
+ '"workspace"',
1192
+ ),
1193
+ (
1194
+ "trash_retention_days",
1195
+ _t("setting.trash_retention_days", "Esvaziar Lixeira Após (dias)"),
1196
+ _t("setting.desc.trash_retention_days", "0 = nunca apagar automaticamente."),
1197
+ "slider",
1198
+ 0,
1199
+ (0, 365),
1200
+ "integer (0–365)",
1201
+ "0",
1202
+ ),
1203
+ (
1204
+ "trash_max_mb",
1205
+ _t("setting.trash_max_mb", "Limite da Lixeira (MB)"),
1206
+ _t("setting.desc.trash_max_mb", "0 = sem limite. Ao exceder, os itens mais antigos são removidos."),
1207
+ "slider",
1208
+ 0,
1209
+ (0, 102400),
1210
+ "integer (0–102400)",
1211
+ "0",
1212
+ ),
1213
+ ]
1214
+
1215
+ def _schema_lint() -> list[tuple]:
1216
+ """Itens da categoria ``lint`` das configurações."""
1217
+ return [
1218
+ (
1219
+ "__sep_lint",
1220
+ "🔍 " + _t("setting.cat_lint", "Lint & Análise de Código"),
1221
+ "",
1222
+ "sep",
1223
+ None,
1224
+ None,
1225
+ None,
1226
+ None,
1227
+ ),
1228
+ (
1229
+ "lint_enabled",
1230
+ _t("setting.lint_enabled", "Lint Habilitado"),
1231
+ _t(
1232
+ "setting.desc.lint_enabled",
1233
+ "Habilita a análise de lint em tempo real para todas as linguagens configuradas.",
1234
+ ),
1235
+ "toggle",
1236
+ True,
1237
+ None,
1238
+ "boolean",
1239
+ "true",
1240
+ ),
1241
+ (
1242
+ "lint_python",
1243
+ _t("setting.lint_python", "Lint Python"),
1244
+ _t(
1245
+ "setting.desc.lint_python",
1246
+ "Habilita análise de lint para arquivos Python (Flake8, Pylint, Mypy).",
1247
+ ),
1248
+ "toggle",
1249
+ True,
1250
+ None,
1251
+ "boolean",
1252
+ "true",
1253
+ ),
1254
+ (
1255
+ "lint_js",
1256
+ _t("setting.lint_js", "Lint JavaScript/TypeScript"),
1257
+ _t(
1258
+ "setting.desc.lint_js",
1259
+ "Habilita análise de lint para arquivos JS/TS com ESLint.",
1260
+ ),
1261
+ "toggle",
1262
+ True,
1263
+ None,
1264
+ "boolean",
1265
+ "true",
1266
+ ),
1267
+ (
1268
+ "lint_html",
1269
+ _t("setting.lint_html", "Lint HTML"),
1270
+ _t(
1271
+ "setting.desc.lint_html",
1272
+ "Habilita análise de lint básica para arquivos HTML (tags não fechadas, atributos duplicados).",
1273
+ ),
1274
+ "toggle",
1275
+ True,
1276
+ None,
1277
+ "boolean",
1278
+ "true",
1279
+ ),
1280
+ (
1281
+ "lint_delay",
1282
+ _t("setting.lint_delay", "Atraso do Lint (ms)"),
1283
+ _t(
1284
+ "setting.desc.lint_delay",
1285
+ "Tempo de espera após parar de digitar antes de executar o lint.",
1286
+ ),
1287
+ "slider",
1288
+ 750,
1289
+ (100, 3000),
1290
+ "integer (100–3000 ms)",
1291
+ "750",
1292
+ ),
1293
+ (
1294
+ "eslint_path",
1295
+ _t("setting.eslint_path", "Caminho do ESLint"),
1296
+ _t(
1297
+ "setting.desc.eslint_path",
1298
+ "Caminho ou comando para executar o ESLint.",
1299
+ ),
1300
+ "entry",
1301
+ "eslint",
1302
+ None,
1303
+ "string",
1304
+ '"eslint"',
1305
+ ),
1306
+ (
1307
+ "pylint_path",
1308
+ _t("setting.pylint_path", "Caminho do Pylint"),
1309
+ _t(
1310
+ "setting.desc.pylint_path",
1311
+ "Caminho ou comando para executar o Pylint.",
1312
+ ),
1313
+ "entry",
1314
+ "pylint",
1315
+ None,
1316
+ "string",
1317
+ '"pylint"',
1318
+ ),
1319
+ (
1320
+ "flake8_path",
1321
+ _t("setting.flake8_path", "Caminho do Flake8"),
1322
+ _t(
1323
+ "setting.desc.flake8_path",
1324
+ "Caminho ou comando para executar o Flake8.",
1325
+ ),
1326
+ "entry",
1327
+ "flake8",
1328
+ None,
1329
+ "string",
1330
+ '"flake8"',
1331
+ ),
1332
+ (
1333
+ "mypy_path",
1334
+ _t("setting.mypy_path", "Caminho do Mypy"),
1335
+ _t(
1336
+ "setting.desc.mypy_path",
1337
+ "Caminho ou comando para executar o Mypy (verificação de tipos).",
1338
+ ),
1339
+ "entry",
1340
+ "mypy",
1341
+ None,
1342
+ "string",
1343
+ '"mypy"',
1344
+ ),
1345
+ (
1346
+ "prettier_path",
1347
+ _t("setting.prettier_path", "Caminho do Prettier"),
1348
+ _t(
1349
+ "setting.desc.prettier_path",
1350
+ "Caminho ou comando para executar o Prettier.",
1351
+ ),
1352
+ "entry",
1353
+ "prettier",
1354
+ None,
1355
+ "string",
1356
+ '"prettier"',
1357
+ ),
1358
+ ]
1359
+
1360
+ def _schema_lsp() -> list[tuple]:
1361
+ """Itens da categoria ``lsp`` das configurações."""
1362
+ return [
1363
+ (
1364
+ "__sep_lsp",
1365
+ "🔤 " + _t("setting.cat_lsp", "LSP - Language Servers"),
1366
+ "",
1367
+ "sep",
1368
+ None,
1369
+ None,
1370
+ None,
1371
+ None,
1372
+ ),
1373
+ (
1374
+ "lsp_enabled",
1375
+ _t("setting.lsp_enabled", "LSP Habilitado"),
1376
+ _t(
1377
+ "setting.desc.lsp_enabled",
1378
+ "Habilita integração com servidores LSP para Go to Definition, Find References, rename, etc.",
1379
+ ),
1380
+ "toggle",
1381
+ True,
1382
+ None,
1383
+ "boolean",
1384
+ "true",
1385
+ ),
1386
+ (
1387
+ "lsp_hover_enabled",
1388
+ _t("setting.lsp_hover_enabled", "Hover LSP"),
1389
+ _t(
1390
+ "setting.desc.lsp_hover",
1391
+ "Exibe documentação do LSP ao passar o mouse sobre símbolos.",
1392
+ ),
1393
+ "toggle",
1394
+ True,
1395
+ None,
1396
+ "boolean",
1397
+ "true",
1398
+ ),
1399
+ (
1400
+ "lsp_format_enabled",
1401
+ _t("setting.lsp_format_enabled", "Formatação LSP"),
1402
+ _t(
1403
+ "setting.desc.lsp_format",
1404
+ "Usa o formatador do LSP em vez do Prettier/Black ao formatar o documento.",
1405
+ ),
1406
+ "toggle",
1407
+ False,
1408
+ None,
1409
+ "boolean",
1410
+ "false",
1411
+ ),
1412
+ (
1413
+ "lsp_diagnostics",
1414
+ _t("setting.lsp_diagnostics", "Diagnósticos LSP"),
1415
+ _t(
1416
+ "setting.desc.lsp_diagnostics",
1417
+ "Exibe diagnósticos (erros/avisos) recebidos do servidor LSP no painel Problemas.",
1418
+ ),
1419
+ "toggle",
1420
+ True,
1421
+ None,
1422
+ "boolean",
1423
+ "true",
1424
+ ),
1425
+ ]
1426
+
1427
+ def _schema_git() -> list[tuple]:
1428
+ """Itens da categoria ``git`` das configurações."""
1429
+ return [
1430
+ (
1431
+ "__sep_git",
1432
+ "🌿 " + _t("setting.cat_git", "Git & Controle de Versão"),
1433
+ "",
1434
+ "sep",
1435
+ None,
1436
+ None,
1437
+ None,
1438
+ None,
1439
+ ),
1440
+ (
1441
+ "git_enabled",
1442
+ _t("setting.git_enabled", "Git Habilitado"),
1443
+ _t(
1444
+ "setting.desc.git_enabled",
1445
+ "Habilita integração Git (painel Git, decorações na file tree, blame).",
1446
+ ),
1447
+ "toggle",
1448
+ True,
1449
+ None,
1450
+ "boolean",
1451
+ "true",
1452
+ ),
1453
+ (
1454
+ "git_decorations",
1455
+ _t("setting.git_decorations", "Decorações Git na File Tree"),
1456
+ _t(
1457
+ "setting.desc.git_decorations",
1458
+ "Exibe indicadores de status Git (M, A, D, ?) nos arquivos da árvore.",
1459
+ ),
1460
+ "toggle",
1461
+ True,
1462
+ None,
1463
+ "boolean",
1464
+ "true",
1465
+ ),
1466
+ (
1467
+ "git_auto_fetch",
1468
+ _t("setting.git_auto_fetch", "Fetch Automático"),
1469
+ _t(
1470
+ "setting.desc.git_auto_fetch",
1471
+ "Executa git fetch automaticamente em intervalos regulares.",
1472
+ ),
1473
+ "toggle",
1474
+ False,
1475
+ None,
1476
+ "boolean",
1477
+ "false",
1478
+ ),
1479
+ (
1480
+ "git_fetch_interval",
1481
+ _t("setting.git_fetch_interval", "Intervalo do Fetch (s)"),
1482
+ _t(
1483
+ "setting.desc.git_fetch_interval",
1484
+ "Intervalo em segundos entre fetches automáticos.",
1485
+ ),
1486
+ "slider",
1487
+ 180,
1488
+ (30, 3600),
1489
+ "integer (30–3600 s)",
1490
+ "180",
1491
+ ),
1492
+ ]
1493
+
1494
+ def _schema_terminal() -> list[tuple]:
1495
+ """Itens da categoria ``terminal`` das configurações."""
1496
+ return [
1497
+ (
1498
+ "__sep_terminal",
1499
+ "💻 " + _t("setting.cat_terminal", "Terminal Integrado"),
1500
+ "",
1501
+ "sep",
1502
+ None,
1503
+ None,
1504
+ None,
1505
+ None,
1506
+ ),
1507
+ (
1508
+ "default_shell",
1509
+ _t("setting.default_shell", "Shell Padrão"),
1510
+ _t(
1511
+ "setting.desc.default_shell",
1512
+ "Shell padrão do terminal integrado. Requer reinicialização do terminal.",
1513
+ ),
1514
+ "combo",
1515
+ get_default_shell(),
1516
+ list(SHELL_OPTIONS.keys()),
1517
+ "string",
1518
+ f'"{get_default_shell()}"',
1519
+ ),
1520
+ (
1521
+ "terminal_font_size",
1522
+ _t("setting.terminal_font_size", "Tamanho da Fonte do Terminal"),
1523
+ _t(
1524
+ "setting.desc.terminal_font_size",
1525
+ "Tamanho da fonte no terminal integrado em pontos.",
1526
+ ),
1527
+ "slider",
1528
+ 12,
1529
+ (8, 24),
1530
+ "integer (8–24)",
1531
+ "12",
1532
+ ),
1533
+ (
1534
+ "terminal_internal_python_warning",
1535
+ _t("setting.terminal_internal_python_warning", "Avisar ao abrir o Python interno"),
1536
+ _t(
1537
+ "setting.desc.terminal_internal_python_warning",
1538
+ "Mostra o aviso de risco antes de abrir o terminal Python interno, que executa código dentro do próprio Codis.",
1539
+ ),
1540
+ "toggle",
1541
+ True,
1542
+ None,
1543
+ "boolean",
1544
+ "true",
1545
+ ),
1546
+ (
1547
+ "terminal_max_lines",
1548
+ _t("setting.terminal_max_lines", "Máximo de Linhas do Terminal"),
1549
+ _t(
1550
+ "setting.desc.terminal_max_lines",
1551
+ "Número máximo de linhas mantidas no buffer do terminal.",
1552
+ ),
1553
+ "slider",
1554
+ 8000,
1555
+ (1000, 50000),
1556
+ "integer (1000–50000)",
1557
+ "8000",
1558
+ ),
1559
+ ]
1560
+
1561
+ def _schema_filetree() -> list[tuple]:
1562
+ """Itens da categoria ``filetree`` das configurações."""
1563
+ return [
1564
+ (
1565
+ "__sep_filetree",
1566
+ "📁 " + _t("setting.cat_filetree", "Explorador de Arquivos"),
1567
+ "",
1568
+ "sep",
1569
+ None,
1570
+ None,
1571
+ None,
1572
+ None,
1573
+ ),
1574
+ (
1575
+ "show_hidden_files",
1576
+ _t("setting.show_hidden_files", "Mostrar Arquivos Ocultos"),
1577
+ _t(
1578
+ "setting.desc.show_hidden_files",
1579
+ "Exibe arquivos e pastas que começam com ponto (.) na árvore de arquivos.",
1580
+ ),
1581
+ "toggle",
1582
+ False,
1583
+ None,
1584
+ "boolean",
1585
+ "false",
1586
+ ),
1587
+ (
1588
+ "respect_ignore_files",
1589
+ _t("setting.respect_ignore_files", "Respeitar .gitignore"),
1590
+ _t(
1591
+ "setting.desc.respect_ignore_files",
1592
+ "Oculta arquivos listados no .gitignore da file tree e da busca.",
1593
+ ),
1594
+ "toggle",
1595
+ True,
1596
+ None,
1597
+ "boolean",
1598
+ "true",
1599
+ ),
1600
+ ]
1601
+
1602
+ def _schema_render() -> list[tuple]:
1603
+ """Itens da categoria ``render`` das configurações."""
1604
+ return [
1605
+ (
1606
+ "__sep_render",
1607
+ "🌐 " + _t("setting.cat_render", "Preview & Render"),
1608
+ "",
1609
+ "sep",
1610
+ None,
1611
+ None,
1612
+ None,
1613
+ None,
1614
+ ),
1615
+ (
1616
+ "render_internal",
1617
+ _t("setting.render_internal", "Render Interno"),
1618
+ _t(
1619
+ "setting.desc.render_internal",
1620
+ "Usa o renderizador interno para Markdown/HTML. Desative para usar o navegador do sistema.",
1621
+ ),
1622
+ "toggle",
1623
+ True,
1624
+ None,
1625
+ "boolean",
1626
+ "true",
1627
+ ),
1628
+ ]
1629
+
1630
+ def _schema_timeline() -> list[tuple]:
1631
+ """Itens da categoria ``timeline`` das configurações."""
1632
+ return [
1633
+ (
1634
+ "__sep_timeline",
1635
+ "🕒 " + _t("setting.cat_timeline", "Timeline de Arquivos"),
1636
+ "",
1637
+ "sep",
1638
+ None,
1639
+ None,
1640
+ None,
1641
+ None,
1642
+ ),
1643
+ (
1644
+ "timeline_max_backups",
1645
+ _t("setting.timeline_max_backups",
1646
+ "Máximo de Backups por Arquivo"),
1647
+ _t(
1648
+ "setting.desc.timeline_max_backups",
1649
+ "Número máximo de snapshots mantidos por arquivo no histórico da timeline.",
1650
+ ),
1651
+ "slider",
1652
+ 20,
1653
+ (5, 100),
1654
+ "integer (5–100)",
1655
+ "20",
1656
+ ),
1657
+ (
1658
+ "timeline_max_age_days",
1659
+ _t("setting.timeline_max_age_days",
1660
+ "Idade Máxima dos Backups (dias)"),
1661
+ _t(
1662
+ "setting.desc.timeline_max_age_days",
1663
+ "Backups mais antigos que este número de dias são removidos automaticamente.",
1664
+ ),
1665
+ "slider",
1666
+ 30,
1667
+ (1, 365),
1668
+ "integer (1–365 dias)",
1669
+ "30",
1670
+ ),
1671
+ ]
1672
+
1673
+ def _schema_flowchart() -> list[tuple]:
1674
+ """Itens da categoria ``flowchart`` das configurações."""
1675
+ return [
1676
+ (
1677
+ "__sep_flowchart",
1678
+ "🔀 " + _t("setting.cat_flowchart", "Flowchart"),
1679
+ "",
1680
+ "sep",
1681
+ None,
1682
+ None,
1683
+ None,
1684
+ None,
1685
+ ),
1686
+ (
1687
+ "flowchart_auto",
1688
+ _t("setting.flowchart_auto", "Flowchart Automático"),
1689
+ _t(
1690
+ "setting.desc.flowchart_auto",
1691
+ "Gera o diagrama de fluxo automaticamente ao editar o arquivo.",
1692
+ ),
1693
+ "toggle",
1694
+ False,
1695
+ None,
1696
+ "boolean",
1697
+ "false",
1698
+ ),
1699
+ (
1700
+ "flowchart_max_depth",
1701
+ _t("setting.flowchart_max_depth", "Profundidade Máxima"),
1702
+ _t(
1703
+ "setting.desc.flowchart_max_depth",
1704
+ "Profundidade máxima de chamadas analisadas para o flowchart.",
1705
+ ),
1706
+ "slider",
1707
+ 3,
1708
+ (1, 8),
1709
+ "integer (1–8)",
1710
+ "3",
1711
+ ),
1712
+ ]
1713
+
1714
+ def _schema_pomodoro() -> list[tuple]:
1715
+ """Itens da categoria ``pomodoro`` das configurações."""
1716
+ return [
1717
+ (
1718
+ "__sep_pomodoro",
1719
+ "⏱ " + _t("setting.cat_pomodoro", "Pomodoro Timer"),
1720
+ "",
1721
+ "sep",
1722
+ None,
1723
+ None,
1724
+ None,
1725
+ None,
1726
+ ),
1727
+ (
1728
+ "pomodoro_work_min",
1729
+ _t("setting.pomodoro_work_min", "Duração do Trabalho (min)"),
1730
+ _t(
1731
+ "setting.desc.pomodoro_work",
1732
+ "Duração de cada sessão de trabalho do Pomodoro em minutos.",
1733
+ ),
1734
+ "slider",
1735
+ 25,
1736
+ (5, 90),
1737
+ "integer (5–90 min)",
1738
+ "25",
1739
+ ),
1740
+ (
1741
+ "pomodoro_break_min",
1742
+ _t("setting.pomodoro_break_min", "Pausa Curta (min)"),
1743
+ _t(
1744
+ "setting.desc.pomodoro_break",
1745
+ "Duração da pausa curta entre sessões de trabalho.",
1746
+ ),
1747
+ "slider",
1748
+ 5,
1749
+ (1, 30),
1750
+ "integer (1–30 min)",
1751
+ "5",
1752
+ ),
1753
+ (
1754
+ "pomodoro_long_break_min",
1755
+ _t("setting.pomodoro_long_break_min", "Pausa Longa (min)"),
1756
+ _t(
1757
+ "setting.desc.pomodoro_long_break",
1758
+ "Duração da pausa longa após completar um ciclo de Pomodoros.",
1759
+ ),
1760
+ "slider",
1761
+ 15,
1762
+ (5, 60),
1763
+ "integer (5–60 min)",
1764
+ "15",
1765
+ ),
1766
+ ]
1767
+
1768
+ def _schema_perf() -> list[tuple]:
1769
+ """Itens da categoria ``perf`` das configurações."""
1770
+ return [
1771
+ (
1772
+ "__sep_perf",
1773
+ _t("setting.cat_perf", "Performance"),
1774
+ "",
1775
+ "sep",
1776
+ None,
1777
+ None,
1778
+ None,
1779
+ None,
1780
+ ),
1781
+ (
1782
+ "kui_perf",
1783
+ _t("setting.kui_perf", "Perfil de Performance K-UI"),
1784
+ _t(
1785
+ "setting.desc.kui_perf",
1786
+ "Controla a intensidade das animações do K-UI. 'minimal' desativa a maioria para máxima performance.",
1787
+ ),
1788
+ "combo",
1789
+ "balanced",
1790
+ ["ultra", "balanced", "power_saver", "minimal"],
1791
+ "ultra | balanced | power_saver | minimal",
1792
+ "balanced",
1793
+ ),
1794
+ (
1795
+ "hl_idle_ms",
1796
+ _t("setting.hl_idle_ms", "Debounce do Highlight (ms)"),
1797
+ _t(
1798
+ "setting.desc.hl_idle_ms",
1799
+ "Tempo de inatividade antes de re-executar o syntax highlighting completo.",
1800
+ ),
1801
+ "slider",
1802
+ 60,
1803
+ (20, 500),
1804
+ "integer (20–500 ms)",
1805
+ "60",
1806
+ ),
1807
+ (
1808
+ "autocomplete_min_chars",
1809
+ _t(
1810
+ "setting.autocomplete_min_chars",
1811
+ "Mínimo de Caracteres para Autocomplete",
1812
+ ),
1813
+ _t(
1814
+ "setting.desc.autocomplete_min_chars",
1815
+ "Número mínimo de caracteres digitados antes de exibir sugestões.",
1816
+ ),
1817
+ "slider",
1818
+ 1,
1819
+ (1, 5),
1820
+ "integer (1–5)",
1821
+ "1",
1822
+ ),
1823
+ (
1824
+ "autocomplete_max_items",
1825
+ _t("setting.autocomplete_max_items", "Máximo de Sugestões"),
1826
+ _t(
1827
+ "setting.desc.autocomplete_max_items",
1828
+ "Número máximo de itens exibidos na lista de autocomplete.",
1829
+ ),
1830
+ "slider",
1831
+ 24,
1832
+ (5, 50),
1833
+ "integer (5–50)",
1834
+ "24",
1835
+ ),
1836
+ (
1837
+ "large_file_mb",
1838
+ _t("setting.large_file_mb", "Limite de Arquivo Grande (MB)"),
1839
+ _t(
1840
+ "setting.desc.large_file_mb",
1841
+ "Arquivos maiores que este limite têm syntax highlighting e lint desabilitados.",
1842
+ ),
1843
+ "slider",
1844
+ 3,
1845
+ (1, 20),
1846
+ "integer (1–20 MB)",
1847
+ "3",
1848
+ ),
1849
+ (
1850
+ "search_max_results",
1851
+ _t("setting.search_max_results", "Máximo de Resultados de Busca"),
1852
+ _t(
1853
+ "setting.desc.search_max_results",
1854
+ "Número máximo de resultados exibidos no Find in Files.",
1855
+ ),
1856
+ "slider",
1857
+ 2000,
1858
+ (100, 10000),
1859
+ "integer (100–10000)",
1860
+ "2000",
1861
+ ),
1862
+ (
1863
+ "perf_auto_mode",
1864
+ _t("setting.perf_auto_mode", "Detecção Automática de Travamentos"),
1865
+ _t(
1866
+ "setting.desc.perf_auto_mode",
1867
+ "Monitora a UI e ativa o modo performance automaticamente quando detectar freeze.",
1868
+ ),
1869
+ "toggle",
1870
+ True,
1871
+ None,
1872
+ "boolean",
1873
+ "true",
1874
+ ),
1875
+ (
1876
+ "perf_freeze_threshold_ms",
1877
+ _t("setting.perf_freeze_threshold_ms", "Limiar de Freeze (ms)"),
1878
+ _t(
1879
+ "setting.desc.perf_freeze_threshold_ms",
1880
+ "Quanto de atraso na UI (ms) aciona o modo performance automático. Menor = mais sensível.",
1881
+ ),
1882
+ "slider",
1883
+ 500,
1884
+ (150, 2000),
1885
+ "integer (150–2000 ms)",
1886
+ "500",
1887
+ ),
1888
+ (
1889
+ "perf_kui_fallback",
1890
+ _t("setting.perf_kui_fallback",
1891
+ "Perfil K-UI no modo performance"),
1892
+ _t(
1893
+ "setting.desc.perf_kui_fallback",
1894
+ "Perfil de animação K-UI usado quando o modo performance desativa as animações.",
1895
+ ),
1896
+ "combo",
1897
+ "low",
1898
+ ["low", "minimal", "windows", "cosmic_lite", "power_saver"],
1899
+ "string",
1900
+ "low",
1901
+ ),
1902
+ (
1903
+ "perf_keep_minimap",
1904
+ _t("setting.perf_keep_minimap", "[Modo Perf] Manter Minimap"),
1905
+ _t(
1906
+ "setting.desc.perf_keep_minimap",
1907
+ "Se desmarcado, o minimap é ocultado ao ativar o modo performance.",
1908
+ ),
1909
+ "toggle",
1910
+ True,
1911
+ None,
1912
+ "boolean",
1913
+ "true",
1914
+ ),
1915
+ (
1916
+ "perf_keep_sticky_scroll",
1917
+ _t(
1918
+ "setting.perf_keep_sticky_scroll",
1919
+ "[Modo Perf] Manter Sticky Scroll",
1920
+ ),
1921
+ _t(
1922
+ "setting.desc.perf_keep_sticky_scroll",
1923
+ "Se desmarcado, o sticky scroll é desativado no modo performance.",
1924
+ ),
1925
+ "toggle",
1926
+ True,
1927
+ None,
1928
+ "boolean",
1929
+ "true",
1930
+ ),
1931
+ (
1932
+ "perf_keep_heatmap",
1933
+ _t("setting.perf_keep_heatmap",
1934
+ "[Modo Perf] Manter Edit Heatmap"),
1935
+ _t(
1936
+ "setting.desc.perf_keep_heatmap",
1937
+ "Se desmarcado, o heatmap de edições é parado no modo performance.",
1938
+ ),
1939
+ "toggle",
1940
+ True,
1941
+ None,
1942
+ "boolean",
1943
+ "true",
1944
+ ),
1945
+ (
1946
+ "perf_keep_rhythm",
1947
+ _t("setting.perf_keep_rhythm",
1948
+ "[Modo Perf] Manter Code Rhythm"),
1949
+ _t(
1950
+ "setting.desc.perf_keep_rhythm",
1951
+ "Se desmarcado, a análise de ritmo de digitação é parada no modo performance.",
1952
+ ),
1953
+ "toggle",
1954
+ True,
1955
+ None,
1956
+ "boolean",
1957
+ "true",
1958
+ ),
1959
+ (
1960
+ "perf_keep_lint",
1961
+ _t("setting.perf_keep_lint",
1962
+ "[Modo Perf] Manter Lint Automático"),
1963
+ _t(
1964
+ "setting.desc.perf_keep_lint",
1965
+ "Se desmarcado, o lint automático é desativado no modo performance.",
1966
+ ),
1967
+ "toggle",
1968
+ True,
1969
+ None,
1970
+ "boolean",
1971
+ "true",
1972
+ ),
1973
+ (
1974
+ "perf_keep_kui_anim",
1975
+ _t("setting.perf_keep_kui_anim",
1976
+ "[Modo Perf] Manter Animações K-UI"),
1977
+ _t(
1978
+ "setting.desc.perf_keep_kui_anim",
1979
+ "Se desmarcado, o K-UI troca para o perfil de fallback no modo performance.",
1980
+ ),
1981
+ "toggle",
1982
+ True,
1983
+ None,
1984
+ "boolean",
1985
+ "true",
1986
+ ),
1987
+ ]
1988
+
1989
+ def _schema_security() -> list[tuple]:
1990
+ """Itens da categoria ``security`` das configurações."""
1991
+ return [
1992
+ (
1993
+ "__sep_security",
1994
+ "🔒 " + _t("setting.cat_security", "Segurança"),
1995
+ "",
1996
+ "sep",
1997
+ None,
1998
+ None,
1999
+ None,
2000
+ None,
2001
+ ),
2002
+ (
2003
+ "workspace_trust",
2004
+ _t("setting.workspace_trust", "Workspace Trust"),
2005
+ _t(
2006
+ "setting.desc.workspace_trust",
2007
+ "Exibe diálogo de confiança ao abrir pastas desconhecidas.",
2008
+ ),
2009
+ "toggle",
2010
+ True,
2011
+ None,
2012
+ "boolean",
2013
+ "true",
2014
+ ),
2015
+ ]
2016
+
2017
+ def _schema_advanced() -> list[tuple]:
2018
+ """Itens da categoria ``advanced`` das configurações."""
2019
+ return [
2020
+ (
2021
+ "__sep_advanced",
2022
+ "⚙ " + _t("setting.cat_advanced", "Avançado"),
2023
+ "",
2024
+ "sep",
2025
+ None,
2026
+ None,
2027
+ None,
2028
+ None,
2029
+ ),
2030
+ (
2031
+ "font_min",
2032
+ _t("setting.font_min", "Tamanho Mínimo da Fonte"),
2033
+ _t(
2034
+ "setting.desc.font_min",
2035
+ "Menor tamanho de fonte permitido ao usar Ctrl+- para diminuir.",
2036
+ ),
2037
+ "slider",
2038
+ 7,
2039
+ (4, 12),
2040
+ "integer (4–12)",
2041
+ "7",
2042
+ ),
2043
+ (
2044
+ "font_max",
2045
+ _t("setting.font_max", "Tamanho Máximo da Fonte"),
2046
+ _t(
2047
+ "setting.desc.font_max",
2048
+ "Maior tamanho de fonte permitido ao usar Ctrl+= para aumentar.",
2049
+ ),
2050
+ "slider",
2051
+ 36,
2052
+ (20, 72),
2053
+ "integer (20–72)",
2054
+ "36",
2055
+ ),
2056
+ ]
2057
+
2058
+ def _schema_accessibility() -> list[tuple]:
2059
+ """Itens da categoria ``accessibility`` das configurações."""
2060
+ return [
2061
+ (
2062
+ "__sep_accessibility",
2063
+ "♿ " + _t("setting.cat_accessibility", "Acessibilidade"),
2064
+ "",
2065
+ "sep",
2066
+ None,
2067
+ None,
2068
+ None,
2069
+ None,
2070
+ ),
2071
+ (
2072
+ "a11y_high_contrast",
2073
+ _t("setting.a11y_high_contrast", "Alto Contraste (WCAG AA)"),
2074
+ _t(
2075
+ "setting.desc.a11y_high_contrast",
2076
+ "Ativa paleta de alto contraste em toda a interface para melhor legibilidade.",
2077
+ ),
2078
+ "toggle",
2079
+ False,
2080
+ None,
2081
+ "boolean",
2082
+ "false",
2083
+ ),
2084
+ (
2085
+ "a11y_colorblind_mode",
2086
+ _t("setting.a11y_colorblind_mode", "Modo para Daltonismo"),
2087
+ _t(
2088
+ "setting.desc.a11y_colorblind_mode",
2089
+ "Substitui cores problemáticas por paletas otimizadas para cada tipo de daltonismo. Efeito imediato após salvar.",
2090
+ ),
2091
+ "combo",
2092
+ "",
2093
+ ["", "protanopia", "deuteranopia", "tritanopia", "achromatopsia"],
2094
+ "string",
2095
+ "",
2096
+ ),
2097
+ (
2098
+ "a11y_screen_reader",
2099
+ _t("setting.a11y_screen_reader",
2100
+ "Habilitar Leitor de Tela / TTS"),
2101
+ _t(
2102
+ "setting.desc.a11y_screen_reader",
2103
+ "Ativa saída de voz para leitores de tela (NVDA, ORCA, espeak, say).",
2104
+ ),
2105
+ "toggle",
2106
+ True,
2107
+ None,
2108
+ "boolean",
2109
+ "true",
2110
+ ),
2111
+ (
2112
+ "a11y_keyboard_nav",
2113
+ _t("setting.a11y_keyboard_nav",
2114
+ "Navegação Aprimorada por Teclado"),
2115
+ _t(
2116
+ "setting.desc.a11y_keyboard_nav",
2117
+ "Ativa foco visível aprimorado e navegação Tab/Shift+Tab em todos os painéis.",
2118
+ ),
2119
+ "toggle",
2120
+ True,
2121
+ None,
2122
+ "boolean",
2123
+ "true",
2124
+ ),
2125
+ (
2126
+ "a11y_large_ui_font",
2127
+ _t("setting.a11y_large_ui_font",
2128
+ "Fonte de UI Grande (mín. 13pt)"),
2129
+ _t(
2130
+ "setting.desc.a11y_large_ui_font",
2131
+ "Aumenta a fonte da interface para no mínimo 13pt em todos os menus e painéis.",
2132
+ ),
2133
+ "toggle",
2134
+ False,
2135
+ None,
2136
+ "boolean",
2137
+ "false",
2138
+ ),
2139
+ (
2140
+ "a11y_reduce_motion",
2141
+ _t("setting.a11y_reduce_motion", "Reduzir Animações e Movimento"),
2142
+ _t(
2143
+ "setting.desc.a11y_reduce_motion",
2144
+ "Desativa animações, transições e efeitos visuais em movimento.",
2145
+ ),
2146
+ "toggle",
2147
+ False,
2148
+ None,
2149
+ "boolean",
2150
+ "false",
2151
+ ),
2152
+ ]
2153
+
2154
+ def _schema_ssh() -> list[tuple]:
2155
+ """Itens da categoria ``ssh`` das configurações."""
2156
+ return [
2157
+ (
2158
+ "__sep_ssh",
2159
+ "🖧 " + _t("setting.cat_ssh", "SSH Remoto"),
2160
+ "",
2161
+ "sep",
2162
+ None,
2163
+ None,
2164
+ None,
2165
+ None,
2166
+ ),
2167
+ (
2168
+ "ssh_default_port",
2169
+ _t("setting.ssh_default_port", "Porta SSH Padrão"),
2170
+ _t(
2171
+ "setting.desc.ssh_default_port",
2172
+ "Porta padrão para novas conexões SSH quando não especificada.",
2173
+ ),
2174
+ "slider",
2175
+ 22,
2176
+ (1, 65535),
2177
+ "integer",
2178
+ "22",
2179
+ ),
2180
+ (
2181
+ "ssh_connect_timeout",
2182
+ _t("setting.ssh_connect_timeout", "Timeout de Conexão (s)"),
2183
+ _t(
2184
+ "setting.desc.ssh_connect_timeout",
2185
+ "Segundos antes de abortar tentativa de conexão SSH.",
2186
+ ),
2187
+ "slider",
2188
+ 10,
2189
+ (3, 60),
2190
+ "integer",
2191
+ "10",
2192
+ ),
2193
+ (
2194
+ "ssh_keepalive_interval",
2195
+ _t("setting.ssh_keepalive_interval", "Intervalo Keepalive (s)"),
2196
+ _t(
2197
+ "setting.desc.ssh_keepalive_interval",
2198
+ "Intervalo em segundos para envio de pacotes keepalive. 0 desativa.",
2199
+ ),
2200
+ "slider",
2201
+ 30,
2202
+ (0, 300),
2203
+ "integer",
2204
+ "30",
2205
+ ),
2206
+ (
2207
+ "ssh_agent_forwarding",
2208
+ _t("setting.ssh_agent_forwarding", "Forwarding de Agente SSH"),
2209
+ _t(
2210
+ "setting.desc.ssh_agent_forwarding",
2211
+ "Encaminha o agente SSH local para o host remoto (opção -A).",
2212
+ ),
2213
+ "toggle",
2214
+ False,
2215
+ None,
2216
+ "boolean",
2217
+ "false",
2218
+ ),
2219
+ (
2220
+ "ssh_strict_host_key",
2221
+ _t("setting.ssh_strict_host_key", "Verificação Estrita de Host"),
2222
+ _t(
2223
+ "setting.desc.ssh_strict_host_key",
2224
+ "Se ativado, rejeita hosts desconhecidos. Desativado usa accept-new para novos hosts.",
2225
+ ),
2226
+ "toggle",
2227
+ False,
2228
+ None,
2229
+ "boolean",
2230
+ "false",
2231
+ ),
2232
+ (
2233
+ "ssh_sftp_buffer_kb",
2234
+ _t("setting.ssh_sftp_buffer_kb", "Buffer SFTP (KB)"),
2235
+ _t(
2236
+ "setting.desc.ssh_sftp_buffer_kb",
2237
+ "Tamanho do buffer de transferência SFTP em kilobytes.",
2238
+ ),
2239
+ "slider",
2240
+ 32,
2241
+ (8, 512),
2242
+ "integer",
2243
+ "32",
2244
+ ),
2245
+ (
2246
+ "ssh_open_in_editor",
2247
+ _t("setting.ssh_open_in_editor",
2248
+ "Abrir Arquivo Remoto no Editor"),
2249
+ _t(
2250
+ "setting.desc.ssh_open_in_editor",
2251
+ "Ao clicar em um arquivo remoto, baixa e abre no editor automaticamente.",
2252
+ ),
2253
+ "toggle",
2254
+ True,
2255
+ None,
2256
+ "boolean",
2257
+ "true",
2258
+ ),
2259
+ (
2260
+ "debug_dap_enabled",
2261
+ _t("setting.debug_dap_enabled",
2262
+ "Habilitar Debug via debugpy (DAP)"),
2263
+ _t(
2264
+ "setting.desc.debug_dap_enabled",
2265
+ "Usa debugpy para depuração real com breakpoints, stepping e "
2266
+ "variáveis em Python. Ativado automaticamente quando o "
2267
+ "debugpy está disponível no PATH/ambiente - o Codis conecta "
2268
+ "a ele sozinho, sem precisar de um cliente DAP externo. "
2269
+ "Desative aqui para forçar a execução simples (sem "
2270
+ "breakpoints reais).",
2271
+ ),
2272
+ "toggle",
2273
+ True,
2274
+ None,
2275
+ "boolean",
2276
+ "true",
2277
+ ),
2278
+ (
2279
+ "debug_dap_port",
2280
+ _t("setting.debug_dap_port", "Porta do debugpy"),
2281
+ _t(
2282
+ "setting.desc.debug_dap_port",
2283
+ "Porta local usada pelo servidor debugpy para conexão DAP.",
2284
+ ),
2285
+ "slider",
2286
+ 5678,
2287
+ (1024, 65535),
2288
+ "integer",
2289
+ "5678",
2290
+ ),
2291
+ ]
2292
+
2293
+ def _schema_collab() -> list[tuple]:
2294
+ """Itens da categoria ``collab`` das configurações."""
2295
+ return [
2296
+ (
2297
+ "__sep_collab",
2298
+ "👥 " + _t("setting.cat_collab", "Colaboração"),
2299
+ "",
2300
+ "sep",
2301
+ None,
2302
+ None,
2303
+ None,
2304
+ None,
2305
+ ),
2306
+ (
2307
+ "collab_enabled",
2308
+ _t("setting.collab_enabled", "Habilitar Edição Colaborativa"),
2309
+ _t(
2310
+ "setting.desc.collab_enabled",
2311
+ "Ativa o servidor de colaboração em tempo real para edição simultânea.",
2312
+ ),
2313
+ "toggle",
2314
+ False,
2315
+ None,
2316
+ "boolean",
2317
+ "false",
2318
+ ),
2319
+ (
2320
+ "collab_port",
2321
+ _t("setting.collab_port", "Porta do Servidor Collab"),
2322
+ _t(
2323
+ "setting.desc.collab_port",
2324
+ "Porta TCP usada pelo servidor de colaboração.",
2325
+ ),
2326
+ "slider",
2327
+ 9001,
2328
+ (1024, 65535),
2329
+ "integer",
2330
+ "9001",
2331
+ ),
2332
+ (
2333
+ "collab_max_peers",
2334
+ _t("setting.collab_max_peers", "Máx. Participantes"),
2335
+ _t(
2336
+ "setting.desc.collab_max_peers",
2337
+ "Número máximo de usuários simultâneos na sessão colaborativa.",
2338
+ ),
2339
+ "slider",
2340
+ 5,
2341
+ (2, 20),
2342
+ "integer",
2343
+ "5",
2344
+ ),
2345
+ (
2346
+ "collab_show_cursors",
2347
+ _t("setting.collab_show_cursors", "Mostrar Cursores Remotos"),
2348
+ _t(
2349
+ "setting.desc.collab_show_cursors",
2350
+ "Exibe a posição do cursor de cada participante com cor diferente.",
2351
+ ),
2352
+ "toggle",
2353
+ True,
2354
+ None,
2355
+ "boolean",
2356
+ "true",
2357
+ ),
2358
+ (
2359
+ "collab_show_chat",
2360
+ _t("setting.collab_show_chat", "Mostrar Chat Integrado"),
2361
+ _t(
2362
+ "setting.desc.collab_show_chat",
2363
+ "Exibe painel de chat lateral durante sessões colaborativas.",
2364
+ ),
2365
+ "toggle",
2366
+ True,
2367
+ None,
2368
+ "boolean",
2369
+ "true",
2370
+ ),
2371
+ (
2372
+ "collab_autosave_sync",
2373
+ _t("setting.collab_autosave_sync", "Sincronizar Auto-save"),
2374
+ _t(
2375
+ "setting.desc.collab_autosave_sync",
2376
+ "Sincroniza o estado do arquivo entre participantes ao auto-salvar.",
2377
+ ),
2378
+ "toggle",
2379
+ True,
2380
+ None,
2381
+ "boolean",
2382
+ "true",
2383
+ ),
2384
+ ]
2385
+
2386
+ def _schema_plugins_cfg() -> list[tuple]:
2387
+ """Itens da categoria ``plugins_cfg`` das configurações."""
2388
+ return [
2389
+ (
2390
+ "__sep_plugins_cfg",
2391
+ "🔌 " + _t("setting.cat_plugins_cfg", "Plugins (Isolamento)"),
2392
+ "",
2393
+ "sep",
2394
+ None,
2395
+ None,
2396
+ None,
2397
+ None,
2398
+ ),
2399
+ (
2400
+ "plugin_isolation",
2401
+ _t(
2402
+ "setting.plugin_isolation",
2403
+ "Executar Plugins em Processos Separados",
2404
+ ),
2405
+ _t(
2406
+ "setting.desc.plugin_isolation",
2407
+ "Plugins com isolated=True rodam em subprocessos Python independentes para maior segurança.",
2408
+ ),
2409
+ "toggle",
2410
+ True,
2411
+ None,
2412
+ "boolean",
2413
+ "true",
2414
+ ),
2415
+ (
2416
+ "plugin_timeout_s",
2417
+ _t("setting.plugin_timeout_s", "Timeout de Chamada ao Plugin (s)"),
2418
+ _t(
2419
+ "setting.desc.plugin_timeout_s",
2420
+ "Segundos antes de considerar um plugin travado e encerrar o processo.",
2421
+ ),
2422
+ "slider",
2423
+ 10,
2424
+ (2, 60),
2425
+ "integer",
2426
+ "10",
2427
+ ),
2428
+ (
2429
+ "plugin_heartbeat_s",
2430
+ _t("setting.plugin_heartbeat_s", "Timeout de Heartbeat (s)"),
2431
+ _t(
2432
+ "setting.desc.plugin_heartbeat_s",
2433
+ "Intervalo em segundos entre verificações de saúde do processo do plugin.",
2434
+ ),
2435
+ "slider",
2436
+ 5,
2437
+ (1, 30),
2438
+ "integer",
2439
+ "5",
2440
+ ),
2441
+ (
2442
+ "plugin_max_restarts",
2443
+ _t("setting.plugin_max_restarts",
2444
+ "Máx. Reinicializações Automáticas"),
2445
+ _t(
2446
+ "setting.desc.plugin_max_restarts",
2447
+ "Número máximo de vezes que um plugin travado é reiniciado automaticamente.",
2448
+ ),
2449
+ "slider",
2450
+ 3,
2451
+ (0, 10),
2452
+ "integer",
2453
+ "3",
2454
+ ),
2455
+ (
2456
+ "plugin_sandbox_network",
2457
+ _t(
2458
+ "setting.plugin_sandbox_network",
2459
+ "Bloquear Rede em Plugins Isolados",
2460
+ ),
2461
+ _t(
2462
+ "setting.desc.plugin_sandbox_network",
2463
+ "Impede que plugins isolados façam conexões de rede (experimental, Linux).",
2464
+ ),
2465
+ "toggle",
2466
+ False,
2467
+ None,
2468
+ "boolean",
2469
+ "false",
2470
+ ),
2471
+ ]
2472
+
2473
+ def _schema_theme_adv() -> list[tuple]:
2474
+ """Itens da categoria ``theme_adv`` das configurações."""
2475
+ return [
2476
+ (
2477
+ "__sep_theme_adv",
2478
+ _t("setting.cat_theme_adv", "Aparência Avançada"),
2479
+ "",
2480
+ "sep",
2481
+ None,
2482
+ None,
2483
+ None,
2484
+ None,
2485
+ ),
2486
+ (
2487
+ "ui_cursor",
2488
+ _t("setting.ui_cursor", "Cursor Customizado"),
2489
+ _t(
2490
+ "setting.desc.ui_cursor",
2491
+ "Cursor do mouse em toda a interface. Nomes Tk: arrow, crosshair, hand2, pirate, star, fleur...",
2492
+ ),
2493
+ "combo",
2494
+ "default",
2495
+ [
2496
+ "default",
2497
+ "arrow",
2498
+ "crosshair",
2499
+ "hand2",
2500
+ "move",
2501
+ "xterm",
2502
+ "watch",
2503
+ "plus",
2504
+ "fleur",
2505
+ "heart",
2506
+ "star",
2507
+ "pirate",
2508
+ "target",
2509
+ ],
2510
+ "string",
2511
+ "default",
2512
+ ),
2513
+ (
2514
+ "ui_icon_set",
2515
+ _t("setting.ui_icon_set", "Conjunto de Ícones"),
2516
+ _t(
2517
+ "setting.desc.ui_icon_set",
2518
+ "Nome da pasta em src/theme/icons/ para ícones customizados. Em branco = padrões.",
2519
+ ),
2520
+ "text",
2521
+ "",
2522
+ None,
2523
+ "string",
2524
+ "",
2525
+ ),
2526
+ (
2527
+ "ui_font_family",
2528
+ _t("setting.ui_font_family", "Família de Fonte da UI"),
2529
+ _t(
2530
+ "setting.desc.ui_font_family",
2531
+ "Fonte usada em menus e painéis (não no editor). Em branco = tema padrão.",
2532
+ ),
2533
+ "text",
2534
+ "",
2535
+ None,
2536
+ "string",
2537
+ "",
2538
+ ),
2539
+ (
2540
+ "ui_scale",
2541
+ _t("setting.ui_scale", "Escala da Interface (%)"),
2542
+ _t(
2543
+ "setting.desc.ui_scale",
2544
+ "Tamanho geral da interface em porcentagem. 0 = automático "
2545
+ "(ajusta à resolução da tela); 50-250 = manual. Reduza em "
2546
+ "telas pequenas, aumente em telas grandes.",
2547
+ ),
2548
+ "slider",
2549
+ 0,
2550
+ (0, 250),
2551
+ "integer (0 ou 50–250)",
2552
+ "0",
2553
+ ),
2554
+ (
2555
+ "ui_font_size",
2556
+ _t("setting.ui_font_size", "Tamanho da Fonte da UI"),
2557
+ _t(
2558
+ "setting.desc.ui_font_size",
2559
+ "Tamanho em pontos da fonte da UI (0 = auto baseado no DPI).",
2560
+ ),
2561
+ "slider",
2562
+ 0,
2563
+ (0, 20),
2564
+ "integer",
2565
+ "0",
2566
+ ),
2567
+ ]
2568
+
2569
+
2570
+ class SettingsEditor(tk.Frame):
2571
+ """Editor de configurações em modo avançado - painel inline scrollável.
2572
+
2573
+ Exibe o schema completo de configurações com busca em tempo real,
2574
+ controles visuais (toggle/slider/combo/entry) e reset individual.
2575
+ Salva imediatamente ao alterar cada item.
2576
+
2577
+ Extensível por plugins: use ``PluginAPI.add_settings_section()`` para
2578
+ adicionar seções extras ao final do schema.
2579
+
2580
+ Args:
2581
+ parent: Widget pai Tkinter.
2582
+ tmgr: Instância de ThemeManager.
2583
+ cfg: Instância de ConfigManager.
2584
+ on_change: Callback(key, value) acionado a cada alteração salva.
2585
+ """
2586
+
2587
+ _EXTRA_SCHEMA: list = []
2588
+
2589
+ @classmethod
2590
+ def _get_schema(cls) -> list:
2591
+ """Retorna o schema completo de configurações do Codis.
2592
+
2593
+ Cada entrada é uma tupla de 8 elementos:
2594
+ ``(key, label, description, kind, default, options, type_hint, example)``
2595
+
2596
+ onde ``kind`` é um dos: 'toggle', 'slider', 'combo', 'entry', 'sep'.
2597
+
2598
+ Returns:
2599
+ list: Lista de tuplas de schema de configuração.
2600
+ """
2601
+ return [
2602
+ *_schema_editor(),
2603
+ *_schema_advanced_editor(),
2604
+ *_schema_autocomplete(),
2605
+ *_schema_appearance(),
2606
+ *_schema_layout(),
2607
+ *_schema_save(),
2608
+ *_schema_trash(),
2609
+ *_schema_lint(),
2610
+ *_schema_lsp(),
2611
+ *_schema_git(),
2612
+ *_schema_terminal(),
2613
+ *_schema_filetree(),
2614
+ *_schema_render(),
2615
+ *_schema_timeline(),
2616
+ *_schema_flowchart(),
2617
+ *_schema_pomodoro(),
2618
+ *_schema_perf(),
2619
+ *_schema_security(),
2620
+ *_schema_advanced(),
2621
+ *_schema_accessibility(),
2622
+ *_schema_ssh(),
2623
+ *_schema_collab(),
2624
+ *_schema_plugins_cfg(),
2625
+ *_schema_theme_adv(),
2626
+ *cls._EXTRA_SCHEMA,
2627
+ ]
2628
+
2629
+ def __init__(
2630
+ self,
2631
+ parent: tk.Widget,
2632
+ tmgr: ThemeManager,
2633
+ cfg: ConfigManager,
2634
+ on_change: Callable | None = None,
2635
+ ) -> None:
2636
+ t = tmgr.theme
2637
+ super().__init__(parent, bg=t.editor_bg)
2638
+ self._tmgr = tmgr
2639
+ self._cfg = cfg
2640
+ self._on_change = on_change
2641
+ self._all_rows: list[dict] = []
2642
+ self._active_cat: str | None = None
2643
+ self._filter_q = ""
2644
+ self._built = False
2645
+ self._theme_stale = False
2646
+ self.bind("<Map>", self._on_map, add=True)
2647
+ I18n.get_instance().on_locale_registry_change(self._refresh_language_combo)
2648
+
2649
+ def _ensure_built(self) -> None:
2650
+ """Constrói a UI na primeira exibição (idempotente)."""
2651
+ if self._built:
2652
+ return
2653
+ self._built = True
2654
+ self._build_ui()
2655
+
2656
+ def _on_map(self, _event: Any = None) -> None:
2657
+ """Garante a construção e reaplica um tema pendente ao exibir o painel."""
2658
+ self._ensure_built()
2659
+ if self._theme_stale:
2660
+ self._theme_stale = False
2661
+ self._rebuild_for_theme()
2662
+
2663
+ def _rebuild_for_theme(self) -> None:
2664
+ """Reconstrói linhas e categorias com o tema atual."""
2665
+ for w in self._content.winfo_children():
2666
+ w.destroy()
2667
+ self._all_rows.clear()
2668
+ self._build_rows()
2669
+ self._build_cat_panel()
2670
+ if self._filter_q:
2671
+ self._apply_filter(self._filter_q)
2672
+
2673
+ def _build_ui(self) -> None:
2674
+ t = self._tmgr.theme
2675
+
2676
+ top = tk.Frame(self, bg=t.editor_bg)
2677
+ top.pack(fill="x", padx=0, pady=0)
2678
+
2679
+ tk.Label(
2680
+ top,
2681
+ text=" ⚙ " + _t("ui.settings_title", "Configurações"),
2682
+ bg=t.editor_bg,
2683
+ fg=t.fg,
2684
+ font=(FONT_UI, 11, "bold"),
2685
+ ).pack(side="left", pady=6)
2686
+
2687
+ edit_btn = tk.Label(
2688
+ top,
2689
+ text="{ } JSON",
2690
+ bg=t.editor_bg,
2691
+ fg=getattr(t, "t_link", t.accent),
2692
+ font=(FONT_UI, 8),
2693
+ cursor="hand2",
2694
+ padx=8,
2695
+ )
2696
+ edit_btn.pack(side="right", pady=6)
2697
+ edit_btn.bind("<Button-1>", self._open_json)
2698
+ edit_btn.bind("<Enter>", lambda _: edit_btn.config(fg=t.fg))
2699
+ edit_btn.bind(
2700
+ "<Leave>", lambda _: edit_btn.config(
2701
+ fg=getattr(t, "t_link", t.accent))
2702
+ )
2703
+
2704
+ sb = tk.Frame(self, bg=t.editor_bg, pady=0)
2705
+ sb.pack(fill="x", padx=8, pady=(0, 4))
2706
+
2707
+ search_wrap = tk.Frame(
2708
+ sb, bg=t.input_bg, highlightthickness=1, highlightbackground=t.border
2709
+ )
2710
+ search_wrap.pack(fill="x")
2711
+
2712
+ tk.Label(
2713
+ search_wrap, text=" 🔍", bg=t.input_bg, fg=t.fg_muted, font=(FONT_UI, 9)
2714
+ ).pack(side="left")
2715
+
2716
+ self._search_var = tk.StringVar()
2717
+ self._search_var.trace_add("write", self._on_search_change)
2718
+ self._search_entry = tk.Entry(
2719
+ search_wrap,
2720
+ textvariable=self._search_var,
2721
+ bg=t.input_bg,
2722
+ fg=t.fg,
2723
+ insertbackground=getattr(t, "cursor", t.fg),
2724
+ relief="flat",
2725
+ bd=0,
2726
+ font=(FONT_UI, 10),
2727
+ highlightthickness=0,
2728
+ )
2729
+ self._search_entry.pack(side="left", fill="x",
2730
+ expand=True, padx=4, pady=4)
2731
+
2732
+ self._clear_btn = tk.Label(
2733
+ search_wrap,
2734
+ text="✕",
2735
+ bg=t.input_bg,
2736
+ fg=t.fg_muted,
2737
+ font=(FONT_UI, 9),
2738
+ cursor="hand2",
2739
+ padx=6,
2740
+ )
2741
+ self._clear_btn.bind(
2742
+ "<Button-1>",
2743
+ lambda _: (self._search_var.set(""),
2744
+ self._search_entry.focus_set()),
2745
+ )
2746
+
2747
+ tk.Frame(self, bg=t.border, height=1).pack(fill="x")
2748
+
2749
+ body = tk.Frame(self, bg=t.editor_bg)
2750
+ body.pack(fill="both", expand=True)
2751
+
2752
+ self._cat_panel = tk.Frame(
2753
+ body, bg=getattr(t, "sidebar_bg", t.panel_bg), width=148
2754
+ )
2755
+ self._cat_panel.pack(side="left", fill="y")
2756
+ self._cat_panel.pack_propagate(False)
2757
+
2758
+ tk.Frame(body, bg=t.border, width=1).pack(side="left", fill="y")
2759
+
2760
+ self._right_pane = right = tk.Frame(body, bg=t.editor_bg)
2761
+ right.pack(side="left", fill="both", expand=True)
2762
+
2763
+ self._canvas = tk.Canvas(right, bg=t.editor_bg, highlightthickness=0)
2764
+ vsb = ttk.Scrollbar(
2765
+ right,
2766
+ orient="vertical",
2767
+ command=self._canvas.yview,
2768
+ style="Thin.Vertical.TScrollbar",
2769
+ )
2770
+ vsb.pack(side="right", fill="y")
2771
+ self._canvas.config(yscrollcommand=vsb.set)
2772
+ self._canvas.pack(fill="both", expand=True)
2773
+
2774
+ self._content = tk.Frame(self._canvas, bg=t.editor_bg)
2775
+ self._cw = self._canvas.create_window(
2776
+ (0, 0), window=self._content, anchor="nw")
2777
+
2778
+ debounce_canvas(self._canvas, self._cw, ms=40,
2779
+ extra_widget=self._content)
2780
+
2781
+ self._bind_scroll(self._canvas)
2782
+ self._bind_scroll(self._content)
2783
+
2784
+ self._build_rows()
2785
+ self._build_cat_panel()
2786
+ self._init_search_debounce()
2787
+
2788
+ def _build_cat_panel(self) -> None:
2789
+ """Popula o painel lateral de categorias."""
2790
+ for w in self._cat_panel.winfo_children():
2791
+ w.destroy()
2792
+
2793
+ schema = self._get_schema()
2794
+ seen: list[tuple[str, str]] = []
2795
+ for entry in schema:
2796
+ if entry[3] == "sep":
2797
+ seen.append((entry[0], entry[1]))
2798
+
2799
+ for cat_key, cat_label in seen:
2800
+ self._build_cat_button(cat_key, cat_label)
2801
+
2802
+ def _build_cat_button(self, cat_key: str, cat_label: str) -> None:
2803
+ t = self._tmgr.theme
2804
+ is_active = self._active_cat == cat_key
2805
+
2806
+ btn_bg = (
2807
+ getattr(t, "sel_bg", t.panel_bg)
2808
+ if is_active
2809
+ else getattr(t, "sidebar_bg", t.panel_bg)
2810
+ )
2811
+ btn_fg = t.fg if is_active else t.fg_muted
2812
+
2813
+ btn = tk.Label(
2814
+ self._cat_panel,
2815
+ text=cat_label,
2816
+ anchor="w",
2817
+ bg=btn_bg,
2818
+ fg=btn_fg,
2819
+ font=(FONT_UI, 8, "bold" if is_active else "normal"),
2820
+ padx=10,
2821
+ pady=5,
2822
+ cursor="hand2",
2823
+ wraplength=130,
2824
+ justify="left",
2825
+ )
2826
+ btn.pack(fill="x")
2827
+
2828
+ def _enter(_, b=btn):
2829
+ if self._active_cat != cat_key:
2830
+ b.config(
2831
+ bg=getattr(t, "hover_bg", getattr(
2832
+ t, "sidebar_hover", t.sel_bg))
2833
+ )
2834
+
2835
+ def _leave(_, b=btn):
2836
+ if self._active_cat != cat_key:
2837
+ b.config(bg=getattr(t, "sidebar_bg", t.panel_bg))
2838
+
2839
+ def _click(_, k=cat_key):
2840
+ self._scroll_to_category(k)
2841
+
2842
+ btn.bind("<Enter>", _enter)
2843
+ btn.bind("<Leave>", _leave)
2844
+ btn.bind("<Button-1>", _click)
2845
+
2846
+ def _scroll_to_category(self, cat_key: str) -> None:
2847
+ """Rola o painel de conteúdo até o separador da categoria."""
2848
+ self._active_cat = cat_key
2849
+ self._build_cat_panel()
2850
+ for row_info in self._all_rows:
2851
+ if row_info.get("is_sep") and row_info.get("cat_key") == cat_key:
2852
+ w = row_info["widget"]
2853
+ with contextlib.suppress(tk.TclError):
2854
+ self._content.update_idletasks()
2855
+ wy = w.winfo_y()
2856
+ ch = self._canvas.winfo_height()
2857
+ total = self._content.winfo_height()
2858
+ if total > ch:
2859
+ frac = max(0.0, min(1.0, wy / (total - ch)))
2860
+ self._canvas.yview_moveto(frac)
2861
+ return
2862
+
2863
+ def _build_rows(self) -> None:
2864
+ t = self._tmgr.theme
2865
+ self._all_rows.clear()
2866
+
2867
+ schema = self._get_schema()
2868
+ current_cat: str | None = None
2869
+
2870
+ for entry in schema:
2871
+ key, label, desc, kind, default, opts, type_hint, example = entry
2872
+
2873
+ if kind == "sep":
2874
+ current_cat = key
2875
+ w = self._build_sep(key, label)
2876
+ self._all_rows.append(
2877
+ {
2878
+ "widget": w,
2879
+ "search_key": label.lower(),
2880
+ "is_sep": True,
2881
+ "cat_key": key,
2882
+ }
2883
+ )
2884
+ else:
2885
+ w = self._build_row(
2886
+ key,
2887
+ label,
2888
+ desc,
2889
+ kind,
2890
+ default,
2891
+ opts,
2892
+ t,
2893
+ type_hint,
2894
+ example,
2895
+ current_cat,
2896
+ )
2897
+ self._all_rows.append(
2898
+ {
2899
+ "widget": w,
2900
+ "search_key": (key + " " + label + " " + desc).lower(),
2901
+ "is_sep": False,
2902
+ "cat_key": current_cat,
2903
+ }
2904
+ )
2905
+
2906
+ def _build_sep(self, cat_key: str, label: str) -> tk.Frame:
2907
+ t = self._tmgr.theme
2908
+
2909
+ wrapper = tk.Frame(self._content, bg=t.editor_bg)
2910
+ wrapper.pack(fill="x", pady=(16, 0))
2911
+
2912
+ accent_color = getattr(t, "accent", "#7aa2f7")
2913
+ sep_bar = tk.Frame(wrapper, bg=accent_color, width=3)
2914
+ sep_bar.pack(side="left", fill="y", padx=(12, 0))
2915
+
2916
+ lbl = tk.Label(
2917
+ wrapper,
2918
+ text=f" {label}",
2919
+ bg=t.editor_bg,
2920
+ fg=t.fg,
2921
+ font=(FONT_UI, 9, "bold"),
2922
+ anchor="w",
2923
+ )
2924
+ lbl.pack(side="left", fill="x", expand=True, pady=4)
2925
+
2926
+ tk.Frame(self._content, bg=t.border, height=1).pack(
2927
+ fill="x", padx=12, pady=(0, 4)
2928
+ )
2929
+
2930
+ return wrapper
2931
+
2932
+ def _build_row(
2933
+ self,
2934
+ key: str,
2935
+ label: str,
2936
+ desc: str,
2937
+ kind: str,
2938
+ default: Any,
2939
+ opts: Any,
2940
+ t: Theme,
2941
+ type_hint: str | None,
2942
+ example: str | None,
2943
+ cat_key: str | None,
2944
+ ) -> tk.Frame:
2945
+ row = tk.Frame(self._content, bg=t.editor_bg, highlightthickness=0)
2946
+ row.pack(fill="x", padx=0, pady=0)
2947
+
2948
+ inner = tk.Frame(row, bg=t.editor_bg, padx=14, pady=6)
2949
+ inner.pack(fill="x", expand=True)
2950
+
2951
+ cur_val = self._cfg.get(key, default)
2952
+
2953
+ txt_col = tk.Frame(inner, bg=t.editor_bg)
2954
+ txt_col.pack(side="left", fill="x", expand=True, anchor="n")
2955
+
2956
+ lbl_w = tk.Label(
2957
+ txt_col,
2958
+ text=label,
2959
+ bg=t.editor_bg,
2960
+ fg=t.fg,
2961
+ font=(FONT_UI, 9, "bold"),
2962
+ anchor="w",
2963
+ justify="left",
2964
+ )
2965
+ lbl_w.pack(anchor="w")
2966
+
2967
+ if desc:
2968
+ desc_w = tk.Label(
2969
+ txt_col,
2970
+ text=desc,
2971
+ bg=t.editor_bg,
2972
+ fg=t.fg_muted,
2973
+ font=(FONT_UI, 8),
2974
+ anchor="w",
2975
+ justify="left",
2976
+ wraplength=1,
2977
+ )
2978
+ desc_w.pack(anchor="w")
2979
+ object.__setattr__(row, "_desc_lbl", desc_w)
2980
+
2981
+ ctrl_col = tk.Frame(inner, bg=t.editor_bg)
2982
+ ctrl_col.pack(side="right", anchor="n", padx=(8, 0))
2983
+
2984
+ self._build_control(ctrl_col, key, kind, default,
2985
+ opts, cur_val, t, row)
2986
+
2987
+ rb = tk.Label(
2988
+ ctrl_col,
2989
+ text="↺",
2990
+ bg=t.editor_bg,
2991
+ fg=t.fg_muted,
2992
+ font=(FONT_UI, 7),
2993
+ cursor="hand2",
2994
+ )
2995
+ rb.pack(anchor="e", pady=(2, 0))
2996
+ rb.bind("<Button-1>", lambda _, k=key, d=default: self._reset(k, d))
2997
+ rb.bind("<Enter>", lambda _, w=rb: w.config(
2998
+ fg=getattr(t, "accent", t.fg)))
2999
+ rb.bind("<Leave>", lambda _, w=rb: w.config(fg=t.fg_muted))
3000
+
3001
+ tk.Frame(self._content, bg=t.border, height=1).pack(fill="x", padx=12)
3002
+
3003
+ hover_bg = getattr(t, "hover_bg", getattr(t, "list_hover", t.sel_bg))
3004
+ _hover_children = list(inner.winfo_children())
3005
+ make_hover_highlight(row, _hover_children +
3006
+ [inner], hover_bg, t.editor_bg)
3007
+ make_hover_highlight(inner, _hover_children, hover_bg, t.editor_bg)
3008
+
3009
+ self._bind_scroll(row)
3010
+ self._bind_scroll(inner)
3011
+
3012
+ def _on_row_resize(e, _r=row):
3013
+ dl = getattr(_r, "_desc_lbl", None)
3014
+ if dl:
3015
+ avail = max(100, e.width - 230)
3016
+ with contextlib.suppress(tk.TclError):
3017
+ dl.config(wraplength=avail)
3018
+
3019
+ row.bind("<Configure>", _on_row_resize)
3020
+
3021
+ return row
3022
+
3023
+ def _build_control(
3024
+ self,
3025
+ parent: tk.Widget,
3026
+ key: str,
3027
+ kind: str,
3028
+ default: Any,
3029
+ opts: Any,
3030
+ cur_val: Any,
3031
+ t: Theme,
3032
+ row: tk.Frame,
3033
+ ) -> None:
3034
+ if kind == "toggle":
3035
+ self._build_toggle(parent, key, cur_val, t)
3036
+ elif kind == "slider":
3037
+ self._build_slider(parent, key, opts, cur_val, t)
3038
+ elif kind == "combo":
3039
+ if key == "language":
3040
+ self._build_language_combo(parent, key, cur_val, t, row)
3041
+ else:
3042
+ self._build_combo(parent, key, opts, cur_val, t)
3043
+ elif kind == "entry":
3044
+ self._build_entry(parent, key, cur_val, t)
3045
+
3046
+ def _build_toggle(
3047
+ self, parent: tk.Widget, key: str, cur_val: Any, t: Theme
3048
+ ) -> None:
3049
+ """Custom toggle switch (sliding pill, no ttk Checkbutton)."""
3050
+ is_on = bool(cur_val)
3051
+
3052
+ ON_BG = getattr(t, "accent", "#7aa2f7")
3053
+ OFF_BG = getattr(t, "border", "#3a3f58")
3054
+ PILL_W, PILL_H = 36, 18
3055
+ DOT_R = 7
3056
+
3057
+ c = tk.Canvas(
3058
+ parent,
3059
+ width=PILL_W,
3060
+ height=PILL_H,
3061
+ bg=t.editor_bg,
3062
+ highlightthickness=0,
3063
+ cursor="hand2",
3064
+ )
3065
+ c.pack(pady=6)
3066
+
3067
+ state = {"on": is_on}
3068
+
3069
+ def _draw(on: bool) -> None:
3070
+ c.delete("all")
3071
+ bg = ON_BG if on else OFF_BG
3072
+ c.create_oval(0, 0, PILL_H, PILL_H, fill=bg, outline="")
3073
+ c.create_oval(PILL_W - PILL_H, 0, PILL_W,
3074
+ PILL_H, fill=bg, outline="")
3075
+ c.create_rectangle(
3076
+ PILL_H // 2, 0, PILL_W - PILL_H // 2, PILL_H, fill=bg, outline=""
3077
+ )
3078
+ dx = PILL_W - DOT_R - 3 if on else DOT_R + 3
3079
+ dy = PILL_H // 2
3080
+ c.create_oval(
3081
+ dx - DOT_R,
3082
+ dy - DOT_R,
3083
+ dx + DOT_R,
3084
+ dy + DOT_R,
3085
+ fill="#ffffff",
3086
+ outline="",
3087
+ )
3088
+
3089
+ _draw(is_on)
3090
+
3091
+ def _toggle(_e: Any) -> None:
3092
+ state["on"] = not state["on"]
3093
+ _draw(state["on"])
3094
+ self._save(key, state["on"])
3095
+
3096
+ c.bind("<Button-1>", _toggle)
3097
+
3098
+ def _build_slider(
3099
+ self, parent: tk.Widget, key: str, opts: tuple, cur_val: Any, t: Theme
3100
+ ) -> None:
3101
+ lo, hi = opts
3102
+ try:
3103
+ val = int(float(cur_val))
3104
+ except (TypeError, ValueError):
3105
+ val = lo
3106
+
3107
+ frame = tk.Frame(parent, bg=t.editor_bg)
3108
+ frame.pack(pady=4)
3109
+
3110
+ val_lbl = tk.Label(
3111
+ frame,
3112
+ text=str(val),
3113
+ bg=t.editor_bg,
3114
+ fg=t.fg,
3115
+ font=(FONT_UI, 8),
3116
+ width=6,
3117
+ anchor="e",
3118
+ )
3119
+ val_lbl.pack(side="right")
3120
+
3121
+ var = tk.DoubleVar(value=val)
3122
+
3123
+ def _on_slide(v: str) -> None:
3124
+ iv = int(float(v))
3125
+ val_lbl.config(text=str(iv))
3126
+ if getattr(frame, "_slide_job", None):
3127
+ with contextlib.suppress(Exception):
3128
+ frame.after_cancel(frame._slide_job)
3129
+ frame._slide_job = frame.after(
3130
+ 120, lambda k=key, iv=iv: self._save(k, iv))
3131
+
3132
+ sl = ttk.Scale(
3133
+ frame,
3134
+ from_=lo,
3135
+ to=hi,
3136
+ orient="horizontal",
3137
+ variable=var,
3138
+ length=150,
3139
+ command=_on_slide,
3140
+ )
3141
+ sl.pack(side="left")
3142
+
3143
+ def _build_combo(
3144
+ self, parent: tk.Widget, key: str, opts: list, cur_val: Any, t: Theme
3145
+ ) -> None:
3146
+ var = tk.StringVar(value=str(cur_val))
3147
+ dd = DropDown(
3148
+ parent,
3149
+ textvariable=var,
3150
+ values=opts,
3151
+ width=20,
3152
+ font=(FONT_UI, 9),
3153
+ state="readonly",
3154
+ )
3155
+ dd.pack(pady=4)
3156
+ dd.bind("<<ComboboxSelected>>", lambda _,
3157
+ k=key, v=var: self._save(k, v.get()))
3158
+
3159
+ def _build_entry(self, parent: tk.Widget, key: str, cur_val: Any, t: Theme) -> None:
3160
+ var = tk.StringVar(value=str(cur_val))
3161
+ wrap = tk.Frame(
3162
+ parent, bg=t.input_bg, highlightthickness=1, highlightbackground=t.border
3163
+ )
3164
+ wrap.pack(pady=4)
3165
+ ent = tk.Entry(
3166
+ wrap,
3167
+ textvariable=var,
3168
+ bg=t.input_bg,
3169
+ fg=t.fg,
3170
+ insertbackground=getattr(t, "cursor", t.fg),
3171
+ relief="flat",
3172
+ bd=0,
3173
+ font=(FONT_UI, 9),
3174
+ width=20,
3175
+ )
3176
+ ent.pack(padx=4, pady=2)
3177
+
3178
+ def _save_entry(*_: Any) -> None:
3179
+ self._save(key, var.get())
3180
+
3181
+ ent.bind("<FocusOut>", _save_entry)
3182
+ ent.bind("<Return>", _save_entry)
3183
+
3184
+ def _focus_in(_e: Any) -> None:
3185
+ wrap.config(highlightbackground=getattr(t, "accent", t.border))
3186
+
3187
+ def _focus_out(_e: Any) -> None:
3188
+ wrap.config(highlightbackground=t.border)
3189
+ _save_entry()
3190
+
3191
+ ent.bind("<FocusIn>", _focus_in)
3192
+ ent.bind("<FocusOut>", _focus_out)
3193
+
3194
+ def _build_language_combo(
3195
+ self, parent: tk.Widget, key: str, cur_val: Any, t: Theme, row: tk.Frame
3196
+ ) -> None:
3197
+ labels_by_code = _get_language_labels()
3198
+ codes = _get_language_options()
3199
+ if str(cur_val) not in codes:
3200
+ codes.append(str(cur_val))
3201
+ display_names = [labels_by_code.get(c, c) for c in codes]
3202
+ current_name = labels_by_code.get(str(cur_val), str(cur_val))
3203
+
3204
+ var = tk.StringVar(value=current_name)
3205
+ dd = DropDown(
3206
+ parent,
3207
+ textvariable=var,
3208
+ values=display_names,
3209
+ width=20,
3210
+ font=(FONT_UI, 9),
3211
+ state="readonly",
3212
+ )
3213
+ dd.pack(pady=4)
3214
+
3215
+ def _on_select(_: Any) -> None:
3216
+ name_sel = var.get()
3217
+ try:
3218
+ code_sel = codes[display_names.index(name_sel)]
3219
+ except (ValueError, IndexError):
3220
+ code_sel = name_sel
3221
+ self._save(key, code_sel)
3222
+
3223
+ dd.bind("<<ComboboxSelected>>", _on_select)
3224
+ object.__setattr__(row, "_lang_combo", dd)
3225
+ object.__setattr__(row, "_lang_var", var)
3226
+
3227
+ def _on_search_change(self, *_: Any) -> None:
3228
+ q = self._search_var.get().strip().lower()
3229
+
3230
+ if q:
3231
+ self._clear_btn.pack(side="right")
3232
+ else:
3233
+ self._clear_btn.pack_forget()
3234
+
3235
+ if q:
3236
+ self._cat_panel.pack_forget()
3237
+ else:
3238
+ self._cat_panel.pack(side="left", fill="y",
3239
+ before=self._right_pane)
3240
+
3241
+ self._search_debounce(q)
3242
+
3243
+ _search_after_id: Any = None
3244
+
3245
+ def _init_search_debounce(self) -> None:
3246
+ self._search_debounce = debounce_fn(self, self._apply_filter, ms=250)
3247
+
3248
+ def _apply_filter(self, q: str) -> None:
3249
+ """Show/hide rows and separators based on query - batched via BatchPacker."""
3250
+ batcher = BatchPacker(self._content)
3251
+
3252
+ if not q:
3253
+ for info in self._all_rows:
3254
+ w = info["widget"]
3255
+ is_sep = info.get("is_sep", False)
3256
+ kw = {"fill": "x", "pady": (16, 0) if is_sep else 0, "padx": 0}
3257
+ batcher.show(w, **kw)
3258
+ batcher.flush()
3259
+ return
3260
+
3261
+ cats_with_matches: set[str] = set()
3262
+ for info in self._all_rows:
3263
+ if not info.get("is_sep") and q in info.get("search_key", ""):
3264
+ cats_with_matches.add(info.get("cat_key") or "")
3265
+
3266
+ for info in self._all_rows:
3267
+ w = info["widget"]
3268
+ is_sep = info.get("is_sep", False)
3269
+ ck = info.get("cat_key") or ""
3270
+ if is_sep:
3271
+ if ck in cats_with_matches:
3272
+ batcher.show(w, fill="x", pady=(16, 0), padx=0)
3273
+ else:
3274
+ batcher.hide(w)
3275
+ elif q in info.get("search_key", ""):
3276
+ batcher.show(w, fill="x", pady=0, padx=0)
3277
+ else:
3278
+ batcher.hide(w)
3279
+ batcher.flush()
3280
+
3281
+ def _bind_scroll(self, widget: tk.Widget) -> None:
3282
+ def _on_wheel(e: Any) -> None:
3283
+ if e.delta:
3284
+ self._canvas.yview_scroll(-1 * (e.delta // 120), "units")
3285
+ elif e.num == 4:
3286
+ self._canvas.yview_scroll(-1, "units")
3287
+ else:
3288
+ self._canvas.yview_scroll(1, "units")
3289
+
3290
+ widget.bind("<MouseWheel>", _on_wheel, add=True)
3291
+ widget.bind("<Button-4>", _on_wheel, add=True)
3292
+ widget.bind("<Button-5>", _on_wheel, add=True)
3293
+
3294
+ def _save(self, key: str, value: Any) -> None:
3295
+ self._cfg.set(key, value)
3296
+ if self._on_change:
3297
+ self._on_change(key, value)
3298
+
3299
+ def _reset(self, key: str, default: Any) -> None:
3300
+ self._cfg.set(key, default)
3301
+ if self._on_change:
3302
+ self._on_change(key, default)
3303
+ yview = self._canvas.yview()
3304
+ for w in self._content.winfo_children():
3305
+ w.destroy()
3306
+ self._all_rows.clear()
3307
+ self._build_rows()
3308
+ self._content.update_idletasks()
3309
+ self._canvas.yview_moveto(yview[0])
3310
+ if self._filter_q:
3311
+ self._apply_filter(self._filter_q)
3312
+
3313
+ def _refresh_language_combo(self) -> None:
3314
+ labels = _get_language_labels()
3315
+ codes = _get_language_options()
3316
+ names = [labels.get(c, c) for c in codes]
3317
+ cur = self._cfg.get("language", "pt-BR")
3318
+ cur_nm = labels.get(str(cur), str(cur))
3319
+
3320
+ for info in self._all_rows:
3321
+ w = info["widget"]
3322
+ combo = getattr(w, "_lang_combo", None)
3323
+ var = getattr(w, "_lang_var", None)
3324
+ if combo is None:
3325
+ continue
3326
+ with contextlib.suppress(tk.TclError):
3327
+ combo.config(values=names)
3328
+ var.set(cur_nm)
3329
+
3330
+ def _open_json(self, _event: Any = None) -> None:
3331
+ p = CONFIG_DIR / "config.json"
3332
+ if self._on_change:
3333
+ self._on_change("_open_json", str(p))
3334
+
3335
+ def apply_theme(self, t: Theme) -> None:
3336
+ """Aplica o tema ``t`` ao editor de configurações.
3337
+
3338
+ Se a UI ainda não foi construída, nada a refazer (será criada já com o
3339
+ tema atual). Se estiver oculta, o rebuild é adiado até o próximo
3340
+ ``<Map>`` para evitar recriar ~140 widgets sem o usuário ver.
3341
+ """
3342
+ self.config(bg=t.editor_bg)
3343
+ if not self._built:
3344
+ return
3345
+ if not self.winfo_ismapped():
3346
+ self._theme_stale = True
3347
+ return
3348
+ self._theme_stale = False
3349
+ self._rebuild_for_theme()