Merge branch 'master' of https://github.com/prusa3d/Slic3r into scene_manipulators

This commit is contained in:
Enrico Turri 2018-06-27 15:32:39 +02:00
commit 6c6f6ed4e2
6 changed files with 23 additions and 13 deletions

View File

@ -83,8 +83,11 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, cons
const auto model_id = model.id; const auto model_id = model.id;
bool default_variant = true; // Mark the first variant as default in the GUI
for (const auto &variant : model.variants) { for (const auto &variant : model.variants) {
const auto label = wxString::Format("%s %s %s", variant.name, _(L("mm")), _(L("nozzle"))); const auto label = wxString::Format("%s %s %s %s", variant.name, _(L("mm")), _(L("nozzle")),
(default_variant ? _(L("(default)")) : wxString()));
default_variant = false;
auto *cbox = new Checkbox(panel, label, model_id, variant.name); auto *cbox = new Checkbox(panel, label, model_id, variant.name);
const size_t idx = cboxes.size(); const size_t idx = cboxes.size();
cboxes.push_back(cbox); cboxes.push_back(cbox);
@ -113,11 +116,6 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, cons
sizer->Add(all_none_sizer, 0, wxEXPAND); sizer->Add(all_none_sizer, 0, wxEXPAND);
SetSizer(sizer); SetSizer(sizer);
if (cboxes.size() > 0) {
cboxes[0]->SetValue(true);
on_checkbox(cboxes[0], true);
}
} }
void PrinterPicker::select_all(bool select) void PrinterPicker::select_all(bool select)
@ -130,6 +128,14 @@ void PrinterPicker::select_all(bool select)
} }
} }
void PrinterPicker::select_one(size_t i, bool select)
{
if (i < cboxes.size() && cboxes[i]->GetValue() != select) {
cboxes[i]->SetValue(select);
on_checkbox(cboxes[i], select);
}
}
void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked) void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked)
{ {
variants_checked += checked ? 1 : -1; variants_checked += checked ? 1 : -1;
@ -232,6 +238,7 @@ PageWelcome::PageWelcome(ConfigWizard *parent) :
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors; AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors); printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors);
printer_picker->select_one(0, true); // Select the default (first) model/variant on the Prusa vendor
printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) { printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) {
appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable); appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable);
this->on_variant_checked(); this->on_variant_checked();

View File

@ -56,6 +56,7 @@ struct PrinterPicker: wxPanel
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors); PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
void select_all(bool select); void select_all(bool select);
void select_one(size_t i, bool select);
void on_checkbox(const Checkbox *cbox, bool checked); void on_checkbox(const Checkbox *cbox, bool checked);
}; };

View File

@ -71,6 +71,7 @@ Http::priv::priv(const std::string &url) :
form(nullptr), form(nullptr),
form_end(nullptr), form_end(nullptr),
headerlist(nullptr), headerlist(nullptr),
limit(0),
cancel(false) cancel(false)
{ {
if (curl == nullptr) { if (curl == nullptr) {

View File

@ -46,7 +46,8 @@ public:
Http& operator=(const Http &) = delete; Http& operator=(const Http &) = delete;
Http& operator=(Http &&) = delete; Http& operator=(Http &&) = delete;
// Sets a maximum size of the data that can be received. The default is 5MB. // Sets a maximum size of the data that can be received.
// A value of zero sets the default limit, which is is 5MB.
Http& size_limit(size_t sizeLimit); Http& size_limit(size_t sizeLimit);
// Sets a HTTP header field. // Sets a HTTP header field.
Http& header(std::string name, const std::string &value); Http& header(std::string name, const std::string &value);

View File

@ -537,15 +537,15 @@ bool PresetUpdater::config_update() const
incompats_map.emplace(std::make_pair(std::move(vendor), std::move(restrictions))); incompats_map.emplace(std::make_pair(std::move(vendor), std::move(restrictions)));
} }
p->had_config_update = true; // This needs to be done before a dialog is shown because of OnIdle() + CallAfter() in Perl
GUI::MsgDataIncompatible dlg(std::move(incompats_map)); GUI::MsgDataIncompatible dlg(std::move(incompats_map));
const auto res = dlg.ShowModal(); const auto res = dlg.ShowModal();
if (res == wxID_REPLACE) { if (res == wxID_REPLACE) {
BOOST_LOG_TRIVIAL(info) << "User wants to re-configure..."; BOOST_LOG_TRIVIAL(info) << "User wants to re-configure...";
p->perform_updates(std::move(updates)); p->perform_updates(std::move(updates));
GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT); GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT);
if (wizard.run(GUI::get_preset_bundle(), this)) { if (! wizard.run(GUI::get_preset_bundle(), this)) {
p->had_config_update = true;
} else {
return false; return false;
} }
} else { } else {
@ -566,6 +566,8 @@ bool PresetUpdater::config_update() const
updates_map.emplace(std::make_pair(std::move(vendor), std::move(ver_str))); updates_map.emplace(std::make_pair(std::move(vendor), std::move(ver_str)));
} }
p->had_config_update = true; // Ditto, see above
GUI::MsgUpdateConfig dlg(std::move(updates_map)); GUI::MsgUpdateConfig dlg(std::move(updates_map));
const auto res = dlg.ShowModal(); const auto res = dlg.ShowModal();
@ -581,8 +583,6 @@ bool PresetUpdater::config_update() const
} else { } else {
BOOST_LOG_TRIVIAL(info) << "User refused the update"; BOOST_LOG_TRIVIAL(info) << "User refused the update";
} }
p->had_config_update = true;
} else { } else {
BOOST_LOG_TRIVIAL(info) << "No configuration updates available."; BOOST_LOG_TRIVIAL(info) << "No configuration updates available.";
} }

View File

@ -31,7 +31,7 @@
try { try {
THIS->do_export(print, path, preview_data); THIS->do_export(print, path, preview_data);
} catch (std::exception& e) { } catch (std::exception& e) {
croak(e.what()); croak("%s\n", e.what());
} }
%}; %};