ENH: do not block GUI when downloading hms file

Change-Id: I2175c86caba66c54e8a708a402bc3595e1e77ac9
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-02-15 08:56:31 +08:00 committed by Lane.Wei
parent e7ea07944f
commit dd792048a0
1 changed files with 20 additions and 19 deletions

View File

@ -248,9 +248,8 @@ wxString HMSQuery::query_print_error_msg(int print_error)
int HMSQuery::check_hms_info()
{
int result = 0;
boost::thread check_thread = boost::thread([this] {
bool download_new_hms_info = true;
// load local hms json file
std::string version = "";
if (load_from_local(version) == 0) {
@ -265,9 +264,11 @@ int HMSQuery::check_hms_info()
BOOST_LOG_TRIVIAL(info) << "HMS: check_hms_info need download new hms info = " << download_new_hms_info;
// download if version is update
if (download_new_hms_info) {
result = download_hms_info();
download_hms_info();
}
return result;
return;
});
return 0;
}
std::string get_hms_wiki_url(std::string error_code)