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

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.49031 2.42996C6.78031 0.719961 4.00031 0.719961 2.29031 2.42996C0.580312 4.13996 0.580312 6.91996 2.29031 8.62996C3.88031 10.22 6.39031 10.33 8.11031 8.96996L9.59031 10.45C9.59031 10.45 9.23031 10.81 9.59031 11.18C9.95031 11.55 13.2403 14.83 13.2403 14.83C13.2403 14.83 13.6003 15.19 13.9703 14.83C14.3303 14.47 14.7003 14.1 14.7003 14.1C14.7003 14.1 15.0603 13.74 14.7003 13.37C14.3403 13 11.0503 9.71996 11.0503 9.71996C10.6903 9.35996 10.3203 9.71996 10.3203 9.71996L8.83031 8.24996C10.1903 6.51996 10.0803 4.01996 8.49031 2.42996ZM8.10031 8.24996C6.60031 9.74996 4.17031 9.74996 2.67031 8.24996C1.17031 6.74996 1.17031 4.31996 2.67031 2.81996C4.17031 1.31996 6.60031 1.31996 8.10031 2.81996C9.60031 4.31996 9.60031 6.74996 8.10031 8.24996Z" fill="#00AE42"/>
</svg>

After

Width:  |  Height:  |  Size: 877 B

View file

@ -0,0 +1,9 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="4.5" y="2.5" width="20" height="22.7097" rx="2.5" stroke="#6B6B6B" stroke-linejoin="round"/>
<path d="M8.06458 8.09668H17.5484" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
<path d="M20.9354 8.09668H21.6128" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
<path d="M20.9354 14.1936H21.6128" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
<path d="M20.9354 20.2905H21.6128" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
<path d="M8.06458 14.1936H17.5484" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
<path d="M8.06458 20.2905H17.5484" stroke="#00AE42" stroke-width="2" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 769 B

View file

@ -252,6 +252,10 @@ PresetsConfigSubstitutions PresetBundle::load_presets(AppConfig &config, Forward
else {
dir_user_presets = data_dir() + "/" + PRESET_USER_DIR + "/default";
}
fs::path user_folder(data_dir() + "/" + PRESET_USER_DIR);
if (!fs::exists(user_folder))
fs::create_directory(user_folder);
fs::path folder(dir_user_presets);
if (!fs::exists(folder))
fs::create_directory(folder);
@ -700,6 +704,11 @@ void PresetBundle::save_user_presets(AppConfig& config, std::vector<std::string>
const std::string dir_user_presets = data_dir() + "/" + PRESET_USER_DIR + "/"+ config.get("preset_folder");
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" enter, save to %1%")%dir_user_presets;
fs::path user_folder(data_dir() + "/" + PRESET_USER_DIR);
if (!fs::exists(user_folder))
fs::create_directory(user_folder);
fs::path folder(dir_user_presets);
if (!fs::exists(folder))
fs::create_directory(folder);

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;