html – Widget Text Needs to be White

I need to change the color to white on the title of a widget that I have in my footer. I looked at the source code and note that it says H4 before and after the text. However, when I change the color of H4 in the global typography, it does not change the color of this widget text. I also found the area for the Widget Header and changed it to white but it also is not changing the text to white on the widget. I see the below when I view source code but when I go into CSS, it will not bring it up when I search. Here is what the code currently says:

<section id="media_image-3" class="fusion-footer-widget-column widget widget_media_image"><h4 class="widget-title">Members of:</h4>

magento2 – Get custom price via price-box widget

I have a single price on the page so i create a method on the priceBox to collect it via an API.

The problem i am having is that from my other JS module i can not access this widget or method. Every time i do so it will execute the _create or _init on that price-box which triggers a second call (the _create call).

Is there a way to to retrieve the actual instance of the widget and just call that refresh method?

There are different things i already tried though:

# Unknown function
const priceBox = $('.price-box', '.product-info-price').priceBox();
priceBox.collectPricesForProduct(sku);

# New create is invoked
var priceBox = $.mage.priceBox;
priceBox().collectPricesForProduct(sku);

Below is the example code of the actual price-box. Hope someone can help!

define((
    'jquery',
    'Magento_Catalog/js/price-utils',
    'underscore',
    'mage/template',
    'jquery/ui'
), function ($, utils, _, mageTemplate) {
    'use strict';

    return function (widget) {
        $.widget('mage.priceBox', widget, {
            _create: function initPriceBox() {
                this._super();
                var sku = $('div.product-info-main .product-info-price .product.attribute.sku div').html();
                this.collectPricesForProduct(sku);
            },
            collectPricesForProduct: function(sku, language){
                $('.price-box').hide();
                jQuery('.price-box').parent().prepend('<i class="fa fa-circle-o-notch fa-2x fa-spin"></i>');

                var self = this;
                $('#product-addtocart-button').attr('disabled', 'disabled');
                request.done(function (response) {
                    const prices = {
                        baseOldPrice: {
                            amount: response.prices.excl
                        },
                        oldPrice: {
                            amount: response.prices.incl
                        },
                        basePrice: {
                            amount: response.prices.excl
                        },
                        finalPrice: {
                            amount: response.prices.incl
                        }
                    };
                    self.options.prices = prices;
                    self.element.trigger('updatePrice');
                    $('.price-box').show().parent().find('.fa-spin').remove();
                    $('#product-addtocart-button').removeAttr('disabled');
                });
                request.error(function () {
                    alert('fatal error, no price');
                    $('.price-box').show().parent().find('.fa-spin').remove();
                    $('#product-addtocart-button').removeAttr('disabled');
                });
            }
        });
        return $.mage.priceBox;
    }
});

rust – Fuzzy Search Table Widget in FLTK-Rs

I’m building a fuzzy search table widget in FLTK-RS. On my pretty decently spec’d machine I’m getting pretty laggy performance, does anyone have any thoughts on ways to improve this?

If you’d like to clone it from a repo, here’s a link to a repo: https://github.com/wyhinton/search_table_testing

fltk = "^1.0.18"
sublime_fuzzy = "0.7.0"
rand = "0.8.0"
//main.rs
//demonstrates a fuzzy search bar 
use fltk::{ group::*, app::*, window::*, prelude::*};
use rand::{distributions::Alphanumeric, Rng};

mod search_bar;
use search_bar::SearchBar;
use search_bar::Result;

mod search_table;
use search_table::SearchTable;
use std::rc::Rc;
use std::cell::RefCell;
use sublime_fuzzy::best_match;

static INITIAL_COUNT: i32 = 20;
///generate array of random ASCII strings


pub struct CustomEvent{}
impl CustomEvent {
    const SEARCH_INPUT: i32 = 42;
}

struct FuzzySearch{
}

