Exemple #1
0
    TheDummyAssistant(openfluid::machine::SimulationBlob* SimBlob) :
      Gtk::Assistant(), mp_SimBlob(SimBlob), mp_TestUnitsColl(0), m_Applied(false)
    {
      set_title("Dummy assistant");
      set_default_size(400, 300);
      set_modal(true);

      Gtk::Label* Label1 = Gtk::manage(new Gtk::Label(
          "I'm a Dummy assistant for tests"));
      append_page(*Label1);
      set_page_title(*Label1, "Page 1/2");
      set_page_type(*Label1, Gtk::ASSISTANT_PAGE_INTRO);
      set_page_complete(*Label1, true);

      Gtk::Label* Label2 = Gtk::manage(new Gtk::Label());

      if (!mp_SimBlob)
      {
        Label2->set_text("Nb of units in TestUnits class: no CoreRepository\n"
          "Nothing to do");

        signal_apply().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide));
      }
      else
      {
        unsigned int Size = 0;

        mp_TestUnitsColl = mp_SimBlob->getCoreRepository().getUnits("TestUnits");

        if (mp_TestUnitsColl)
          Size = mp_TestUnitsColl->getList()->size();

        Label2->set_text(Glib::ustring::compose(
            "Nb of units in TestUnits class: %1\n"
              "Clicking ok will add a Unit of class \"TestUnits\"", Size));

        signal_apply().connect(
            sigc::mem_fun(*this, &TheDummyAssistant::m_apply));
      }

      append_page(*Label2);
      set_page_title(*Label2, "Page 2/2");
      set_page_type(*Label2, Gtk::ASSISTANT_PAGE_CONFIRM);
      set_page_complete(*Label2, true);

      signal_cancel().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide));
      signal_close().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide));

      show_all_children();
    }
void DisneyMaterialLayerUI::create_input_widgets(const Dictionary& values)
{
    for (size_t i = 0, e = m_input_metadata.size(); i < e; ++i)
    {
        Dictionary im = m_input_metadata[i];
        const string input_name = im.get<string>("name");
        const string input_type = im.get<string>("type");

        im.insert("value",
            values.strings().exist(input_name) ? values.get<string>(input_name) :
            im.strings().exist("default") ? im.get<string>("default") :
            "");

        unique_ptr<IInputWidgetProxy> widget_proxy =
            input_type == "colormap" ?
                im.dictionaries().exist("entity_types") &&
                im.dictionaries().get("entity_types").strings().exist("color")
                    ? create_color_input_widgets(im)
                    : create_colormap_input_widgets(im) :
            input_type == "text" ? create_text_input_widgets(im) :
            unique_ptr<IInputWidgetProxy>(nullptr);

        assert(widget_proxy.get());
        connect(widget_proxy.get(), SIGNAL(signal_changed()), SIGNAL(signal_apply()));

        m_widget_proxies.insert(input_name, std::move(widget_proxy));
    }
}
Exemple #3
0
void Settings::on_settings_save() {
	save_settings();
	ImagePool::close();
	ImagePool::init();
	hide();
	signal_apply();
}