chore(tahuantinsuyu): fase 28 — limpieza de warnings y dead_code
- Reemplaza `Context<Self>` por `Context<'_, Self>` (y la misma fórmula para `Context<TahuantinsuyuTree>`) en tree/panel/canvas: 60 warnings de "hidden lifetime parameters are deprecated" → 0. - Borra `TREE_WIDTH` y `PANEL_HEIGHT` (constantes muertas) y el campo `main_split` del shell (vive como child de outer_split, no necesita retención aparte). - Quita `yahweh-bus` de tahuantinsuyu — el `bus: Entity<AppBus>` estaba con `#[allow(dead_code)]` sin cablear. Cuando lo necesitemos para coordinación cross-app lo reagregamos. - Suprime imports `Module` (panel), `AppContext` (canvas) y prefija el `cx` no usado en `on_jog_down`. - Marca `BrahmanStatus::Offline.reason` y `Shell.tree` con `#[allow(dead_code)]` documentando por qué se retienen (logs y subscripciones). Workspace ahora compila limpio salvo un warning conocido de `eternal-validation` (variable `sin_i` sin usar — fuera de brahman). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,7 @@ use gpui::{
|
||||
};
|
||||
|
||||
use tahuantinsuyu_model::ChartKind;
|
||||
use tahuantinsuyu_modules::{Control, Module, Registry, SelectOption};
|
||||
use tahuantinsuyu_modules::{Control, Registry, SelectOption};
|
||||
use yahweh_theme::Theme;
|
||||
|
||||
// =====================================================================
|
||||
@@ -101,7 +101,7 @@ pub struct ControlPanel {
|
||||
impl EventEmitter<PanelEvent> for ControlPanel {}
|
||||
|
||||
impl ControlPanel {
|
||||
pub fn new(cx: &mut Context<Self>) -> Self {
|
||||
pub fn new(cx: &mut Context<'_, Self>) -> Self {
|
||||
cx.observe_global::<Theme>(|_, cx| cx.notify()).detach();
|
||||
Self {
|
||||
active_kind: None,
|
||||
@@ -134,13 +134,13 @@ impl ControlPanel {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
fn toggle_collapsed(&mut self, module_id: String, cx: &mut Context<Self>) {
|
||||
fn toggle_collapsed(&mut self, module_id: String, cx: &mut Context<'_, Self>) {
|
||||
let current = self.is_collapsed(&module_id);
|
||||
self.collapse_overrides.insert(module_id, !current);
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn set_active_kind(&mut self, kind: Option<ChartKind>, cx: &mut Context<Self>) {
|
||||
pub fn set_active_kind(&mut self, kind: Option<ChartKind>, cx: &mut Context<'_, Self>) {
|
||||
if self.active_kind != kind {
|
||||
if let Some(k) = kind {
|
||||
for m in self.registry.for_kind(k) {
|
||||
@@ -180,7 +180,7 @@ impl ControlPanel {
|
||||
|
||||
/// Setea un toggle desde afuera (sin emitir evento). Usado por el
|
||||
/// shell para sincronizar cuando el canvas se autotoggleó via hotkey.
|
||||
pub fn set_toggle(&mut self, module_id: &str, key: &str, value: bool, cx: &mut Context<Self>) {
|
||||
pub fn set_toggle(&mut self, module_id: &str, key: &str, value: bool, cx: &mut Context<'_, Self>) {
|
||||
self.toggle_state
|
||||
.insert((module_id.to_string(), key.to_string()), value);
|
||||
cx.notify();
|
||||
@@ -189,7 +189,7 @@ impl ControlPanel {
|
||||
/// Setea un slider desde afuera (sin emitir evento). El shell la
|
||||
/// usa, por ejemplo, para inicializar `progression.target_age_years`
|
||||
/// con la edad actual del sujeto al cargar una carta nueva.
|
||||
pub fn set_slider(&mut self, module_id: &str, key: &str, value: f64, cx: &mut Context<Self>) {
|
||||
pub fn set_slider(&mut self, module_id: &str, key: &str, value: f64, cx: &mut Context<'_, Self>) {
|
||||
self.slider_state
|
||||
.insert((module_id.to_string(), key.to_string()), value);
|
||||
cx.notify();
|
||||
@@ -199,7 +199,7 @@ impl ControlPanel {
|
||||
/// `Control::ChartPicker`. El shell la llama cada vez que la
|
||||
/// jerarquía de cartas cambia (crear/borrar) para que el dropdown
|
||||
/// quede al día sin necesidad de re-instanciar el panel.
|
||||
pub fn set_chart_options(&mut self, options: Vec<ChartOption>, cx: &mut Context<Self>) {
|
||||
pub fn set_chart_options(&mut self, options: Vec<ChartOption>, cx: &mut Context<'_, Self>) {
|
||||
self.chart_options = options;
|
||||
cx.notify();
|
||||
}
|
||||
@@ -212,7 +212,7 @@ impl ControlPanel {
|
||||
module_id: &str,
|
||||
key: &str,
|
||||
value: Option<String>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
self.string_state
|
||||
.insert((module_id.to_string(), key.to_string()), value);
|
||||
@@ -226,14 +226,14 @@ impl ControlPanel {
|
||||
module_id: &str,
|
||||
key: &str,
|
||||
chart_id: Option<String>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
self.set_string(module_id, key, chart_id, cx);
|
||||
}
|
||||
|
||||
// ----- internos: handlers -----
|
||||
|
||||
fn on_toggle_click(&mut self, module_id: String, key: String, cx: &mut Context<Self>) {
|
||||
fn on_toggle_click(&mut self, module_id: String, key: String, cx: &mut Context<'_, Self>) {
|
||||
let entry = self
|
||||
.toggle_state
|
||||
.entry((module_id.clone(), key.clone()))
|
||||
@@ -256,7 +256,7 @@ impl ControlPanel {
|
||||
max: f64,
|
||||
bounds: Bounds<Pixels>,
|
||||
position: Point<Pixels>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
self.slider_drag = Some(SliderDrag {
|
||||
module_id: module_id.clone(),
|
||||
@@ -271,20 +271,20 @@ impl ControlPanel {
|
||||
&mut self,
|
||||
bounds: Bounds<Pixels>,
|
||||
position: Point<Pixels>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
if self.slider_drag.is_some() {
|
||||
self.apply_slider_position(bounds, position, cx);
|
||||
}
|
||||
}
|
||||
|
||||
fn end_slider_drag(&mut self, cx: &mut Context<Self>) {
|
||||
fn end_slider_drag(&mut self, cx: &mut Context<'_, Self>) {
|
||||
if self.slider_drag.take().is_some() {
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_dropdown_open(&mut self, module_id: String, key: String, cx: &mut Context<Self>) {
|
||||
fn toggle_dropdown_open(&mut self, module_id: String, key: String, cx: &mut Context<'_, Self>) {
|
||||
let key_pair = (module_id, key);
|
||||
let new_state = match self.dropdown_open.as_ref() {
|
||||
Some(open) if open == &key_pair => None,
|
||||
@@ -299,7 +299,7 @@ impl ControlPanel {
|
||||
module_id: String,
|
||||
key: String,
|
||||
value: Option<String>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
self.string_state
|
||||
.insert((module_id.clone(), key.clone()), value.clone());
|
||||
@@ -320,7 +320,7 @@ impl ControlPanel {
|
||||
&mut self,
|
||||
bounds: Bounds<Pixels>,
|
||||
position: Point<Pixels>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) {
|
||||
let Some(drag) = self.slider_drag.as_ref().cloned() else {
|
||||
return;
|
||||
@@ -354,7 +354,7 @@ const SLIDER_TRACK_H: f32 = 8.0;
|
||||
const SLIDER_THUMB: f32 = 12.0;
|
||||
|
||||
impl Render for ControlPanel {
|
||||
fn render(&mut self, _w: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
fn render(&mut self, _w: &mut Window, cx: &mut Context<'_, Self>) -> impl IntoElement {
|
||||
let theme = Theme::global(cx).clone();
|
||||
let modules: Vec<(String, String, String, Vec<Control>)> = match self.active_kind {
|
||||
Some(k) => self
|
||||
@@ -438,7 +438,7 @@ impl ControlPanel {
|
||||
label: &str,
|
||||
description: &str,
|
||||
controls: &[Control],
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let collapsed = self.is_collapsed(module_id);
|
||||
let chevron = if collapsed { "▸" } else { "▾" };
|
||||
@@ -510,7 +510,7 @@ impl ControlPanel {
|
||||
theme: &Theme,
|
||||
module_id: &str,
|
||||
c: &Control,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
match c {
|
||||
Control::Toggle {
|
||||
@@ -548,7 +548,7 @@ impl ControlPanel {
|
||||
label: &str,
|
||||
default: bool,
|
||||
hotkey: Option<&str>,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let active = self
|
||||
.toggle_state
|
||||
@@ -606,7 +606,7 @@ impl ControlPanel {
|
||||
min: f64,
|
||||
max: f64,
|
||||
default: f64,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let value = self
|
||||
.slider_state
|
||||
@@ -750,7 +750,7 @@ impl ControlPanel {
|
||||
module_id: &str,
|
||||
key: &str,
|
||||
label: &str,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let options: Vec<(String, String)> = self
|
||||
.chart_options
|
||||
@@ -777,7 +777,7 @@ impl ControlPanel {
|
||||
label: &str,
|
||||
options: &[SelectOption],
|
||||
default: &str,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let opts: Vec<(String, String)> = options
|
||||
.iter()
|
||||
@@ -801,7 +801,7 @@ impl ControlPanel {
|
||||
placeholder: &str,
|
||||
options: &[(String, String)],
|
||||
include_auto: bool,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let current_value = self
|
||||
.string_state
|
||||
@@ -877,7 +877,7 @@ impl ControlPanel {
|
||||
key: &str,
|
||||
options: &[(String, String)],
|
||||
include_auto: bool,
|
||||
cx: &mut Context<Self>,
|
||||
cx: &mut Context<'_, Self>,
|
||||
) -> gpui::Div {
|
||||
let mut popup = div()
|
||||
.absolute()
|
||||
|
||||
Reference in New Issue
Block a user