Merge branch 'master-remote' into SoftFever

This commit is contained in:
SoftFever 2022-10-14 20:40:22 +08:00
commit 834d43af1d
38 changed files with 432 additions and 158 deletions

View file

@ -1140,6 +1140,7 @@ bool MachineObject::has_recording()
int MachineObject::command_get_version()
{
BOOST_LOG_TRIVIAL(info) << "command_get_version";
json j;
j["info"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["info"]["command"] = "get_version";
@ -1716,6 +1717,9 @@ bool MachineObject::is_function_supported(PrinterFunction func)
case FUNC_LOCAL_TUNNEL:
func_name = "FUNC_LOCAL_TUNNEL";
break;
case FUNC_PRINT_WITHOUT_SD:
func_name = "FUNC_PRINT_WITHOUT_SD";
break;
default:
return true;
}
@ -2177,6 +2181,13 @@ int MachineObject::parse_json(std::string payload)
camera_timelapse = false;
}
}
if (jj["ipcam"].contains("ipcam_dev")) {
if (jj["ipcam"]["ipcam_dev"].get<std::string>() == "1") {
has_ipcam = true;
} else {
has_ipcam = false;
}
}
}
}
catch (...) {
@ -2673,8 +2684,12 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
void MachineObject::get_firmware_info()
{
m_firmware_valid = false;
if (m_firmware_thread_started)
return;
boost::thread update_info_thread = Slic3r::create_thread(
[&] {
m_firmware_thread_started = true;
int result = 0;
unsigned int http_code;
std::string http_body;
@ -2745,6 +2760,7 @@ void MachineObject::get_firmware_info()
catch (...) {
return;
}
m_firmware_thread_started = false;
m_firmware_valid = true;
}
);

View file

@ -69,6 +69,7 @@ enum PrinterFunction {
FUNC_MEDIA_FILE,
FUNC_REMOTE_TUNNEL,
FUNC_LOCAL_TUNNEL,
FUNC_PRINT_WITHOUT_SD,
FUNC_MAX
};
@ -492,6 +493,7 @@ public:
PrintingSpeedLevel _parse_printing_speed_lvl(int lvl);
/* camera */
bool has_ipcam { false };
bool camera_recording { false };
bool camera_timelapse { false };
bool camera_has_sdcard { false };
@ -617,6 +619,7 @@ public:
void update_slice_info(std::string project_id, std::string profile_id, std::string subtask_id, int plate_idx);
bool m_firmware_valid { false };
bool m_firmware_thread_started { false };
void get_firmware_info();
bool is_firmware_info_valid();
};

View file

@ -165,6 +165,31 @@ static std::string convert_studio_language_to_api(std::string lang_code)
return "en";*/
}
#ifdef _WIN32
bool is_associate_files(std::wstring extend)
{
wchar_t app_path[MAX_PATH];
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
std::wstring prog_id = L" Bambu.Studio.1";
std::wstring reg_base = L"Software\\Classes";
std::wstring reg_extension = reg_base + L"\\." + extend;
wchar_t szValueCurrent[1000];
DWORD dwType;
DWORD dwSize = sizeof(szValueCurrent);
int iRC = ::RegGetValueW(HKEY_CURRENT_USER, reg_extension.c_str(), nullptr, RRF_RT_ANY, &dwType, szValueCurrent, &dwSize);
bool bDidntExist = iRC == ERROR_FILE_NOT_FOUND;
if (!bDidntExist && ::wcscmp(szValueCurrent, prog_id.c_str()) == 0)
return true;
return false;
}
#endif
class BBLSplashScreen : public wxSplashScreen
{
public:
@ -1793,6 +1818,20 @@ void GUI_App::init_app_config()
// Save orig_version here, so its empty if no app_config existed before this run.
m_last_config_version = app_config->orig_version();//parse_semver_from_ini(app_config->config_path());
}
else {
#ifdef _WIN32
// update associate files from registry information
if (is_associate_files(L"3mf")) {
app_config->set("associate_3mf", "true");
}
if (is_associate_files(L"stl")) {
app_config->set("associate_stl", "true");
}
if (is_associate_files(L"step") && is_associate_files(L"stp")) {
app_config->set("associate_step", "true");
}
#endif // _WIN32
}
}
// returns true if found newer version and user agreed to use it
@ -2021,8 +2060,10 @@ bool GUI_App::on_init_inner()
associate_files(L"3mf");
if (app_config->get("associate_stl") == "true")
associate_files(L"stl");
if (app_config->get("associate_step") == "true")
if (app_config->get("associate_step") == "true") {
associate_files(L"step");
associate_files(L"stp");
}
if (app_config->get("associate_gcode") == "true")
associate_files(L"gcode");
#endif // __WXMSW__
@ -2270,7 +2311,7 @@ bool GUI_App::on_init_inner()
//#ifdef __linux__
// if (!m_post_initialized && m_opengl_initialized) {
//#else
if (!m_post_initialized) {
if (!m_post_initialized && !m_adding_script_handler) {
//#endif
m_post_initialized = true;
#ifdef WIN32
@ -4269,8 +4310,10 @@ void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_
associate_files(L"3mf");
if (app_config->get("associate_stl") == "true")
associate_files(L"stl");
if (app_config->get("associate_step") == "true")
if (app_config->get("associate_step") == "true") {
associate_files(L"step");
associate_files(L"stp");
}
}
else {
if (app_config->get("associate_gcode") == "true")

View file

@ -273,6 +273,8 @@ private:
boost::thread m_sync_update_thread;
bool enable_sync = false;
bool m_adding_script_handler { false };
public:
bool OnInit() override;
bool initialized() const { return m_initialized; }
@ -463,6 +465,8 @@ public:
//BBS
void load_url(wxString url);
void run_script(wxString js);
bool is_adding_script_handler() { return m_adding_script_handler; }
void set_adding_script_handler(bool status) { m_adding_script_handler = status; }
// Parameters extracted from the command line to be passed to GUI after initialization.
GUI_InitParams* init_params { nullptr };

View file

@ -112,10 +112,20 @@ private:
public:
MonitorPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
~MonitorPanel();
enum PrinterTab {
PT_STATUS = 0,
PT_MEDIA = 1,
PT_UPDATE = 2,
PT_HMS = 3,
PT_DEBUG = 4,
PT_MAX_NUM = 5
};
void init_bitmap();
void init_timer();
void init_tabpanel();
Tabbook* get_tabpanel() { return m_tabpanel; };
void set_default();
wxWindow* create_side_tools();

View file

@ -555,11 +555,22 @@ Sidebar::Sidebar(Plater *parent)
AppConfig *app_config = wxGetApp().app_config;
std::string str_bed_type = app_config->get("curr_bed_type");
m_bed_type_list->Select(atoi(str_bed_type.c_str()));
int bed_type_value = atoi(str_bed_type.c_str());
m_bed_type_list->Select(bed_type_value);
bed_type_sizer->Add(bed_type_title, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
bed_type_sizer->Add(m_bed_type_list, 1, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(10));
vsizer_printer->Add(bed_type_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
auto& project_config = wxGetApp().preset_bundle->project_config;
/*const t_config_enum_values* keys_map = print_config_def.get("curr_bed_type")->enum_keys_map;
BedType bed_type = btCount;
for (auto item : *keys_map) {
if (item.first == str_bed_type)
bed_type = (BedType)item.second;
}*/
BedType bed_type = (BedType)bed_type_value;
project_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
p->m_panel_printer_content->SetSizer(vsizer_printer);
p->m_panel_printer_content->Layout();
scrolled_sizer->Add(p->m_panel_printer_content, 0, wxTOP | wxEXPAND, FromDIP(14));
@ -9057,6 +9068,10 @@ void Plater::print_job_finished(wxCommandEvent &evt)
p->hide_select_machine_dlg();
p->main_frame->request_select_tab(MainFrame::TabPosition::tpMonitor);
//jump to monitor and select device status panel
MonitorPanel* curr_monitor = p->main_frame->m_monitor;
if(curr_monitor)
curr_monitor->get_tabpanel()->ChangeSelection(MonitorPanel::PrinterTab::PT_STATUS);
}
// Called when the Eject button is pressed.

View file

@ -691,6 +691,7 @@ wxWindow* PreferencesDialog::create_general_page()
auto title_sync_settings = create_item_title(_L("User sync"), page, _L("User sync"));
auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset");
#ifdef _WIN32
auto title_associate_file = create_item_title(_L("Associate files to BambuStudio"), page, _L("Associate files to BambuStudio"));
// associate file
@ -700,6 +701,7 @@ wxWindow* PreferencesDialog::create_general_page()
_L("If enabled, sets BambuStudio as default application to open .stl files"), 50, "associate_stl");
auto item_associate_step = create_item_checkbox(_L("Associate .step/.stp files to BambuStudio"), page,
_L("If enabled, sets BambuStudio as default application to open .step files"), 50, "associate_step");
#endif // _WIN32
auto title_backup = create_item_title(_L("Backup"), page, _L("Backup"));
@ -713,10 +715,12 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_sync_settings, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
#ifdef _WIN32
sizer_page->Add(title_associate_file, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_associate_3mf, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
#endif // _WIN32
sizer_page->Add(title_backup, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3));
sizer_page->Add(item_backup_interval, 0, wxTOP,FromDIP(3));

View file

@ -40,6 +40,59 @@ wxDEFINE_EVENT(EVT_EDIT_PRINT_NAME, wxCommandEvent);
static wxString task_canceled_text = _L("Task canceled");
std::string get_print_status_info(PrintDialogStatus status)
{
switch(status) {
case PrintStatusInit:
return "PrintStatusInit";
case PrintStatusNoUserLogin:
return "PrintStatusNoUserLogin";
case PrintStatusInvalidPrinter:
return "PrintStatusInvalidPrinter";
case PrintStatusConnectingServer:
return "PrintStatusConnectingServer";
case PrintStatusReading:
return "PrintStatusReading";
case PrintStatusReadingFinished:
return "PrintStatusReadingFinished";
case PrintStatusReadingTimeout:
return "PrintStatusReadingTimeout";
case PrintStatusInUpgrading:
return "PrintStatusInUpgrading";
case PrintStatusNeedUpgradingAms:
return "PrintStatusNeedUpgradingAms";
case PrintStatusInSystemPrinting:
return "PrintStatusInSystemPrinting";
case PrintStatusInPrinting:
return "PrintStatusInPrinting";
case PrintStatusDisableAms:
return "PrintStatusDisableAms";
case PrintStatusAmsMappingSuccess:
return "PrintStatusAmsMappingSuccess";
case PrintStatusAmsMappingInvalid:
return "PrintStatusAmsMappingInvalid";
case PrintStatusAmsMappingU0Invalid:
return "PrintStatusAmsMappingU0Invalid";
case PrintStatusAmsMappingValid:
return "PrintStatusAmsMappingValid";
case PrintStatusAmsMappingByOrder:
return "PrintStatusAmsMappingByOrder";
case PrintStatusRefreshingMachineList:
return "PrintStatusRefreshingMachineList";
case PrintStatusSending:
return "PrintStatusSending";
case PrintStatusSendingCanceled:
return "PrintStatusSendingCanceled";
case PrintStatusLanModeNoSdcard:
return "PrintStatusLanModeNoSdcard";
case PrintStatusNoSdcard:
return "PrintStatusNoSdcard";
}
return "unknown";
}
MachineListModel::MachineListModel() : wxDataViewVirtualListModel(INITIAL_NUMBER_OF_MACHINES) { ; }
void MachineListModel::display_machines(std::map<std::string, MachineObject *> list)
@ -1414,7 +1467,7 @@ void SelectMachineDialog::update_print_status_msg(wxString msg, bool is_warning,
void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxString> params)
{
if (m_print_status != status)
BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status;
BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")";
m_print_status = status;
// m_comboBox_printer
@ -1524,7 +1577,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
} else if (status == PrintDialogStatus::PrintStatusSendingCanceled) {
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
} else if (status == PrintDialogStatus::PrintStatusLanModeNoSdcard) {
wxString msg_text = _L("An SD card needs to be inserted before printing via LAN.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(true);
@ -1534,6 +1587,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
update_print_status_msg(msg_text, false, false);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
wxString msg_text = _L("An SD card needs to be inserted before printing.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
}
}
@ -1913,6 +1971,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
if (obj) {
obj->command_get_version();
obj->command_request_push_all();
dev->set_selected_machine(m_printer_last_select);
update_select_layout(obj);
} else {
@ -2016,11 +2075,17 @@ void SelectMachineDialog::update_show_status()
show_status(PrintDialogStatus::PrintStatusInPrinting);
return;
}
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD)) {
show_status(PrintDialogStatus::PrintStatusNoSdcard);
return;
}
// check sdcard when if lan mode printer
if (obj_->is_lan_mode_printer()) {
if (!obj_->has_sdcard()) {
show_status(PrintDialogStatus::PrintStatusNoSdcard);
show_status(PrintDialogStatus::PrintStatusLanModeNoSdcard);
return;
}
}

View file

@ -248,9 +248,12 @@ enum PrintDialogStatus {
PrintStatusRefreshingMachineList,
PrintStatusSending,
PrintStatusSendingCanceled,
PrintStatusLanModeNoSdcard,
PrintStatusNoSdcard
};
std::string get_print_status_info(PrintDialogStatus status);
class SelectMachineDialog : public DPIDialog
{
private:

View file

@ -1341,7 +1341,7 @@ void StatusPanel::update(MachineObject *obj)
m_timelapse_button->Hide();
}
if (obj->is_function_supported(PrinterFunction::FUNC_RECORDING)) {
if (obj->is_function_supported(PrinterFunction::FUNC_RECORDING) || obj->has_ipcam) {
m_recording_button->Show();
} else {
m_recording_button->Hide();
@ -1397,6 +1397,10 @@ void StatusPanel::update_error_message()
wxGetApp().get_hms_query()->query_print_error_msg(obj->print_error),
print_error_str);
show_error_message(error_msg);
//hint dialog
ConfirmHintDialog print_error_dlg(this->GetParent(), wxID_ANY, _L("Warning"));
print_error_dlg.SetHint(error_msg);
print_error_dlg.ShowModal();
}
before_error_code = obj->print_error;
}

