mirror of https://github.com/bobwen-dev/hunter
show ... while loading
This commit is contained in:
parent
3b38143f9b
commit
6c305d3d61
|
@ -144,13 +144,6 @@ impl FileBrowser {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn go_back(&mut self) -> HResult<()> {
|
pub fn go_back(&mut self) -> HResult<()> {
|
||||||
// if self.left_widget().is_err() {
|
|
||||||
// return None;
|
|
||||||
// }
|
|
||||||
// if self.columns.get_main_widget().is_none() {
|
|
||||||
// return None;
|
|
||||||
// }
|
|
||||||
let fileview = self.main_widget()?;
|
|
||||||
let path = self.selected_file()?.grand_parent()?;
|
let path = self.selected_file()?.grand_parent()?;
|
||||||
std::env::set_current_dir(path)?;
|
std::env::set_current_dir(path)?;
|
||||||
self.columns.pop_widget();
|
self.columns.pop_widget();
|
||||||
|
@ -185,7 +178,6 @@ impl FileBrowser {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cwd(&self) -> HResult<File> {
|
pub fn cwd(&self) -> HResult<File> {
|
||||||
//(self.columns.get_main_widget()?.widget()?.content.directory.clone())
|
|
||||||
let widget = self.columns.get_main_widget()?.widget()?;
|
let widget = self.columns.get_main_widget()?.widget()?;
|
||||||
let cwd = (*widget.lock()?).as_ref()?.content.directory.clone();
|
let cwd = (*widget.lock()?).as_ref()?.content.directory.clone();
|
||||||
Ok(cwd)
|
Ok(cwd)
|
||||||
|
|
|
@ -88,14 +88,16 @@ where
|
||||||
if len < 2 {
|
if len < 2 {
|
||||||
return Err(HError::NoWidgetError);
|
return Err(HError::NoWidgetError);
|
||||||
}
|
}
|
||||||
Ok(self.widgets.widgets.get(len - 2)?)
|
let widget = self.widgets.widgets.get(len - 2)?;
|
||||||
|
Ok(widget)
|
||||||
}
|
}
|
||||||
pub fn get_left_widget_mut(&mut self) -> HResult<&mut T> {
|
pub fn get_left_widget_mut(&mut self) -> HResult<&mut T> {
|
||||||
let len = self.widgets.widgets.len();
|
let len = self.widgets.widgets.len();
|
||||||
if len < 2 {
|
if len < 2 {
|
||||||
return Err(HError::NoWidgetError);
|
return Err(HError::NoWidgetError);
|
||||||
}
|
}
|
||||||
Ok(self.widgets.widgets.get_mut(len - 2)?)
|
let widget = self.widgets.widgets.get_mut(len - 2)?;
|
||||||
|
Ok(widget)
|
||||||
}
|
}
|
||||||
pub fn get_main_widget(&self) -> HResult<&T> {
|
pub fn get_main_widget(&self) -> HResult<&T> {
|
||||||
let widget = self.widgets.widgets.last()?;
|
let widget = self.widgets.widgets.last()?;
|
||||||
|
|
|
@ -98,7 +98,6 @@ impl<T: Send + 'static> WillBe<T> where {
|
||||||
-> HResult<()> {
|
-> HResult<()> {
|
||||||
if self.check().is_ok() {
|
if self.check().is_ok() {
|
||||||
fun(self.thing.clone());
|
fun(self.thing.clone());
|
||||||
//*self.on_ready.try_lock()? = None;
|
|
||||||
} else {
|
} else {
|
||||||
*self.on_ready.try_lock()? = Some(fun);
|
*self.on_ready.try_lock()? = Some(fun);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +180,12 @@ impl<T: Widget + Send + 'static> Widget for WillBeWidget<T> {
|
||||||
widget.refresh();
|
widget.refresh();
|
||||||
}
|
}
|
||||||
fn get_drawlist(&self) -> String {
|
fn get_drawlist(&self) -> String {
|
||||||
if self.willbe.check().is_err() { return "".to_string() }
|
if self.willbe.check().is_err() {
|
||||||
|
let clear = self.get_clearlist();
|
||||||
|
let (xpos, ypos) = self.get_coordinates().u16position();
|
||||||
|
let pos = crate::term::goto_xy(xpos, ypos);
|
||||||
|
return clear + &pos + "..."
|
||||||
|
}
|
||||||
let widget = self.widget().unwrap();
|
let widget = self.widget().unwrap();
|
||||||
let widget = widget.try_lock().unwrap();
|
let widget = widget.try_lock().unwrap();
|
||||||
let widget = widget.as_ref().unwrap();
|
let widget = widget.as_ref().unwrap();
|
||||||
|
|
Loading…
Reference in New Issue