NEW:support for sending print job from SD card view
Change-Id: I8366345ae4323c1b568bfd267d036e2474ff969a
This commit is contained in:
parent
3d1f61c7ed
commit
7af252fa99
|
@ -0,0 +1,18 @@
|
|||
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_d_12_4)">
|
||||
<rect x="2" y="34" width="32" height="32" rx="2" transform="rotate(-90 2 34)" fill="#EEEEEE"/>
|
||||
</g>
|
||||
<path d="M13.3006 18.65C12.8998 18.3331 12.8998 17.6669 13.3006 17.35L19.8807 12.1469C20.351 11.7751 21 12.152 21 12.7969L21 23.2031C21 23.848 20.351 24.2249 19.8807 23.8531L13.3006 18.65Z" fill="#909090"/>
|
||||
<defs>
|
||||
<filter id="filter0_d_12_4" x="0.953722" y="0.953723" width="34.0926" height="34.0926" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset/>
|
||||
<feGaussianBlur stdDeviation="0.523139"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_12_4"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_12_4" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,18 @@
|
|||
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_d_12_8)">
|
||||
<rect x="34" y="2" width="32" height="32" rx="2" transform="rotate(90 34 2)" fill="#EEEEEE"/>
|
||||
</g>
|
||||
<path d="M22.6994 17.35C23.1002 17.6669 23.1002 18.3331 22.6994 18.65L16.1193 23.8531C15.649 24.2249 15 23.848 15 23.2031L15 12.7969C15 12.152 15.649 11.7751 16.1193 12.1469L22.6994 17.35Z" fill="#909090"/>
|
||||
<defs>
|
||||
<filter id="filter0_d_12_8" x="0.953722" y="0.953722" width="34.0926" height="34.0926" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset/>
|
||||
<feGaussianBlur stdDeviation="0.523139"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_12_8"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_12_8" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -3188,6 +3188,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
|
||||
bool _BBS_3MF_Importer::_handle_end_object()
|
||||
{
|
||||
if (!m_load_model) {
|
||||
delete m_curr_object;
|
||||
m_curr_object = nullptr;
|
||||
return true;
|
||||
}
|
||||
if (!m_curr_object || (m_curr_object->id == -1)) {
|
||||
add_error("Found invalid object");
|
||||
return false;
|
||||
|
|
|
@ -1390,21 +1390,28 @@ void MachineObject::parse_version_func()
|
|||
is_support_ai_monitoring = true;
|
||||
is_support_ams_humidity = true;
|
||||
}
|
||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER)
|
||||
local_use_ssl = false;
|
||||
else {
|
||||
local_use_ssl = ota_version->second.sw_ver.compare("01.03.01.04") >= 0;
|
||||
|
||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
|
||||
local_use_ssl_for_mqtt = false;
|
||||
local_use_ssl_for_ftp = true;
|
||||
}else {
|
||||
local_use_ssl_for_mqtt = ota_version->second.sw_ver.compare("01.03.01.04") >= 0;
|
||||
local_use_ssl_for_ftp = true;
|
||||
}
|
||||
|
||||
is_support_remote_tunnel = true;
|
||||
local_camera_proto = (ota_version->second.sw_ver.compare("01.03.01.04") >= 0
|
||||
|| (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.20.39") >= 0)) ? 2 : 0;
|
||||
}
|
||||
} else if (printer_type == "C11") {
|
||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER)
|
||||
local_use_ssl = false;
|
||||
else {
|
||||
local_use_ssl = true;
|
||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
|
||||
local_use_ssl_for_mqtt = false;
|
||||
local_use_ssl_for_ftp = false;
|
||||
} else {
|
||||
local_use_ssl_for_mqtt = true;
|
||||
local_use_ssl_for_ftp = true;
|
||||
}
|
||||
|
||||
is_cloud_print_only = true;
|
||||
if (ota_version != module_vers.end()) {
|
||||
is_support_send_to_sdcard = ota_version->second.sw_ver.compare("01.02.00.00") >= 0;
|
||||
|
@ -1415,6 +1422,16 @@ void MachineObject::parse_version_func()
|
|||
if (esp32_version != module_vers.end()) {
|
||||
ams_support_auto_switch_filament_flag = esp32_version->second.sw_ver.compare("00.03.11.50") >= 0;
|
||||
}
|
||||
} else if (printer_type == "C12") {
|
||||
is_support_ai_monitoring = true;
|
||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
|
||||
local_use_ssl_for_mqtt = false;
|
||||
local_use_ssl_for_ftp = false;
|
||||
}
|
||||
else {
|
||||
local_use_ssl_for_mqtt = true;
|
||||
local_use_ssl_for_ftp = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2146,8 +2163,9 @@ void MachineObject::set_print_state(std::string status)
|
|||
print_status = status;
|
||||
}
|
||||
|
||||
int MachineObject::connect(bool is_anonymous)
|
||||
int MachineObject::connect(bool is_anonymous, bool use_openssl)
|
||||
{
|
||||
if (dev_ip.empty()) return -1;
|
||||
std::string username;
|
||||
std::string password;
|
||||
if (!is_anonymous) {
|
||||
|
@ -2735,10 +2753,10 @@ int MachineObject::parse_json(std::string payload)
|
|||
|
||||
/* get fimware type */
|
||||
try {
|
||||
if (jj.contains("lifecycle")) {
|
||||
if (jj["lifecycle"].get<std::string>() == "engineer")
|
||||
if (jj.contains("mess_production_state")) {
|
||||
if (jj["mess_production_state"].get<std::string>() == "engineer")
|
||||
firmware_type = PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER;
|
||||
else if (jj["lifecycle"].get<std::string>() == "product")
|
||||
else if (jj["mess_production_state"].get<std::string>() == "product")
|
||||
firmware_type = PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION;
|
||||
}
|
||||
}
|
||||
|
@ -3949,9 +3967,10 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
/* update userMachineList info */
|
||||
auto it = userMachineList.find(dev_id);
|
||||
if (it != userMachineList.end()) {
|
||||
it->second->dev_ip = dev_ip;
|
||||
it->second->bind_state = bind_state;
|
||||
it->second->bind_sec_link = sec_link;
|
||||
it->second->dev_ip = dev_ip;
|
||||
it->second->bind_state = bind_state;
|
||||
it->second->bind_sec_link = sec_link;
|
||||
it->second->dev_connection_type = connect_type;
|
||||
}
|
||||
|
||||
/* update localMachineList */
|
||||
|
@ -4150,7 +4169,7 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
|||
if (last_selected->second->is_connecting() && !need_disconnect)
|
||||
return false;
|
||||
|
||||
if (!need_disconnect) {m_agent->disconnect_printer();}
|
||||
if (!need_disconnect) {m_agent->disconnect_printer(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4166,7 +4185,7 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
|||
if (m_agent) {
|
||||
if (!need_disconnect) {m_agent->disconnect_printer();}
|
||||
it->second->reset();
|
||||
it->second->connect();
|
||||
it->second->connect(false, it->second->local_use_ssl_for_mqtt);
|
||||
it->second->set_lan_mode_connection_state(true);
|
||||
}
|
||||
}
|
||||
|
@ -4182,7 +4201,7 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
|||
}
|
||||
} else {
|
||||
it->second->reset();
|
||||
it->second->connect();
|
||||
it->second->connect(false, it->second->local_use_ssl_for_mqtt);
|
||||
it->second->set_lan_mode_connection_state(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,6 +410,8 @@ public:
|
|||
std::string dev_ip;
|
||||
std::string dev_id;
|
||||
bool local_use_ssl { false };
|
||||
bool local_use_ssl_for_mqtt { false };
|
||||
bool local_use_ssl_for_ftp { false };
|
||||
float nozzle_diameter { 0.0f };
|
||||
std::string dev_connection_type; /* lan | cloud */
|
||||
std::string connection_type() { return dev_connection_type; }
|
||||
|
@ -662,7 +664,7 @@ public:
|
|||
std::vector<HMSItem> hms_list;
|
||||
|
||||
/* machine mqtt apis */
|
||||
int connect(bool is_anonymous = false);
|
||||
int connect(bool is_anonymous = false, bool use_openssl = true);
|
||||
int disconnect();
|
||||
|
||||
json_diff print_json;
|
||||
|
|
|
@ -1881,7 +1881,7 @@ void GUI_App::init_networking_callbacks()
|
|||
if (state == ConnectStatus::ConnectStatusOk) {
|
||||
obj->command_request_push_all();
|
||||
obj->command_get_version();
|
||||
event.SetInt(1);
|
||||
event.SetInt(0);
|
||||
event.SetString(obj->dev_id);
|
||||
} else if (state == ConnectStatus::ConnectStatusFailed) {
|
||||
obj->set_access_code("");
|
||||
|
@ -1895,18 +1895,28 @@ void GUI_App::init_networking_callbacks()
|
|||
text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->dev_name), obj->dev_id, msg);
|
||||
wxGetApp().show_dialog(text);
|
||||
}
|
||||
event.SetInt(0);
|
||||
event.SetInt(-1);
|
||||
} else if (state == ConnectStatus::ConnectStatusLost) {
|
||||
m_device_manager->set_selected_machine("", true);
|
||||
event.SetInt(0);
|
||||
event.SetInt(-1);
|
||||
BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = lost";
|
||||
} else {
|
||||
event.SetInt(0);
|
||||
event.SetInt(-1);
|
||||
BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = " << state;
|
||||
}
|
||||
|
||||
obj->set_lan_mode_connection_state(false);
|
||||
}
|
||||
else {
|
||||
if (state == ConnectStatus::ConnectStatusOk) {
|
||||
event.SetInt(1);
|
||||
event.SetString(obj->dev_id);
|
||||
}
|
||||
else {
|
||||
event.SetInt(-2);
|
||||
event.SetString(obj->dev_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.SetEventObject(this);
|
||||
wxPostEvent(this, event);
|
||||
|
|
|
@ -140,7 +140,7 @@ void PrintJob::process()
|
|||
}
|
||||
|
||||
/* check gcode is valid */
|
||||
if (!plate->is_valid_gcode_file()) {
|
||||
if (!plate->is_valid_gcode_file() && m_print_type == "from_normal") {
|
||||
update_status(curr_percent, check_gcode_failed_str);
|
||||
return;
|
||||
}
|
||||
|
@ -171,11 +171,11 @@ void PrintJob::process()
|
|||
|
||||
// local print access
|
||||
params.dev_ip = m_dev_ip;
|
||||
params.use_ssl = m_local_use_ssl;
|
||||
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
|
||||
params.use_ssl_for_mqtt = m_local_use_ssl_for_mqtt;
|
||||
params.username = "bblp";
|
||||
params.password = m_access_code;
|
||||
|
||||
|
||||
// check access code and ip address
|
||||
if (this->connection_type == "lan") {
|
||||
params.dev_id = m_dev_id;
|
||||
|
@ -190,11 +190,14 @@ void PrintJob::process()
|
|||
m_job_finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
params.project_name = "";
|
||||
params.filename = "";
|
||||
}
|
||||
|
||||
params.dev_id = m_dev_id;
|
||||
params.ftp_folder = m_ftp_folder;
|
||||
//params.project_name = project_name;
|
||||
//params.project_name = m_project_name;
|
||||
|
||||
|
||||
params.filename = job_data._3mf_path.string();
|
||||
|
@ -210,6 +213,8 @@ void PrintJob::process()
|
|||
params.connection_type = this->connection_type;
|
||||
params.task_use_ams = this->task_use_ams;
|
||||
params.task_bed_type = this->task_bed_type;
|
||||
params.print_type = this->m_print_type;
|
||||
|
||||
if (wxGetApp().model().model_info && wxGetApp().model().model_info.get()) {
|
||||
ModelInfo* model_info = wxGetApp().model().model_info.get();
|
||||
auto origin_profile_id = model_info->metadata_items.find(BBL_DESIGNER_PROFILE_ID_TAG);
|
||||
|
@ -245,10 +250,8 @@ void PrintJob::process()
|
|||
}
|
||||
|
||||
|
||||
if (params.preset_name.empty() && params.project_name.empty()) {
|
||||
params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString();
|
||||
params.project_name = m_project_name;
|
||||
}
|
||||
if (params.preset_name.empty()) {params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString();}
|
||||
if (params.project_name.empty()) {params.project_name = m_project_name;}
|
||||
|
||||
wxString error_text;
|
||||
wxString msg_text;
|
||||
|
|
|
@ -46,8 +46,10 @@ public:
|
|||
std::string task_ams_mapping;
|
||||
std::string task_ams_mapping_info;
|
||||
std::string connection_type;
|
||||
std::string m_print_type;
|
||||
|
||||
bool m_local_use_ssl { true };
|
||||
bool m_local_use_ssl_for_mqtt { true };
|
||||
bool m_local_use_ssl_for_ftp { true };
|
||||
bool task_bed_leveling;
|
||||
bool task_flow_cali;
|
||||
bool task_vibration_cali;
|
||||
|
|
|
@ -130,7 +130,8 @@ void SendJob::process()
|
|||
params.dev_ip = m_dev_ip;
|
||||
params.username = "bblp";
|
||||
params.password = m_access_code;
|
||||
params.use_ssl = m_local_use_ssl;
|
||||
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
|
||||
params.use_ssl_for_mqtt = m_local_use_ssl_for_mqtt;
|
||||
|
||||
// check access code and ip address
|
||||
params.dev_id = m_dev_id;
|
||||
|
@ -219,7 +220,8 @@ void SendJob::process()
|
|||
params.dev_ip = m_dev_ip;
|
||||
params.username = "bblp";
|
||||
params.password = m_access_code;
|
||||
params.use_ssl = m_local_use_ssl;
|
||||
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
|
||||
params.use_ssl_for_mqtt = m_local_use_ssl_for_mqtt;
|
||||
wxString error_text;
|
||||
wxString msg_text;
|
||||
|
||||
|
|
|
@ -37,11 +37,12 @@ public:
|
|||
std::string m_project_name;
|
||||
std::string m_dev_ip;
|
||||
std::string m_access_code;
|
||||
bool m_local_use_ssl{false};
|
||||
std::string task_bed_type;
|
||||
std::string task_ams_mapping;
|
||||
std::string connection_type;
|
||||
|
||||
bool m_local_use_ssl_for_ftp{false};
|
||||
bool m_local_use_ssl_for_mqtt{false};
|
||||
bool cloud_print_only { false };
|
||||
bool has_sdcard { false };
|
||||
bool task_use_ams { true };
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "ImageGrid.h"
|
||||
#include "I18N.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
#include "Plater.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "Widgets/SwitchButton.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
|
@ -466,7 +466,7 @@ void Slic3r::GUI::MediaFilePanel::doAction(size_t index, int action)
|
|||
} else if (action == 1) {
|
||||
if (fs->GetFileType() == PrinterFileSystem::F_MODEL) {
|
||||
if (index != -1) {
|
||||
fs->FetchModel(index, [](std::string const & data) {
|
||||
fs->FetchModel(index, [fs,index](std::string const & data) {
|
||||
Slic3r::DynamicPrintConfig config;
|
||||
Slic3r::Model model;
|
||||
Slic3r::PlateDataPtrs plate_data_list;
|
||||
|
@ -475,6 +475,10 @@ void Slic3r::GUI::MediaFilePanel::doAction(size_t index, int action)
|
|||
if (!Slic3r::load_gcode_3mf_from_stream(is, &config, &model, &plate_data_list, &file_version))
|
||||
return;
|
||||
// TODO: print gcode 3mf
|
||||
auto &file = fs->GetFile(index);
|
||||
Slic3r::GUI::wxGetApp().plater()->update_print_required_data(config, model, plate_data_list, from_u8(file.name).ToStdString());
|
||||
wxPostEvent(Slic3r::GUI::wxGetApp().plater(), SimpleEvent(EVT_PRINT_FROM_SDCARD_VIEW));
|
||||
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -165,6 +165,8 @@ wxDEFINE_EVENT(EVT_INSTALL_PLUGIN_HINT, wxCommandEvent);
|
|||
wxDEFINE_EVENT(EVT_PREVIEW_ONLY_MODE_HINT, wxCommandEvent);
|
||||
//BBS: change light/dark mode
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_COLOR_MODE_CHANGED, SimpleEvent);
|
||||
//BBS: print
|
||||
wxDEFINE_EVENT(EVT_PRINT_FROM_SDCARD_VIEW, SimpleEvent);
|
||||
|
||||
|
||||
bool Plater::has_illegal_filename_characters(const wxString& wxs_name)
|
||||
|
@ -2092,6 +2094,7 @@ struct Plater::priv
|
|||
//void show_action_buttons(const bool is_ready_to_slice) const;
|
||||
bool show_publish_dlg(bool show = true);
|
||||
void update_publish_dialog_status(wxString &msg, int percent = -1);
|
||||
void on_action_print_plate_from_sdcard(SimpleEvent&);
|
||||
|
||||
// Set the bed shape to a single closed 2D polygon(array of two element arrays),
|
||||
// triangulate the bed and store the triangles into m_bed.m_triangles,
|
||||
|
@ -2167,6 +2170,7 @@ struct Plater::priv
|
|||
//BBS: add popup object table logic
|
||||
bool PopupObjectTable(int object_id, int volume_id, const wxPoint& position);
|
||||
void on_action_send_to_printer(bool isall = false);
|
||||
void update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
private:
|
||||
bool layers_height_allowed() const;
|
||||
|
||||
|
@ -2490,6 +2494,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
q->Bind(EVT_GLTOOLBAR_SLICE_PLATE, &priv::on_action_slice_plate, this);
|
||||
q->Bind(EVT_GLTOOLBAR_SLICE_ALL, &priv::on_action_slice_all, this);
|
||||
q->Bind(EVT_GLTOOLBAR_PRINT_PLATE, &priv::on_action_print_plate, this);
|
||||
q->Bind(EVT_PRINT_FROM_SDCARD_VIEW, &priv::on_action_print_plate_from_sdcard, this);
|
||||
q->Bind(EVT_GLTOOLBAR_SELECT_SLICED_PLATE, &priv::on_action_select_sliced_plate, this);
|
||||
q->Bind(EVT_GLTOOLBAR_PRINT_ALL, &priv::on_action_print_all, this);
|
||||
q->Bind(EVT_GLTOOLBAR_EXPORT_GCODE, &priv::on_action_export_gcode, this);
|
||||
|
@ -6177,17 +6182,31 @@ void Plater::priv::on_action_print_plate(SimpleEvent&)
|
|||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received print plate event\n" ;
|
||||
}
|
||||
|
||||
//do not check login for lan printing
|
||||
////BBS check login status
|
||||
//if (!wxGetApp().check_login()) return;
|
||||
|
||||
|
||||
//BBS
|
||||
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL);
|
||||
m_select_machine_dlg->prepare(partplate_list.get_curr_plate_index());
|
||||
m_select_machine_dlg->ShowModal();
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_print_plate_from_sdcard(SimpleEvent&)
|
||||
{
|
||||
if (q != nullptr) {
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received print plate event\n";
|
||||
}
|
||||
|
||||
//BBS
|
||||
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(PrintFromType::FROM_SDCARD_VIEW);
|
||||
m_select_machine_dlg->prepare(0);
|
||||
m_select_machine_dlg->ShowModal();
|
||||
}
|
||||
|
||||
void Plater::priv::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
{
|
||||
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->update_print_required_data(config, model, plate_data_list, file_name);
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_send_to_printer(bool isall)
|
||||
{
|
||||
|
@ -10245,6 +10264,12 @@ bool Plater::undo_redo_string_getter(const bool is_undo, int idx, const char** o
|
|||
return false;
|
||||
}
|
||||
|
||||
void Plater::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
{
|
||||
p->update_print_required_data(config, model, plate_data_list, file_name);
|
||||
}
|
||||
|
||||
|
||||
void Plater::undo_redo_topmost_string_getter(const bool is_undo, std::string& out_text)
|
||||
{
|
||||
const std::vector<UndoRedo::Snapshot>& ss_stack = p->undo_redo_stack().snapshots();
|
||||
|
|
|
@ -91,6 +91,7 @@ wxDECLARE_EVENT(EVT_INSTALL_PLUGIN_HINT, wxCommandEvent);
|
|||
wxDECLARE_EVENT(EVT_UPDATE_PLUGINS_WHEN_LAUNCH, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_PREVIEW_ONLY_MODE_HINT, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_COLOR_MODE_CHANGED, SimpleEvent);
|
||||
wxDECLARE_EVENT(EVT_PRINT_FROM_SDCARD_VIEW, SimpleEvent);
|
||||
|
||||
|
||||
const wxString DEFAULT_PROJECT_NAME = "Untitled";
|
||||
|
@ -373,6 +374,7 @@ public:
|
|||
void redo_to(int selection);
|
||||
bool undo_redo_string_getter(const bool is_undo, int idx, const char** out_text);
|
||||
void undo_redo_topmost_string_getter(const bool is_undo, std::string& out_text);
|
||||
void update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
bool search_string_getter(int idx, const char** label, const char** tooltip);
|
||||
// For the memory statistics.
|
||||
const Slic3r::UndoRedo::Stack& undo_redo_stack_main() const;
|
||||
|
|
|
@ -1298,7 +1298,8 @@ void InputIpAddressDialog::on_ok(wxMouseEvent& evt)
|
|||
m_send_job = std::make_shared<SendJob>(m_status_bar, wxGetApp().plater(), m_obj->dev_id);
|
||||
m_send_job->m_dev_ip = ip.ToStdString();
|
||||
m_send_job->m_access_code = str_access_code.ToStdString();
|
||||
m_send_job->m_local_use_ssl = m_obj->local_use_ssl;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = m_obj->local_use_ssl_for_mqtt;
|
||||
m_send_job->m_local_use_ssl_for_ftp = m_obj->local_use_ssl_for_ftp;
|
||||
m_send_job->connection_type = m_obj->connection_type();
|
||||
m_send_job->cloud_print_only = true;
|
||||
m_send_job->has_sdcard = m_obj->has_sdcard();
|
||||
|
|
|
@ -1056,19 +1056,40 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
}
|
||||
});
|
||||
|
||||
auto m_sizer_thumbnail_area = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto last_plate_panel = new wxWindow(m_scrollable_region, wxID_ANY);
|
||||
last_plate_panel->SetBackgroundColour(*wxWHITE);
|
||||
auto last_plate_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
last_plate_panel->SetMinSize(wxSize(FromDIP(32), FromDIP(32)));
|
||||
m_bitmap_last_plate = new wxStaticBitmap(last_plate_panel, wxID_ANY, create_scaled_bitmap("go_last_plate", this, 32), wxDefaultPosition, wxSize(FromDIP(32), FromDIP(32)), 0);
|
||||
last_plate_sizer->Add(m_bitmap_last_plate, 0, wxALIGN_CENTER, 0);
|
||||
last_plate_panel->SetSizer(last_plate_sizer);
|
||||
|
||||
m_panel_image = new wxPanel(m_scrollable_region, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
m_panel_image->SetBackgroundColour(m_colour_def_color);
|
||||
|
||||
m_sizer_thumbnail = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer_thumbnail = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_thumbnailPanel = new ThumbnailPanel(m_panel_image);
|
||||
m_thumbnailPanel->SetSize(wxSize(FromDIP(256), FromDIP(256)));
|
||||
m_thumbnailPanel->SetMinSize(wxSize(FromDIP(256), FromDIP(256)));
|
||||
m_thumbnailPanel->SetMaxSize(wxSize(FromDIP(256), FromDIP(256)));
|
||||
m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxEXPAND, 0);
|
||||
m_thumbnailPanel->SetBackgroundColour(*wxRED);
|
||||
m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxALIGN_CENTER, 0);
|
||||
m_panel_image->SetSizer(m_sizer_thumbnail);
|
||||
m_panel_image->Layout();
|
||||
|
||||
auto next_plate_panel = new wxWindow(m_scrollable_region, wxID_ANY);
|
||||
next_plate_panel->SetBackgroundColour(*wxWHITE);
|
||||
auto next_plate_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
next_plate_panel->SetMinSize(wxSize(FromDIP(32), FromDIP(32)));
|
||||
m_bitmap_next_plate = new wxStaticBitmap(next_plate_panel, wxID_ANY, create_scaled_bitmap("go_next_plate", this, 32), wxDefaultPosition, wxSize(FromDIP(32), FromDIP(32)), 0);
|
||||
next_plate_sizer->Add(m_bitmap_next_plate, 0, wxALIGN_CENTER, 0);
|
||||
next_plate_panel->SetSizer(next_plate_sizer);
|
||||
|
||||
m_sizer_thumbnail_area->Add(last_plate_panel, 0, wxALIGN_CENTER, 0);
|
||||
m_sizer_thumbnail_area->Add(m_panel_image, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(24));
|
||||
m_sizer_thumbnail_area->Add(next_plate_panel, 0, wxALIGN_CENTER, 0);
|
||||
|
||||
wxBoxSizer *m_sizer_basic = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *m_sizer_basic_weight = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *m_sizer_basic_time = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -1215,8 +1236,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_sizer_prepare->Add(0, 0, 1, wxTOP, FromDIP(12));
|
||||
|
||||
auto hyperlink_sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
auto m_hyperlink = new wxHyperlinkCtrl(m_panel_prepare, wxID_ANY, _L("Can't find my devices?"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
|
||||
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);
|
||||
|
||||
hyperlink_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
m_sizer_prepare->Add(hyperlink_sizer, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
|
@ -1352,41 +1372,10 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
|
||||
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
|
||||
|
||||
// bind
|
||||
Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {
|
||||
show_print_failed_info(true);
|
||||
});
|
||||
Bind(EVT_UPDATE_USER_MACHINE_LIST, &SelectMachineDialog::update_printer_combobox, this);
|
||||
Bind(EVT_PRINT_JOB_CANCEL, &SelectMachineDialog::on_print_job_cancel, this);
|
||||
Bind(EVT_SET_FINISH_MAPPING, &SelectMachineDialog::on_set_finish_mapping, this);
|
||||
wxGetApp().Bind(EVT_CONNECT_LAN_MODE_PRINT, [this](wxCommandEvent& e) {
|
||||
if (e.GetInt() == 1) {
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
if (dev->get_selected_machine()) {
|
||||
m_comboBox_printer->SetValue(dev->get_selected_machine()->dev_name + "(LAN)");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m_panel_prepare->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
check_fcous_state(this);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
m_scrollable_region->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
check_fcous_state(this);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
check_fcous_state(this);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
m_sizer_scrollable_region->Add(m_rename_switch_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(8));
|
||||
m_sizer_scrollable_region->Add(m_panel_image, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_scrollable_region->Add(m_sizer_thumbnail_area, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||
m_sizer_scrollable_region->Add(m_sizer_basic, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
//m_sizer_scrollable_region->Add(m_sizer_material, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
|
@ -1401,7 +1390,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
|
||||
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(13));
|
||||
m_sizer_main->Add(m_scrollable_view, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_main->Add(m_scrollable_view, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, FromDIP(25));
|
||||
|
||||
#ifdef FILAMENT_BACKUP
|
||||
m_sizer_main->Add(m_sizer_backup, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
|
@ -1421,7 +1410,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
|
||||
m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_main->Add(m_sw_print_failed_info, 0, wxALIGN_CENTER, 0);
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(13));
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(18));
|
||||
|
||||
show_print_failed_info(false);
|
||||
|
||||
|
@ -1432,10 +1421,60 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
|
||||
init_bind();
|
||||
init_timer();
|
||||
// CenterOnParent();
|
||||
Centre(wxBOTH);
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::init_bind()
|
||||
{
|
||||
Bind(wxEVT_TIMER, &SelectMachineDialog::on_timer, this);
|
||||
Bind(EVT_CLEAR_IPADDRESS, &SelectMachineDialog::clear_ip_address_config, this);
|
||||
Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {show_print_failed_info(true);});
|
||||
Bind(EVT_UPDATE_USER_MACHINE_LIST, &SelectMachineDialog::update_printer_combobox, this);
|
||||
Bind(EVT_PRINT_JOB_CANCEL, &SelectMachineDialog::on_print_job_cancel, this);
|
||||
Bind(EVT_SET_FINISH_MAPPING, &SelectMachineDialog::on_set_finish_mapping, this);
|
||||
Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
|
||||
m_panel_prepare->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
|
||||
m_scrollable_region->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
|
||||
m_bitmap_last_plate->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
|
||||
m_bitmap_last_plate->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
|
||||
m_bitmap_next_plate->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
|
||||
m_bitmap_next_plate->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
|
||||
|
||||
|
||||
wxGetApp().Bind(EVT_CONNECT_LAN_MODE_PRINT, [this](wxCommandEvent& e) {
|
||||
if (e.GetInt() == 0) {
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
if (dev->get_selected_machine()) {
|
||||
m_comboBox_printer->SetValue(dev->get_selected_machine()->dev_name + "(LAN)");
|
||||
}
|
||||
}else if(e.GetInt() == 1){
|
||||
on_send_print();
|
||||
}
|
||||
else if (e.GetInt() == -2) {
|
||||
MessageDialog msg_wingow(nullptr, _L("Printer local connection failed, please try again."), "", wxAPPLY | wxOK);
|
||||
msg_wingow.ShowModal();
|
||||
}
|
||||
});
|
||||
|
||||
m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
if (m_print_plate_idx > 0) {
|
||||
m_print_plate_idx--;
|
||||
update_page_turn_state(true);
|
||||
set_default_from_sdcard();
|
||||
}
|
||||
});
|
||||
|
||||
m_bitmap_next_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
if (m_print_plate_idx < (m_print_plate_total - 1)) {
|
||||
m_print_plate_idx++;
|
||||
update_page_turn_state(true);
|
||||
set_default_from_sdcard();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SelectMachineDialog::check_focus(wxWindow* window)
|
||||
{
|
||||
if (window == m_rename_input || window == m_rename_input->GetTextCtrl()) {
|
||||
|
@ -2144,12 +2183,6 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
|||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::init_bind()
|
||||
{
|
||||
Bind(wxEVT_TIMER, &SelectMachineDialog::on_timer, this);
|
||||
Bind(EVT_CLEAR_IPADDRESS, &SelectMachineDialog::clear_ip_address_config, this);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::init_timer()
|
||||
{
|
||||
m_refresh_timer = new wxTimer();
|
||||
|
@ -2302,7 +2335,13 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, confirm_title);
|
||||
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) {
|
||||
confirm_dlg.on_hide();
|
||||
this->on_ok();
|
||||
if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||
this->connect_printer_mqtt();
|
||||
}
|
||||
else {
|
||||
this->on_send_print();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
confirm_text.push_back(_L("Please click the confirm button if you still want to proceed with printing.") + "\n");
|
||||
|
@ -2324,11 +2363,30 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
confirm_dlg.on_show();
|
||||
|
||||
} else {
|
||||
this->on_ok();
|
||||
if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||
this->connect_printer_mqtt();
|
||||
}
|
||||
else {
|
||||
this->on_send_print();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::on_ok()
|
||||
void SelectMachineDialog::connect_printer_mqtt()
|
||||
{
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
MachineObject* obj_ = dev->get_selected_machine();
|
||||
|
||||
if (obj_->connection_type() == "cloud") {
|
||||
obj_->connect(false, obj_->local_use_ssl_for_mqtt);
|
||||
}
|
||||
else {
|
||||
on_send_print();
|
||||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::on_send_print()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: on_ok to send";
|
||||
m_is_canceled = false;
|
||||
|
@ -2341,10 +2399,10 @@ void SelectMachineDialog::on_ok()
|
|||
return;
|
||||
}
|
||||
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
|
||||
MachineObject *obj_ = dev->get_selected_machine();
|
||||
MachineObject* obj_ = dev->get_selected_machine();
|
||||
assert(obj_->dev_id == m_printer_last_select);
|
||||
if (obj_ == nullptr) {
|
||||
return;
|
||||
|
@ -2367,7 +2425,7 @@ void SelectMachineDialog::on_ok()
|
|||
m_is_canceled = true;
|
||||
wxCommandEvent* event = new wxCommandEvent(EVT_PRINT_JOB_CANCEL);
|
||||
wxQueueEvent(this, event);
|
||||
});
|
||||
});
|
||||
|
||||
if (m_is_canceled) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_is_canceled";
|
||||
|
@ -2387,55 +2445,71 @@ void SelectMachineDialog::on_ok()
|
|||
json mapping_info_json = json::array();
|
||||
json item;
|
||||
if (m_filaments.size() > 0) {
|
||||
item["sourceColor"] = m_filaments[0].color.substr(1, 6) + "FF";
|
||||
item["sourceColor"] = m_filaments[0].color.substr(1, 6) + "FF";
|
||||
item["filamentType"] = m_filaments[0].type;
|
||||
mapping_info_json.push_back(item);
|
||||
ams_mapping_info = mapping_info_json.dump();
|
||||
}
|
||||
}
|
||||
|
||||
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool &cancel) {
|
||||
if (this->m_is_canceled) return;
|
||||
bool cancelled = false;
|
||||
wxString msg = _L("Preparing print job");
|
||||
m_status_bar->update_status(msg, cancelled, 10, true);
|
||||
m_export_3mf_cancel = cancel = cancelled;
|
||||
});
|
||||
|
||||
if (m_is_canceled || m_export_3mf_cancel) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_export_3mf_cancel or m_is_canceled";
|
||||
m_status_bar->set_status_text(task_canceled_text);
|
||||
return;
|
||||
}
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool& cancel) {
|
||||
if (this->m_is_canceled) return;
|
||||
bool cancelled = false;
|
||||
wxString msg = _L("Preparing print job");
|
||||
m_status_bar->update_status(msg, cancelled, 10, true);
|
||||
m_export_3mf_cancel = cancel = cancelled;
|
||||
});
|
||||
|
||||
if (result < 0) {
|
||||
wxString msg = _L("Abnormal print file data. Please slice again");
|
||||
m_status_bar->set_status_text(msg);
|
||||
return;
|
||||
}
|
||||
if (m_is_canceled || m_export_3mf_cancel) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_export_3mf_cancel or m_is_canceled";
|
||||
m_status_bar->set_status_text(task_canceled_text);
|
||||
return;
|
||||
}
|
||||
|
||||
// export config 3mf if needed
|
||||
if (!obj_->is_lan_mode_printer()) {
|
||||
result = m_plater->export_config_3mf(m_print_plate_idx);
|
||||
if (result < 0) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "export_config_3mf failed, result = " << result;
|
||||
wxString msg = _L("Abnormal print file data. Please slice again");
|
||||
m_status_bar->set_status_text(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
// export config 3mf if needed
|
||||
if (!obj_->is_lan_mode_printer()) {
|
||||
result = m_plater->export_config_3mf(m_print_plate_idx);
|
||||
if (result < 0) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "export_config_3mf failed, result = " << result;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_is_canceled || m_export_3mf_cancel) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_export_3mf_cancel or m_is_canceled";
|
||||
m_status_bar->set_status_text(task_canceled_text);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_is_canceled || m_export_3mf_cancel) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_export_3mf_cancel or m_is_canceled";
|
||||
m_status_bar->set_status_text(task_canceled_text);
|
||||
return;
|
||||
}
|
||||
|
||||
m_print_job = std::make_shared<PrintJob>(m_status_bar, m_plater, m_printer_last_select);
|
||||
m_print_job->m_dev_ip = obj_->dev_ip;
|
||||
m_print_job->m_ftp_folder = obj_->get_ftp_folder();
|
||||
m_print_job->m_access_code = obj_->get_access_code();
|
||||
m_print_job->m_local_use_ssl = obj_->local_use_ssl;
|
||||
m_print_job = std::make_shared<PrintJob>(m_status_bar, m_plater, m_printer_last_select);
|
||||
m_print_job->m_dev_ip = obj_->dev_ip;
|
||||
m_print_job->m_ftp_folder = obj_->get_ftp_folder();
|
||||
m_print_job->m_access_code = obj_->get_access_code();
|
||||
m_print_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
|
||||
m_print_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
|
||||
m_print_job->connection_type = obj_->connection_type();
|
||||
m_print_job->cloud_print_only= obj_->is_cloud_print_only;
|
||||
m_print_job->set_project_name(m_current_project_name.utf8_string());
|
||||
m_print_job->cloud_print_only = obj_->is_cloud_print_only;
|
||||
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
m_print_job->m_print_type = "from_normal";
|
||||
m_print_job->set_project_name(m_current_project_name.utf8_string());
|
||||
}
|
||||
else if(m_print_type == PrintFromType::FROM_SDCARD_VIEW){
|
||||
m_print_job->m_print_type = "from_sdcard_view";
|
||||
m_print_job->connection_type = "lan";
|
||||
auto input_str_arr = wxGetApp().split_str(m_required_data_file_name,".gcode.3mf");
|
||||
if (input_str_arr.size() > 1) {
|
||||
m_print_job->set_project_name(input_str_arr[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj_->is_support_ams_mapping()) {
|
||||
m_print_job->task_ams_mapping = ams_mapping_array;
|
||||
|
@ -2580,6 +2654,14 @@ bool SelectMachineDialog::is_timeout()
|
|||
return false;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
{
|
||||
m_required_data_config = config;
|
||||
m_required_data_model = model;
|
||||
m_required_data_plate_data_list = plate_data_list;
|
||||
m_required_data_file_name = file_name;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::reset_timeout()
|
||||
{
|
||||
m_timeout_count = 0;
|
||||
|
@ -2877,10 +2959,13 @@ void SelectMachineDialog::update_show_status()
|
|||
dev->check_pushing();
|
||||
|
||||
PartPlate* plate = m_plater->get_partplate_list().get_curr_plate();
|
||||
|
||||
// blank plate has no valid gcode file
|
||||
if (plate&& !plate->is_valid_gcode_file()) {
|
||||
show_status(PrintDialogStatus::PrintStatusBlankPlate);
|
||||
return;
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
if (plate && !plate->is_valid_gcode_file()) {
|
||||
show_status(PrintDialogStatus::PrintStatusBlankPlate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MachineObject* obj_ = dev->get_my_machine(m_printer_last_select);
|
||||
|
@ -3195,11 +3280,30 @@ void SelectMachineDialog::set_flow_calibration_state(bool state)
|
|||
|
||||
void SelectMachineDialog::set_default()
|
||||
{
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
m_stext_printer_title->Show(true);
|
||||
m_comboBox_printer->Show(true);
|
||||
m_button_refresh->Show(true);
|
||||
m_rename_normal_panel->Show(true);
|
||||
m_hyperlink->Show(true);
|
||||
}
|
||||
else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||
m_stext_printer_title->Show(false);
|
||||
m_comboBox_printer->Show(false);
|
||||
m_button_refresh->Show(false);
|
||||
m_rename_normal_panel->Show(false);
|
||||
m_hyperlink->Show(false);
|
||||
|
||||
/* DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev_manager) return;
|
||||
MachineObject* obj_ = dev_manager->get_selected_machine();*/
|
||||
}
|
||||
|
||||
//project name
|
||||
m_rename_switch_panel->SetSelection(0);
|
||||
|
||||
wxString filename = m_plater->get_export_gcode_filename("", false,
|
||||
m_print_plate_idx == PLATE_ALL_IDX ?true:false);
|
||||
m_print_plate_idx == PLATE_ALL_IDX ? true : false);
|
||||
|
||||
if (m_print_plate_idx == PLATE_ALL_IDX && filename.empty()) {
|
||||
filename = _L("Untitled");
|
||||
|
@ -3208,7 +3312,7 @@ void SelectMachineDialog::set_default()
|
|||
if (filename.empty()) {
|
||||
filename = m_plater->get_export_gcode_filename("", true);
|
||||
if (std::strstr(filename.c_str(), _L("Untitled").c_str()) == NULL) {
|
||||
filename = wxString::Format("Untitled%s",filename);
|
||||
filename = wxString::Format("Untitled%s", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3217,7 +3321,6 @@ void SelectMachineDialog::set_default()
|
|||
m_rename_text->SetLabelText(m_current_project_name);
|
||||
m_rename_normal_panel->Layout();
|
||||
|
||||
|
||||
//clear combobox
|
||||
m_list.clear();
|
||||
m_comboBox_printer->Clear();
|
||||
|
@ -3225,6 +3328,7 @@ void SelectMachineDialog::set_default()
|
|||
m_print_info = "";
|
||||
m_comboBox_printer->SetValue(wxEmptyString);
|
||||
m_comboBox_printer->Enable();
|
||||
|
||||
// rset status bar
|
||||
m_status_bar->reset();
|
||||
|
||||
|
@ -3232,7 +3336,8 @@ void SelectMachineDialog::set_default()
|
|||
if (agent) {
|
||||
if (agent->is_user_login()) {
|
||||
show_status(PrintDialogStatus::PrintStatusInit);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusNoUserLogin);
|
||||
}
|
||||
}
|
||||
|
@ -3243,73 +3348,85 @@ void SelectMachineDialog::set_default()
|
|||
AppConfig* config = wxGetApp().app_config;
|
||||
if (config && config->get("print", "bed_leveling") == "0") {
|
||||
m_checkbox_list["bed_leveling"]->SetValue(false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_checkbox_list["bed_leveling"]->SetValue(true);
|
||||
}
|
||||
if (config && config->get("print", "flow_cali") == "0") {
|
||||
m_checkbox_list["flow_cali"]->SetValue(false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_checkbox_list["flow_cali"]->SetValue(true);
|
||||
}
|
||||
if (config && config->get("print", "timelapse") == "0") {
|
||||
m_checkbox_list["timelapse"]->SetValue(false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_checkbox_list["timelapse"]->SetValue(true);
|
||||
}
|
||||
|
||||
m_ams_check->SetValue(true);
|
||||
|
||||
// thumbmail
|
||||
//wxBitmap bitmap;
|
||||
ThumbnailData &data = m_plater->get_partplate_list().get_curr_plate()->thumbnail_data;
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
set_default_normal();
|
||||
}
|
||||
else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||
set_default_from_sdcard();
|
||||
}
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
void SelectMachineDialog::set_default_normal()
|
||||
{
|
||||
update_page_turn_state(false);
|
||||
ThumbnailData& data = m_plater->get_partplate_list().get_curr_plate()->thumbnail_data;
|
||||
if (data.is_valid()) {
|
||||
wxImage image(data.width, data.height);
|
||||
image.InitAlpha();
|
||||
for (unsigned int r = 0; r < data.height; ++r) {
|
||||
unsigned int rr = (data.height - 1 - r) * data.width;
|
||||
for (unsigned int c = 0; c < data.width; ++c) {
|
||||
unsigned char *px = (unsigned char *) data.pixels.data() + 4 * (rr + c);
|
||||
image.SetRGB((int) c, (int) r, px[0], px[1], px[2]);
|
||||
image.SetAlpha((int) c, (int) r, px[3]);
|
||||
unsigned char* px = (unsigned char*)data.pixels.data() + 4 * (rr + c);
|
||||
image.SetRGB((int)c, (int)r, px[0], px[1], px[2]);
|
||||
image.SetAlpha((int)c, (int)r, px[3]);
|
||||
}
|
||||
}
|
||||
image = image.Rescale(FromDIP(256), FromDIP(256));
|
||||
image = image.Rescale(FromDIP(256), FromDIP(256));
|
||||
m_thumbnailPanel->set_thumbnail(image);
|
||||
//bitmap = wxBitmap(image);
|
||||
}
|
||||
|
||||
//m_staticbitmap->SetBitmap(bitmap);
|
||||
//m_sizer_thumbnail->Layout();
|
||||
|
||||
//for black list
|
||||
std::vector<std::string> materials;
|
||||
std::vector<std::string> brands;
|
||||
std::vector<std::string> display_materials;
|
||||
{
|
||||
auto preset_bundle = wxGetApp().preset_bundle;
|
||||
for (auto filament_name : preset_bundle->filament_presets) {
|
||||
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
||||
if (filament_name.compare(iter->name) == 0) {
|
||||
std::string display_filament_type;
|
||||
std::string filament_type = iter->config.get_filament_type(display_filament_type);
|
||||
display_materials.push_back(display_filament_type);
|
||||
materials.push_back(filament_type);
|
||||
|
||||
auto preset_bundle = wxGetApp().preset_bundle;
|
||||
for (auto filament_name : preset_bundle->filament_presets) {
|
||||
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
||||
if (filament_name.compare(iter->name) == 0) {
|
||||
std::string display_filament_type;
|
||||
std::string filament_type = iter->config.get_filament_type(display_filament_type);
|
||||
display_materials.push_back(display_filament_type);
|
||||
materials.push_back(filament_type);
|
||||
|
||||
if (iter->vendor && !iter->vendor->name.empty())
|
||||
brands.push_back(iter->vendor->name);
|
||||
else
|
||||
brands.push_back("");
|
||||
}
|
||||
if (iter->vendor && !iter->vendor->name.empty())
|
||||
brands.push_back(iter->vendor->name);
|
||||
else
|
||||
brands.push_back("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// material info
|
||||
//init MaterialItem
|
||||
auto extruders = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders();
|
||||
BitmapCache bmcache;
|
||||
|
||||
MaterialHash::iterator iter = m_materialList.begin();
|
||||
while (iter != m_materialList.end()) {
|
||||
int id = iter->first;
|
||||
Material *item = iter->second;
|
||||
int id = iter->first;
|
||||
Material* item = iter->second;
|
||||
item->item->Destroy();
|
||||
delete item;
|
||||
iter++;
|
||||
|
@ -3321,36 +3438,24 @@ void SelectMachineDialog::set_default()
|
|||
|
||||
for (auto i = 0; i < extruders.size(); i++) {
|
||||
auto extruder = extruders[i] - 1;
|
||||
auto colour = wxGetApp().preset_bundle->project_config.opt_string("filament_colour", (unsigned int) extruder);
|
||||
auto colour = wxGetApp().preset_bundle->project_config.opt_string("filament_colour", (unsigned int)extruder);
|
||||
unsigned char rgb[3];
|
||||
bmcache.parse_color(colour, rgb);
|
||||
|
||||
auto colour_rgb = wxColour((int) rgb[0], (int) rgb[1], (int) rgb[2]);
|
||||
auto colour_rgb = wxColour((int)rgb[0], (int)rgb[1], (int)rgb[2]);
|
||||
if (extruder >= materials.size() || extruder < 0 || extruder >= display_materials.size())
|
||||
continue;
|
||||
|
||||
/* if (m_materialList.size() == 0) {
|
||||
auto tips_panel = new wxPanel(m_scrollable_region, wxID_ANY);
|
||||
tips_panel->SetSize(wxSize(60,40));
|
||||
tips_panel->SetMinSize(wxSize(60,40));
|
||||
tips_panel->SetMaxSize(wxSize(60,40));
|
||||
tips_panel->SetBackgroundColour(*wxRED);
|
||||
m_sizer_material->Add(tips_panel, 0, wxALL, FromDIP(4));
|
||||
}*/
|
||||
|
||||
MaterialItem *item = new MaterialItem(m_scrollable_region, colour_rgb, _L(display_materials[extruder]));
|
||||
MaterialItem* item = new MaterialItem(m_scrollable_region, colour_rgb, _L(display_materials[extruder]));
|
||||
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
|
||||
|
||||
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {
|
||||
|
||||
});
|
||||
|
||||
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
|
||||
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent& e) {});
|
||||
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent& e) {
|
||||
MaterialHash::iterator iter = m_materialList.begin();
|
||||
while (iter != m_materialList.end()) {
|
||||
int id = iter->first;
|
||||
Material * item = iter->second;
|
||||
MaterialItem *m = item->item;
|
||||
int id = iter->first;
|
||||
Material* item = iter->second;
|
||||
MaterialItem* m = item->item;
|
||||
m->on_normal();
|
||||
iter++;
|
||||
}
|
||||
|
@ -3360,11 +3465,11 @@ void SelectMachineDialog::set_default()
|
|||
|
||||
|
||||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
|
||||
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
|
||||
// update ams data
|
||||
DeviceManager *dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev_manager) return;
|
||||
MachineObject *obj_ = dev_manager->get_selected_machine();
|
||||
MachineObject* obj_ = dev_manager->get_selected_machine();
|
||||
|
||||
if (obj_ && obj_->is_support_ams_mapping()) {
|
||||
if (m_mapping_popup.IsShown()) return;
|
||||
|
@ -3372,10 +3477,10 @@ void SelectMachineDialog::set_default()
|
|||
pos.y += item->GetRect().height;
|
||||
m_mapping_popup.Move(pos);
|
||||
|
||||
if (obj_ &&
|
||||
obj_->has_ams() &&
|
||||
if (obj_ &&
|
||||
obj_->has_ams() &&
|
||||
m_ams_check->GetValue() &&
|
||||
obj_->dev_id == m_printer_last_select)
|
||||
obj_->dev_id == m_printer_last_select)
|
||||
{
|
||||
m_mapping_popup.set_parent_item(item);
|
||||
m_mapping_popup.set_current_filament_id(extruder);
|
||||
|
@ -3384,18 +3489,18 @@ void SelectMachineDialog::set_default()
|
|||
m_mapping_popup.Popup();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Material *material_item = new Material();
|
||||
material_item->id = extruder;
|
||||
material_item->item = item;
|
||||
m_materialList[i] = material_item;
|
||||
Material* material_item = new Material();
|
||||
material_item->id = extruder;
|
||||
material_item->item = item;
|
||||
m_materialList[i] = material_item;
|
||||
|
||||
// build for ams mapping
|
||||
if (extruder < materials.size() && extruder >= 0) {
|
||||
FilamentInfo info;
|
||||
info.id = extruder;
|
||||
info.type = materials[extruder];
|
||||
info.id = extruder;
|
||||
info.type = materials[extruder];
|
||||
info.brand = brands[extruder];
|
||||
info.color = colour_rgb.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
||||
m_filaments.push_back(info);
|
||||
|
@ -3404,16 +3509,14 @@ void SelectMachineDialog::set_default()
|
|||
|
||||
if (extruders.size() <= 4) {
|
||||
m_sizer_material->SetCols(extruders.size());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_sizer_material->SetCols(4);
|
||||
}
|
||||
|
||||
m_scrollable_region->Layout();
|
||||
m_scrollable_region->Fit();
|
||||
|
||||
//m_scrollable_view->Layout();
|
||||
//m_scrollable_view->Fit();
|
||||
|
||||
m_scrollable_view->SetSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMinSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());
|
||||
|
@ -3427,27 +3530,21 @@ void SelectMachineDialog::set_default()
|
|||
set_flow_calibration_state(true);
|
||||
}
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
|
||||
|
||||
wxSize screenSize = wxGetDisplaySize();
|
||||
auto dialogSize = this->GetSize();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef __WINDOWS__
|
||||
if (screenSize.y < dialogSize.y) {
|
||||
m_need_adaptation_screen = true;
|
||||
m_scrollable_view->SetScrollRate(0, 5);
|
||||
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
|
||||
m_scrollable_view->SetMinSize(wxSize(-1, FromDIP(220)));
|
||||
m_scrollable_view->SetMaxSize(wxSize(-1, FromDIP(220)));
|
||||
} else {
|
||||
/* m_scrollable_view->SetSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMinSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());*/
|
||||
}
|
||||
else {
|
||||
m_scrollable_view->SetScrollRate(0, 0);
|
||||
}
|
||||
#endif // __WXOSX_MAC__
|
||||
#endif // __WXOSX_MAC__
|
||||
|
||||
|
||||
reset_ams_material();
|
||||
|
@ -3455,7 +3552,7 @@ void SelectMachineDialog::set_default()
|
|||
// basic info
|
||||
auto aprint_stats = m_plater->get_partplate_list().get_current_fff_print().print_statistics();
|
||||
wxString time;
|
||||
PartPlate *plate = m_plater->get_partplate_list().get_curr_plate();
|
||||
PartPlate* plate = m_plater->get_partplate_list().get_curr_plate();
|
||||
if (plate) {
|
||||
if (plate->get_slice_result()) { time = wxString::Format("%s", short_time(get_time_dhms(plate->get_slice_result()->print_statistics.modes[0].time))); }
|
||||
}
|
||||
|
@ -3467,6 +3564,181 @@ void SelectMachineDialog::set_default()
|
|||
m_stext_weight->SetLabel(weight);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::set_default_from_sdcard()
|
||||
{
|
||||
m_print_plate_total = m_required_data_plate_data_list.size();
|
||||
update_page_turn_state(true);
|
||||
|
||||
ThumbnailData& data = m_required_data_plate_data_list[m_print_plate_idx]->plate_thumbnail;
|
||||
wxMemoryInputStream mis((unsigned char*)data.pixels.data(), data.pixels.size());
|
||||
wxImage image = wxImage(mis);
|
||||
image = image.Rescale(FromDIP(256), FromDIP(256));
|
||||
m_thumbnailPanel->set_thumbnail(image);
|
||||
|
||||
//for black list
|
||||
std::vector<std::string> materials;
|
||||
std::vector<std::string> brands;
|
||||
std::vector<std::string> display_materials;
|
||||
|
||||
for (auto i = 0; i < m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size(); i++) {
|
||||
FilamentInfo fo = m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info[i];
|
||||
display_materials.push_back(fo.type);
|
||||
materials.push_back(fo.type);
|
||||
brands.push_back(fo.brand);
|
||||
}
|
||||
|
||||
//init MaterialItem
|
||||
MaterialHash::iterator iter = m_materialList.begin();
|
||||
while (iter != m_materialList.end()) {
|
||||
int id = iter->first;
|
||||
Material* item = iter->second;
|
||||
item->item->Destroy();
|
||||
delete item;
|
||||
iter++;
|
||||
}
|
||||
|
||||
m_ams_mapping_result.clear();
|
||||
m_sizer_material->Clear();
|
||||
m_materialList.clear();
|
||||
m_filaments.clear();
|
||||
|
||||
|
||||
for (auto i = 0; i < m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size(); i++) {
|
||||
FilamentInfo fo = m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info[i];
|
||||
|
||||
MaterialItem* item = new MaterialItem(m_scrollable_region, wxColour(fo.color), fo.type);
|
||||
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
|
||||
|
||||
item->Bind(wxEVT_LEFT_UP, [this, item, materials](wxMouseEvent& e) {});
|
||||
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, fo](wxMouseEvent& e) {
|
||||
MaterialHash::iterator iter = m_materialList.begin();
|
||||
while (iter != m_materialList.end()) {
|
||||
int id = iter->first;
|
||||
Material* item = iter->second;
|
||||
MaterialItem* m = item->item;
|
||||
m->on_normal();
|
||||
iter++;
|
||||
}
|
||||
|
||||
try {
|
||||
m_current_filament_id = fo.id;
|
||||
}
|
||||
catch (...) {}
|
||||
item->on_selected();
|
||||
|
||||
|
||||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
|
||||
// update ams data
|
||||
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev_manager) return;
|
||||
MachineObject* obj_ = dev_manager->get_selected_machine();
|
||||
|
||||
if (obj_ && obj_->is_support_ams_mapping()) {
|
||||
if (m_mapping_popup.IsShown()) return;
|
||||
wxPoint pos = item->ClientToScreen(wxPoint(0, 0));
|
||||
pos.y += item->GetRect().height;
|
||||
m_mapping_popup.Move(pos);
|
||||
|
||||
if (obj_ &&
|
||||
obj_->has_ams() &&
|
||||
m_ams_check->GetValue() &&
|
||||
obj_->dev_id == m_printer_last_select)
|
||||
{
|
||||
m_mapping_popup.set_parent_item(item);
|
||||
m_mapping_popup.set_current_filament_id(fo.id);
|
||||
m_mapping_popup.set_tag_texture(fo.type);
|
||||
m_mapping_popup.update_ams_data(obj_->amsList);
|
||||
m_mapping_popup.Popup();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Material* material_item = new Material();
|
||||
material_item->id = fo.id;
|
||||
material_item->item = item;
|
||||
m_materialList[i] = material_item;
|
||||
|
||||
// build for ams mapping
|
||||
m_filaments.push_back(fo);
|
||||
}
|
||||
|
||||
if (m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size() <= 4) {
|
||||
m_sizer_material->SetCols(m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size());
|
||||
}
|
||||
else {
|
||||
m_sizer_material->SetCols(4);
|
||||
}
|
||||
|
||||
m_scrollable_region->Layout();
|
||||
m_scrollable_region->Fit();
|
||||
|
||||
m_scrollable_view->SetSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMinSize(m_scrollable_region->GetSize());
|
||||
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());
|
||||
|
||||
//disable pei bed
|
||||
auto bed_type = m_plater->get_partplate_list().get_curr_plate()->get_bed_type(true);
|
||||
if (bed_type == BedType::btPTE) {
|
||||
set_flow_calibration_state(false);
|
||||
}
|
||||
else {
|
||||
set_flow_calibration_state(true);
|
||||
}
|
||||
|
||||
wxSize screenSize = wxGetDisplaySize();
|
||||
auto dialogSize = this->GetSize();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
if (screenSize.y < dialogSize.y) {
|
||||
m_need_adaptation_screen = true;
|
||||
m_scrollable_view->SetScrollRate(0, 5);
|
||||
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
|
||||
m_scrollable_view->SetMinSize(wxSize(-1, FromDIP(220)));
|
||||
m_scrollable_view->SetMaxSize(wxSize(-1, FromDIP(220)));
|
||||
}
|
||||
else {
|
||||
m_scrollable_view->SetScrollRate(0, 0);
|
||||
}
|
||||
#endif // __WXOSX_MAC__
|
||||
|
||||
|
||||
reset_ams_material();
|
||||
|
||||
// basic info
|
||||
auto aprint_stats = m_plater->get_partplate_list().get_current_fff_print().print_statistics();
|
||||
wxString time;
|
||||
PartPlate* plate = m_plater->get_partplate_list().get_curr_plate();
|
||||
if (plate) {
|
||||
if (plate->get_slice_result()) { time = wxString::Format("%s", short_time(get_time_dhms(plate->get_slice_result()->print_statistics.modes[0].time))); }
|
||||
}
|
||||
|
||||
char weight[64];
|
||||
::sprintf(weight, " %.2f g", aprint_stats.total_weight);
|
||||
|
||||
m_stext_time->SetLabel(time);
|
||||
m_stext_weight->SetLabel(weight);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::update_page_turn_state(bool show)
|
||||
{
|
||||
m_bitmap_last_plate->Show(show);
|
||||
m_bitmap_next_plate->Show(show);
|
||||
|
||||
if (show) {
|
||||
if (m_print_plate_idx <= 0) { m_bitmap_last_plate->Hide(); }
|
||||
else { m_bitmap_last_plate->Show(); }
|
||||
|
||||
if ((m_print_plate_idx + 1) >= m_print_plate_total) { m_bitmap_next_plate->Hide(); }
|
||||
else { m_bitmap_next_plate->Show(); }
|
||||
|
||||
if (m_print_plate_total == 1) {
|
||||
m_bitmap_last_plate->Show(false);
|
||||
m_bitmap_next_plate->Show(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::sys_color_changed()
|
||||
{
|
||||
if (wxGetApp(). dark_mode()) {
|
||||
|
@ -3490,6 +3762,15 @@ bool SelectMachineDialog::Show(bool show)
|
|||
update_user_machine_list();
|
||||
//update_lan_machine_list();
|
||||
}
|
||||
else {
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (dev) {
|
||||
MachineObject* obj_ = dev->get_selected_machine();
|
||||
if (obj_->connection_type() == "cloud") {
|
||||
obj_->disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (show) {
|
||||
m_refresh_timer->Start(LIST_REFRESH_INTERVAL);
|
||||
|
@ -3697,7 +3978,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
|
||||
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_staticbitmap = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize);
|
||||
sizer->Add(m_staticbitmap, 1, wxEXPAND|wxALL, 0);
|
||||
sizer->Add(m_staticbitmap, 1, wxEXPAND, 0);
|
||||
SetSizer(sizer);
|
||||
Layout();
|
||||
Fit();
|
||||
|
|
|
@ -57,6 +57,11 @@ enum PrinterBindState {
|
|||
ALLOW_UNBIND
|
||||
};
|
||||
|
||||
enum PrintFromType {
|
||||
FROM_NORMAL,
|
||||
FROM_SDCARD_VIEW,
|
||||
};
|
||||
|
||||
class Material
|
||||
{
|
||||
public:
|
||||
|
@ -272,7 +277,9 @@ class SelectMachineDialog : public DPIDialog
|
|||
private:
|
||||
int m_current_filament_id{0};
|
||||
int m_print_plate_idx{0};
|
||||
int m_print_plate_total{0};
|
||||
int m_timeout_count{0};
|
||||
int m_print_error_code;
|
||||
bool m_is_in_sending_mode{ false };
|
||||
bool m_ams_mapping_res{ false };
|
||||
bool m_ams_mapping_valid{ false };
|
||||
|
@ -280,22 +287,32 @@ private:
|
|||
bool m_export_3mf_cancel{ false };
|
||||
bool m_is_canceled{ false };
|
||||
bool m_is_rename_mode{ false };
|
||||
|
||||
std::string m_print_error_msg;
|
||||
std::string m_print_error_extra;
|
||||
std::string m_printer_last_select;
|
||||
std::string m_print_info;
|
||||
wxString m_current_project_name;
|
||||
PrintDialogStatus m_print_status { PrintStatusInit };
|
||||
|
||||
wxColour m_colour_def_color{wxColour(255, 255, 255)};
|
||||
wxColour m_colour_bold_color{wxColour(38, 46, 48)};
|
||||
StateColor m_btn_bg_enable;
|
||||
|
||||
|
||||
std::map<std::string, CheckBox *> m_checkbox_list;
|
||||
std::map<std::string, bool> m_checkbox_state_list;
|
||||
std::vector<wxString> m_bedtype_list;
|
||||
std::vector<MachineObject*> m_list;
|
||||
std::vector<FilamentInfo> m_filaments;
|
||||
std::vector<FilamentInfo> m_ams_mapping_result;
|
||||
std::shared_ptr<BBLStatusBarSend> m_status_bar;
|
||||
wxObjectDataPtr<MachineListModel> m_machine_model;
|
||||
|
||||
std::map<std::string, ::CheckBox *> m_checkbox_list;
|
||||
std::map<std::string, bool> m_checkbox_state_list;
|
||||
Slic3r::DynamicPrintConfig m_required_data_config;
|
||||
Slic3r::Model m_required_data_model;
|
||||
Slic3r::PlateDataPtrs m_required_data_plate_data_list;
|
||||
std::string m_required_data_file_name;
|
||||
|
||||
protected:
|
||||
PrintFromType m_print_type{FROM_NORMAL};
|
||||
AmsMapingPopup m_mapping_popup{ nullptr };
|
||||
AmsMapingTipPopup m_mapping_tip_popup{ nullptr };
|
||||
AmsTutorialPopup m_mapping_tutorial_popup{ nullptr };
|
||||
|
@ -316,6 +333,8 @@ protected:
|
|||
ComboBox* m_comboBox_printer{ nullptr };
|
||||
ComboBox* m_comboBox_bed{ nullptr };
|
||||
wxStaticBitmap* m_staticbitmap{ nullptr };
|
||||
wxStaticBitmap* m_bitmap_last_plate{ nullptr };
|
||||
wxStaticBitmap* m_bitmap_next_plate{ nullptr };
|
||||
ThumbnailPanel* m_thumbnailPanel{ nullptr };
|
||||
wxWindow* select_bed{ nullptr };
|
||||
wxWindow* select_flow{ nullptr };
|
||||
|
@ -351,19 +370,7 @@ protected:
|
|||
std::shared_ptr<PrintJob> m_print_job;
|
||||
wxScrolledWindow* m_scrollable_view;
|
||||
wxScrolledWindow* m_sw_print_failed_info{nullptr};
|
||||
|
||||
/* model */
|
||||
wxObjectDataPtr<MachineListModel> m_machine_model;
|
||||
std::shared_ptr<BBLStatusBarSend> m_status_bar;
|
||||
|
||||
/*error info*/
|
||||
int m_print_error_code;
|
||||
std::string m_print_error_msg;
|
||||
std::string m_print_error_extra;
|
||||
|
||||
std::vector<MachineObject*> m_list;
|
||||
std::vector<FilamentInfo> m_filaments;
|
||||
std::vector<FilamentInfo> m_ams_mapping_result; /* ams mapping data */
|
||||
wxHyperlinkCtrl* m_hyperlink{nullptr};
|
||||
public:
|
||||
SelectMachineDialog(Plater *plater = nullptr);
|
||||
~SelectMachineDialog();
|
||||
|
@ -394,12 +401,16 @@ public:
|
|||
void on_cancel(wxCloseEvent& event);
|
||||
void show_errors(wxString& info);
|
||||
void on_ok_btn(wxCommandEvent& event);
|
||||
void on_ok();
|
||||
void connect_printer_mqtt();
|
||||
void on_send_print();
|
||||
void clear_ip_address_config(wxCommandEvent& e);
|
||||
void on_refresh(wxCommandEvent& event);
|
||||
void on_set_finish_mapping(wxCommandEvent& evt);
|
||||
void on_print_job_cancel(wxCommandEvent& evt);
|
||||
void set_default();
|
||||
void set_default_normal();
|
||||
void set_default_from_sdcard();
|
||||
void update_page_turn_state(bool show);
|
||||
void on_timer(wxTimerEvent& event);
|
||||
void on_selection_changed(wxCommandEvent& event);
|
||||
void Enable_Refresh_Button(bool en);
|
||||
|
@ -417,10 +428,13 @@ public:
|
|||
bool is_same_printer_model();
|
||||
bool has_tips(MachineObject* obj);
|
||||
bool is_timeout();
|
||||
void update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
void set_print_type(PrintFromType type) {m_print_type = type;};
|
||||
bool Show(bool show);
|
||||
bool do_ams_mapping(MachineObject* obj_);
|
||||
bool get_ams_mapping_result(std::string& mapping_array_str, std::string& ams_mapping_info);
|
||||
|
||||
PrintFromType get_print_type() {return m_print_type;};
|
||||
wxString format_text(wxString &m_msg);
|
||||
wxWindow* create_ams_checkbox(wxString title, wxWindow* parent, wxString tooltip);
|
||||
wxWindow* create_item_checkbox(wxString title, wxWindow* parent, wxString tooltip, std::string param);
|
||||
|
@ -449,10 +463,10 @@ public:
|
|||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
void on_edit_name(wxCommandEvent &e);
|
||||
|
||||
MachineObject *m_info {nullptr};
|
||||
wxStaticText* m_static_valid {nullptr};
|
||||
::TextInput* m_textCtr {nullptr};
|
||||
Button* m_button_confirm {nullptr};
|
||||
Button* m_button_confirm{nullptr};
|
||||
TextInput* m_textCtr{nullptr};
|
||||
wxStaticText* m_static_valid{nullptr};
|
||||
MachineObject* m_info{nullptr};
|
||||
};
|
||||
|
||||
|
||||
|
@ -466,11 +480,13 @@ public:
|
|||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize);
|
||||
~ThumbnailPanel();
|
||||
|
||||
void OnPaint(wxPaintEvent &event);
|
||||
void PaintBackground(wxDC &dc);
|
||||
void OnEraseBackground(wxEraseEvent &event);
|
||||
void set_thumbnail(wxImage img);
|
||||
~ThumbnailPanel();
|
||||
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
@ -791,7 +791,8 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
|||
m_send_job = std::make_shared<SendJob>(m_status_bar, m_plater, m_printer_last_select);
|
||||
m_send_job->m_dev_ip = obj_->dev_ip;
|
||||
m_send_job->m_access_code = obj_->get_access_code();
|
||||
m_send_job->m_local_use_ssl = obj_->local_use_ssl;
|
||||
m_send_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
|
||||
m_send_job->connection_type = obj_->connection_type();
|
||||
m_send_job->cloud_print_only = true;
|
||||
m_send_job->has_sdcard = obj_->has_sdcard();
|
||||
|
|
|
@ -170,10 +170,12 @@ struct PrintParams {
|
|||
std::string comments;
|
||||
int origin_profile_id = 0;
|
||||
std::string origin_model_id;
|
||||
std::string print_type;
|
||||
|
||||
/* access options */
|
||||
std::string dev_ip;
|
||||
bool use_ssl;
|
||||
bool use_ssl_for_ftp;
|
||||
bool use_ssl_for_mqtt;
|
||||
std::string username;
|
||||
std::string password;
|
||||
|
||||
|
|
Loading…
Reference in New Issue