impl FuzzySearch{
    pub fn new(w: i32, h: i32)->Self{
        let initial_strings = random_string_arr(INITIAL_COUNT, 5, 30); 
        let active_strings = Rc::from(RefCell::from(initial_strings.clone())); 
        let mut container= Pack::new(0,0,400,200,None).center_of_parent();
        let sb = SearchBar::new();
        let mut table = SearchTable::new(0,0+25, w, h-25, active_strings.clone()) ;
        container.end();
        let active_strins_cl = active_strings.clone();
        container.handle(move |_, ev| 
            if ev == CustomEvent::SEARCH_INPUT.into(){
            if sb.value().len() > 0{
                dbg!(sb.value().len());
                let values = fuzzy_search(sb.value(), active_strins_cl.try_borrow_mut().expect("hello").to_vec());
                table.set_values(values);
       
            } else {
                table.set_values(initial_strings.clone());
            }
            true
          } else {
              false
          });
        FuzzySearch{
        }
    }
}
fn main() {
    let app = App::default();
    let mut win = Window::new(200, 200, 700, 500, "Fuzzy Search");
    let _fuzzy_search = FuzzySearch::new(600,400);
    win.end();
    win.show();
    app.run().unwrap();

}

fn fuzzy_search(search_value: String, items: Vec<String>)-> Vec<String> {
    let mut results = vec!();
    for x in 0..items.len(){
        let m = best_match(&search_value, &items(x));
        //best_match returns an Option<Match> so we need to check for Some and None values
        match m {
            //if we get a match back push it to our result array
            Some(val) => {
                let res = Result{
                    score: val.clone().score(),
                    val: items(x).clone(),
                };
                dbg!(res.score);
                if res.score > 0.3 as isize{
                    results.push(res);
                }
            }
            //do nothing if result is none
            None => ()
        }
    }
    //sort the resulsts by their score (heigh->low)
    results.sort_by(|a, b| b.score.cmp(&a.score));
    //map the sorted list to the string values
    let result_strings: Vec<String> = results.into_iter().map(|x|x.val).collect();
    result_strings
}

fn random_string_arr(n_strings: i32, min_str_length: i32, max_str_length: i32) -> Vec<String>{
    let mut string_arr = vec!();
    
    for _x in 0..n_strings{
        let _count =  rand::thread_rng().gen_range(min_str_length..max_str_length);
        let s: String = rand::thread_rng()
        .sample_iter(&Alphanumeric)
        .take(7)
        .map(char::from)
        .collect();

        string_arr.push(s)
    }
    string_arr
 }
//search_table.rs
use fltk::{prelude::*,  table::*, button::*, draw::*, enums::*};
use crate::{CustomEvent};
mod table_button;
use std::rc::Rc;
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use std::convert::TryInto;

pub struct SearchTable{
    table: Table,
    items: Rc<RefCell<Vec<String>>>,
}

impl SearchTable{
    pub fn new(x: i32, y: i32, w: i32, h: i32, items: Rc<RefCell<Vec<String>>>) -> SearchTable {
        //table setup
        let mut table = Table::new(x,y,w+20,h, None);
        table.end();
        table.set_rows(10);
        table.set_cols(5);
        table.set_row_height_all(90);
        
        

        //provide access to our strings inside of our table draw call
        let items_cl_1 = items.clone();
        table.draw(move|widg|{
            //provide access to our strings inside of draw_cell
            // let ic_cl_2 = items_cl_1.clone();
            draw_rect_fill(
                widg.x(),
                widg.y(),
                widg.width(),
                widg.height(),
                Color::Red,
            );
            //draw the children after drawing the background fill color
            widg.draw_children();
        });
        //draw our widgets again if we input into our search bar
        table.handle(move |widg, ev| 
          if ev == CustomEvent::SEARCH_INPUT.into(){
            // fltk::prelude::GroupExt::clear(widg); 
              widg.redraw();
            true
        } else {
            false
        });
        let mut buttons = vec!();
        for x in 0..100{
            buttons.push(Button::new(0,0,50,50, None));
        }
        let st = SearchTable{
            table: table,
            items: items.clone(),
        };

        st
    }
    //update our available list of strings
    pub fn set_values(&mut self, new_items: Vec<String>){
        *self.items.borrow_mut() = new_items;
        let ic_cl_2 = self.items.clone();
        self.table.draw_cell(move |t, ctx, row, col, x, y, w, h| {
            if let TableContext::Cell = ctx {
                let t_index = row*t.cols() as i32+ col;
                //create a new button intance 
                //maybe our buttons could be cached so we don't have to call the constructor over and over
                if t_index < *&ic_cl_2.borrow().len() as i32{
                    let mut button = Button::new(x, y, w, h,None);
                    button.set_label(&ic_cl_2.borrow()(t_index as usize) );
                    t.add(&button);
                }
                dbg!(t.children());
            }
        });
    }

}

