mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-31 07:58:43 +03:00
exclude_area and host_type
This commit is contained in:
@@ -280,7 +280,16 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
|
||||
// right pane with preview canvas
|
||||
m_canvas = new Bed_2D(this);
|
||||
m_canvas->SetMinSize({ FromDIP(400), FromDIP(400) });
|
||||
m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent& e) { m_canvas->repaint(m_shape); });
|
||||
//B52
|
||||
m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent& e) {
|
||||
std::vector<Vec2d> tem_shape = m_shape;
|
||||
if (m_exclude_area.size() > 1) {
|
||||
for (const auto &point : m_exclude_area) {
|
||||
tem_shape.push_back({point.x(), point.y()});
|
||||
}
|
||||
}
|
||||
m_canvas->repaint(tem_shape);
|
||||
});
|
||||
m_canvas->Bind(wxEVT_SIZE, [this](wxSizeEvent& e) { m_canvas->Refresh(); });
|
||||
|
||||
wxSizer* left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
@@ -665,12 +674,12 @@ const std::vector<Vec2d> BedShapePanel::update_exclude_area(ConfigOptionsGroupSh
|
||||
e_area.push_back({exclude_min_1.x(), exclude_min_1.y()});
|
||||
e_area.push_back({0, 0});
|
||||
}
|
||||
|
||||
if (e_area.size() > 1) {
|
||||
for (const auto &point : e_area) {
|
||||
m_shape.push_back({point.x(), point.y()});
|
||||
}
|
||||
}
|
||||
|
||||
//if (e_area.size() > 1) {
|
||||
// for (const auto &point : e_area) {
|
||||
// m_shape.push_back({point.x(), point.y()});
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return e_area;
|
||||
}
|
||||
|
||||
@@ -2148,11 +2148,13 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
m_printer_view->AddButton(
|
||||
printer_name, host, (data->model_id), (data->fullname),
|
||||
[host, this](wxMouseEvent &event) {
|
||||
wxString formattedHost = wxString::Format("http://%s", host);
|
||||
//B55
|
||||
wxString formattedHost = host;
|
||||
//wxString formattedHost = wxString::Format("http://%s", host);
|
||||
if (!host.Lower().starts_with("http"))
|
||||
wxString formattedHost = wxString::Format("http://%s", host);
|
||||
if (!formattedHost.Lower().ends_with("10088"))
|
||||
formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
formattedHost = wxString::Format("http://%s", host);
|
||||
//if (!formattedHost.Lower().ends_with("10088"))
|
||||
// formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
this->m_printer_view->load_url(formattedHost);
|
||||
},
|
||||
(data->selected), cfg_t);
|
||||
@@ -2168,18 +2170,20 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
if (const DynamicPrintConfig *cfg = wxGetApp().preset_bundle->physical_printers.get_selected_printer_config(); cfg) {
|
||||
const PhysicalPrinter &pp = preset_bundle.physical_printers.get_selected_printer();
|
||||
wxString host = pp.config.opt_string("print_host");
|
||||
//B55
|
||||
//B45
|
||||
std::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)");
|
||||
bool isValidIPAddress = std::regex_match(host.ToStdString(), ipRegex);
|
||||
if (host.empty() || !isValidIPAddress) {
|
||||
//std::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)");
|
||||
//bool isValidIPAddress = std::regex_match(host.ToStdString(), ipRegex);
|
||||
if (host.empty()) {
|
||||
tem_host = "";
|
||||
host = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir()));
|
||||
}
|
||||
//B55
|
||||
else {
|
||||
if (!host.Lower().starts_with("http"))
|
||||
host = wxString::Format("http://%s", host);
|
||||
if (!host.Lower().ends_with("10088"))
|
||||
host = wxString::Format("%s:10088", host);
|
||||
// if (!host.Lower().ends_with("10088"))
|
||||
// host = wxString::Format("%s:10088", host);
|
||||
}
|
||||
if (tem_host != host) {
|
||||
//B45
|
||||
|
||||
@@ -509,7 +509,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
|
||||
text_ctrl* printhost_win = printhost_field ? dynamic_cast<text_ctrl*>(printhost_field->getWindow()) : nullptr;
|
||||
if (!m_opened_as_connect && printhost_win && m_last_host_type != htQIDIConnect){
|
||||
m_stored_host = printhost_win->GetValue();
|
||||
printhost_win->SetValue(L"https://connect.prusa3d.com");
|
||||
printhost_win->SetValue(L"https://connect.qidi3d.com");
|
||||
}
|
||||
} else {
|
||||
m_printhost_browse_btn->Show();
|
||||
@@ -743,6 +743,19 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event)
|
||||
Field* printhost_field = m_optgroup->get_field("print_host");
|
||||
text_ctrl* printhost_win = printhost_field ? dynamic_cast<text_ctrl*>(printhost_field->getWindow()) : nullptr;
|
||||
const auto opt = m_config->option<ConfigOptionEnum<PrintHostType>>("host_type");
|
||||
if (opt->value == htMoonraker) {
|
||||
Field * printhost_field = m_optgroup->get_field("print_host");
|
||||
text_ctrl *printhost_win = printhost_field ? dynamic_cast<text_ctrl *>(printhost_field->getWindow()) : nullptr;
|
||||
wxString temp_host = printhost_win->GetValue();
|
||||
//B55
|
||||
wxString formattedHost = temp_host;
|
||||
/* if (!temp_host.Lower().starts_with("http"))
|
||||
wxString formattedHost = wxString::Format("http://%s", temp_host);*/
|
||||
if (!formattedHost.Lower().ends_with("10088"))
|
||||
formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
m_optgroup->set_value("print_host", formattedHost, true);
|
||||
m_optgroup->get_field("print_host")->field_changed();
|
||||
}
|
||||
if (opt->value == htQIDIConnect) {
|
||||
if (printhost_win && printhost_win->GetValue() != L"https://connect.qidi3d.com"){
|
||||
InfoDialog msg(this, _L("Warning"), _L("URL of QIDIConnect is different from https://connect.qidi3d.com. Do you want to continue?"), true, wxYES_NO);
|
||||
|
||||
@@ -8167,7 +8167,15 @@ void Plater::set_bed_shape() const
|
||||
|
||||
auto bed_shape = p->config->option<ConfigOptionPoints>("bed_shape")->values;
|
||||
auto exclude_area = p->config->option<ConfigOptionPoints>("bed_exclude_area")->values;
|
||||
set_bed_shape(bed_shape, p->config->option<ConfigOptionFloat>("max_print_height")->value,
|
||||
|
||||
Pointfs tem_shape = bed_shape;
|
||||
tem_shape.push_back({0, 0});
|
||||
for (const auto &point : exclude_area) {
|
||||
tem_shape.push_back({point.x(), point.y()});
|
||||
}
|
||||
tem_shape.push_back({0, 0});
|
||||
|
||||
set_bed_shape(tem_shape, p->config->option<ConfigOptionFloat>("max_print_height")->value,
|
||||
p->config->option<ConfigOptionString>("bed_custom_texture")->value,
|
||||
p->config->option<ConfigOptionString>("bed_custom_model")->value, exclude_area);
|
||||
}
|
||||
|
||||
@@ -380,9 +380,10 @@ void PresetComboBox::open_physical_printer_url()
|
||||
const PhysicalPrinter &pp = m_preset_bundle->physical_printers.get_selected_printer();
|
||||
std::string host = pp.config.opt_string("print_host");
|
||||
assert(!host.empty());
|
||||
// B31
|
||||
if (host.find(":10088") == -1)
|
||||
host = host + ":10088";
|
||||
//B55
|
||||
//// B31
|
||||
//if (host.find(":10088") == -1)
|
||||
// host = host + ":10088";
|
||||
wxGetApp().open_browser_with_warning_dialog(host);
|
||||
}
|
||||
|
||||
|
||||
@@ -360,10 +360,11 @@ void PrinterWebView::AddButton(const wxString & devi
|
||||
//customButton->Bind(wxEVT_BUTTON, std::bind(&PrinterWebView::OnCustomButtonClick, this,handler));
|
||||
customButton->Bind(wxEVT_BUTTON, [this, ip, customButton](wxCommandEvent &event) {
|
||||
wxString host = ip;
|
||||
//B55
|
||||
if (!host.Lower().starts_with("http"))
|
||||
host = wxString::Format("http://%s", host);
|
||||
if (!host.Lower().ends_with("10088"))
|
||||
host = wxString::Format("%s:10088", host);
|
||||
// if (!host.Lower().ends_with("10088"))
|
||||
// host = wxString::Format("%s:10088", host);
|
||||
load_url(host);
|
||||
customButton->ResumeStatusThread();
|
||||
});
|
||||
@@ -540,11 +541,13 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event)
|
||||
std::string printer_name = printer.name;
|
||||
wxString host = printer.config.opt_string("print_host");
|
||||
|
||||
wxString formattedHost = wxString::Format("http://%s", host);
|
||||
//B55
|
||||
wxString formattedHost = host;
|
||||
// wxString formattedHost = wxString::Format("http://%s", host);
|
||||
if (!host.Lower().starts_with("http"))
|
||||
wxString formattedHost = wxString::Format("http://%s", host);
|
||||
if (!formattedHost.Lower().ends_with("10088"))
|
||||
formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
// if (!formattedHost.Lower().ends_with("10088"))
|
||||
// formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
|
||||
std::string fullname = preset_bundle.physical_printers.get_selected_full_printer_name();
|
||||
std::string preset_name = printer.get_preset_name(fullname);
|
||||
@@ -557,8 +560,9 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event)
|
||||
model_id = preset->config.opt_string("printer_model");
|
||||
}
|
||||
|
||||
boost::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)");
|
||||
bool isValidIPAddress = boost::regex_match(host.ToStdString(), ipRegex);
|
||||
//boost::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)");
|
||||
//bool isValidIPAddress = boost::regex_match(host.ToStdString(), ipRegex);
|
||||
bool isValidIPAddress = true;
|
||||
DynamicPrintConfig *cfg_t = &(printer.config);
|
||||
|
||||
UnSelectedButton();
|
||||
@@ -760,8 +764,9 @@ void PrinterWebView::load_url(wxString& url)
|
||||
//m_web = url;
|
||||
m_browser->LoadURL(url);
|
||||
|
||||
//B55
|
||||
url.Remove(0, 7);
|
||||
url.Remove(url.length() - 6);
|
||||
//url.Remove(url.length() - 6);
|
||||
for (MachineListButton *button : m_buttons) {
|
||||
if (url == (button->getIPLabel()))
|
||||
button->SetSelect(true);
|
||||
|
||||
Reference in New Issue
Block a user