callbacks/policycheck_state: convert to new API (orbtk v0.3.1-alpha4)
Before
* let text = *button(&mut ctx.widget()).text();
* let text = Button::get(&mut ctx.widget()).text();
* let text = *button(&mut ctx.widget()).clone_text();
* let text = Button::get(&mut ctx.widget()).clone_text();
* button(&mut ctx.widget()).text_mut().push_str("test");
* Button::get(&mut ctx.widget()).text_mut().push_str("test");
* button(&mut ctx.widget()).set_text(String16::from("test"));
* Button::get(&mut ctx.widget()).set_text(String16::from("test"));
Now
* let text = Button::text_clone(&ctx.widget());
* Button::text_mut(&mut ctx.widget()).push_str("test");
* Button::text_set(&mut ctx.widget(), String16::from("test"));
* ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -20,13 +20,11 @@ use std::collections::HashMap;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use tracing::{debug, error, info, trace};
|
||||
|
||||
use crate::services::imports::allianzdirectcall::import;
|
||||
//use crate::callbacks::policy_check::is_valid;
|
||||
|
||||
use crate::{
|
||||
callbacks::global_state::GlobalState,
|
||||
data::structures::{PolicyCode, PolicyDataList, PolicyList},
|
||||
data::constants::*,
|
||||
services::imports::allianzdirectcall::import,
|
||||
};
|
||||
|
||||
/// Actions that can execute on the task view.
|
||||
@@ -69,11 +67,11 @@ pub struct PolicyCheckState {
|
||||
last_focused: Option<Entity>,
|
||||
button_menu: Entity,
|
||||
menu: Entity,
|
||||
popup_progress: Entity,
|
||||
policy_data_count: u64,
|
||||
policy_numbers: HashMap<u64, PolicyCode>,
|
||||
progress_bar: Entity,
|
||||
progress_count: f64,
|
||||
progress_popup: Entity,
|
||||
theme_name: String
|
||||
}
|
||||
|
||||
@@ -134,9 +132,8 @@ impl PolicyCheckState {
|
||||
}
|
||||
|
||||
/// Clear text in text box.
|
||||
pub fn clear_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) {
|
||||
let mut text_box = TextBox::get(ctx.get_widget(text_box));
|
||||
let _text = text_box.text_mut();
|
||||
pub fn clear_entry(&mut self, _text_box: Entity, ctx: &mut Context<'_>) {
|
||||
TextBox::text_set(&mut ctx.widget(), String::from(""));
|
||||
}
|
||||
|
||||
/// Get the active language environment.
|
||||
@@ -160,8 +157,7 @@ impl PolicyCheckState {
|
||||
-> Result<(), Box<dyn std::error::Error>> {
|
||||
// WIP: for now, only import once per session
|
||||
if self.policy_data_count == 0 {
|
||||
let mut text_block_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
text_block_wrapper.set_enabled(true);
|
||||
TextBlock::enabled_set(&mut ctx.child("policy_check_result"), true);
|
||||
|
||||
if self.policy_numbers.len() == 0 {
|
||||
// initialize popup widget
|
||||
@@ -220,7 +216,8 @@ impl PolicyCheckState {
|
||||
ctx: &mut Context<'_>) {
|
||||
trace!(target: "advotracker", parse_entry = "started");
|
||||
|
||||
let policy_number_string = ctx.get_widget(policy_check_policy_number).get::<String16>("text").as_string();
|
||||
//let policy_number_string = ctx.get_widget(policy_check_policy_number).get::<String16>("text").as_string();
|
||||
let policy_number_string = TextBox::text_clone(&mut ctx.get_widget(policy_check_policy_number));
|
||||
let policy_number_length = policy_number_string.len();
|
||||
|
||||
// // WIP: redundant lang selection (already in main!)
|
||||
@@ -245,80 +242,78 @@ impl PolicyCheckState {
|
||||
// Parse policy code: "AS-123456789"
|
||||
// DION VERS POLLFNR
|
||||
// 1 AS 1515735810
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Collapsed);
|
||||
button(ctx.child("policy_check_button_result")).set_visibility(Visibility::Collapsed);
|
||||
button(ctx.child("policy_check_button_result")).set_background("transparent");
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Collapsed);
|
||||
Button::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Visible);
|
||||
Button::background_set(&mut ctx.child("policy_check_button_result"), String::from("transparent"));
|
||||
|
||||
if policy_number_length == 10 {
|
||||
// cast policy_number_sting to <u64>
|
||||
match policy_number_string.parse::<u64>() {
|
||||
Ok(p) => {
|
||||
let mut result_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
result_wrapper.set_text("");
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(""));
|
||||
|
||||
// match hashmap's key
|
||||
match self.policy_numbers.get(&p) {
|
||||
Some(policy_code) => {
|
||||
// matching key, get associated value
|
||||
trace!(target: "advotracker", state = "success",
|
||||
policy_number = ?p, policy_code = ?policy_code);
|
||||
result_wrapper.set_enabled(true);
|
||||
let string_result = format!("1-{:?}-{}",
|
||||
policy_code, p);
|
||||
result_wrapper.set_text(string_result);
|
||||
button(ctx.child("policy_check_button_result")).set_icon(material_icons_font::MD_CHECK);
|
||||
button(ctx.child("policy_check_button_result")).set_icon_brush("#008000");
|
||||
TextBlock::enabled_set(&mut ctx.child("policy_check_result"), true);
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(string_result));
|
||||
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
let res = t!("policy.validation.button_success", self.lang);
|
||||
button(ctx.child("policy_check_button_result")).set_text(res);
|
||||
button(ctx.child("policy_check_button_result")).set_visibility(Visibility::Visible);
|
||||
button(ctx.child("policy_check_button_result")).set_foreground("#008000");
|
||||
button(ctx.child("policy_check_button_result")).set_background("transparent");
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Visible);
|
||||
Button::text_set(&mut ctx.child("policy_check_button_result"), String::from(res));
|
||||
Button::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Visible);
|
||||
Button::icon_set(&mut ctx.child("policy_check_button_result"), material_icons_font::MD_CHECK);
|
||||
Button::icon_brush_set(&mut ctx.child("policy_check_button_result"), String::from("#008000"));
|
||||
Button::foreground_set(&mut ctx.child("policy_check_button_result"), String::from("#008000"));
|
||||
Button::background_set(&mut ctx.child("policy_check_button_result"), String::from("transparent"));
|
||||
}
|
||||
_ => {
|
||||
// no matching key
|
||||
let res = t!("policy.validation.failed", self.lang);
|
||||
trace!(target: "advotracker", state = ?res, policy_number = ?p);
|
||||
button(ctx.child("policy_check_button_result")).set_icon(material_icons_font::MD_CLEAR);
|
||||
button(ctx.child("policy_check_button_result")).set_icon_brush("#FF0000");
|
||||
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
let res = t!("policy.validation.button_failed", self.lang);
|
||||
button(ctx.child("policy_check_button_result")).set_text(res);
|
||||
button(ctx.child("policy_check_button_result")).set_visibility(Visibility::Visible);
|
||||
button(ctx.child("policy_check_button_result")).set_foreground("#FF0000");
|
||||
let mut text_block_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
Button::text_set(&mut ctx.child("policy_check_button_result"), String::from(res));
|
||||
Button::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Visible);
|
||||
Button::icon_set(&mut ctx.child("policy_check_button_result"), material_icons_font::MD_CLEAR);
|
||||
Button::icon_brush_set(&mut ctx.child("policy_check_button_result"), String::from("#FF0000"));
|
||||
Button::foreground_set(&mut ctx.child("policy_check_button_result"), String::from("#FF0000"));
|
||||
let res = t!("policy.validation.not_found", self.lang);
|
||||
text_block_wrapper.set_text(res);
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Visible);
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(res));
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
trace!(target: "advotracker", state = "error", error_type = "invalid type", error = ?e);
|
||||
button(ctx.child("policy_check_button_result")).set_icon(material_icons_font::MD_CLEAR);
|
||||
button(ctx.child("policy_check_button_result")).set_icon_brush("#FF0000");
|
||||
button(ctx.child("policy_check_button_result")).set_visibility(Visibility::Visible);
|
||||
button(ctx.child("policy_check_button_result")).set_foreground("#FF0000");
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Visible);
|
||||
let mut text_block_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
|
||||
Button::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Visible);
|
||||
Button::icon_set(&mut ctx.child("policy_check_button_result"), material_icons_font::MD_CLEAR);
|
||||
Button::icon_brush_set(&mut ctx.child("policy_check_button_result"), String::from("#FF0000"));
|
||||
Button::foreground_set(&mut ctx.child("policy_check_button_result"), String::from("#FF0000"));
|
||||
let res = t!("policy.validation.invalid_input", self.lang);
|
||||
text_block_wrapper.set_text(res);
|
||||
text_block_wrapper.set_enabled(true);
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(res));
|
||||
TextBlock::enabled_set(&mut ctx.child("policy_check_result"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if policy_number_length < 10 {
|
||||
let mut text_block_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
text_block_wrapper.set_enabled(true);
|
||||
let res = t!("policy.validation.to_short", self.lang);
|
||||
text_block_wrapper.set_text(res);
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Visible);
|
||||
//self.set_visibility(policy_check_policy_number, ctx);
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(res));
|
||||
TextBlock::enabled_set(&mut ctx.child("policy_check_result"), true);
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
}
|
||||
if policy_number_length > 10 {
|
||||
let mut text_block_wrapper: TextBlockCtx<'_> = text_block(ctx.child("policy_check_result"));
|
||||
text_block_wrapper.set_enabled(true);
|
||||
let res = t!("policy.validation.to_long", self.lang);
|
||||
text_block_wrapper.set_text(res);
|
||||
text_block(ctx.child("policy_check_label_result")).set_visibility(Visibility::Visible);
|
||||
TextBlock::text_set(&mut ctx.child("policy_check_result"), String::from(res));
|
||||
TextBlock::enabled_set(&mut ctx.child("policy_check_result"), true);
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
}
|
||||
|
||||
trace!(target: "advotracker", parse_entry = "finished");
|
||||
@@ -327,7 +322,7 @@ impl PolicyCheckState {
|
||||
/// Remove the menu popup box
|
||||
fn remove_popup(&mut self, id: Entity, ctx: &mut Context<'_>) {
|
||||
ctx.remove_child(self.menu);
|
||||
ctx.remove_child(self.popup_progress);
|
||||
ctx.remove_child(self.progress_popup);
|
||||
println!("Popup {:?} removed !", id);
|
||||
}
|
||||
|
||||
@@ -345,17 +340,13 @@ impl PolicyCheckState {
|
||||
// }
|
||||
|
||||
/// Change status of given text box to edit mode.
|
||||
fn set_entry(&mut self, policy_check_policy_number: Entity, ctx: &mut Context<'_>) {
|
||||
if *ctx.get_widget(policy_check_policy_number).get::<bool>("focused") {
|
||||
let mut text_box_wrapper: TextBoxCtx<'_> = text_box(ctx.child("policy_check_policy_number"));
|
||||
text_box_wrapper.set_visibility( Visibility::Visible);
|
||||
text_box_wrapper.set_enabled(true);
|
||||
text_box_wrapper.set_text("");
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget {
|
||||
ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element));
|
||||
fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) {
|
||||
if ctx.get_widget(text_box).get::<String16>("text").is_empty() {
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Collapsed);
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Collapsed);
|
||||
} else {
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_label_result"), Visibility::Visible);
|
||||
TextBlock::visibility_set(&mut ctx.child("policy_check_button_result"), Visibility::Visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,11 +361,11 @@ impl PolicyCheckState {
|
||||
.expect("PolicyCheckState: Can't create overlay as child of entity");
|
||||
|
||||
let label_account = t!("policy.menu.label_account", self.lang);
|
||||
button(ctx.child(ID_POLICY_CHECK_MENU_LABEL_ACCOUNT)).set_text(label_account);
|
||||
Button::text_set(&mut ctx.child(ID_POLICY_CHECK_MENU_LABEL_ACCOUNT), String::from(label_account));
|
||||
let label_quit = t!("policy.menu.label_quit", self.lang);
|
||||
button(ctx.child(ID_POLICY_CHECK_MENU_LABEL_QUIT)).set_text(label_quit);
|
||||
Button::text_set(&mut ctx.child(ID_POLICY_CHECK_MENU_LABEL_QUIT), String::from(label_quit));
|
||||
let label_toggle_theme = t!("policy.menu.label_toggle_theme", self.lang);
|
||||
button(ctx.child(ID_POLICY_CHECK_MENU_LABEL_TOGGLE_THEME)).set_text(label_toggle_theme);
|
||||
Button::text_set(&mut ctx.child(ID_POLICY_CHECK_MENU_LABEL_TOGGLE_THEME), String::from(label_toggle_theme));
|
||||
}
|
||||
|
||||
/// Set a progress popup that updates the import status in a progress bar
|
||||
@@ -387,29 +378,29 @@ impl PolicyCheckState {
|
||||
let build_context = &mut ctx.build_context();
|
||||
|
||||
let res = t!("policy.string.progress_text", self.lang);
|
||||
self.popup_progress = create_popup_progress(current_entity, &res, build_context);
|
||||
self.progress_popup = create_popup_progress(current_entity, &res, build_context);
|
||||
|
||||
// create a progress_popup widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER"
|
||||
build_context.append_child(stack, self.popup_progress);
|
||||
build_context.append_child(stack, self.progress_popup);
|
||||
|
||||
self.progress_bar = ctx
|
||||
.entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR)
|
||||
.expect("PolicyCheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.");
|
||||
|
||||
println!("PopupProgress created: {:?}", self.popup_progress);
|
||||
println!("PopupProgress created: {:?}", self.progress_popup);
|
||||
}
|
||||
|
||||
/// Change visibility of the result label.
|
||||
fn _set_visibility(&self, entity: Entity, ctx: &mut Context<'_>) {
|
||||
if ctx.get_widget(entity).get::<String16>("text").is_empty() {
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_RESULT)).set_visibility(Visibility::Collapsed);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_BUTTON_RESULT)).set_visibility(Visibility::Collapsed);
|
||||
} else {
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_RESULT)).set_visibility(Visibility::Visible);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_BUTTON_RESULT)).set_visibility(Visibility::Visible);
|
||||
}
|
||||
if ctx.get_widget(entity).get::<String16>("text").is_empty() {
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Collapsed);
|
||||
} else {
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
|
||||
}
|
||||
|
||||
//ctx.get_widget(self.label_result).update_theme_by_state(true);
|
||||
//ctx.get_widget(self.label_result).update_theme_by_state(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -444,7 +435,8 @@ impl PolicyCheckState {
|
||||
fn update_progress_bar(&self, ctx: &mut Context<'_>) {
|
||||
let res = t!("policy.string.progress_time", self.lang);
|
||||
let string_duration = format!("{}: {:?}", res, self.duration);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_PROGRESS_TIME)).set_text(string_duration);
|
||||
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME), String::from(string_duration));
|
||||
|
||||
let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR);
|
||||
progress_bar.set::<f64>("val", self.progress_count);
|
||||
@@ -482,16 +474,16 @@ impl State for PolicyCheckState {
|
||||
|
||||
// Constants
|
||||
let res = t!("policy.string.header", self.lang);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_HEADER)).set_text(res);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HEADER), String::from(res));
|
||||
|
||||
let res = t!("policy.string.label_policy_number", self.lang);
|
||||
let string_label_policy_number = format!("{}:", res);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)).set_text(string_label_policy_number);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_POLICY_NUMBER), String::from(string_label_policy_number));
|
||||
|
||||
let res = t!("policy.string.label_result", self.lang);
|
||||
let string_label_result = format!("{}:", res);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_RESULT)).set_text(string_label_result);
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_RESULT)).set_visibility(Visibility::Collapsed);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), String::from(string_label_result));
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
|
||||
|
||||
// // Load the saved data from a file in 'ron' format into our data structure.
|
||||
// // The cargo package identifier (default: 'nwx.advotracker') is used as the
|
||||
@@ -526,21 +518,22 @@ impl State for PolicyCheckState {
|
||||
if let Some(action) = self.action {
|
||||
match action {
|
||||
Action::AddProgress(increment) => {
|
||||
let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val();
|
||||
let old_width = ProgressBar::val_clone(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
|
||||
|
||||
let new_width = old_width + increment;
|
||||
// Set the ProgressBar's val property to the calculated percentage
|
||||
// (whereas 0.0 means 0 %, and 1.0 means 100 %) to increment the progress
|
||||
if new_width <= 1. {
|
||||
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(new_width);
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
|
||||
} else {
|
||||
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(1.);
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.);
|
||||
}
|
||||
}
|
||||
Action::ClearEntry(policy_check_policy_number) => {
|
||||
ctx.get_widget(policy_check_policy_number).set("enabled", false);
|
||||
}
|
||||
Action::InputTextChanged(entity) => {
|
||||
println!("entry changed: {}", text_box(ctx.get_widget(entity)).text());
|
||||
println!("entry changed: {}", TextBox::text_clone(&ctx.get_widget(entity)));
|
||||
}
|
||||
Action::ImportData => {
|
||||
match self.import_data(ctx) {
|
||||
@@ -567,7 +560,7 @@ impl State for PolicyCheckState {
|
||||
self.remove_popup(entity, ctx);
|
||||
}
|
||||
Action::ResetProgress => {
|
||||
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.);
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
|
||||
}
|
||||
Action::SetEntry(policy_check_policy_number) => {
|
||||
//self.last_focused = Some();
|
||||
@@ -578,16 +571,15 @@ impl State for PolicyCheckState {
|
||||
}
|
||||
Action::SetProgress(value) => {
|
||||
if value >= 0. || value <= 1. {
|
||||
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(value);
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value);
|
||||
} else {
|
||||
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.);
|
||||
}
|
||||
}
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
|
||||
} }
|
||||
Action::SetProgressPopup(_entity) => {
|
||||
self.set_popup_progress(ctx);
|
||||
}
|
||||
Action::SetVisibility(_entity) => {
|
||||
text_block(ctx.child(ID_POLICY_CHECK_LABEL_RESULT)).set_visibility(Visibility::Collapsed);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
|
||||
}
|
||||
Action::TextChanged(entity, _index) => {
|
||||
self.set_entry(entity, ctx);
|
||||
@@ -628,7 +620,7 @@ impl State for PolicyCheckState {
|
||||
|
||||
let res = t!("policy.string.data_count", lang);
|
||||
let string_data_count = format!("{}: {:?}", res, self.policy_numbers.len());
|
||||
text_block(ctx.child(ID_POLICY_DATA_COUNT_BLOCK)).set_text(string_data_count);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_DATA_COUNT_BLOCK), String::from(string_data_count));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,7 +713,7 @@ fn create_popup_progress(target: Entity, text: &str, ctx: &mut BuildContext<'_>)
|
||||
.id(ID_POLICY_CHECK_POPUP_PROGRESS)
|
||||
.target(target)
|
||||
.open(true)
|
||||
//.style("popup_progress")
|
||||
//.style("popup_progress")
|
||||
.width(280)
|
||||
.height(100)
|
||||
.on_mouse_down(move |ctx, _| {
|
||||
@@ -738,7 +730,7 @@ fn create_popup_progress(target: Entity, text: &str, ctx: &mut BuildContext<'_>)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_PROGRESS_TEXT)
|
||||
//.style("textblock_progress")
|
||||
//.style("textblock_progress")
|
||||
.font_size(12)
|
||||
.text(text)
|
||||
.build(ctx)
|
||||
@@ -747,13 +739,13 @@ fn create_popup_progress(target: Entity, text: &str, ctx: &mut BuildContext<'_>)
|
||||
ProgressBar::new()
|
||||
.id(ID_POLICY_CHECK_PROGRESS_BAR)
|
||||
.val(0)
|
||||
//.width(250)
|
||||
//.width(250)
|
||||
.build(ctx)
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_PROGRESS_TIME)
|
||||
//.style("textblock_progress")
|
||||
//.style("textblock_progress")
|
||||
.h_align("end")
|
||||
.font_size(12)
|
||||
.build(ctx)
|
||||
|
||||
Reference in New Issue
Block a user