From d9c786e88c4901eca592401d58bb79244d94c607 Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Mon, 1 Nov 2021 08:38:17 +0100 Subject: [PATCH] Remove luahost --- Cargo.lock | 52 ------------------------------- Cargo.toml | 1 - lua/date.lua | 13 -------- lua/hello.lua | 1 - lua/ui.lua | 69 ------------------------------------------ src/main.rs | 1 - src/sources/luahost.rs | 56 ---------------------------------- src/sources/mod.rs | 3 -- 8 files changed, 196 deletions(-) delete mode 100644 lua/date.lua delete mode 100644 lua/hello.lua delete mode 100644 lua/ui.lua delete mode 100644 src/sources/luahost.rs diff --git a/Cargo.lock b/Cargo.lock index cd860c0..3add91f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,15 +64,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[package]] -name = "bstr" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -dependencies = [ - "memchr", -] - [[package]] name = "bumpalo" version = "3.7.1" @@ -655,24 +646,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "lua-src" -version = "543.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72914332bf1ef0e1185b229135d639f11a4a8ccfd32852db8e52419c04c0247" -dependencies = [ - "cc", -] - -[[package]] -name = "luajit-src" -version = "210.2.0+resty5f13855" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f85722ea9e022305a077b916c9271011a195ee8dc9b2b764fc78b0378e3b72" -dependencies = [ - "cc", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -734,21 +707,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "mlua" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4235d7e740d73d7429df6f176c81b248f05c39d67264d45a7d8cecb67c227f6f" -dependencies = [ - "bstr", - "cc", - "lua-src", - "luajit-src", - "num-traits", - "once_cell", - "pkg-config", -] - [[package]] name = "ndk" version = "0.3.0" @@ -853,15 +811,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - [[package]] name = "num_cpus" version = "1.13.0" @@ -1149,7 +1098,6 @@ dependencies = [ "fuse-rust", "fuzzy-matcher", "log", - "mlua", "nix 0.23.0", "pangocairo", "rayon", diff --git a/Cargo.toml b/Cargo.toml index 34aacef..bc5db47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,6 @@ fuzzy-matcher = "0.3.7" walkdir = "2.3.2" freedesktop_entry_parser = "1.2.0" -mlua = { version = "0.6", features = ["lua54", "vendored"] } nix = "0.23.0" fuse-rust = "0.3.0" anyhow = "1.0.44" diff --git a/lua/date.lua b/lua/date.lua deleted file mode 100644 index c549fa8..0000000 --- a/lua/date.lua +++ /dev/null @@ -1,13 +0,0 @@ -local date = require "date" --- prints all FRIDAY the 13TH dates between year 2000 and 2010 -for i = 2000, 2010 do - -- year jan 1 - x = date(i, 1, 1) - -- from january to december - for j = 1, 12 do - -- set date to 13, check if friday - if x:setmonth(j, 13):getweekday() == 6 then - print(x:fmt("%A, %B %d %Y")) - end - end -end \ No newline at end of file diff --git a/lua/hello.lua b/lua/hello.lua deleted file mode 100644 index 8e23576..0000000 --- a/lua/hello.lua +++ /dev/null @@ -1 +0,0 @@ -print("Hello World") \ No newline at end of file diff --git a/lua/ui.lua b/lua/ui.lua deleted file mode 100644 index 40a549f..0000000 --- a/lua/ui.lua +++ /dev/null @@ -1,69 +0,0 @@ -local lwtk = require("lwtk") - -local Application = lwtk.Application -local Column = lwtk.Column -local Row = lwtk.Row -local PushButton = lwtk.PushButton -local TextInput = lwtk.TextInput -local TitleText = lwtk.TitleText -local Space = lwtk.Space - -local app = Application("example01.lua") - -local function quit() - app:close() -end - -local win = app:newWindow { - title = "example01", - Column { - id = "c1", - TitleText { text = "What's your name?" }, - TextInput { id = "i1", focus = true, style = { Columns = 40 } }, - Row { - Space {}, - PushButton { id = "b1", text = "&OK", disabled = true, - default = true }, - - PushButton { id = "b2", text = "&Quit", onClicked = quit }, - Space {} - } - }, - Column { - id = "c2", - visible = false, - Space {}, - TitleText { id = "t2", style = { TextAlign = "center" } }, - Space {}, - Row { - Space {}, - PushButton { id = "b3", text = "&Again" }, - - PushButton { id = "b4", text = "&Quit", default = true, - onClicked = quit }, - Space {} - } - } -} - -win:childById("c1"):setOnInputChanged(function(widget, input) - widget:childById("b1"):setDisabled(input.text == "") -end) - -win:childById("b1"):setOnClicked(function(widget) - win:childById("t2"):setText("Hello "..win:childById("i1").text.."!") - win:childById("c1"):setVisible(false) - win:childById("c2"):setVisible(true) -end) - -win:childById("b3"):setOnClicked(function(widget) - win:childById("i1"):setText("") - win:childById("i1"):setFocus() - win:childById("t2"):setText("") - win:childById("c1"):setVisible(true) - win:childById("c2"):setVisible(false) -end) - -win:show() - -app:runEventLoop() \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index d8ecbb3..456ff73 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,6 @@ fn main() -> Result<(), Box> { .add_source(sources::TestSource::new("ts1")) .add_source(sources::Window::new()) .add_source(sources::Apps::new()) - .add_source(sources::LuaHost::new()) .add_source(sources::ShellHost::new()) .with_matcher(FuseMatcher::new()); diff --git a/src/sources/luahost.rs b/src/sources/luahost.rs deleted file mode 100644 index 49f7e99..0000000 --- a/src/sources/luahost.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::path::PathBuf; -use mlua::prelude::*; - -use log::debug; -use walkdir::WalkDir; - -use crate::roftl::{Entry, Source, Action}; - -pub struct LuaHost { - scripts: Vec, -} - -impl LuaHost { - pub fn new() -> Box { - Box::new(LuaHost{ scripts: vec![] }) - } -} - -impl Source for LuaHost { - fn name(&self) -> &'static str { - "lua" - } - - fn entries(&mut self) -> Vec { - // TODO read from config - let script_path = "/home/armin/dev/incubator/roftl/lua"; - - let scripts: Vec = WalkDir::new(script_path).into_iter() - .map(|e| e.unwrap().path().to_path_buf()) - .collect(); - - let mut entries: Vec = vec![]; - for (idx, script) in scripts.iter().enumerate() { - entries.push( - Entry { - source: self.name(), - name: script.file_stem().unwrap().to_str().unwrap().into(), - description: "".into(), - identifier: idx as u64 - }); - } - self.scripts = scripts; - entries - } - - fn action(&self, entry: &Entry, action: Action) { - let script = self.scripts.get(entry.identifier as usize).unwrap(); - debug!{"Got script {:?}", script}; - - let script_content = std::fs::read_to_string(script).unwrap(); - let lua = Lua::new(); - lua.load(&script_content).exec().unwrap(); - - debug!{"Executed {:?}", script}; - } -} diff --git a/src/sources/mod.rs b/src/sources/mod.rs index d4595bd..e9aba03 100644 --- a/src/sources/mod.rs +++ b/src/sources/mod.rs @@ -7,8 +7,5 @@ pub use windows::Window; mod apps; pub use apps::Apps; -mod luahost; -pub use luahost::LuaHost; - mod shellhost; pub use shellhost::ShellHost;