mirror of
https://github.com/veeso/termscp.git
synced 2026-04-05 09:41:53 -07:00
fix: tuirealm 2.x (#299)
This commit is contained in:
committed by
GitHub
parent
4e63093d25
commit
7eb913ec7b
@@ -6,7 +6,7 @@
|
||||
// Locals
|
||||
use std::env;
|
||||
|
||||
use tuirealm::tui::style::Color;
|
||||
use tuirealm::ratatui::style::Color;
|
||||
use tuirealm::{State, StateValue};
|
||||
|
||||
use super::{Id, IdSsh, IdTheme, SetupActivity, ViewLayout};
|
||||
|
||||
@@ -19,7 +19,7 @@ use tuirealm::listener::EventListenerCfg;
|
||||
use tuirealm::props::Color;
|
||||
use tuirealm::{Application, NoUserEvent, Update};
|
||||
|
||||
use super::{Activity, Context, ExitReason};
|
||||
use super::{Activity, Context, ExitReason, CROSSTERM_MAX_POLL};
|
||||
use crate::config::themes::Theme;
|
||||
use crate::system::config_client::ConfigClient;
|
||||
use crate::system::theme_provider::ThemeProvider;
|
||||
@@ -262,7 +262,7 @@ impl SetupActivity {
|
||||
Self {
|
||||
app: Application::init(
|
||||
EventListenerCfg::default()
|
||||
.default_input_listener(ticks)
|
||||
.crossterm_input_listener(ticks, CROSSTERM_MAX_POLL)
|
||||
.poll_timeout(ticks),
|
||||
),
|
||||
exit_reason: None,
|
||||
|
||||
@@ -8,7 +8,7 @@ pub mod ssh_keys;
|
||||
pub mod theme;
|
||||
|
||||
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
|
||||
use tuirealm::tui::widgets::Clear;
|
||||
use tuirealm::ratatui::widgets::Clear;
|
||||
use tuirealm::{Frame, Sub, SubClause, SubEventClause};
|
||||
|
||||
use super::*;
|
||||
@@ -112,23 +112,23 @@ impl SetupActivity {
|
||||
|
||||
pub(super) fn view_popups(&mut self, f: &mut Frame) {
|
||||
if self.app.mounted(&Id::Common(IdCommon::ErrorPopup)) {
|
||||
let popup = Popup(Size::Percentage(50), Size::Unit(3)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(50), Size::Unit(3)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
// make popup
|
||||
self.app.view(&Id::Common(IdCommon::ErrorPopup), f, popup);
|
||||
} else if self.app.mounted(&Id::Common(IdCommon::QuitPopup)) {
|
||||
// make popup
|
||||
let popup = Popup(Size::Percentage(40), Size::Unit(3)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(40), Size::Unit(3)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
self.app.view(&Id::Common(IdCommon::QuitPopup), f, popup);
|
||||
} else if self.app.mounted(&Id::Common(IdCommon::Keybindings)) {
|
||||
// make popup
|
||||
let popup = Popup(Size::Percentage(50), Size::Percentage(70)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(50), Size::Percentage(70)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
self.app.view(&Id::Common(IdCommon::Keybindings), f, popup);
|
||||
} else if self.app.mounted(&Id::Common(IdCommon::SavePopup)) {
|
||||
// make popup
|
||||
let popup = Popup(Size::Percentage(30), Size::Unit(3)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(30), Size::Unit(3)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
self.app.view(&Id::Common(IdCommon::SavePopup), f, popup);
|
||||
}
|
||||
@@ -235,33 +235,13 @@ impl SetupActivity {
|
||||
|
||||
/// Returns a sub clause which requires that no popup is mounted in order to be satisfied
|
||||
fn no_popup_mounted_clause() -> SubClause<Id> {
|
||||
SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Common(
|
||||
IdCommon::ErrorPopup,
|
||||
))))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Common(
|
||||
IdCommon::Keybindings,
|
||||
))))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Common(
|
||||
IdCommon::QuitPopup,
|
||||
))))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Common(
|
||||
IdCommon::SavePopup,
|
||||
))))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Ssh(
|
||||
IdSsh::DelSshKeyPopup,
|
||||
))))),
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(Id::Ssh(
|
||||
IdSsh::SshHost,
|
||||
))))),
|
||||
)),
|
||||
)),
|
||||
)),
|
||||
)),
|
||||
tuirealm::subclause_and_not!(
|
||||
Id::Common(IdCommon::ErrorPopup),
|
||||
Id::Common(IdCommon::Keybindings),
|
||||
Id::Common(IdCommon::QuitPopup),
|
||||
Id::Common(IdCommon::SavePopup),
|
||||
Id::Ssh(IdSsh::DelSshKeyPopup),
|
||||
Id::Ssh(IdSsh::SshHost)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Ext
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tuirealm::tui::layout::{Constraint, Direction, Layout};
|
||||
use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
|
||||
use tuirealm::{State, StateValue};
|
||||
|
||||
use super::{
|
||||
@@ -50,7 +50,7 @@ impl SetupActivity {
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
.split(f.size());
|
||||
.split(f.area());
|
||||
// Render common widget
|
||||
self.app.view(&Id::Common(IdCommon::Header), f, chunks[0]);
|
||||
self.app.view(&Id::Common(IdCommon::Footer), f, chunks[2]);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
// Locals
|
||||
// Ext
|
||||
use tuirealm::tui::layout::{Constraint, Direction, Layout};
|
||||
use tuirealm::tui::widgets::Clear;
|
||||
use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
|
||||
use tuirealm::ratatui::widgets::Clear;
|
||||
|
||||
use super::{components, Context, Id, IdCommon, IdSsh, SetupActivity, ViewLayout};
|
||||
use crate::utils::ui::{Popup, Size};
|
||||
@@ -37,7 +37,7 @@ impl SetupActivity {
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
.split(f.size());
|
||||
.split(f.area());
|
||||
// Render common widget
|
||||
self.app.view(&Id::Common(IdCommon::Header), f, chunks[0]);
|
||||
self.app.view(&Id::Common(IdCommon::Footer), f, chunks[2]);
|
||||
@@ -45,11 +45,11 @@ impl SetupActivity {
|
||||
// Popups
|
||||
self.view_popups(f);
|
||||
if self.app.mounted(&Id::Ssh(IdSsh::DelSshKeyPopup)) {
|
||||
let popup = Popup(Size::Percentage(30), Size::Unit(3)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(30), Size::Unit(3)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
self.app.view(&Id::Ssh(IdSsh::DelSshKeyPopup), f, popup);
|
||||
} else if self.app.mounted(&Id::Ssh(IdSsh::SshHost)) {
|
||||
let popup = Popup(Size::Percentage(50), Size::Percentage(20)).draw_in(f.size());
|
||||
let popup = Popup(Size::Percentage(50), Size::Percentage(20)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
let popup_chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// Locals
|
||||
// Ext
|
||||
use tuirealm::tui::layout::{Constraint, Direction, Layout};
|
||||
use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
|
||||
|
||||
use super::{components, Context, Id, IdCommon, IdTheme, SetupActivity, Theme, ViewLayout};
|
||||
|
||||
@@ -39,7 +39,7 @@ impl SetupActivity {
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
.split(f.size());
|
||||
.split(f.area());
|
||||
// Render common widget
|
||||
self.app.view(&Id::Common(IdCommon::Header), f, chunks[0]);
|
||||
self.app.view(&Id::Common(IdCommon::Footer), f, chunks[2]);
|
||||
|
||||
Reference in New Issue
Block a user