Skip to content

Commit

Permalink
Fix sh/check.sh (#1446)
Browse files Browse the repository at this point in the history
* Don't bother serializing date in widget gallery
* Make egui_extras non-optional dependency of egui_demo_lib
  • Loading branch information
emilk authored Apr 3, 2022
1 parent 10f30a0 commit 861b0e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 34 deletions.
10 changes: 5 additions & 5 deletions egui_demo_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extra_debug_asserts = ["egui/extra_debug_asserts"]
extra_asserts = ["egui/extra_asserts"]

datetime = ["egui_extras/chrono", "chrono"]
http = ["egui_extras", "ehttp", "image", "poll-promise"]
http = ["ehttp", "image", "poll-promise"]
persistence = [
"egui/persistence",
"epi/persistence",
Expand All @@ -42,17 +42,17 @@ syntax_highlighting = ["syntect"]
[dependencies]
egui = { version = "0.17.0", path = "../egui", default-features = false }
epi = { version = "0.17.0", path = "../epi" }
egui_extras = { version = "0.17.0", path = "../egui_extras", features = [
"image",
"datepicker",
] }

chrono = { version = "0.4", optional = true, features = ["js-sys", "wasmbind"] }
enum-map = { version = "2", features = ["serde"] }
tracing = "0.1"
unicode_names2 = { version = "0.5.0", default-features = false }

# feature "http":
egui_extras = { version = "0.17.0", path = "../egui_extras", optional = true, features = [
"image",
"datepicker",
] }
ehttp = { version = "0.2.0", optional = true }
image = { version = "0.24", optional = true, default-features = false, features = [
"jpeg",
Expand Down
13 changes: 7 additions & 6 deletions egui_demo_lib/src/apps/demo/widget_gallery.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(feature = "datetime")]
mod serde_date_format;

#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
enum Enum {
Expand All @@ -20,9 +17,11 @@ pub struct WidgetGallery {
string: String,
color: egui::Color32,
animate_progress_bar: bool,

#[cfg(feature = "datetime")]
#[serde(with = "serde_date_format")]
date: chrono::Date<chrono::Utc>,
#[cfg_attr(feature = "serde", serde(skip))]
date: Option<chrono::Date<chrono::Utc>>,

#[cfg_attr(feature = "serde", serde(skip))]
texture: Option<egui::TextureHandle>,
}
Expand All @@ -39,7 +38,7 @@ impl Default for WidgetGallery {
color: egui::Color32::LIGHT_BLUE.linear_multiply(0.5),
animate_progress_bar: false,
#[cfg(feature = "datetime")]
date: chrono::offset::Utc::now().date(),
date: None,
texture: None,
}
}
Expand Down Expand Up @@ -110,6 +109,7 @@ impl WidgetGallery {
string,
color,
animate_progress_bar,
#[cfg(feature = "datetime")]
date,
texture,
} = self;
Expand Down Expand Up @@ -212,6 +212,7 @@ impl WidgetGallery {

#[cfg(feature = "datetime")]
{
let date = date.get_or_insert_with(|| chrono::offset::Utc::now().date());
ui.add(doc_link_label("DatePickerButton", "DatePickerButton"));
ui.add(egui_extras::DatePickerButton::new(date));
ui.end_row();
Expand Down
23 changes: 0 additions & 23 deletions egui_demo_lib/src/apps/demo/widget_gallery/serde_date_format.rs

This file was deleted.

0 comments on commit 861b0e1

Please sign in to comment.