test css
This commit is contained in:
parent
322461371f
commit
1218af7314
@ -44,7 +44,7 @@ tokio = { version = "1.35.1", features = ["time", "fs", "io-std", "macros", "num
|
||||
async-trait = "0.1.77"
|
||||
lazy_static = "1.4.0"
|
||||
once_cell = "1.19.0"
|
||||
relm4-icons = "0.6.0"
|
||||
relm4-icons = {version="0.6.0",features=["add-filled","delete-filled","chevron-up-filled","chevron-down-filled"]}
|
||||
# plotters-cairo = "0.5.0"
|
||||
|
||||
|
||||
|
||||
@ -108,6 +108,7 @@ impl SimpleComponent for AppModel {
|
||||
};
|
||||
|
||||
let app = relm4::main_application();
|
||||
relm4_icons::initialize_icons();
|
||||
app.set_menubar(Some(&main_menu));
|
||||
|
||||
let model = AppModel {
|
||||
|
||||
@ -7,6 +7,7 @@ use std::sync::Arc;
|
||||
|
||||
use super::sidebar::{sidebar::SideBarModel, Msg, SideBarOutputMsg};
|
||||
use adw::prelude::*;
|
||||
use gtk::prelude::StyleContextExt;
|
||||
use gtk::subclass::root;
|
||||
use relm4::{
|
||||
component::{AsyncComponent, AsyncComponentParts},
|
||||
@ -42,9 +43,14 @@ impl AsyncComponent for MonitorModel {
|
||||
set_position: 1000,
|
||||
#[wrap(Some)]
|
||||
#[name="render"]
|
||||
set_start_child=&Render{
|
||||
set_start_child=>k::Box{
|
||||
add_css_class: "rb",
|
||||
set_margin_all: 5,
|
||||
Render{
|
||||
add_css_class: "rb",
|
||||
#[watch]
|
||||
set_interior_layers: model.layers.clone(),
|
||||
}
|
||||
},
|
||||
#[wrap(Some)]
|
||||
set_end_child=model.sidebar.widget(),
|
||||
|
||||
@ -21,12 +21,21 @@ pub struct BottomBarModel {
|
||||
msg: TestMsg,
|
||||
}
|
||||
|
||||
impl BottomBarModel {
|
||||
pub fn new(icon: String) -> Self {
|
||||
Self {
|
||||
icon,
|
||||
msg: TestMsg::Add,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[relm4::factory(pub)]
|
||||
impl FactoryComponent for BottomBarModel {
|
||||
type ParentWidget = gtk::Box;
|
||||
type ParentInput = Msg;
|
||||
type Input = ();
|
||||
type Output = TextMsg;
|
||||
type Output = TestMsg;
|
||||
type Init = BottomBarModel;
|
||||
type CommandOutput = ();
|
||||
|
||||
@ -34,8 +43,7 @@ impl FactoryComponent for BottomBarModel {
|
||||
#[root]
|
||||
gtk::Box{
|
||||
gtk::Button{
|
||||
#[wrap(Some)]
|
||||
set_icon_name= model.icon.as_str(),
|
||||
set_icon_name=self.icon.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,6 +54,13 @@ impl FactoryComponent for BottomBarModel {
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Self::Input, sender: FactorySender<Self>) {
|
||||
match message {}
|
||||
}
|
||||
|
||||
fn forward_to_parent(_output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(match _output {
|
||||
_ => Msg::None
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ pub struct SideBarModel {
|
||||
#[derive(Debug)]
|
||||
pub enum Msg {
|
||||
RefreshList(Vec<Layer>),
|
||||
None
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -64,7 +65,7 @@ impl SimpleComponent for SideBarModel {
|
||||
sender.output(
|
||||
SideBarOutputMsg::NewLayer(
|
||||
Layer::grid_render_layer_with_path(
|
||||
"/users/tsuki/projects/radar-g/test2.npz",
|
||||
std::path::Path::new("./test2.npz"),
|
||||
"DBZ".to_string(),
|
||||
Npz,
|
||||
BoundaryNorm::default(),
|
||||
@ -83,10 +84,12 @@ impl SimpleComponent for SideBarModel {
|
||||
#[local]
|
||||
bottom_panel -> gtk::Notebook{
|
||||
set_margin_top: 10,
|
||||
set_margin_bottom: 10,
|
||||
set_margin_bottom: 5,
|
||||
},
|
||||
#[local_ref]
|
||||
counter_box -> gtk::Box{}
|
||||
counter_box -> gtk::Box{
|
||||
set_spacing: 5,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -103,7 +106,16 @@ impl SimpleComponent for SideBarModel {
|
||||
let mut list_view_wrapper: TypedListView<LayerItem, gtk::SingleSelection> =
|
||||
TypedListView::with_sorting();
|
||||
|
||||
let bottom_bar_vec = FactoryVecDeque::new(gtk::Box::default(), sender.input_sender());
|
||||
let mut bottom_bar_vec = FactoryVecDeque::new(gtk::Box::default(), sender.input_sender());
|
||||
|
||||
|
||||
{
|
||||
let mut bottom_bar_vec_guard = bottom_bar_vec.guard();
|
||||
bottom_bar_vec_guard.push_back(BottomBarModel::new("add-filled".to_string()));
|
||||
bottom_bar_vec_guard.push_back(BottomBarModel::new("delete-filled".to_string()));
|
||||
bottom_bar_vec_guard.push_back(BottomBarModel::new("chevron-up-filled".to_string()));
|
||||
bottom_bar_vec_guard.push_back(BottomBarModel::new("chevron-down-filled".to_string()));
|
||||
}
|
||||
|
||||
let model = SideBarModel {
|
||||
counter: 0,
|
||||
@ -121,7 +133,7 @@ impl SimpleComponent for SideBarModel {
|
||||
.hexpand(true)
|
||||
.build();
|
||||
|
||||
let counter_box = model.bottom_bar_vec.widgets();
|
||||
let counter_box = model.bottom_bar_vec.widget();
|
||||
|
||||
layer_page.set_child(Some(my_view));
|
||||
layer_page.set_margin_horizontal(5);
|
||||
@ -140,6 +152,8 @@ impl SimpleComponent for SideBarModel {
|
||||
.append(LayerItem::new(layer.name, true));
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ impl Render {
|
||||
renderer.set_screen_target(Some(fbo));
|
||||
let mut canvas = Canvas::new(renderer).expect("Cannot create canvas");
|
||||
canvas
|
||||
.add_font_dir("/Users/tsuki/projects/radar-g/src/assets")
|
||||
.add_font_dir(std::path::Path::new("./src/assets"))
|
||||
.unwrap();
|
||||
|
||||
self.canvas.replace(Some(canvas));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user