mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-16 18:53:53 +01:00
ui: update to egui 0.31
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use std::time::Duration;
|
||||
use egui::{Align, Id, Layout, Margin, RichText, Rounding, ScrollArea};
|
||||
use egui::{Align, CornerRadius, Id, Layout, Margin, RichText, ScrollArea, StrokeKind};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
|
||||
use crate::AppConfig;
|
||||
@@ -182,10 +182,10 @@ impl WalletsContent {
|
||||
egui::TopBottomPanel::bottom("wallets_bottom_panel")
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING,
|
||||
right: View::far_right_inset_margin(ui) + View::TAB_ITEMS_PADDING,
|
||||
top: View::TAB_ITEMS_PADDING,
|
||||
bottom: View::get_bottom_inset() + View::TAB_ITEMS_PADDING,
|
||||
left: (View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
@@ -226,10 +226,10 @@ impl WalletsContent {
|
||||
.resizable(false)
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + 4.0,
|
||||
right: View::far_right_inset_margin(ui) + 4.0,
|
||||
top: 3.0,
|
||||
bottom: 4.0,
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + 4.0) as i8,
|
||||
top: 3.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
fill: Colors::fill_deep(),
|
||||
..Default::default()
|
||||
@@ -536,12 +536,12 @@ impl WalletsContent {
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(78.0);
|
||||
let rounding = View::item_rounding(0, 1, false);
|
||||
let (bg, stroke) = if current {
|
||||
(Colors::fill_deep(), View::item_stroke())
|
||||
let bg = if current {
|
||||
Colors::fill_deep()
|
||||
} else {
|
||||
(Colors::fill(), View::hover_stroke())
|
||||
Colors::fill()
|
||||
};
|
||||
ui.painter().rect(rect, rounding, bg, stroke);
|
||||
ui.painter().rect(rect, rounding, bg, View::item_stroke(), StrokeKind::Middle);
|
||||
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
if !wallet.is_open() {
|
||||
@@ -551,7 +551,7 @@ impl WalletsContent {
|
||||
});
|
||||
if !wallet.syncing() {
|
||||
let mut show_selection = false;
|
||||
View::item_button(ui, Rounding::default(), GLOBE, None, || {
|
||||
View::item_button(ui, CornerRadius::default(), GLOBE, None, || {
|
||||
self.wallet_content = Some(WalletContent::new(wallet.clone(), None));
|
||||
self.conn_selection_content = Some(
|
||||
WalletConnectionModal::new(wallet.get_current_connection())
|
||||
@@ -577,7 +577,7 @@ impl WalletsContent {
|
||||
// Show button to close opened wallet.
|
||||
if !wallet.is_closing() {
|
||||
View::item_button(ui, if !current {
|
||||
Rounding::default()
|
||||
CornerRadius::default()
|
||||
} else {
|
||||
View::item_rounding(0, 1, true)
|
||||
}, LOCK_KEY, None, || {
|
||||
|
||||
@@ -115,10 +115,10 @@ impl WalletCreation {
|
||||
egui::TopBottomPanel::bottom("wallet_creation_step_panel")
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING,
|
||||
right: View::get_right_inset() + View::TAB_ITEMS_PADDING,
|
||||
top: View::TAB_ITEMS_PADDING,
|
||||
bottom: View::get_bottom_inset() + View::TAB_ITEMS_PADDING,
|
||||
left: (View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::get_right_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
fill: Colors::fill_deep(),
|
||||
..Default::default()
|
||||
@@ -143,10 +143,10 @@ impl WalletCreation {
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + 4.0,
|
||||
right: View::get_right_inset() + 4.0,
|
||||
top: 3.0,
|
||||
bottom: 4.0,
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
top: 3.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Layout, RichText, ScrollArea};
|
||||
use egui::{Align, Layout, RichText, ScrollArea, StrokeKind};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, COMPUTER_TOWER, FOLDER_OPEN, GLOBE_SIMPLE, PLUGS_CONNECTED};
|
||||
@@ -108,7 +108,11 @@ impl WalletsModal {
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(78.0);
|
||||
let rounding = View::item_rounding(0, 1, false);
|
||||
ui.painter().rect(rect, rounding, Colors::fill(), View::hover_stroke());
|
||||
ui.painter().rect(rect,
|
||||
rounding,
|
||||
Colors::fill(),
|
||||
View::hover_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
if self.can_open {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use std::time::Duration;
|
||||
use egui::{Align, Id, Layout, Margin, RichText, ScrollArea};
|
||||
use egui::{Align, Id, Layout, Margin, RichText, ScrollArea, StrokeKind};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use grin_chain::SyncStatus;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
@@ -123,10 +123,10 @@ impl WalletContent {
|
||||
egui::TopBottomPanel::top(Id::from("wallet_account").with(wallet.identifier()))
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + 4.0,
|
||||
right: View::get_right_inset() + 4.0,
|
||||
top: 4.0,
|
||||
bottom: 0.0,
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
top: 4.0 as i8,
|
||||
bottom: 0.0 as i8,
|
||||
},
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
@@ -185,10 +185,10 @@ impl WalletContent {
|
||||
egui::TopBottomPanel::bottom("wallet_tabs")
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING,
|
||||
right: View::get_right_inset() + View::TAB_ITEMS_PADDING,
|
||||
top: View::TAB_ITEMS_PADDING,
|
||||
bottom: View::get_bottom_inset() + View::TAB_ITEMS_PADDING,
|
||||
left: (View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::get_right_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
@@ -214,10 +214,10 @@ impl WalletContent {
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: View::far_left_inset_margin(ui) + 4.0,
|
||||
right: View::get_right_inset() + 4.0,
|
||||
top: 0.0,
|
||||
bottom: 4.0,
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
top: 0.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
@@ -287,7 +287,11 @@ impl WalletContent {
|
||||
rect.set_height(75.0);
|
||||
// Draw round background.
|
||||
let rounding = View::item_rounding(0, 2, false);
|
||||
ui.painter().rect(rect, rounding, Colors::fill_lite(), View::item_stroke());
|
||||
ui.painter().rect(rect,
|
||||
rounding,
|
||||
Colors::fill_lite(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw button to show QR code scanner.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Align, Id, Layout, RichText, ScrollArea};
|
||||
use egui::{Align, Id, Layout, RichText, ScrollArea, StrokeKind};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
|
||||
@@ -187,7 +187,11 @@ fn account_item_ui(ui: &mut egui::Ui,
|
||||
// Draw round background.
|
||||
let bg_rect = rect.clone();
|
||||
let item_rounding = View::item_rounding(index, size, false);
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::fill(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect,
|
||||
item_rounding,
|
||||
Colors::fill(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Align, Layout, RichText};
|
||||
use egui::{Align, Layout, RichText, StrokeKind};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CHECK, CHECK_CIRCLE, CHECK_FAT, DOTS_THREE_CIRCLE, GLOBE, GLOBE_SIMPLE, PLUS_CIRCLE, X_CIRCLE};
|
||||
@@ -190,7 +190,11 @@ impl ConnectionSettings {
|
||||
// Draw round background.
|
||||
let bg_rect = rect.clone();
|
||||
let item_rounding = View::item_rounding(index, len, false);
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::fill(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect,
|
||||
item_rounding,
|
||||
Colors::fill(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Align, Layout, RichText, Rounding};
|
||||
use egui::{Align, CornerRadius, Layout, RichText, StrokeKind};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CHECK_CIRCLE, COPY, DOTS_THREE_CIRCLE, EXPORT, GEAR_SIX, GLOBE_SIMPLE, POWER, QR_CODE, SHIELD_CHECKERED, SHIELD_SLASH, WARNING_CIRCLE, X_CIRCLE};
|
||||
@@ -148,7 +148,11 @@ impl WalletTransport {
|
||||
// Draw round background.
|
||||
let bg_rect = rect.clone();
|
||||
let item_rounding = View::item_rounding(0, 2, false);
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::fill_lite(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect,
|
||||
item_rounding,
|
||||
Colors::fill_lite(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
@@ -168,14 +172,14 @@ impl WalletTransport {
|
||||
let service_id = &wallet.identifier();
|
||||
if !Tor::is_service_starting(service_id) && wallet.foreign_api_port().is_some() {
|
||||
if !Tor::is_service_running(service_id) {
|
||||
View::item_button(ui, Rounding::default(), POWER, Some(Colors::green()), || {
|
||||
View::item_button(ui, CornerRadius::default(), POWER, Some(Colors::green()), || {
|
||||
if let Ok(key) = wallet.secret_key() {
|
||||
let api_port = wallet.foreign_api_port().unwrap();
|
||||
Tor::start_service(api_port, key, service_id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
View::item_button(ui, Rounding::default(), POWER, Some(Colors::red()), || {
|
||||
View::item_button(ui, CornerRadius::default(), POWER, Some(Colors::red()), || {
|
||||
Tor::stop_service(service_id);
|
||||
});
|
||||
}
|
||||
@@ -254,7 +258,11 @@ impl WalletTransport {
|
||||
} else {
|
||||
View::item_rounding(1, 2, false)
|
||||
};
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::fill_lite(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect,
|
||||
item_rounding,
|
||||
Colors::fill_lite(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
@@ -274,7 +282,7 @@ impl WalletTransport {
|
||||
});
|
||||
|
||||
// Show button to enable/disable Tor listener for current wallet.
|
||||
View::item_button(ui, Rounding::default(), COPY, None, || {
|
||||
View::item_button(ui, CornerRadius::default(), COPY, None, || {
|
||||
cb.copy_string_to_buffer(addr.clone());
|
||||
});
|
||||
|
||||
@@ -338,7 +346,11 @@ impl WalletTransport {
|
||||
// Draw round background.
|
||||
let bg_rect = rect.clone();
|
||||
let item_rounding = View::item_rounding(1, 2, false);
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::fill(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect,
|
||||
item_rounding,
|
||||
Colors::fill(),
|
||||
View::item_stroke(),
|
||||
StrokeKind::Middle);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::top_down(Align::Center), |ui| {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
use std::ops::Range;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use egui::{Align, Id, Layout, Rect, RichText, Rounding, ScrollArea};
|
||||
use egui::{Align, Id, Layout, Rect, RichText, CornerRadius, ScrollArea, StrokeKind};
|
||||
use egui::epaint::RectShape;
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use grin_core::consensus::COINBASE_MATURITY;
|
||||
@@ -155,15 +155,15 @@ impl WalletTransactions {
|
||||
// Draw tx item background.
|
||||
let mut r = View::item_rounding(index, txs.len(), false);
|
||||
let p = ui.painter();
|
||||
p.rect(rect, r, Colors::fill_lite(), View::item_stroke());
|
||||
p.rect(rect, r, Colors::fill_lite(), View::item_stroke(), StrokeKind::Middle);
|
||||
|
||||
let tx = txs.get(index).unwrap();
|
||||
let data = wallet.get_data().unwrap();
|
||||
Self::tx_item_ui(ui, tx, rect, &data, |ui| {
|
||||
// Draw button to show transaction info.
|
||||
if tx.data.tx_slate_id.is_some() {
|
||||
r.nw = 0.0;
|
||||
r.sw = 0.0;
|
||||
r.nw = 0.0 as u8;
|
||||
r.sw = 0.0 as u8;
|
||||
View::item_button(ui, r, FILE_TEXT, None, || {
|
||||
self.show_tx_info_modal(wallet, tx, false);
|
||||
});
|
||||
@@ -174,7 +174,7 @@ impl WalletTransactions {
|
||||
// Draw button to show transaction finalization.
|
||||
if wallet_loaded && tx.can_finalize {
|
||||
let (icon, color) = (CHECK, Some(Colors::green()));
|
||||
View::item_button(ui, Rounding::default(), icon, color, || {
|
||||
View::item_button(ui, CornerRadius::default(), icon, color, || {
|
||||
self.show_tx_info_modal(wallet, tx, true);
|
||||
});
|
||||
}
|
||||
@@ -182,7 +182,7 @@ impl WalletTransactions {
|
||||
// Draw button to cancel transaction.
|
||||
if wallet_loaded && tx.can_cancel() {
|
||||
let (icon, color) = (PROHIBIT, Some(Colors::red()));
|
||||
View::item_button(ui, Rounding::default(), icon, color, || {
|
||||
View::item_button(ui, CornerRadius::default(), icon, color, || {
|
||||
self.confirm_cancel_tx_id = Some(tx.data.id);
|
||||
// Show transaction cancellation confirmation modal.
|
||||
Modal::new(CANCEL_TX_CONFIRMATION_MODAL)
|
||||
@@ -205,13 +205,13 @@ impl WalletTransactions {
|
||||
}
|
||||
let rect = ui.available_rect_before_wrap();
|
||||
// Draw background.
|
||||
let mut bg = RectShape::new(rect, Rounding {
|
||||
nw: 0.0,
|
||||
ne: 0.0,
|
||||
sw: 8.0,
|
||||
se: 8.0,
|
||||
}, Colors::TRANSPARENT, View::item_stroke());
|
||||
let bg_idx = ui.painter().add(bg);
|
||||
let mut bg = RectShape::new(rect, CornerRadius {
|
||||
nw: 0.0 as u8,
|
||||
ne: 0.0 as u8,
|
||||
sw: 8.0 as u8,
|
||||
se: 8.0 as u8,
|
||||
}, Colors::TRANSPARENT, View::item_stroke(), StrokeKind::Middle);
|
||||
let bg_idx = ui.painter().add(bg.clone());
|
||||
let resp = ui.allocate_ui(rect.size(), |ui| {
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
// Correct vertical spacing between items.
|
||||
|
||||
@@ -16,7 +16,7 @@ use std::thread;
|
||||
use std::sync::Arc;
|
||||
use parking_lot::RwLock;
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Id, Layout, RichText, Rounding, ScrollArea};
|
||||
use egui::{Align, Id, Layout, RichText, CornerRadius, ScrollArea, StrokeKind};
|
||||
use grin_util::ToHex;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
use grin_wallet_libwallet::{Error, Slate, SlateState, TxLogEntryType};
|
||||
@@ -230,7 +230,7 @@ impl WalletTransactionModal {
|
||||
// Draw tx item background.
|
||||
let p = ui.painter();
|
||||
let r = View::item_rounding(0, 2, false);
|
||||
p.rect(rect, r, Colors::TRANSPARENT, View::item_stroke());
|
||||
p.rect(rect, r, Colors::TRANSPARENT, View::item_stroke(), StrokeKind::Middle);
|
||||
|
||||
// Show transaction amount status and time.
|
||||
let data = wallet.get_data().unwrap();
|
||||
@@ -274,7 +274,7 @@ impl WalletTransactionModal {
|
||||
// Draw button to cancel transaction.
|
||||
if wallet_loaded && tx.can_cancel() {
|
||||
let r = if tx.can_finalize {
|
||||
Rounding::default()
|
||||
CornerRadius::default()
|
||||
} else {
|
||||
View::item_rounding(0, 2, true)
|
||||
};
|
||||
@@ -555,13 +555,13 @@ fn info_item_ui(ui: &mut egui::Ui,
|
||||
let bg_rect = rect.clone();
|
||||
let mut rounding = View::item_rounding(1, 3, false);
|
||||
|
||||
ui.painter().rect(bg_rect, rounding, Colors::fill(), View::item_stroke());
|
||||
ui.painter().rect(bg_rect, rounding, Colors::fill(), View::item_stroke(), StrokeKind::Middle);
|
||||
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw button to copy transaction info value.
|
||||
if copy {
|
||||
rounding.nw = 0.0;
|
||||
rounding.sw = 0.0;
|
||||
rounding.nw = 0.0 as u8;
|
||||
rounding.sw = 0.0 as u8;
|
||||
View::item_button(ui, rounding, COPY, None, || {
|
||||
cb.copy_string_to_buffer(value.clone());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user