This commit is contained in:
bubnikv
2019-02-22 15:25:44 +01:00
6 changed files with 34 additions and 23 deletions

View File

@@ -1178,7 +1178,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
const auto obj_idx = get_selected_obj_idx();
if (obj_idx < 0) return;
const std::string name = _(L("Generic")) + "-" + _(type_name);
const wxString name = _(L("Generic")) + "-" + _(type_name);
TriangleMesh mesh;
auto& bed_shape = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionPoints>("bed_shape")->values;
@@ -1230,7 +1230,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
}
#endif // ENABLE_GENERIC_SUBPARTS_PLACEMENT
new_volume->name = name;
new_volume->name = into_u8(name);
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
@@ -1238,7 +1238,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
parts_changed(obj_idx);
const auto object_item = m_objects_model->GetTopParent(GetSelection());
select_item(m_objects_model->AddVolumeChild(object_item, from_u8(name), type));
select_item(m_objects_model->AddVolumeChild(object_item, name, type));
#ifndef __WXOSX__ //#ifdef __WXMSW__ // #ys_FIXME
selection_changed();
#endif //no __WXOSX__ //__WXMSW__

View File

@@ -101,6 +101,10 @@ void ImGuiWrapper::set_style_scaling(float scaling)
bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt)
{
if (! display_initialized()) {
return false;
}
ImGuiIO& io = ImGui::GetIO();
io.MousePos = ImVec2((float)evt.GetX(), (float)evt.GetY());
io.MouseDown[0] = evt.LeftDown();
@@ -116,6 +120,10 @@ bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt)
bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
{
if (! display_initialized()) {
return false;
}
ImGuiIO& io = ImGui::GetIO();
if (evt.GetEventType() == wxEVT_CHAR) {
@@ -521,6 +529,12 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data)
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
}
bool ImGuiWrapper::display_initialized() const
{
const ImGuiIO& io = ImGui::GetIO();
return io.DisplaySize.x >= 0.0f && io.DisplaySize.y >= 0.0f;
}
void ImGuiWrapper::destroy_device_objects()
{
destroy_fonts_texture();

View File

@@ -75,6 +75,7 @@ private:
void init_input();
void init_style();
void render_draw_data(ImDrawData *draw_data);
bool display_initialized() const;
void destroy_device_objects();
void destroy_fonts_texture();

View File

@@ -353,14 +353,6 @@ Updates PresetUpdater::priv::get_config_updates() const
// Perform a basic load and check the version
const auto vp = VendorProfile::from_ini(bundle_path, false);
const auto ver_current = idx.find(vp.config_version);
if (ver_current == idx.end()) {
auto message = (boost::format("Preset bundle `%1%` version not found in index: %2%") % idx.vendor() % vp.config_version.to_string()).str();
BOOST_LOG_TRIVIAL(error) << message;
GUI::show_error(nullptr, GUI::from_u8(message));
continue;
}
// Getting a recommended version from the latest index, wich may have been downloaded
// from the internet, or installed / updated from the installation resources.
const auto recommended = idx.recommended();
@@ -368,15 +360,24 @@ Updates PresetUpdater::priv::get_config_updates() const
BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % idx.vendor();
}
BOOST_LOG_TRIVIAL(debug) << boost::format("Vendor: %1%, version installed: %2%, version cached: %3%")
const auto ver_current = idx.find(vp.config_version);
const bool ver_current_found = ver_current != idx.end();
if (! ver_current_found) {
auto message = (boost::format("Preset bundle `%1%` version not found in index: %2%") % idx.vendor() % vp.config_version.to_string()).str();
BOOST_LOG_TRIVIAL(error) << message;
GUI::show_error(nullptr, GUI::from_u8(message));
}
BOOST_LOG_TRIVIAL(debug) << boost::format("Vendor: %1%, version installed: %2%%3%, version cached: %4%")
% vp.name
% ver_current->config_version.to_string()
% vp.config_version.to_string()
% (ver_current_found ? "" : " (not found in index!)")
% recommended->config_version.to_string();
if (! ver_current->is_current_slic3r_supported()) {
if (ver_current_found && !ver_current->is_current_slic3r_supported()) {
BOOST_LOG_TRIVIAL(warning) << "Current Slic3r incompatible with installed bundle: " << bundle_path.string();
updates.incompats.emplace_back(std::move(bundle_path), *ver_current);
} else if (recommended->config_version > ver_current->config_version) {
} else if (recommended->config_version > vp.config_version) {
// Config bundle update situation
// Check if the update is already present in a snapshot