Skip to content

Commit

Permalink
WIP - minimize the usage of #[cfg(feature = "micropython")] outside t…
Browse files Browse the repository at this point in the history
…ranslations module
  • Loading branch information
grdddj committed Oct 3, 2023
1 parent f3e852d commit a17f5e3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
1 change: 0 additions & 1 deletion core/embed/rust/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub mod event;
pub mod geometry;
pub mod lerp;
pub mod screens;
#[cfg(feature = "micropython")]
pub mod translations;
#[macro_use]
pub mod util;
Expand Down
12 changes: 0 additions & 12 deletions core/embed/rust/src/ui/model_tr/component/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// NOTE: things needing micropython do so mostly because of translations
// (we cannot have them inside bootloader)

mod button;
mod button_controller;
mod common;
Expand Down Expand Up @@ -28,52 +25,43 @@ pub use loader::{Loader, LoaderMsg, LoaderStyle, LoaderStyleSheet};
pub use result::ResultScreen;
pub use welcome_screen::WelcomeScreen;

#[cfg(feature = "micropython")]
mod address_details;
mod changing_text;
#[cfg(feature = "micropython")]
mod coinjoin_progress;
mod flow;
mod flow_pages;
mod frame;
#[cfg(feature = "micropython")]
mod homescreen;
#[cfg(feature = "micropython")]
mod page;
mod progress;
mod result_anim;
mod result_popup;
mod scrollbar;
#[cfg(feature = "micropython")]
mod share_words;
mod show_more;
mod title;

#[cfg(feature = "micropython")]
pub use address_details::AddressDetails;

pub use changing_text::ChangingTextLine;
#[cfg(feature = "micropython")]
pub use coinjoin_progress::CoinJoinProgress;
pub use flow::Flow;
pub use flow_pages::{FlowPages, Page};
pub use frame::{Frame, ScrollableContent, ScrollableFrame};
#[cfg(feature = "micropython")]
pub use homescreen::{ConfirmHomescreen, Homescreen, Lockscreen};
#[cfg(feature = "micropython")]
pub use input_methods::{
number_input::NumberInput,
passphrase::PassphraseEntry,
pin::PinEntry,
simple_choice::SimpleChoice,
wordlist::{WordlistEntry, WordlistType},
};
#[cfg(feature = "micropython")]
pub use page::ButtonPage;
pub use progress::Progress;
pub use result_anim::{ResultAnim, ResultAnimMsg};
pub use result_popup::{ResultPopup, ResultPopupMsg};
pub use scrollbar::ScrollBar;
#[cfg(feature = "micropython")]
pub use share_words::ShareWords;
pub use show_more::{CancelInfoConfirmMsg, ShowMore};
13 changes: 0 additions & 13 deletions core/embed/rust/src/ui/model_tt/component/mod.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,36 @@
// NOTE: things needing micropython do so mostly because of translations
// (we cannot have them inside bootloader)

#[cfg(feature = "micropython")]
mod address_details;
mod button;
#[cfg(feature = "micropython")]
mod coinjoin_progress;
mod dialog;
mod fido;
#[rustfmt::skip]
mod fido_icons;
mod error;
mod frame;
#[cfg(feature = "micropython")]
mod hold_to_confirm;
#[cfg(feature = "dma2d")]
mod homescreen;
mod horizontal_page;
mod keyboard;
mod loader;
#[cfg(feature = "micropython")]
mod number_input;
#[cfg(feature = "micropython")]
mod page;
mod progress;
mod result;
mod scroll;
mod swipe;
mod welcome_screen;

#[cfg(feature = "micropython")]
pub use address_details::AddressDetails;
pub use button::{
Button, ButtonContent, ButtonMsg, ButtonStyle, ButtonStyleSheet, CancelConfirmMsg,
CancelInfoConfirmMsg, IconText, SelectWordMsg,
};
#[cfg(feature = "micropython")]
pub use coinjoin_progress::CoinJoinProgress;
pub use dialog::{Dialog, DialogMsg, IconDialog};
pub use error::ErrorScreen;
pub use fido::{FidoConfirm, FidoMsg};
pub use frame::{Frame, FrameMsg};
#[cfg(feature = "micropython")]
pub use hold_to_confirm::{HoldToConfirm, HoldToConfirmMsg};
#[cfg(feature = "dma2d")]
pub use homescreen::{Homescreen, HomescreenMsg, Lockscreen};
Expand All @@ -55,9 +44,7 @@ pub use keyboard::{
word_count::{SelectWordCount, SelectWordCountMsg},
};
pub use loader::{Loader, LoaderMsg, LoaderStyle, LoaderStyleSheet};
#[cfg(feature = "micropython")]
pub use number_input::{NumberInputDialog, NumberInputDialogMsg};
#[cfg(feature = "micropython")]
pub use page::{SwipeHoldPage, SwipePage};
pub use progress::Progress;
pub use result::{ResultFooter, ResultScreen, ResultStyle};
Expand Down
11 changes: 6 additions & 5 deletions core/embed/rust/src/ui/translations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod en;
#[cfg(feature = "micropython")]
mod export;
mod general;

pub use en::EN_TRANSLATIONS;
use en::EN_TRANSLATIONS;

use crate::{
micropython::{buffer::StrBuffer, obj::Obj, util},
trezorhal::storage::translations_get,
};
#[cfg(feature = "micropython")]
use crate::micropython::{buffer::StrBuffer, obj::Obj, util};
use crate::trezorhal::storage::translations_get;

use core::str;

Expand All @@ -16,6 +16,7 @@ const DELIMITER_BYTE: u8 = b'*';
const TERMINATE_BYTE: u8 = 0xFF;

/// Translation function callable from micropython.
#[cfg(feature = "micropython")]
pub extern "C" fn translate_obj(key: Obj) -> Obj {
let block = || {
let str_key: StrBuffer = key.try_into()?;
Expand Down

0 comments on commit a17f5e3

Please sign in to comment.