mirror of https://codeberg.org/topola/topola.git
chore(egui): fix rust warnings
This commit is contained in:
parent
5e3ccf2560
commit
161fa002c1
|
|
@ -33,7 +33,7 @@ impl Trigger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn button(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) {
|
pub fn button(&mut self, _ctx: &egui::Context, ui: &mut egui::Ui) {
|
||||||
self.triggered = ui.button(self.action.widget_text()).clicked();
|
self.triggered = ui.button(self.action.widget_text()).clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ impl Trigger {
|
||||||
self.triggered()
|
self.triggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn consume_key(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) {
|
fn consume_key(&mut self, ctx: &egui::Context, _ui: &mut egui::Ui) {
|
||||||
if ctx.input_mut(|i| i.consume_shortcut(&self.action.shortcut)) {
|
if ctx.input_mut(|i| i.consume_shortcut(&self.action.shortcut)) {
|
||||||
self.triggered = true;
|
self.triggered = true;
|
||||||
}
|
}
|
||||||
|
|
@ -62,14 +62,14 @@ impl Switch {
|
||||||
Self { action }
|
Self { action }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_widget(&mut self, ctx: &egui::Context, ui: &mut egui::Ui, selected: &mut bool) {
|
pub fn toggle_widget(&mut self, _ctx: &egui::Context, ui: &mut egui::Ui, selected: &mut bool) {
|
||||||
ui.toggle_value(selected, self.action.widget_text());
|
ui.toggle_value(selected, self.action.widget_text());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn consume_key_enabled(
|
pub fn consume_key_enabled(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &egui::Context,
|
ctx: &egui::Context,
|
||||||
ui: &mut egui::Ui,
|
_ui: &mut egui::Ui,
|
||||||
selected: &mut bool,
|
selected: &mut bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if ctx.input_mut(|i| i.consume_shortcut(&self.action.shortcut)) {
|
if ctx.input_mut(|i| i.consume_shortcut(&self.action.shortcut)) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ use topola::{
|
||||||
InvokerStatus,
|
InvokerStatus,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
board::mesadata::AccessMesadata,
|
|
||||||
drawing::graph::PrimitiveIndex,
|
drawing::graph::PrimitiveIndex,
|
||||||
geometry::primitive::PrimitiveShape,
|
geometry::primitive::PrimitiveShape,
|
||||||
router::{navmesh::Navmesh, trace::TraceStepper},
|
router::{navmesh::Navmesh, trace::TraceStepper},
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
use geo::point;
|
|
||||||
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
|
||||||
future::Future,
|
future::Future,
|
||||||
sync::{
|
sync::{
|
||||||
mpsc::{channel, Receiver, Sender},
|
mpsc::{channel, Receiver, Sender},
|
||||||
|
|
@ -13,27 +10,6 @@ use unic_langid::{langid, LanguageIdentifier};
|
||||||
|
|
||||||
use topola::{
|
use topola::{
|
||||||
autorouter::{invoker::Invoker, Autorouter},
|
autorouter::{invoker::Invoker, Autorouter},
|
||||||
drawing::{
|
|
||||||
dot::FixedDotIndex,
|
|
||||||
graph::{MakePrimitive, PrimitiveIndex},
|
|
||||||
primitive::MakePrimitiveShape,
|
|
||||||
rules::AccessRules,
|
|
||||||
Drawing, DrawingException, Infringement,
|
|
||||||
},
|
|
||||||
geometry::{
|
|
||||||
compound::ManageCompounds,
|
|
||||||
primitive::{AccessPrimitiveShape, BendShape, DotShape, PrimitiveShape, SegShape},
|
|
||||||
shape::AccessShape,
|
|
||||||
GenericNode,
|
|
||||||
},
|
|
||||||
layout::{poly::MakePolyShape, via::ViaWeight, Layout},
|
|
||||||
math::Circle,
|
|
||||||
router::{
|
|
||||||
draw::DrawException,
|
|
||||||
navmesh::{BinavvertexNodeIndex, Navmesh},
|
|
||||||
trace::TraceStepper,
|
|
||||||
tracer::Tracer,
|
|
||||||
},
|
|
||||||
specctra::{design::SpecctraDesign, mesadata::SpecctraMesadata},
|
specctra::{design::SpecctraDesign, mesadata::SpecctraMesadata},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -44,7 +20,6 @@ use crate::{
|
||||||
layers::Layers,
|
layers::Layers,
|
||||||
menu_bar::MenuBar,
|
menu_bar::MenuBar,
|
||||||
overlay::Overlay,
|
overlay::Overlay,
|
||||||
painter::Painter,
|
|
||||||
status_bar::StatusBar,
|
status_bar::StatusBar,
|
||||||
translator::Translator,
|
translator::Translator,
|
||||||
viewport::Viewport,
|
viewport::Viewport,
|
||||||
|
|
@ -250,10 +225,9 @@ impl eframe::App for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.error_dialog
|
self.error_dialog.update(ctx, &self.translator);
|
||||||
.update(ctx, &self.translator, &self.viewport);
|
|
||||||
|
|
||||||
let viewport_rect = self.viewport.update(
|
let _viewport_rect = self.viewport.update(
|
||||||
ctx,
|
ctx,
|
||||||
&self.top,
|
&self.top,
|
||||||
&mut self.arc_mutex_maybe_invoker.lock().unwrap(),
|
&mut self.arc_mutex_maybe_invoker.lock().unwrap(),
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
//! dialog for error messages (e.g. for displaying file parser errors)
|
//! dialog for error messages (e.g. for displaying file parser errors)
|
||||||
|
|
||||||
|
use crate::translator::Translator;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{translator::Translator, viewport::Viewport};
|
|
||||||
|
|
||||||
pub struct ErrorDialog {
|
pub struct ErrorDialog {
|
||||||
/// messages is a list of error messages to display.
|
/// messages is a list of error messages to display.
|
||||||
///
|
///
|
||||||
|
|
@ -32,7 +31,7 @@ impl ErrorDialog {
|
||||||
self.window_open = true;
|
self.window_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self, ctx: &egui::Context, tr: &Translator, viewport: &Viewport) {
|
pub fn update(&mut self, ctx: &egui::Context, tr: &Translator) {
|
||||||
let mut messages_cleared = false;
|
let mut messages_cleared = false;
|
||||||
egui::Window::new(tr.text("title-error-messages"))
|
egui::Window::new(tr.text("title-error-messages"))
|
||||||
.id("error-messages-dialog".into())
|
.id("error-messages-dialog".into())
|
||||||
|
|
@ -48,10 +47,12 @@ impl ErrorDialog {
|
||||||
let mut messages_to_discard = BTreeSet::<usize>::new();
|
let mut messages_to_discard = BTreeSet::<usize>::new();
|
||||||
let style = Arc::clone(ui.style());
|
let style = Arc::clone(ui.style());
|
||||||
for (msg_id, msg) in self.messages.iter().enumerate() {
|
for (msg_id, msg) in self.messages.iter().enumerate() {
|
||||||
use egui::style::{FontSelection, TextStyle};
|
use egui::{
|
||||||
use egui::text::{LayoutJob, TextWrapping};
|
style::{FontSelection, TextStyle},
|
||||||
use egui::widget_text::{RichText, WidgetText};
|
text::LayoutJob,
|
||||||
use egui::{Align, FontFamily, FontId, TextFormat};
|
widget_text::{RichText, WidgetText},
|
||||||
|
Align,
|
||||||
|
};
|
||||||
|
|
||||||
let mut loj = LayoutJob::default();
|
let mut loj = LayoutJob::default();
|
||||||
loj.break_on_newline = true;
|
loj.break_on_newline = true;
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,8 @@ mod translator;
|
||||||
mod viewport;
|
mod viewport;
|
||||||
|
|
||||||
use app::App;
|
use app::App;
|
||||||
use fluent_templates::static_loader;
|
|
||||||
use sys_locale::get_locale;
|
use sys_locale::get_locale;
|
||||||
use unic_langid::{langid, LanguageIdentifier};
|
use unic_langid::langid;
|
||||||
|
|
||||||
// Build to native.
|
// Build to native.
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::{mpsc::Sender, Arc, Mutex},
|
sync::{mpsc::Sender, Arc, Mutex},
|
||||||
};
|
};
|
||||||
|
|
@ -7,7 +6,7 @@ use std::{
|
||||||
use topola::{
|
use topola::{
|
||||||
autorouter::{
|
autorouter::{
|
||||||
command::Command,
|
command::Command,
|
||||||
invoker::{Invoker, InvokerError, InvokerStatus},
|
invoker::{Invoker, InvokerError},
|
||||||
AutorouterOptions,
|
AutorouterOptions,
|
||||||
},
|
},
|
||||||
router::RouterOptions,
|
router::RouterOptions,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use std::collections::HashSet;
|
|
||||||
|
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use rstar::AABB;
|
use rstar::AABB;
|
||||||
use spade::InsertionError;
|
use spade::InsertionError;
|
||||||
|
|
@ -17,9 +15,9 @@ use topola::{
|
||||||
},
|
},
|
||||||
graph::{GenericIndex, GetPetgraphIndex},
|
graph::{GenericIndex, GetPetgraphIndex},
|
||||||
layout::{
|
layout::{
|
||||||
poly::{MakePolyShape, Poly, PolyWeight},
|
poly::{MakePolyShape, PolyWeight},
|
||||||
via::ViaWeight,
|
via::ViaWeight,
|
||||||
CompoundWeight, Layout, NodeIndex,
|
CompoundWeight, NodeIndex,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -61,7 +59,7 @@ impl Overlay {
|
||||||
}
|
}
|
||||||
NodeIndex::Compound(compound) => {
|
NodeIndex::Compound(compound) => {
|
||||||
match board.layout().drawing().compound_weight(compound) {
|
match board.layout().drawing().compound_weight(compound) {
|
||||||
CompoundWeight::Poly(weight) => {
|
CompoundWeight::Poly(_) => {
|
||||||
board
|
board
|
||||||
.layout()
|
.layout()
|
||||||
.poly(GenericIndex::<PolyWeight>::new(
|
.poly(GenericIndex::<PolyWeight>::new(
|
||||||
|
|
@ -94,12 +92,12 @@ impl Overlay {
|
||||||
}
|
}
|
||||||
NodeIndex::Compound(compound) => {
|
NodeIndex::Compound(compound) => {
|
||||||
match board.layout().drawing().compound_weight(compound) {
|
match board.layout().drawing().compound_weight(compound) {
|
||||||
CompoundWeight::Poly(weight) => board
|
CompoundWeight::Poly(_) => board
|
||||||
.layout()
|
.layout()
|
||||||
.poly(GenericIndex::<PolyWeight>::new(compound.petgraph_index()))
|
.poly(GenericIndex::<PolyWeight>::new(compound.petgraph_index()))
|
||||||
.shape()
|
.shape()
|
||||||
.into(),
|
.into(),
|
||||||
CompoundWeight::Via(weight) => board
|
CompoundWeight::Via(_) => board
|
||||||
.layout()
|
.layout()
|
||||||
.via(GenericIndex::<ViaWeight>::new(compound.petgraph_index()))
|
.via(GenericIndex::<ViaWeight>::new(compound.petgraph_index()))
|
||||||
.shape()
|
.shape()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use geo::{CoordsIter, Point, Polygon};
|
||||||
use rstar::AABB;
|
use rstar::AABB;
|
||||||
use topola::{
|
use topola::{
|
||||||
geometry::primitive::{AccessPrimitiveShape, PrimitiveShape},
|
geometry::primitive::{AccessPrimitiveShape, PrimitiveShape},
|
||||||
math::{self, Circle},
|
math::Circle,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Painter<'a> {
|
pub struct Painter<'a> {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use topola::autorouter::invoker::InvokerStatus;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
activity::{ActivityStatus, ActivityWithStatus},
|
activity::{ActivityStatus, ActivityWithStatus},
|
||||||
translator::Translator,
|
translator::Translator,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ use topola::{
|
||||||
command::Command,
|
command::Command,
|
||||||
invoker::{GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles, Invoker},
|
invoker::{GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles, Invoker},
|
||||||
},
|
},
|
||||||
board::mesadata::AccessMesadata,
|
|
||||||
drawing::{
|
drawing::{
|
||||||
graph::{MakePrimitive, PrimitiveIndex},
|
graph::{MakePrimitive, PrimitiveIndex},
|
||||||
primitive::MakePrimitiveShape,
|
primitive::MakePrimitiveShape,
|
||||||
|
|
@ -21,8 +20,8 @@ use topola::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
activity::ActivityWithStatus, app::execute, layers::Layers, menu_bar::MenuBar,
|
activity::ActivityWithStatus, layers::Layers, menu_bar::MenuBar, overlay::Overlay,
|
||||||
overlay::Overlay, painter::Painter,
|
painter::Painter,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Viewport {
|
pub struct Viewport {
|
||||||
|
|
@ -253,7 +252,7 @@ impl Viewport {
|
||||||
|
|
||||||
if let Some(navmesh) = activity.maybe_navmesh() {
|
if let Some(navmesh) = activity.maybe_navmesh() {
|
||||||
if top.show_origin_destination {
|
if top.show_origin_destination {
|
||||||
if let (origin, destination) = (navmesh.origin(), navmesh.destination()) {
|
let (origin, destination) = (navmesh.origin(), navmesh.destination());
|
||||||
painter.paint_dot(
|
painter.paint_dot(
|
||||||
Circle {
|
Circle {
|
||||||
pos: board.layout().drawing().primitive(origin).shape().center(),
|
pos: board.layout().drawing().primitive(origin).shape().center(),
|
||||||
|
|
@ -273,7 +272,6 @@ impl Viewport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
viewport_rect
|
viewport_rect
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue