FIX: fix the total progress not correct issue

Change-Id: I18b9d5034726b45c7331f1dae5e2b24c5e5bd170
(cherry picked from commit ba8c691a2c94f7a2f2ff0ce7f195de20a6c22573)
This commit is contained in:
lane.wei 2022-11-10 16:37:51 +08:00 committed by Lane.Wei
parent e44e1c1f19
commit 4b655f06d4
2 changed files with 22 additions and 12 deletions

View File

@ -132,6 +132,7 @@ std::map<int, std::string> cli_errors = {
{CLI_EXPORT_3MF_ERROR, "Export 3mf error"}, {CLI_EXPORT_3MF_ERROR, "Export 3mf error"},
{CLI_NO_SUITABLE_OBJECTS, "Found no objects in print volume to slice"}, {CLI_NO_SUITABLE_OBJECTS, "Found no objects in print volume to slice"},
{CLI_VALIDATE_ERROR, "Validate print error"}, {CLI_VALIDATE_ERROR, "Validate print error"},
{CLI_OBJECTS_PARTLY_INSIDE, "Objects partly inside"},
{CLI_SLICING_ERROR, "Slice error"} {CLI_SLICING_ERROR, "Slice error"}
}; };
@ -193,9 +194,9 @@ typedef struct _cli_callback_mgr {
//notify_message = "Plate "+ std::to_string(m_plate_index) + "/" +std::to_string(m_plate_count)+ ": Percent " + std::to_string(m_progress) + ": "+m_message; //notify_message = "Plate "+ std::to_string(m_plate_index) + "/" +std::to_string(m_plate_count)+ ": Percent " + std::to_string(m_progress) + ": "+m_message;
char pipe_message[PIPE_BUFFER_SIZE] = {0}; char pipe_message[PIPE_BUFFER_SIZE] = {0};
strncpy(pipe_message, notify_message.c_str(), PIPE_BUFFER_SIZE); sprintf(pipe_message, "%s\n", notify_message.c_str());
int ret = write(m_pipe_fd, pipe_message,PIPE_BUFFER_SIZE); int ret = write(m_pipe_fd, pipe_message, strlen(pipe_message));
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": write returns "<<ret; BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": write returns "<<ret;
return; return;
@ -251,7 +252,7 @@ typedef struct _cli_callback_mgr {
} }
} }
else else
m_total_progress = 0.9*m_progress; m_total_progress = m_progress;
m_message = message; m_message = message;
m_warning_step = warning_step; m_warning_step = warning_step;
m_data_ready = true; m_data_ready = true;
@ -362,7 +363,7 @@ int CLI::run(int argc, char **argv)
} }
BOOST_LOG_TRIVIAL(info) << "Current BambuStudio Version "<< SLIC3R_VERSION << std::endl; BOOST_LOG_TRIVIAL(info) << "Current BambuStudio Version "<< SLIC3R_VERSION << std::endl;
/*BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc="<< argc << std::endl; /*BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc=" << argc << std::endl;
for (int index=0; index < argc; index++) for (int index=0; index < argc; index++)
BOOST_LOG_TRIVIAL(info) << "index="<< index <<", arg is "<< argv[index] <<std::endl; BOOST_LOG_TRIVIAL(info) << "index="<< index <<", arg is "<< argv[index] <<std::endl;
int debug_argc = 9; int debug_argc = 9;
@ -371,11 +372,11 @@ int CLI::run(int argc, char **argv)
"--slice", "--slice",
"0", "0",
"--export-3mf=output.3mf", "--export-3mf=output.3mf",
"test_thumbnail.3mf", "--curr-bed-type",
"--load-settings", "Engineering Plate",
"machine.json;process.json",
"--load-filaments", "--load-filaments",
"filament.json;filament.json;filament.json;filament.json" "GFSU00.json",
"fujian.3mf"
}; };
if (! this->setup(debug_argc, debug_argv))*/ if (! this->setup(debug_argc, debug_argv))*/
if (!this->setup(argc, argv)) if (!this->setup(argc, argv))

View File

@ -1753,14 +1753,23 @@ void GUI_App::init_networking_callbacks()
GUI_App::~GUI_App() GUI_App::~GUI_App()
{ {
if (app_config != nullptr) BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": enter");
if (app_config != nullptr) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": destroy app_config");
delete app_config; delete app_config;
}
if (preset_bundle != nullptr) if (preset_bundle != nullptr) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": destroy preset_bundle");
delete preset_bundle; delete preset_bundle;
}
if (preset_updater != nullptr) if (preset_updater != nullptr) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": destroy preset updater");
delete preset_updater; delete preset_updater;
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": exit");
} }
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>. // If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
@ -3271,7 +3280,7 @@ std::string GUI_App::handle_web_request(std::string cmd)
CallAfter([this] { CallAfter([this] {
wxGetApp().request_user_logout(); wxGetApp().request_user_logout();
}); });
} }
else if (command_str.compare("homepage_modeldepot") == 0) { else if (command_str.compare("homepage_modeldepot") == 0) {
CallAfter([this] { CallAfter([this] {
wxGetApp().open_mall_page_dialog(); wxGetApp().open_mall_page_dialog();