fixup
This commit is contained in:
parent
49d0637fc8
commit
277d9052b0
22
src/lib.rs
22
src/lib.rs
|
@ -1,6 +1,6 @@
|
|||
use orbtk::prelude::*;
|
||||
use rhai::RegisterFn;
|
||||
use rhai::{packages::*, Engine, EvalAltResult, INT};
|
||||
use rhai::{Engine};
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use std::time::Duration;
|
||||
pub mod parser;
|
||||
|
@ -33,11 +33,11 @@ impl Widget for MainViewState {
|
|||
this
|
||||
}
|
||||
|
||||
fn insert_handler(self, handler: impl Into<Rc<dyn EventHandler>>) -> Self {
|
||||
fn insert_handler(self, _handler: impl Into<Rc<dyn EventHandler>>) -> Self {
|
||||
self
|
||||
}
|
||||
|
||||
fn child(self, child: Entity) -> Self {
|
||||
fn child(self, _child: Entity) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ impl MVState {
|
|||
.register_fn("update_property", move |x: &str, y: &str, z: &str| {
|
||||
tx.send((String::from(x), String::from(y), String::from(z)));
|
||||
});
|
||||
let result = self.engine.eval::<()>(action.as_str());
|
||||
let _result = self.engine.eval::<()>(action.as_str());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -69,12 +69,12 @@ impl State for MVState {
|
|||
self.update(registry, ctx);
|
||||
}
|
||||
|
||||
fn update(&mut self, registry: &mut Registry, ctx: &mut Context) {
|
||||
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context) {
|
||||
match &self.rx {
|
||||
Some(rx) => match rx.recv_timeout(Duration::from_millis(1)) {
|
||||
Ok((x, y, z)) => {
|
||||
ctx.child(x.as_str())
|
||||
.set::<String16>(y.as_str(), String16::from("hijack"));
|
||||
.set::<String16>(y.as_str(), String16::from(z));
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
@ -106,16 +106,16 @@ fn render_ctx(
|
|||
grid = grid.attach(Grid::row(row as usize));
|
||||
grid = grid.attach(Grid::column(col as usize));
|
||||
let rows = parse_number(child.properties.get("rows")) as u32;
|
||||
let cols = parse_number(child.properties.get("cols")) as u32;
|
||||
let _cols = parse_number(child.properties.get("cols")) as u32;
|
||||
|
||||
let mut grid_rows = Rows::create();
|
||||
for i in 0..rows {
|
||||
for _i in 0..rows {
|
||||
grid_rows = grid_rows.row("stretch");
|
||||
}
|
||||
grid = grid.rows(grid_rows.build());
|
||||
|
||||
let mut grid_cols = Columns::create();
|
||||
for i in 0..rows {
|
||||
for _i in 0..rows {
|
||||
grid_cols = grid_cols.column("stretch");
|
||||
}
|
||||
grid = grid.columns(grid_cols.build());
|
||||
|
@ -140,8 +140,8 @@ fn render_ctx(
|
|||
return Some(grid.build(ctx));
|
||||
}
|
||||
"Rectangle" => {
|
||||
let width = parse_number(child.properties.get("width"));
|
||||
let height = parse_number(child.properties.get("height"));
|
||||
let _width = parse_number(child.properties.get("width"));
|
||||
let _height = parse_number(child.properties.get("height"));
|
||||
|
||||
let color = match child.properties.get("color") {
|
||||
Some(QmlString(col)) => match col.as_str() {
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,20 +1,15 @@
|
|||
use orbtk::prelude::*;
|
||||
use rhai::RegisterFn;
|
||||
use rhai::{packages::*, Engine, EvalAltResult, INT};
|
||||
|
||||
use rqml::parser::parse_qml;
|
||||
use rqml::{MVState, MainViewState};
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
use std::fs::read_to_string;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use rhai::Engine;
|
||||
|
||||
|
||||
fn main() {
|
||||
Application::new()
|
||||
.window(|ctx| {
|
||||
let mut app_context: HashMap<String, Entity> = HashMap::new();
|
||||
let _app_context: HashMap<String, Entity> = HashMap::new();
|
||||
let qml_doc = parse_qml("./res/example.qml");
|
||||
let top_level = qml_doc.children.clone();
|
||||
println!("{:?}", qml_doc);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extern crate pest;
|
||||
|
||||
use crate::Value::{QmlIdent, QmlNumber, QmlString};
|
||||
use pest::iterators::{Pair, Pairs};
|
||||
use pest::iterators::{Pairs};
|
||||
use pest::Parser;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::read_to_string;
|
||||
|
|
Loading…
Reference in New Issue