Watch
1
0
Fork
You've already forked souveraine
0

placement compiles: one field per snapshot, and it deserialises

This commit is contained in:
Fimeg 2026-08-05 19:59:29 -04:00
commit 425693a298
3 changed files with 24 additions and 22 deletions

View file

@ -35,8 +35,8 @@ use anyhow::{Context, Result};
use tao::event::{Event, StartCause, WindowEvent};
use tao::event_loop::{ControlFlow, EventLoop, EventLoopProxy};
use tao::window::WindowBuilder;
use wry::WebViewBuilder;
use wry::http::Response;
use wry::WebViewBuilder;
/// What the shell can tell the face to do, and what it says back.
///
@ -74,11 +74,11 @@ fn main() -> Result<()> {
}
"--transparent" => transparent = true,
"--size" => {
if let Some(v) = args.next()
&& let Some((w, h)) = v.split_once('x')
{
width = w.parse().unwrap_or(width);
height = h.parse().unwrap_or(height);
if let Some(v) = args.next() {
if let Some((w, h)) = v.split_once('x') {
width = w.parse().unwrap_or(width);
height = h.parse().unwrap_or(height);
}
}
}
"--help" | "-h" => {
@ -181,10 +181,10 @@ fn serve_ipc(path: &std::path::Path, proxy: EventLoopProxy<FromShell>) {
Some("quit") => Some(FromShell::Quit),
_ => None,
};
if let Some(event) = event
&& proxy.send_event(event).is_err()
{
return;
if let Some(event) = event {
if proxy.send_event(event).is_err() {
return;
}
}
}
}
@ -268,7 +268,10 @@ const INIT_SCRIPT: &str = r#"
/// surface, so the build goes through the Unix extension. Kept in one place so
/// the two modes do not each grow a platform branch.
#[cfg(target_os = "linux")]
fn build_webview(builder: WebViewBuilder<'_>, window: &tao::window::Window) -> Result<wry::WebView> {
fn build_webview(
builder: WebViewBuilder<'_>,
window: &tao::window::Window,
) -> Result<wry::WebView> {
use tao::platform::unix::WindowExtUnix;
use wry::WebViewBuilderExtUnix;
let vbox = window
@ -278,7 +281,10 @@ fn build_webview(builder: WebViewBuilder<'_>, window: &tao::window::Window) -> R
}
#[cfg(not(target_os = "linux"))]
fn build_webview(builder: WebViewBuilder<'_>, window: &tao::window::Window) -> Result<wry::WebView> {
fn build_webview(
builder: WebViewBuilder<'_>,
window: &tao::window::Window,
) -> Result<wry::WebView> {
builder.build(window).context("building the webview")
}

View file

@ -1367,7 +1367,7 @@ const LEGAL_TRANSITIONS: &[(DeviceState, DeviceState)] = &[
/// Which states count as "locked" for security purposes.
/// Where the phone believes it is. See [`DeviceStateMachine::placement`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PlacementBelief {
Hand,
@ -1383,7 +1383,7 @@ pub enum PlacementBelief {
///
/// The facts travel with the answer so a refusal can say what it believed and
/// why, rather than asserting a conclusion the caller cannot argue with.
#[derive(Debug, Clone, Copy, serde::Serialize)]
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
pub struct Placement {
pub belief: PlacementBelief,
pub confidence: f32,
@ -2730,7 +2730,6 @@ impl DeviceStateMachine {
sleep_inhibitor_held: false,
sensors_degraded: self.source_health.any_down(),
placement: self.placement(),
placement: self.placement(),
};
self.forensic.append(
ForensicEvent::Transition {
@ -3004,7 +3003,6 @@ impl DeviceStateMachine {
sleep_inhibitor_held: false,
sensors_degraded: self.source_health.any_down(),
placement: self.placement(),
placement: self.placement(),
};
self.forensic.append(
ForensicEvent::SensorInput {

View file

@ -300,17 +300,15 @@ impl HealthPane {
),
],
));
lines.push(
self.row(
"mood",
vec![Span::styled(
lines.push(self.row(
"mood",
vec![Span::styled(
self.mood.clone(),
Style::default()
.fg(p.agent_primary)
.add_modifier(Modifier::ITALIC),
)],
),
);
));
lines
}