impl Deref for SearchTable {
    type Target = Table;

    fn deref(&self) -> &Self::Target {
        &self.table
    }
}

impl DerefMut for SearchTable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.table
    }
}

//search_bar.rs
use fltk::{ app, frame::*, prelude::*, image::*, group::*, input::*, draw::*, enums::*};
use crate::CustomEvent;

use std::rc::Rc;
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};

#(derive(Debug, Eq, Clone, Ord, PartialEq, PartialOrd))
pub struct Result {
    pub score: isize,
    pub val: String,
}

pub struct SearchBar {
    pub pack: Pack, 
    pub input: Input,
    pub value: Rc<RefCell<String>>,
}

impl SearchBar {
    pub fn new() -> Self {
        //initialize widgets
     
        let search_val = Rc::from(RefCell::from("".to_string()));
        let mut container = Pack::new(0,0,0,25, None);
        let icon = Icon::new();
        //make our text input fill up the right amount of space
        let input_w = icon.parent().unwrap().parent().unwrap().width() - icon.width();
        let mut text_input = Input::new(0,0,input_w,25, None);

        //if our text input is not empty, draw some place-holder text
        text_input.draw(move |b|{
            set_draw_color(Color::Black);
            if b.value().is_empty() {
                draw_text2("Search...", b.x() + 10 , b.y(), b.width(), b.height(), Align::Inside | Align::Left );
            }

        });
        container.end(); 
        container.set_type(PackType::Horizontal);
        container.set_frame(FrameType::BorderFrame);
        container.set_color(Color::Black);

        let val_cl = Rc::clone(&search_val);
        text_input.handle(move |t, ev| {
            match ev {
                Event::KeyDown =>{
                    println!("{}", "got a key down" );
                    // dbg!(t.value());
                    *val_cl.borrow_mut() = t.value();
                    let _ = app::handle_main(CustomEvent::SEARCH_INPUT).unwrap();
                    true
                }
                _=>false 
            }
        });

        let sb = SearchBar {
            pack: container,
            input: text_input,
            value:  search_val,
        };
        sb
    }
    pub fn value(&self)->String{
        (*self.value.borrow().to_owned()).to_string()
    }
    
}

struct Icon{
    frame: Frame
}

impl Icon{
    pub fn new()->Self{
        let icon_w = 24; 
        let h = 24; 
        let mut icon = Frame::new(0,0,icon_w,h, None);
        let mut search_icon = SvgImage::load("search-24px.svg").unwrap();
        icon.draw(move |f|{
            search_icon.draw(f.x(), f.y(), 24, 24);    
        });
        icon.set_frame(FrameType::NoBox); 
        Icon{
            frame: icon
        }
    }
}

impl Deref for Icon {
    type Target = Frame;

    fn deref(&self) -> &Self::Target {
        &self.frame
    }
}

impl DerefMut for Icon {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.frame
    }
}

applications – Install Galaxy S5 Weather Widget on S21

I just replaced my Samsung Galaxy S5 (which I loved) with a new Galaxy S21 (standard model from Verizon). The phone is nice and, of course, much faster…but there is one remaining thing from the S5 that I really want to try and bring to my S21. That is the weather widget, which I believe was by AccuWeather (but might have been third-party developed?). This was a really nice 4×2 widget with a nice little background that changed with the weather and also updated to the town/city you’re currently in. If it’s sunny you get a grassy field with blue skies; if it’s raining you get raindrops on a window; if it’s snowy you get a snow-covered house. I loved that.

