first commit
This commit is contained in:
66
src/main.rs
66
src/main.rs
@@ -1,53 +1,33 @@
|
||||
mod graph {
|
||||
use gtk4 as gtk;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::vec::Vec;
|
||||
use gtk::*;
|
||||
use view::*;
|
||||
use gtk::prelude::*;
|
||||
|
||||
pub struct Graph {
|
||||
frame_graph : HashMap<u32, Vec<u32>>,
|
||||
flags_graph : HashSet<(u32, bool)>
|
||||
}
|
||||
#[path="ui_src/components/switch.rs"]
|
||||
mod switch;
|
||||
|
||||
impl Graph {
|
||||
#[path="ui_src/components/wrapper.rs"]
|
||||
mod wrapper;
|
||||
|
||||
pub fn new() -> Graph {
|
||||
Graph{
|
||||
frame_graph : HashMap::new(),
|
||||
flags_graph : HashSet::new(),
|
||||
}
|
||||
}
|
||||
#[path="ui_src/properties.rs"]
|
||||
mod properties;
|
||||
|
||||
pub fn add(&mut self, parent : u32, children : Vec<u32>){
|
||||
#[path="utils/parse_input.rs"]
|
||||
mod parse_input;
|
||||
|
||||
self.frame_graph.insert(parent, children);
|
||||
self.flags_graph.insert((parent, false));
|
||||
for &i in self.frame_graph.get(&parent).unwrap() {
|
||||
self.flags_graph.insert((i, false));
|
||||
}
|
||||
#[path="utils/state_controller.rs"]
|
||||
mod state_controller;
|
||||
|
||||
}
|
||||
mod view;
|
||||
mod model;
|
||||
mod controller;
|
||||
|
||||
pub fn get(&self) -> &Graph {
|
||||
self.clone()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
mod new_class{
|
||||
|
||||
use super::graph;
|
||||
|
||||
}
|
||||
|
||||
|
||||
fn main(){
|
||||
|
||||
use crate::graph::Graph;
|
||||
|
||||
let mut graph : Graph = Graph::new();
|
||||
graph.add(1, vec![2, 3, 4]);
|
||||
graph.add(2, vec![9, 7, 6, 1]);
|
||||
graph.add(6, vec![12, 11, 19]);
|
||||
fn main() {
|
||||
let app = Application::builder()
|
||||
.application_id("com.github.gtk-rs.examples.basic")
|
||||
.build();
|
||||
|
||||
app.connect_activate(ui);
|
||||
app.run();
|
||||
}
|
||||
Reference in New Issue
Block a user