mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Work on interface
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
use egui::{Color32, TextEdit};
|
use egui::{Color32, TextEdit};
|
||||||
use unshell_lib::config::{InterfaceData, InterfaceStruct, config_struct};
|
use unshell_lib::config::{ConfigStructField, InterfaceData, InterfaceStruct, config_struct};
|
||||||
|
|
||||||
|
struct ConfigInterface(Config)
|
||||||
|
|
||||||
pub fn render(
|
pub fn render(
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
@@ -20,16 +22,16 @@ fn render_config_struct(
|
|||||||
) {
|
) {
|
||||||
for (interface, data) in interface.iter().zip(data) {
|
for (interface, data) in interface.iter().zip(data) {
|
||||||
match (interface, data) {
|
match (interface, data) {
|
||||||
(config_struct::ConfigStructField::Header(text), serde_json::Value::Null) => {
|
(ConfigStructField::Header(text), serde_json::Value::Null) => {
|
||||||
ui.heading(text);
|
ui.heading(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
(config_struct::ConfigStructField::Text(text), serde_json::Value::Null) => {
|
(ConfigStructField::Text(text), serde_json::Value::Null) => {
|
||||||
ui.label(text);
|
ui.label(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
config_struct::ConfigStructField::String {
|
ConfigStructField::String {
|
||||||
default: _,
|
default: _,
|
||||||
max_length,
|
max_length,
|
||||||
protected,
|
protected,
|
||||||
@@ -63,7 +65,7 @@ fn render_config_struct(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
config_struct::ConfigStructField::Integer { default, min, max },
|
ConfigStructField::Integer { default, min, max },
|
||||||
serde_json::Value::Number(number),
|
serde_json::Value::Number(number),
|
||||||
) => todo!(),
|
) => todo!(),
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ impl Config {
|
|||||||
Ok(TreeMessage::Success)
|
Ok(TreeMessage::Success)
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeMessage::RequestStruct => Ok(TreeMessage::Interface(
|
// TreeMessage::RequestStruct => Ok(TreeMessage::Interface(
|
||||||
InterfaceStruct::ConfigStruct(self.keys.clone()),
|
// InterfaceStruct::ConfigStruct(self.keys.clone()),
|
||||||
)),
|
// )),
|
||||||
TreeMessage::RequestState => Ok(TreeMessage::State(InterfaceData::ConfigStruct(
|
TreeMessage::RequestState => Ok(TreeMessage::State(InterfaceData::ConfigStruct(
|
||||||
self.values.clone(),
|
self.values.clone(),
|
||||||
))),
|
))),
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ pub enum TreeMessage {
|
|||||||
RequestStructAndValue,
|
RequestStructAndValue,
|
||||||
|
|
||||||
State(InterfaceData),
|
State(InterfaceData),
|
||||||
Interface(InterfaceStruct),
|
// Interface(InterfaceStruct),
|
||||||
InterfaceAndValue(InterfaceStruct, InterfaceData),
|
InterfaceAndValue(InterfaceStruct, InterfaceData),
|
||||||
|
|
||||||
Success,
|
Success,
|
||||||
|
|||||||
Reference in New Issue
Block a user