Current AccuWeather widgets for the S21 update the town/city well enough, but they’re all smaller and not nearly as pretty, without the changing backgrounds. The S5 widget looks like this:

Samsung Galaxy S5 Weather Widget

So, here’s what I would like to accomplish: bringing the S5 weather widget over to my S21. Anyone have any ideas how to accomplish this?

(Note: An S21 tag is not yet available and I don’t have enough reputation to add it, so I used S20.)

Change default BlogPage Widgets Alignment for Every Widget (Neve-ThemeIsle)

In Neve’s Default theme (here), the block’s (Text ,Image etc)default to left-alignment .

Is it possible to perform a site-wide change in the default alignment (eg. Align-Center)of these blocks?

enter image description here

forms – How can I change the label on the “Add media” button in media field widget?


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




sliders – Widget to enter 3 numbers that must add up to 1

I need the user to select 3 numbers that add up to 1, let’s call them x, y, and z. I could have a slider for x and y. Then z would simply be 1 - x - y. But what if the user slides x to 1 and y to anything above 0? I could popup an error message, but that’s not friendly…

I could shorten y‘s slider depending on what x‘s slider value is. Is there a better solution for this kind of widget(s)? It might be cool to have a slider with 2 tabs, which would separate the x, y, and z values. But I’m worried that might be confusing, particularly if one of the values is very small or 0?

3 slider widget

Is there a good UI solution?

flutter – pasar Variables de un widget a otro

como puedo pasar una variable de un widget a otro

por ejemplo… quiero que cuando aprete el boton “login” imprima el usuario (osea donde imprime el “si” que imprima la variable usuario del otro widget). Sinceramente vengo de python y esto me esa desconcertando un poco . las definiciones aqui nose si se hacen en otra carpeta o que… pero bueno voy aprendiendo

  class CamposUsuario extends StatelessWidget {
  final String texto;
  CamposUsuario({required this.texto});
  final usuario = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return TextFormField(
      decoration: InputDecoration(
          labelStyle: TextStyle(fontSize: 20), labelText: "$texto"),
      obscureText: (this.texto == "Password") ? true : false,
      controller: usuario,
    );
  }
}

class BotonLogin extends StatelessWidget {
  const BotonLogin({
    Key? key,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return RaisedButton(
      padding: EdgeInsets.symmetric(horizontal: 60),
      elevation: 7,
      onPressed: () {
        print('si');
      },
      color: Colors.amber(900),
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
      child: Text("Login"),
    );
  }
}

theme customizer – Widget Modification

I want to modify a tiny aspect of a widget I currently use, it came with the theme or perhaps the recommended theme toolkit plugin… not sure which.

The widget displays featured pages on the homepage but I’d prefer it to display category instead or the option of both with the same design and style.

I figured I could modify it with the code but I can’t seem to find it.

Anyone know how I can go about fixing this?

I found the code from the parent theme’s function.php

”’
/**

  • Featured Section
    */
    function blossom_feminine_featured_section(){
    $ed_featured = get_theme_mod( ‘ed_featured_area’, true );
    $featured_page_one = get_theme_mod( ‘featured_content_one’ );
    $featured_page_two = get_theme_mod( ‘featured_content_two’ );
    $featured_page_three = get_theme_mod( ‘featured_content_three’ );
    $featured_pages = array( $featured_page_one, $featured_page_two, $featured_page_three );
    $featured_page = array_diff( array_unique( $featured_page), array( ” ) );

    if( is_home() && $ed_featured && $featured_pages ){
    $args = array(
    ‘post_type’ => ‘page’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ‘post__in’ => $featured_pages,
    ‘orderby’ => ‘post__in’
    );
    ”’

Uncaught exception ‘Exception’ with message ‘Illegal widget setting ID

Advertising

y u no do it?

Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just $1 per CPM or $0.10 per CPC.