ENH: some improvements and fixs

1. create user folder if not exists
2. add a tips for binding a printer
3. fix sdcard tips
4. modify icons
5. refine layout of task options

Change-Id: Ic0529cf1e8bdde0128052bc42454f6e6aaae87ca
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-10-18 16:47:42 +08:00 committed by Lane.Wei
parent 13b5e589cb
commit f968374b46
8 changed files with 41 additions and 13 deletions

View file

@ -103,7 +103,10 @@ void BindJob::process()
msg = _L("Logging in");
}
if (code != 0) {
msg = _L("Login failed") + wxString::Format("(code=%d,info=%s)", code, info);
msg = _L("Login failed") + wxString::Format("(code=%d,info=%s). ", code, info);
if (code == BAMBU_NETWORK_ERR_TIMEOUT) {
msg += _L("Please check the printer network connection.");
}
}
update_status(curr_percent, msg);
}

View file

@ -85,6 +85,7 @@ wxString PrintJob::get_http_error_msg(unsigned int status, std::string body)
else {
wxString unkown_text = _L("Unkown Error.");
unkown_text += wxString::Format("status=%u, body=%s", status, body);
BOOST_LOG_TRIVIAL(error) << "http_error: status=" << status << ", code=" << code << ", error=" << error;
return unkown_text;
}

View file

@ -138,7 +138,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
auto printhost_browse = [=](wxWindow* parent)
{
auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, "monitor_signal_strong", _L("Browse") + " " + dots);
auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, "printer_host_browser", _L("Browse") + " " + dots);
m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) {
BonjourDialog dialog(this, Preset::printer_technology(*m_config));
if (dialog.show_and_lookup()) {
@ -151,7 +151,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
};
auto print_host_test = [=](wxWindow* parent) {
auto sizer = create_sizer_with_btn(parent, &m_printhost_test_btn, "test", _L("Test"));
auto sizer = create_sizer_with_btn(parent, &m_printhost_test_btn, "printer_host_test", _L("Test"));
m_printhost_test_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));

View file

@ -39,6 +39,8 @@ wxDEFINE_EVENT(EVT_EDIT_PRINT_NAME, wxCommandEvent);
#define LIST_REFRESH_INTERVAL 200
#define MACHINE_LIST_REFRESH_INTERVAL 2000
#define WRAP_GAP FromDIP(30)
static wxString task_canceled_text = _L("Task canceled");
@ -1017,16 +1019,17 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_statictext_printer_msg->SetFont(::Label::Body_13);
m_statictext_printer_msg->Hide();
m_sizer_select = new wxGridSizer(0, 2, 0, 0);
//m_sizer_select = new wxGridSizer(0, 2, 0, 0);
m_sizer_select = new wxWrapSizer();
select_bed = create_item_checkbox(_L("Bed Leveling"), this, _L("Bed Leveling"), "bed_leveling");
select_flow = create_item_checkbox(_L("Flow Calibration"), this, _L("Flow Calibration"), "flow_cali");
select_timelapse = create_item_checkbox(_L("Timelapse"), this, _L("Timelapse"), "timelapse");
select_use_ams = create_ams_checkbox(_L("Enable AMS"), this, _L("Enable AMS"));
m_sizer_select->Add(select_bed);
m_sizer_select->Add(select_flow);
m_sizer_select->Add(select_timelapse);
m_sizer_select->Add(select_use_ams);
m_sizer_select->Add(select_bed, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_flow, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_timelapse, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_use_ams, 0, wxLEFT | wxRIGHT, WRAP_GAP);
select_bed->Show(true);
select_flow->Show(true);
@ -1052,10 +1055,10 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
auto hyperlink_sizer = new wxBoxSizer( wxHORIZONTAL );
auto m_hyperlink = new wxHyperlinkCtrl(m_panel_prepare, wxID_ANY, _L("Can't connect to the printer"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
auto linkimg = new wxStaticBitmap(m_panel_prepare, wxID_ANY, create_scaled_bitmap("link_wiki_img", this, 18), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
//auto linkimg = new wxStaticBitmap(m_panel_prepare, wxID_ANY, create_scaled_bitmap("link_wiki_img", this, 18), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
hyperlink_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
hyperlink_sizer->Add(linkimg, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
//hyperlink_sizer->Add(linkimg, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
m_sizer_prepare->Add(hyperlink_sizer, 0, wxALIGN_CENTER | wxALL, 5);
@ -1263,7 +1266,6 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
} else {
select_timelapse->Hide();
}
Fit();
}
@ -2258,7 +2260,7 @@ void SelectMachineDialog::update_show_status()
show_status(PrintDialogStatus::PrintStatusInPrinting);
return;
}
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD)) {
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && !obj_->has_sdcard()) {
show_status(PrintDialogStatus::PrintStatusNoSdcard);
return;
}

View file

@ -313,7 +313,8 @@ protected:
int m_current_filament_id;
bool m_is_in_sending_mode { false };
wxGridSizer *m_sizer_select;
//wxGridSizer *m_sizer_select;
wxWrapSizer *m_sizer_select;
wxBoxSizer * sizer_thumbnail;
wxGridSizer *m_sizer_material;
wxBoxSizer * m_sizer_main;