initial commit

This commit is contained in:
antifallobst 2023-06-14 23:49:20 +02:00
commit ff8a6e66eb
5 changed files with 2976 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# IDE stuff
.idea
# Rust stuff
target/

2902
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

11
Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "trinitrix"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tui = "0.19"
crossterm = "0.25"
matrix-sdk = "0.6"

10
src/main.rs Normal file
View File

@ -0,0 +1,10 @@
mod ui;
use std::io;
use ui::ui_create;
fn main() -> Result<(), io::Error> {
ui_create();
Ok(())
}

48
src/ui/mod.rs Normal file
View File

@ -0,0 +1,48 @@
use crate::ui;
use crossterm::event::KeyCode::Null;
use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use std::io::Stdout;
use std::{io, thread, time::Duration};
use tui::{
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout},
widgets::{Block, Borders, Widget},
Terminal,
};
pub struct UI {
backend: CrosstermBackend<Stdout>,
terminal: Terminal<CrosstermBackend<Stdout>>,
}
pub fn ui_create() -> Result<(), io::Error> {
// setup terminal
enable_raw_mode()?;
let mut stdout = io::stdout();
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
let backend = CrosstermBackend::new(stdout);
let mut terminal = Terminal::new(backend)?;
terminal.draw(|f| {
let size = f.size();
let block = Block::default().title("Layout design in work...").borders(Borders::ALL);
f.render_widget(block, size);
})?;
thread::sleep(Duration::from_millis(5000));
// restore terminal
disable_raw_mode()?;
execute!(
terminal.backend_mut(),
LeaveAlternateScreen,
DisableMouseCapture
)?;
terminal.show_cursor()?;
Ok(())
}