Remove luahost
This commit is contained in:
parent
bc48bf122e
commit
d9c786e88c
8 changed files with 0 additions and 196 deletions
52
Cargo.lock
generated
52
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
13
lua/date.lua
13
lua/date.lua
|
@ -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
|
|
@ -1 +0,0 @@
|
|||
print("Hello World")
|
69
lua/ui.lua
69
lua/ui.lua
|
@ -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()
|
|
@ -23,7 +23,6 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.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());
|
||||
|
||||
|
|
|
@ -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<PathBuf>,
|
||||
}
|
||||
|
||||
impl LuaHost {
|
||||
pub fn new() -> Box<LuaHost> {
|
||||
Box::new(LuaHost{ scripts: vec![] })
|
||||
}
|
||||
}
|
||||
|
||||
impl Source for LuaHost {
|
||||
fn name(&self) -> &'static str {
|
||||
"lua"
|
||||
}
|
||||
|
||||
fn entries(&mut self) -> Vec<Entry> {
|
||||
// TODO read from config
|
||||
let script_path = "/home/armin/dev/incubator/roftl/lua";
|
||||
|
||||
let scripts: Vec<PathBuf> = WalkDir::new(script_path).into_iter()
|
||||
.map(|e| e.unwrap().path().to_path_buf())
|
||||
.collect();
|
||||
|
||||
let mut entries: Vec<Entry> = 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};
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue