Skip to content

Commit

Permalink
Moved widgets into core so the styles can implement the Theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
flomang committed Nov 26, 2022
1 parent 1adff24 commit 91b1570
Show file tree
Hide file tree
Showing 25 changed files with 1,236 additions and 387 deletions.
15 changes: 1 addition & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ edition = "2021"

[features]
default = ["opengl"]
wgpu = ["grin-gui-widgets/wgpu", "iced/wgpu", "iced/default_system_font"]
opengl = ["grin-gui-widgets/opengl", "iced/glow"]
wgpu = [ "iced/wgpu", "iced/default_system_font"]
opengl = [ "iced/glow"]
no-self-update = ["grin-gui-core/no-self-update"]
debug = ["iced/debug"]

[dependencies]
grin-gui-core = { version = "0.1.0", path = "crates/core", features=['gui'] }
grin-gui-widgets = { version = "0.1.0", path = "crates/widgets" }
#grin-gui-widgets = { version = "0.1.0", path = "crates/widgets" }


iced = { version = "0.5.2", default-features = false }
Expand Down Expand Up @@ -61,5 +61,4 @@ embed-resource = "1.3.3"
members = [
".",
"crates/core",
"crates/widgets"
]
15 changes: 10 additions & 5 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gui = ['iced_native']
no-self-update = []

[build-dependencies]
built = { version = "0.4", features = ["git2"]}
built = { version = "0.4", features = ["git2"] }

[dependencies]

Expand All @@ -36,7 +36,6 @@ grin_wallet_controller = { git = "https://github.com/mimblewimble/grin-wallet",
grin_wallet_api = { git = "https://github.com/mimblewimble/grin-wallet", branch = "master" }
grin_wallet_impls = { git = "https://github.com/mimblewimble/grin-wallet", branch = "master" }
grin_wallet_libwallet = { git = "https://github.com/mimblewimble/grin-wallet", branch = "master" }
grin-gui-widgets = {path = "../widgets"}


############ Local testing ################
Expand All @@ -61,7 +60,7 @@ regex = "1.4.3"
fancy-regex = "0.5.0" # Regex with backtracking
async-std = { version = "1.9.0", features = ["unstable"] }
dirs-next = "2.0.0"
serde = { version = "1.0.123", features=['derive'] }
serde = { version = "1.0.123", features = ['derive'] }
serde_yaml = "0.8.17"
serde_json = "1.0.62"
serde_urlencoded = "0.7"
Expand All @@ -81,16 +80,22 @@ num_cpus = "1.13.0"
dirs = "2.0"
futures = "0.3"
parking_lot = "0.10"
log4rs = { version = "0.12", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }
log4rs = { version = "0.12", features = [
"rolling_file_appender",
"compound_policy",
"size_trigger",
"fixed_window_roller",
] }
backtrace = "0.3"
lazy_static = "1"

iced = { version = "0.5.2", default-features = false }
iced_futures = { version = "0.5.1", features = ["async-std"] }
iced_core = { version = "0.6.1" }
iced_style = "0.5.0"
iced_graphics = { version = "0.4.0" }
iced_native = { version = "0.6.1", optional = true }
iced_aw = { git = "https://github.com/iced-rs/iced_aw"}
iced_aw = { git = "https://github.com/iced-rs/iced_aw" }

[dev-dependencies]
tempfile = "3.2.0"
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod error;
pub mod fs;
pub mod theme;
pub mod network;
pub mod widgets;
#[cfg(feature = "gui")]
pub mod utility;

Expand Down
13 changes: 4 additions & 9 deletions crates/core/src/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ use crate::fs;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;

pub mod application;
pub mod button;
pub mod card;
pub mod checkbox;
pub mod container;
pub mod header;
pub mod modal;
pub mod picklist;
pub mod scrollable;
pub mod table_row;
pub mod text_input;
pub mod application;
pub mod text;
pub mod text_input;

pub use button::ButtonStyle;
pub use card::CardStyle;
Expand Down Expand Up @@ -48,10 +46,8 @@ pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Rendere
pub type PickList<'a, T, Message> = iced::widget::PickList<'a, T, Message, Renderer>;
pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Renderer>;
pub type Modal<'a, Content, Message> = iced_aw::modal::Modal<'a, Content, Message, Renderer, Theme>;
pub type Header<'a, Message> =
grin_gui_widgets::widget::header::Header<'a, Message, Renderer, Theme>;
pub type TableRow<'a, Message> =
grin_gui_widgets::widget::table_row::TableRow<'a, Message, Renderer, Theme>;
pub type Header<'a, Message> = crate::widgets::widget::header::Header<'a, Message, Renderer>;
pub type TableRow<'a, Message> = crate::widgets::widget::table_row::TableRow<'a, Message, Renderer>;

#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)]
pub struct BaseColors {
Expand Down Expand Up @@ -474,7 +470,6 @@ impl Theme {
}
}


fn hex_to_color(hex: &str) -> Option<iced_native::Color> {
if hex.len() == 7 {
let hash = &hex[0..1];
Expand Down
Loading

0 comments on commit 91b1570

Please sign in to comment.