file picker + show_open_file_picker
This commit is contained in:
parent
6cdccb72b2
commit
ce36cd914f
13 changed files with 702 additions and 110 deletions
|
@ -1,28 +1,37 @@
|
|||
use zoon::*;
|
||||
|
||||
pub(super) async fn show_window() {
|
||||
tauri_glue::show_window().await
|
||||
tauri_glue::show_window().await.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn load_waveform(test_file_name: &'static str) {
|
||||
tauri_glue::load_waveform(test_file_name).await
|
||||
pub(super) async fn pick_and_load_waveform() -> Option<super::Filename> {
|
||||
tauri_glue::pick_and_load_waveform()
|
||||
.await
|
||||
.unwrap_throw()
|
||||
.as_string()
|
||||
}
|
||||
|
||||
pub(super) async fn get_hierarchy() -> wellen::Hierarchy {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_hierarchy().await).unwrap_throw()
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_hierarchy().await.unwrap_throw()).unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn get_time_table() -> wellen::TimeTable {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await).unwrap_throw()
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await.unwrap_throw()).unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signal {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::load_and_get_signal(signal_ref.index()).await)
|
||||
.unwrap_throw()
|
||||
serde_wasm_bindgen::from_value(
|
||||
tauri_glue::load_and_get_signal(signal_ref.index())
|
||||
.await
|
||||
.unwrap_throw(),
|
||||
)
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||
tauri_glue::unload_signal(signal_ref.index()).await
|
||||
tauri_glue::unload_signal(signal_ref.index())
|
||||
.await
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
mod tauri_glue {
|
||||
|
@ -31,16 +40,22 @@ mod tauri_glue {
|
|||
// Note: Add all corresponding methods to `frontend/typescript/tauri_glue/tauri_glue.ts`
|
||||
#[wasm_bindgen(module = "/typescript/bundles/tauri_glue.js")]
|
||||
extern "C" {
|
||||
pub async fn show_window();
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn show_window() -> Result<(), JsValue>;
|
||||
|
||||
pub async fn load_waveform(test_file_name: &str);
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn pick_and_load_waveform() -> Result<JsValue, JsValue>;
|
||||
|
||||
pub async fn get_hierarchy() -> JsValue;
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn get_hierarchy() -> Result<JsValue, JsValue>;
|
||||
|
||||
pub async fn get_time_table() -> JsValue;
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn get_time_table() -> Result<JsValue, JsValue>;
|
||||
|
||||
pub async fn load_and_get_signal(signal_ref_index: usize) -> JsValue;
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn load_and_get_signal(signal_ref_index: usize) -> Result<JsValue, JsValue>;
|
||||
|
||||
pub async fn unload_signal(signal_ref_index: usize);
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue