Compare commits
No commits in common. "ca7051d24daea142c8502a7287a39e8fdad0908a" and "5e8888e56b7bfd9600cc2467fc98f2da8e1101e8" have entirely different histories.
ca7051d24d
...
5e8888e56b
1257
Cargo.lock
generated
1257
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -12,9 +12,6 @@ edition = "2018"
|
|||||||
[[bin]]
|
[[bin]]
|
||||||
name = "dust"
|
name = "dust"
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "gui"
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "dust_lib"
|
name = "dust_lib"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
@ -22,6 +19,7 @@ path = "src/lib.rs"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
|
eframe = "0.22.0"
|
||||||
trash = "3.0.3"
|
trash = "3.0.3"
|
||||||
rayon = "1.7.0"
|
rayon = "1.7.0"
|
||||||
serde = { version = "1.0.171", features = ["derive"] }
|
serde = { version = "1.0.171", features = ["derive"] }
|
||||||
@ -38,8 +36,3 @@ serde_json = "1.0.104"
|
|||||||
egui_extras = "0.22.0"
|
egui_extras = "0.22.0"
|
||||||
rustyline = { version = "12.0.0", features = ["with-file-history", "derive"] }
|
rustyline = { version = "12.0.0", features = ["with-file-history", "derive"] }
|
||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
iced = "0.10.0"
|
|
||||||
egui = "0.22.0"
|
|
||||||
eframe = "0.22.0"
|
|
||||||
env_logger = "0.10.0"
|
|
||||||
once_cell = "1.18.0"
|
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
use dust_lib::eval;
|
|
||||||
use iced::widget::{button, column, container, scrollable, text, text_input};
|
|
||||||
use iced::{executor, Alignment, Application, Command, Element, Sandbox, Settings, Theme};
|
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
|
|
||||||
static INPUT_ID: Lazy<text_input::Id> = Lazy::new(text_input::Id::unique);
|
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
|
||||||
DustGui::run(Settings::default())
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DustGui {
|
|
||||||
text_buffer: String,
|
|
||||||
results: Vec<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Application for DustGui {
|
|
||||||
type Executor = executor::Default;
|
|
||||||
|
|
||||||
type Message = Message;
|
|
||||||
|
|
||||||
type Theme = Theme;
|
|
||||||
|
|
||||||
type Flags = ();
|
|
||||||
|
|
||||||
fn new(flags: Self::Flags) -> (Self, iced::Command<Self::Message>) {
|
|
||||||
(
|
|
||||||
DustGui {
|
|
||||||
text_buffer: String::new(),
|
|
||||||
results: Vec::new(),
|
|
||||||
},
|
|
||||||
Command::none(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self) -> String {
|
|
||||||
"Dust".to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update(&mut self, message: Self::Message) -> iced::Command<Self::Message> {
|
|
||||||
match message {
|
|
||||||
Message::TextInput(input) => {
|
|
||||||
self.text_buffer = input;
|
|
||||||
|
|
||||||
Command::none()
|
|
||||||
}
|
|
||||||
Message::Evaluate => {
|
|
||||||
let eval_result = eval(&self.text_buffer);
|
|
||||||
|
|
||||||
Command::batch(vec![])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn view(&self) -> Element<'_, Self::Message, iced::Renderer<Self::Theme>> {
|
|
||||||
let input = text_input("What needs to be done?", &self.text_buffer)
|
|
||||||
.id(INPUT_ID.clone())
|
|
||||||
.on_input(Message::TextInput)
|
|
||||||
.on_submit(Message::Evaluate)
|
|
||||||
.padding(15)
|
|
||||||
.size(30);
|
|
||||||
|
|
||||||
scrollable(container(column![input])).into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
enum Message {
|
|
||||||
TextInput(String),
|
|
||||||
Evaluate,
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user