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