View file

@ -13,10 +13,6 @@ namespace GUI {
static const wxColour TEXT_NORMAL_CLR = wxColour(0, 174, 66);
static const wxColour TEXT_FAILED_CLR = wxColour(255, 111, 0);
wxString normal_upgrade_hint = _L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating.");
wxString force_upgrade_hint = _L("An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'.");
wxString consistency_upgrade_hint = _L("The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio.");
MachineInfoPanel::MachineInfoPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
:wxPanel(parent, id, pos, size, style)
{
@ -503,47 +499,53 @@ void MachineInfoPanel::update_ams(MachineObject *obj)
ams_sn = "-";
ams_ver = "-";
} else {
// update ams img
wxString ams_text = wxString::Format("AMS%s", std::to_string(ams_id + 1));
ams_name = ams_text;
if (m_obj->upgrade_display_state == (int)MachineObject::UpgradingDisplayState::UpgradingInProgress) {
ams_ver = "-";
amspanel->m_ams_new_version_img->Hide();
}
else {
// update ams img
wxString ams_text = wxString::Format("AMS%s", std::to_string(ams_id + 1));
ams_name = ams_text;
if (obj->new_ver_list.empty() && !obj->m_new_ver_list_exist) {
if (obj->upgrade_new_version
&& obj->ams_new_version_number.compare(it->second.sw_ver) != 0) {
amspanel->m_ams_new_version_img->Show();
if (obj->ams_new_version_number.empty()) {
ams_ver = wxString::Format("%s", it->second.sw_ver);
} else {
ams_ver = wxString::Format("%s->%s", it->second.sw_ver, obj->ams_new_version_number);
}
} else {
amspanel->m_ams_new_version_img->Hide();
if (obj->ams_new_version_number.empty()) {
wxString ver_text = wxString::Format("%s", it->second.sw_ver);
ams_ver = ver_text;
} else {
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
ams_ver = ver_text;
}
}
} else {
std::string ams_idx = (boost::format("ams/%1%") % ams_id).str();
auto ver_item = obj->new_ver_list.find(ams_idx);
if (ver_item == obj->new_ver_list.end()) {
amspanel->m_ams_new_version_img->Hide();
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
ams_ver = ver_text;
} else {
if (ver_item->second.sw_new_ver != ver_item->second.sw_ver) {
if (obj->new_ver_list.empty() && !obj->m_new_ver_list_exist) {
if (obj->upgrade_new_version
&& obj->ams_new_version_number.compare(it->second.sw_ver) != 0) {
amspanel->m_ams_new_version_img->Show();
wxString ver_text = wxString::Format("%s->%s", ver_item->second.sw_ver, ver_item->second.sw_new_ver);
ams_ver = ver_text;
if (obj->ams_new_version_number.empty()) {
ams_ver = wxString::Format("%s", it->second.sw_ver);
} else {
ams_ver = wxString::Format("%s->%s", it->second.sw_ver, obj->ams_new_version_number);
}
} else {
amspanel->m_ams_new_version_img->Hide();
wxString ver_text = wxString::Format("%s(%s)", ver_item->second.sw_ver, _L("Latest version"));
if (obj->ams_new_version_number.empty()) {
wxString ver_text = wxString::Format("%s", it->second.sw_ver);
ams_ver = ver_text;
} else {
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
ams_ver = ver_text;
}
}
} else {
std::string ams_idx = (boost::format("ams/%1%") % ams_id).str();
auto ver_item = obj->new_ver_list.find(ams_idx);
if (ver_item == obj->new_ver_list.end()) {
amspanel->m_ams_new_version_img->Hide();
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
ams_ver = ver_text;
} else {
if (ver_item->second.sw_new_ver != ver_item->second.sw_ver) {
amspanel->m_ams_new_version_img->Show();
wxString ver_text = wxString::Format("%s->%s", ver_item->second.sw_ver, ver_item->second.sw_new_ver);
ams_ver = ver_text;
} else {
amspanel->m_ams_new_version_img->Hide();
wxString ver_text = wxString::Format("%s(%s)", ver_item->second.sw_ver, _L("Latest version"));
ams_ver = ver_text;
}
}
}
}
@ -658,7 +660,9 @@ void MachineInfoPanel::upgrade_firmware_internal() {
void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
{
ConfirmHintDialog* confirm_dlg = new ConfirmHintDialog(this->GetParent(), wxID_ANY, _L("Upgrade firmware"));
confirm_dlg->SetHint(normal_upgrade_hint);
confirm_dlg->SetHint(_L(
"Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."
));
confirm_dlg->Bind(EVT_CONFIRM_HINT, [this](wxCommandEvent &e) {
if (m_obj){
m_obj->command_upgrade_confirm();
@ -671,7 +675,9 @@ void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
void MachineInfoPanel::on_consisitency_upgrade_firmware(wxCommandEvent &event)
{
ConfirmHintDialog* confirm_dlg = new ConfirmHintDialog(this->GetParent(), wxID_ANY, _L("Upgrade firmware"));
confirm_dlg->SetHint(normal_upgrade_hint);
confirm_dlg->SetHint(_L(
"Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."
));
confirm_dlg->Bind(EVT_CONFIRM_HINT, [this](wxCommandEvent &e) {
if (m_obj){
m_obj->command_consistency_upgrade_confirm();
@ -794,7 +800,9 @@ void UpgradePanel::update(MachineObject *obj)
if (m_obj->upgrade_force_upgrade) {
m_show_forced_hint = false; //lock hint
ConfirmHintDialog* force_dlg = new ConfirmHintDialog(m_scrolledWindow, wxID_ANY, _L("Upgrade firmware"));
force_dlg->SetHint(force_upgrade_hint);
force_dlg->SetHint(_L(
"An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'."
));
force_dlg->Bind(EVT_CONFIRM_HINT, &MachineInfoPanel::on_upgrade_firmware, m_push_upgrade_panel);
if (force_dlg->ShowModal())
delete force_dlg;
@ -810,7 +818,9 @@ void UpgradePanel::update(MachineObject *obj)
if (m_obj->upgrade_consistency_request) {
m_show_consistency_hint = false;
ConfirmHintDialog* consistency_dlg = new ConfirmHintDialog(m_scrolledWindow, wxID_ANY, _L("Upgrade firmware"));
consistency_dlg->SetHint(consistency_upgrade_hint);
consistency_dlg->SetHint(_L(
"The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio."
));
consistency_dlg->Bind(EVT_CONFIRM_HINT, &MachineInfoPanel::on_consisitency_upgrade_firmware, m_push_upgrade_panel);
if (consistency_dlg->ShowModal())
delete consistency_dlg;

View file

@ -35,7 +35,7 @@ namespace Slic3r { namespace GUI {
json m_ProfileJson;
GuideFrame::GuideFrame(GUI_App *pGUI, long style)
: wxDialog((wxWindow *) (pGUI->mainframe), wxID_ANY, "BambuStudio", wxDefaultPosition, wxDefaultSize, style),
: DPIDialog((wxWindow *) (pGUI->mainframe), wxID_ANY, "BambuStudio", wxDefaultPosition, wxDefaultSize, style),
m_appconfig_new()
{
// INI

View file

@ -34,7 +34,7 @@
namespace Slic3r { namespace GUI {
class GuideFrame : public wxDialog
class GuideFrame : public DPIDialog
{
public:
GuideFrame(GUI_App *pGUI, long style = wxCAPTION | wxCLOSE_BOX | wxSYSTEM_MENU);
@ -92,6 +92,8 @@ public:
int InstallPlugin();
int ShowPluginStatus(int status, int percent, bool &cancel);
void on_dpi_changed(const wxRect &suggested_rect) {}
private:
GUI_App *m_MainPtr;
AppConfig m_appconfig_new;

View file

@ -185,11 +185,21 @@ bool ProgressDialog::Create(const wxString &title, const wxString &message, int
m_sizer_main->Add(m_simplebook, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
} else {
m_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1), 0);
wxScrolledWindow* m_msg_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_msg_scrolledWindow->SetScrollRate(0,5);
m_msg_scrolledWindow->SetMinSize(wxSize(FromDIP(80), FromDIP(300)));
wxBoxSizer* m_msg_sizer= new wxBoxSizer(wxVERTICAL);
m_msg = new wxStaticText(m_msg_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1), 0);
m_msg->Wrap(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x);
m_msg->SetFont(::Label::Body_13);
m_msg->SetForegroundColour(PROGRESSDIALOG_GREY_700);
m_sizer_main->Add(m_msg, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
m_msg_sizer->Add( m_msg, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(5) );
m_msg_scrolledWindow->SetSizer(m_msg_sizer);
m_msg_scrolledWindow->Layout();
m_msg_sizer->Fit(m_msg_scrolledWindow);
m_sizer_main->Add(m_msg_scrolledWindow, 0, wxEXPAND | wxALL, FromDIP(28));
}
@ -237,7 +247,7 @@ bool ProgressDialog::Create(const wxString &title, const wxString &message, int
}
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(16));
m_sizer_main->Add(m_sizer_bottom, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
m_sizer_main->Add(m_sizer_bottom, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(10));
SetSizer(m_sizer_main);

View file

@ -107,8 +107,12 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
#ifndef __WIN32__
Slic3r::GUI::wxGetApp().CallAfter([webView] {
#endif
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": begin to add script message handler for wx.";
Slic3r::GUI::wxGetApp().set_adding_script_handler(true);
if (!webView->AddScriptMessageHandler("wx"))
wxLogError("Could not add script message handler");
Slic3r::GUI::wxGetApp().set_adding_script_handler(false);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": finished add script message handler for wx.";
#ifndef __WIN32__
});
#endif