mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 01:48:42 +03:00
Optimized and fixed some bugs
This commit is contained in:
@@ -806,6 +806,9 @@ void CalibrationPresetPage::set_cali_method(CalibrationMethod method)
|
||||
m_cali_stage_panel->Show(false);
|
||||
|
||||
if (m_custom_range_panel) {
|
||||
wxArrayString values;
|
||||
values.push_back(wxString::Format(wxT("%.0f"), 1.0));
|
||||
m_custom_range_panel->set_values(values);
|
||||
m_custom_range_panel->Show(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,11 +518,12 @@ void MachineObject::reload_printer_settings()
|
||||
parse_json("{}");
|
||||
}
|
||||
|
||||
// y21
|
||||
MachineObject::MachineObject(std::string name, std::string url, std::string ip)
|
||||
// y40
|
||||
MachineObject::MachineObject(std::string name, std::string url, std::string ip, std::string apikey)
|
||||
:dev_name(name),
|
||||
dev_url(url),
|
||||
dev_ip(ip),
|
||||
dev_apikey(apikey),
|
||||
subtask_(nullptr),
|
||||
model_task(nullptr),
|
||||
slice_info(nullptr),
|
||||
|
||||
@@ -415,6 +415,7 @@ public:
|
||||
std::string dev_url;
|
||||
std::string dev_ip;
|
||||
std::string dev_id;
|
||||
std::string dev_apikey;
|
||||
bool local_use_ssl_for_mqtt { true };
|
||||
bool local_use_ssl_for_ftp { true };
|
||||
float nozzle_diameter { 0.0f };
|
||||
@@ -811,8 +812,8 @@ public:
|
||||
bool is_recording_enable();
|
||||
bool is_recording();
|
||||
|
||||
// y21
|
||||
MachineObject(std::string name, std::string url, std::string ip);
|
||||
// y40
|
||||
MachineObject(std::string name, std::string url, std::string ip, std::string apikey = "");
|
||||
MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip);
|
||||
~MachineObject();
|
||||
|
||||
|
||||
@@ -4191,6 +4191,8 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
std::map<int, double> flushed_volume_of_extruders_all_plates; // map<extruder_idx, flushed volume>
|
||||
std::map<int, double> wipe_tower_volume_of_extruders_all_plates; // map<extruder_idx, flushed volume>
|
||||
std::map<int, double> support_volume_of_extruders_all_plates; // map<extruder_idx, flushed volume>
|
||||
//1.9.7.52
|
||||
std::map<int, double> plate_time; // map<plate_idx, time>
|
||||
std::vector<double> model_used_filaments_m_all_plates;
|
||||
std::vector<double> model_used_filaments_g_all_plates;
|
||||
std::vector<double> flushed_filaments_m_all_plates;
|
||||
@@ -4201,6 +4203,8 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
std::vector<double> support_used_filaments_g_all_plates;
|
||||
float total_time_all_plates = 0.0f;
|
||||
float total_cost_all_plates = 0.0f;
|
||||
//1.9.7.52
|
||||
double unit_conver = imperial_units ? GizmoObjectManipulation::oz_to_g : 1.0;
|
||||
struct ColumnData {
|
||||
enum {
|
||||
Model = 1,
|
||||
@@ -4236,13 +4240,15 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
|
||||
return ret;
|
||||
};
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](const Color& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
//1.9.7.52
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](bool draw_icon, const Color& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
{
|
||||
// render icon
|
||||
ImVec2 pos = ImVec2(ImGui::GetCursorScreenPos().x + window_padding * 3, ImGui::GetCursorScreenPos().y);
|
||||
|
||||
draw_list->AddRectFilled({ pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale },
|
||||
ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f }));
|
||||
//1.9.7.52
|
||||
if (draw_icon)
|
||||
draw_list->AddRectFilled({ pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale },
|
||||
ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f }));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20.0 * m_scale, 6.0 * m_scale));
|
||||
|
||||
@@ -4252,7 +4258,8 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
|
||||
// render column item
|
||||
{
|
||||
float dummy_size = ImGui::GetStyle().ItemSpacing.x + icon_size;
|
||||
//1.9.7.52
|
||||
float dummy_size = draw_icon ? ImGui::GetStyle().ItemSpacing.x + icon_size : window_padding * 3;
|
||||
ImGui::SameLine(dummy_size);
|
||||
imgui.text(columns_offsets[0].first);
|
||||
|
||||
@@ -4315,6 +4322,8 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
}
|
||||
}
|
||||
const PrintEstimatedStatistics::Mode& plate_time_mode = plate_print_statistics.modes[static_cast<size_t>(m_time_estimate_mode)];
|
||||
//1.9.7.52
|
||||
plate_time.insert_or_assign(plate->get_index(), plate_time_mode.time);
|
||||
total_time_all_plates += plate_time_mode.time;
|
||||
|
||||
Print* print;
|
||||
@@ -4394,7 +4403,6 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
columns_offsets.push_back({ std::to_string(it->first + 1), offsets[_u8L("Filament")]});
|
||||
|
||||
char buf[64];
|
||||
double unit_conver = imperial_units ? GizmoObjectManipulation::oz_to_g : 1.0;
|
||||
|
||||
float column_sum_m = 0.0f;
|
||||
float column_sum_g = 0.0f;
|
||||
@@ -4430,29 +4438,118 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
columns_offsets.push_back({ buf, offsets[_u8L("Total")] });
|
||||
}
|
||||
|
||||
append_item(filament_colors[it->first], columns_offsets);
|
||||
append_item(true, filament_colors[it->first], columns_offsets);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
|
||||
ImGui::Dummy({ window_padding, window_padding });
|
||||
ImGui::SameLine();
|
||||
imgui.title(_u8L("Total Estimation"));
|
||||
//1.9.7.52
|
||||
// Sum of all rows
|
||||
char buf[64];
|
||||
if (model_volume_of_extruders_all_plates.size() > 1) {
|
||||
// Separator
|
||||
ImGuiWindow *window = ImGui::GetCurrentWindow();
|
||||
const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y),
|
||||
ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f));
|
||||
ImGui::ItemSize(ImVec2(0.0f, 0.0f));
|
||||
const bool item_visible = ImGui::ItemAdd(separator, 0);
|
||||
window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator));
|
||||
|
||||
ImGui::Dummy({ window_padding, window_padding });
|
||||
ImGui::SameLine();
|
||||
imgui.text(_u8L("Total time") + ":");
|
||||
ImGui::SameLine();
|
||||
imgui.text(short_time(get_time_dhms(total_time_all_plates)));
|
||||
std::vector<std::pair<std::string, float>> columns_offsets;
|
||||
columns_offsets.push_back({_u8L("Total"), offsets[_u8L("Filament")]});
|
||||
double total_model_used_filament_m = 0;
|
||||
double total_model_used_filament_g = 0;
|
||||
double total_support_used_filament_m = 0;
|
||||
double total_support_used_filament_g = 0;
|
||||
double total_flushed_filament_m = 0;
|
||||
double total_flushed_filament_g = 0;
|
||||
double total_wipe_tower_used_filament_m = 0;
|
||||
double total_wipe_tower_used_filament_g = 0;
|
||||
if (displayed_columns & ColumnData::Model) {
|
||||
std::for_each(model_used_filaments_m_all_plates.begin(), model_used_filaments_m_all_plates.end(), [&total_model_used_filament_m](double value) {
|
||||
total_model_used_filament_m += value;
|
||||
});
|
||||
std::for_each(model_used_filaments_g_all_plates.begin(), model_used_filaments_g_all_plates.end(), [&total_model_used_filament_g](double value) {
|
||||
total_model_used_filament_g += value;
|
||||
});
|
||||
if ((displayed_columns & ~ColumnData::Model) > 0)
|
||||
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver);
|
||||
else
|
||||
::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver);
|
||||
columns_offsets.push_back({buf, offsets[_u8L("Model")]});
|
||||
}
|
||||
if (displayed_columns & ColumnData::Support) {
|
||||
std::for_each(model_used_filaments_m_all_plates.begin(), model_used_filaments_m_all_plates.end(), [&total_support_used_filament_m](double value) {
|
||||
total_support_used_filament_m += value;
|
||||
});
|
||||
std::for_each(model_used_filaments_g_all_plates.begin(), model_used_filaments_g_all_plates.end(), [&total_support_used_filament_g](double value) {
|
||||
total_support_used_filament_g += value;
|
||||
});
|
||||
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_support_used_filament_m, total_support_used_filament_g / unit_conver);
|
||||
columns_offsets.push_back({buf, offsets[_u8L("Support")]});
|
||||
}
|
||||
if (displayed_columns & ColumnData::Flushed) {
|
||||
std::for_each(flushed_filaments_m_all_plates.begin(), flushed_filaments_m_all_plates.end(), [&total_flushed_filament_m](double value) {
|
||||
total_flushed_filament_m += value;
|
||||
});
|
||||
std::for_each(flushed_filaments_g_all_plates.begin(), flushed_filaments_g_all_plates.end(), [&total_flushed_filament_g](double value) {
|
||||
total_flushed_filament_g += value;
|
||||
});
|
||||
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_flushed_filament_m, total_flushed_filament_g / unit_conver);
|
||||
columns_offsets.push_back({buf, offsets[_u8L("Flushed")]});
|
||||
}
|
||||
if (displayed_columns & ColumnData::WipeTower) {
|
||||
std::for_each(wipe_tower_used_filaments_m_all_plates.begin(), wipe_tower_used_filaments_m_all_plates.end(), [&total_wipe_tower_used_filament_m](double value) {
|
||||
total_wipe_tower_used_filament_m += value;
|
||||
});
|
||||
std::for_each(wipe_tower_used_filaments_g_all_plates.begin(), wipe_tower_used_filaments_g_all_plates.end(), [&total_wipe_tower_used_filament_g](double value) {
|
||||
total_wipe_tower_used_filament_g += value;
|
||||
});
|
||||
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_wipe_tower_used_filament_m, total_wipe_tower_used_filament_g / unit_conver);
|
||||
columns_offsets.push_back({buf, offsets[_u8L("Tower")]});
|
||||
}
|
||||
if ((displayed_columns & ~ColumnData::Model) > 0) {
|
||||
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g",
|
||||
total_model_used_filament_m + total_support_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m,
|
||||
(total_model_used_filament_g + total_support_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g) / unit_conver);
|
||||
columns_offsets.push_back({buf, offsets[_u8L("Total")]});
|
||||
}
|
||||
append_item(false, m_tools.m_tool_colors[0], columns_offsets);
|
||||
}
|
||||
|
||||
ImGui::Dummy({ window_padding, window_padding });
|
||||
ImGui::SameLine();
|
||||
imgui.text(_u8L("Total cost") + ":");
|
||||
ImGui::SameLine();
|
||||
char buf[64];
|
||||
::sprintf(buf, "%.2f", total_cost_all_plates);
|
||||
imgui.text(buf);
|
||||
|
||||
//1.9.7.52
|
||||
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
|
||||
ImGui::Dummy({ window_padding, window_padding });
|
||||
ImGui::SameLine();
|
||||
imgui.title(_u8L("Time Estimation"));
|
||||
|
||||
for (auto it = plate_time.begin(); it != plate_time.end(); it++) {
|
||||
std::vector<std::pair<std::string, float>> columns_offsets;
|
||||
columns_offsets.push_back({ _u8L("Plate") + " " + std::to_string(it->first), offsets[_u8L("Filament")]});
|
||||
columns_offsets.push_back({ short_time(get_time_dhms(it->second)), offsets[_u8L("Model")] });
|
||||
append_item(false, m_tools.m_tool_colors[0], columns_offsets);
|
||||
}
|
||||
|
||||
if (plate_time.size() > 1) {
|
||||
// Separator
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y),
|
||||
ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f));
|
||||
ImGui::ItemSize(ImVec2(0.0f, 0.0f));
|
||||
const bool item_visible = ImGui::ItemAdd(separator, 0);
|
||||
window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator));
|
||||
std::vector<std::pair<std::string, float>> columns_offsets;
|
||||
columns_offsets.push_back({ _u8L("Total"), offsets[_u8L("Filament")] });
|
||||
columns_offsets.push_back({ short_time(get_time_dhms(total_time_all_plates)), offsets[_u8L("Model")] });
|
||||
append_item(false, m_tools.m_tool_colors[0], columns_offsets);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor(6);
|
||||
|
||||
@@ -60,7 +60,8 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
|
||||
m_media_ctrl->Bind(EVT_MEDIA_CTRL_STAT, [this](auto & e) {
|
||||
#if !QDT_RELEASE_TO_PUBLIC
|
||||
wxSize size = m_media_ctrl->GetVideoSize();
|
||||
m_label_stat->SetLabel(e.GetString() + wxString::Format(" VS:%ix%i", size.x, size.y));
|
||||
//1.9.7.52
|
||||
m_label_stat->SetLabel(e.GetString() + wxString::Format(" VS:%ix%i LD:%i", size.x, size.y, m_load_duration));
|
||||
#endif
|
||||
wxString str = e.GetString();
|
||||
m_stat.clear();
|
||||
@@ -182,10 +183,27 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
agent->get_camera_url(machine, [](auto) {});
|
||||
m_last_user_play = wxDateTime::Now();
|
||||
}
|
||||
//1.9.5
|
||||
if (m_last_state == wxMediaState::wxMEDIASTATE_PLAYING && SecondsSinceLastInput() > 900) { // 15 minutes
|
||||
m_next_retry = wxDateTime();
|
||||
Stop(_L("Temporarily closed because there is no operating for a long time."));
|
||||
//1.9.7.52
|
||||
if (m_last_state == wxMediaState::wxMEDIASTATE_PLAYING) {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
if (m_play_timer <= now) {
|
||||
m_play_timer = now + 1min;
|
||||
if (SecondsSinceLastInput() >= 900) { // 15 min
|
||||
auto close = wxGetApp().app_config->get("liveview", "auto_stop_liveview") == "true";
|
||||
if (close) {
|
||||
m_next_retry = wxDateTime();
|
||||
Stop(_L("Temporarily closed because there is no operating for a long time."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto obj = wxGetApp().getDeviceManager()->get_selected_machine();
|
||||
if (obj && obj->is_in_printing()) {
|
||||
m_print_idle = 0;
|
||||
} else if (++m_print_idle >= 5) {
|
||||
m_next_retry = wxDateTime();
|
||||
Stop(_L("Temporarily closed because there is no printing for a while."));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -324,6 +342,7 @@ void MediaPlayCtrl::Play()
|
||||
|
||||
m_label_stat->SetLabel({});
|
||||
SetStatus(_L("Initializing..."));
|
||||
m_play_timer = std::chrono::system_clock::now();
|
||||
|
||||
if (agent) {
|
||||
agent->get_camera_url(m_machine,
|
||||
@@ -389,7 +408,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
|
||||
#endif
|
||||
SetStatus(msg2);
|
||||
} else
|
||||
SetStatus(_L("Stopped."), false);
|
||||
SetStatus(_L("Video Stopped."), false);
|
||||
m_last_state = MEDIASTATE_IDLE;
|
||||
bool auto_retry = wxGetApp().app_config->get("liveview", "auto_retry") != "false";
|
||||
if (!auto_retry || m_failed_code >= 100 || m_failed_code == 1) // not keep retry on local error or EOS
|
||||
@@ -628,7 +647,12 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event)
|
||||
m_last_state = state;
|
||||
m_failed_code = 0;
|
||||
SetStatus(_L("Playing..."), false);
|
||||
|
||||
//1.9.7.52
|
||||
m_print_idle = 0;
|
||||
auto now = std::chrono::system_clock::now();
|
||||
m_load_duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_play_timer).count();
|
||||
m_play_timer = now + 1min;
|
||||
|
||||
// track event
|
||||
json j;
|
||||
j["stage"] = std::to_string(m_last_state);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
|
||||
@@ -102,7 +103,11 @@ private:
|
||||
std::set<int> m_last_failed_codes;
|
||||
wxDateTime m_last_user_play;
|
||||
wxDateTime m_next_retry;
|
||||
|
||||
//1.9.7.52
|
||||
std::chrono::system_clock::time_point m_play_timer;
|
||||
int m_print_idle = 0;
|
||||
int m_load_duration = 0;
|
||||
|
||||
::Button *m_button_play;
|
||||
::Label * m_label_stat;
|
||||
::Label * m_label_status;
|
||||
|
||||
@@ -2552,19 +2552,10 @@ void NotificationManager::qdt_close_preview_only_notification()
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationManager::qdt_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden)
|
||||
//1.9.7.52
|
||||
void NotificationManager::qdt_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden, const std::string hypertext, std::function<bool(wxEvtHandler*)> callback)
|
||||
{
|
||||
std::string hyper_text;
|
||||
auto callback = std::function<bool(wxEvtHandler *)>();
|
||||
if (is_warning) {
|
||||
callback =[](wxEvtHandler *) {
|
||||
wxCommandEvent *evt = new wxCommandEvent(EVT_REPAIR_MODEL);
|
||||
wxQueueEvent(wxGetApp().plater(), evt);
|
||||
return false;
|
||||
};
|
||||
hyper_text = _u8L(" (Repair)");
|
||||
}
|
||||
NotificationData data{NotificationType::QDTObjectInfo, NotificationLevel::PrintInfoNotificationLevel, QDT_NOTICE_MAX_INTERVAL, text, hyper_text, callback};
|
||||
NotificationData data{NotificationType::QDTObjectInfo, NotificationLevel::PrintInfoNotificationLevel, QDT_NOTICE_MAX_INTERVAL, text, hypertext, callback};
|
||||
if (is_warning)
|
||||
data.use_warn_color = true;
|
||||
|
||||
|
||||
@@ -315,7 +315,9 @@ public:
|
||||
void qdt_close_plugin_install_notification();
|
||||
|
||||
//QDS--Objects Info
|
||||
void qdt_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden);
|
||||
//1.9.7.52
|
||||
void qdt_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden,
|
||||
const std::string hypertext = "", std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>());
|
||||
void qdt_close_objectsinfo_notification();
|
||||
|
||||
void qdt_show_seqprintinfo_notification(const std::string &text);
|
||||
|
||||
@@ -117,10 +117,17 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_
|
||||
|
||||
m_printer = PhysicalPrinter("Default Name", m_printer.config, sel_preset);
|
||||
m_config = &m_printer.config;
|
||||
//y40
|
||||
if (printer)
|
||||
{
|
||||
m_config->set_key_value("print_host", new ConfigOptionString(printer->config.opt_string("print_host")));
|
||||
m_config->set_key_value("printhost_apikey", new ConfigOptionString(printer->config.opt_string("printhost_apikey")));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_config->set_key_value("print_host", new ConfigOptionString(""));
|
||||
m_config->set_key_value("printhost_apikey", new ConfigOptionString(""));
|
||||
}
|
||||
m_optgroup = new ConfigOptionsGroup(this, _L("Print Host upload"), m_config);
|
||||
|
||||
auto button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -248,6 +255,11 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||
host_line.append_widget(print_host_test);
|
||||
m_optgroup->append_line(host_line);
|
||||
|
||||
//y40
|
||||
option = m_optgroup->get_option("printhost_apikey");
|
||||
option.opt.width = 15;
|
||||
m_optgroup->append_single_option_line(option);
|
||||
|
||||
m_optgroup->activate();
|
||||
|
||||
Field* printhost_field = m_optgroup->get_field("print_host");
|
||||
@@ -488,10 +500,12 @@ void PhysicalPrinterDialog::OnOK(wxMouseEvent& event)
|
||||
// y3
|
||||
m_printer_name = into_u8(m_input_ctrl->GetValue());
|
||||
m_printer_host = boost::any_cast<std::string>(m_optgroup->get_field("print_host")->get_value());
|
||||
std::string m_apikey = boost::any_cast<std::string>(m_optgroup->get_field("printhost_apikey")->get_value());
|
||||
m_config->set_key_value("name", new ConfigOptionString(into_u8(m_input_ctrl->GetValue())));
|
||||
m_config->set_key_value("preset_name", new ConfigOptionString(into_u8(pret_combobox->GetValue())));
|
||||
m_config->set_key_value("preset_names", new ConfigOptionString(into_u8(pret_combobox->GetValue())));
|
||||
m_config->set_key_value("print_host", new ConfigOptionString(m_printer_host));
|
||||
m_config->set_key_value("printhost_apikey", new ConfigOptionString(m_apikey));
|
||||
PhysicalPrinterCollection& printers = wxGetApp().preset_bundle->physical_printers;
|
||||
m_printer.set_name(m_printer_name);
|
||||
if(!old_name.empty())
|
||||
|
||||
@@ -1307,8 +1307,23 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
cb->update();
|
||||
}
|
||||
|
||||
if (p->combo_printer)
|
||||
//w13
|
||||
if (p->combo_printer) {
|
||||
p->combo_printer->update();
|
||||
bool get_seal_status =wxGetApp().enable_seal();
|
||||
auto print_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
if (get_seal_status) {
|
||||
print_config->set_key_value("seal", new ConfigOptionBool(true));
|
||||
config->set_seal(true);
|
||||
wxGetApp().set_seal_an(true);
|
||||
}
|
||||
else {
|
||||
print_config->set_key_value("seal", new ConfigOptionBool(false));
|
||||
config->set_seal(false);
|
||||
wxGetApp().set_seal_an(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sidebar::update_presets(Preset::Type preset_type)
|
||||
@@ -1830,7 +1845,8 @@ void Sidebar::sync_ams_list()
|
||||
add_button(wxID_OK, true, _L("Sync"));
|
||||
add_button(wxID_YES, false, _L("Resync"));
|
||||
}
|
||||
add_button(wxID_CANCEL, false, _L("Cancel"));
|
||||
//1.9.7.52
|
||||
add_button(wxID_CANCEL, false, _L("No"));
|
||||
}
|
||||
} dlg(this, ams_filament_ids.empty());
|
||||
auto res = dlg.ShowModal();
|
||||
@@ -7095,22 +7111,37 @@ void Plater::priv::on_action_print_plate(SimpleEvent&)
|
||||
}
|
||||
|
||||
//QDS
|
||||
//y30
|
||||
//y40
|
||||
wxString title = "Send print job to";
|
||||
SelectMachineDialog* dlg = new SelectMachineDialog(q, title);
|
||||
if (dlg->ShowModal() == wxID_YES)
|
||||
{
|
||||
std::string send_ip = dlg->get_machine_url();
|
||||
std::string show_ip = dlg->get_machine_ip();
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
std::string send_apikey = dlg->get_machine_apikey();
|
||||
std::string project_name = dlg->get_project_name();
|
||||
if (project_name.find(".gcode") == std::string::npos)
|
||||
{
|
||||
project_name += ".gcode";
|
||||
}
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::StartPrint;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
if (send_apikey.empty())
|
||||
{
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::StartPrint;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
}
|
||||
else
|
||||
{
|
||||
DynamicPrintConfig cfg_t;
|
||||
cfg_t.set_key_value("print_host", new ConfigOptionString(send_ip));
|
||||
cfg_t.set_key_value("host_type", new ConfigOptionString("ptfff"));
|
||||
cfg_t.set_key_value("printhost_apikey", new ConfigOptionString(send_apikey));
|
||||
PrintHostJob upload_job(&cfg_t);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::StartPrint;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
}
|
||||
}
|
||||
//if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
//m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL);
|
||||
@@ -7122,7 +7153,7 @@ void Plater::priv::on_action_print_plate(SimpleEvent&)
|
||||
void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&)
|
||||
{
|
||||
|
||||
// y21
|
||||
//y40
|
||||
// if (!m_send_multi_dlg)
|
||||
// m_send_multi_dlg = new SendMultiMachinePage(q);
|
||||
// m_send_multi_dlg->prepare(partplate_list.get_curr_plate_index());
|
||||
@@ -7139,29 +7170,55 @@ void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&)
|
||||
std::map<std::string, std::vector<std::string>> send_machine_info = m_send_multi_dlg->get_selected_machine_info();
|
||||
for (auto it = send_machine_info.begin(); it != send_machine_info.end(); it++)
|
||||
{
|
||||
std::string send_ip = it->second[0];
|
||||
std::string show_ip = it->second[1];
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
|
||||
if (project_name.find(".gcode") == std::string::npos)
|
||||
{
|
||||
project_name += ".gcode";
|
||||
}
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
upload_job.create_time = std::chrono::system_clock::now();
|
||||
if (diff.count() < 0)
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 -
|
||||
diff.count() + 4;
|
||||
else
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60;
|
||||
std::chrono::seconds seconds_to_add(upload_job.sendinginterval);
|
||||
std::string send_ip = it->second[0];
|
||||
std::string show_ip = it->second[1];
|
||||
std::string apikey = it->second[2];
|
||||
if (apikey.empty())
|
||||
{
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
upload_job.create_time = std::chrono::system_clock::now();
|
||||
if (diff.count() < 0)
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 -
|
||||
diff.count() + 4;
|
||||
else
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60;
|
||||
std::chrono::seconds seconds_to_add(upload_job.sendinginterval);
|
||||
|
||||
m_time_p = upload_job.create_time + seconds_to_add;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
count++;
|
||||
m_time_p = upload_job.create_time + seconds_to_add;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
DynamicPrintConfig cfg_t;
|
||||
cfg_t.set_key_value("print_host", new ConfigOptionString(send_ip));
|
||||
cfg_t.set_key_value("host_type", new ConfigOptionString("ptfff"));
|
||||
cfg_t.set_key_value("printhost_apikey", new ConfigOptionString(apikey));
|
||||
PrintHostJob upload_job(&cfg_t);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
upload_job.create_time = std::chrono::system_clock::now();
|
||||
if (diff.count() < 0)
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 -
|
||||
diff.count() + 4;
|
||||
else
|
||||
upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) *
|
||||
std::stoi(wxGetApp().app_config->get("sending_interval")) * 60;
|
||||
std::chrono::seconds seconds_to_add(upload_job.sendinginterval);
|
||||
|
||||
m_time_p = upload_job.create_time + seconds_to_add;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7277,22 +7334,38 @@ void Plater::priv::on_action_export_to_sdcard(SimpleEvent&)
|
||||
// BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received export sliced file event\n";
|
||||
// q->send_to_printer();
|
||||
// }
|
||||
//y30
|
||||
//y40
|
||||
wxString title = "Send to Printer SD card";
|
||||
SelectMachineDialog* dlg = new SelectMachineDialog(q, title);
|
||||
if (dlg->ShowModal() == wxID_YES)
|
||||
{
|
||||
std::string send_ip = dlg->get_machine_url();
|
||||
std::string show_ip = dlg->get_machine_ip();
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
std::string send_apikey = dlg->get_machine_apikey();
|
||||
std::string project_name = dlg->get_project_name();
|
||||
if (project_name.find(".gcode") == std::string::npos)
|
||||
{
|
||||
project_name += ".gcode";
|
||||
}
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
if (send_apikey.empty())
|
||||
{
|
||||
PrintHostJob upload_job(send_ip, show_ip);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
}
|
||||
else
|
||||
{
|
||||
DynamicPrintConfig cfg_t;
|
||||
cfg_t.set_key_value("print_host", new ConfigOptionString(send_ip));
|
||||
cfg_t.set_key_value("host_type", new ConfigOptionString("ptfff"));
|
||||
cfg_t.set_key_value("printhost_apikey", new ConfigOptionString(send_apikey));
|
||||
PrintHostJob upload_job(&cfg_t);
|
||||
upload_job.upload_data.upload_path = project_name;
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
export_gcode(fs::path(), false, std::move(upload_job));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8240,6 +8313,8 @@ void Plater::priv::on_create_filament(SimpleEvent &)
|
||||
CreatePresetSuccessfulDialog success_dlg(wxGetApp().mainframe, SuccessType::FILAMENT);
|
||||
int res = success_dlg.ShowModal();
|
||||
}
|
||||
//1.9.7.52
|
||||
wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_FILAMENTS);
|
||||
}
|
||||
|
||||
void Plater::priv::on_modify_filament(SimpleEvent &evt)
|
||||
@@ -8267,7 +8342,8 @@ void Plater::priv::on_modify_filament(SimpleEvent &evt)
|
||||
tab->select_preset(need_edit_preset->name);
|
||||
// when some preset have modified, if the printer is not need_edit_preset_name compatible printer, the preset will jump to other preset, need select again
|
||||
if (!need_edit_preset->is_compatible) tab->select_preset(need_edit_preset->name);
|
||||
}
|
||||
} else
|
||||
wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_FILAMENTS); //1.9.7.52
|
||||
|
||||
}
|
||||
|
||||
@@ -13032,7 +13108,7 @@ int Plater::send_gcode(int plate_idx, Export3mfProgressFn proFn)
|
||||
return -1;
|
||||
}
|
||||
|
||||
SaveStrategy strategy = SaveStrategy::Silence | SaveStrategy::SkipModel | SaveStrategy::WithGcode;
|
||||
SaveStrategy strategy = SaveStrategy::Silence | SaveStrategy::SkipModel | SaveStrategy::WithGcode | SaveStrategy::SkipAuxiliary; //1.9.7.52
|
||||
#if !QDT_RELEASE_TO_PUBLIC
|
||||
//only save model in QA environment
|
||||
std::string sel = get_app_config()->get("iot_environment");
|
||||
@@ -14531,16 +14607,38 @@ void Plater::show_object_info()
|
||||
wxString info_manifold;
|
||||
int non_manifold_edges = 0;
|
||||
auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges);
|
||||
//1.9.7.52
|
||||
bool warning = non_manifold_edges > 0;
|
||||
wxString hyper_text;
|
||||
std::function<bool(wxEvtHandler*)> callback;
|
||||
if (warning) {
|
||||
hyper_text = _L(" (Repair)");
|
||||
callback = [](wxEvtHandler*) {
|
||||
wxCommandEvent* evt = new wxCommandEvent(EVT_REPAIR_MODEL);
|
||||
wxQueueEvent(wxGetApp().plater(), evt);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
if (non_manifold_edges > 0) {
|
||||
info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please repair the model on QIDI Studio(windows) or CAD softwares."));
|
||||
//1.9.7.52
|
||||
info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please use a third-party tool to repair the model before importing it into QIDI Studio, such as "));
|
||||
}
|
||||
if (warning) {
|
||||
std::string repair_url = "https://www.formware.co/onlinestlrepair";
|
||||
hyper_text = repair_url + ".";
|
||||
callback = [repair_url](wxEvtHandler*) {
|
||||
wxGetApp().open_browser_with_warning_dialog(repair_url);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
#endif //APPLE & LINUX
|
||||
|
||||
info_manifold = "<Error>" + info_manifold + "</Error>";
|
||||
info_text += into_u8(info_manifold);
|
||||
notify_manager->qdt_show_objectsinfo_notification(info_text, is_windows10()&&(non_manifold_edges > 0), !(p->current_panel == p->view3D));
|
||||
//1.9.7.52
|
||||
notify_manager->qdt_show_objectsinfo_notification(info_text, warning, !(p->current_panel == p->view3D), into_u8(hyper_text), callback);
|
||||
}
|
||||
|
||||
bool Plater::show_publish_dialog(bool show)
|
||||
|
||||
@@ -167,6 +167,10 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(
|
||||
else if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_TURKISH)) {
|
||||
language_name = wxString::FromUTF8("\x54\xC3\xBC\x72\x6B\xC3\xA7\x65");
|
||||
}
|
||||
//1.9.7.52
|
||||
else if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_POLISH)) {
|
||||
language_name = wxString::FromUTF8("Polski");
|
||||
}
|
||||
|
||||
if (language == vlist[i]->CanonicalName) {
|
||||
m_current_language_selected = i;
|
||||
@@ -631,8 +635,9 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||
//ZY2
|
||||
/*if (param == "privacyuse") {
|
||||
checkbox->SetValue((app_config->get("firstguide", param) == "true") ? true : false);
|
||||
}
|
||||
else {
|
||||
} else if (param == "auto_stop_liveview") {
|
||||
checkbox->SetValue((app_config->get("liveview", param) == "true") ? false : true);
|
||||
} else {
|
||||
checkbox->SetValue((app_config->get(param) == "true") ? true : false);
|
||||
}*/
|
||||
checkbox->SetValue((app_config->get(param) == "true") ? true : false);
|
||||
@@ -664,6 +669,9 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||
}
|
||||
app_config->save();
|
||||
}
|
||||
else if (param == "auto_stop_liveview") {
|
||||
app_config->set("liveview", param, !checkbox->GetValue());
|
||||
}
|
||||
else {
|
||||
app_config->set_bool(param, checkbox->GetValue());
|
||||
app_config->save();
|
||||
@@ -1000,7 +1008,8 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||
wxLANGUAGE_CZECH,
|
||||
wxLANGUAGE_UKRAINIAN,
|
||||
wxLANGUAGE_PORTUGUESE_BRAZILIAN,
|
||||
wxLANGUAGE_TURKISH
|
||||
wxLANGUAGE_TURKISH,
|
||||
wxLANGUAGE_POLISH
|
||||
};
|
||||
|
||||
auto translations = wxTranslations::Get()->GetAvailableTranslations(SLIC3R_APP_KEY);
|
||||
@@ -1084,8 +1093,9 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||
auto item_backup_interval = create_item_backup_input(_L("every"), page, _L("The peroid of backup in seconds."), "backup_interval");
|
||||
|
||||
//downloads
|
||||
auto title_downloads = create_item_title(_L("Downloads"), page, _L("Downloads"));
|
||||
auto title_media = create_item_title(_L("Media"), page, _L("Media"));
|
||||
auto item_downloads = create_item_downloads(page,50,"download_path");
|
||||
// auto item_auto_stop_liveview = create_item_checkbox(_L("Keep liveview when printing."), page, _L("By default, Liveview will pause after 15 minutes of inactivity on the computer. Check this box to disable this feature during printing."), 50, "auto_stop_liveview");
|
||||
|
||||
//dark mode
|
||||
#ifdef _WIN32
|
||||
@@ -1147,8 +1157,9 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||
sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3));
|
||||
item_backup->Add(item_backup_interval, 0, wxLEFT, 0);
|
||||
|
||||
sizer_page->Add(title_downloads, 0, wxTOP| wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(title_media, 0, wxTOP| wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_downloads, 0, wxEXPAND, FromDIP(3));
|
||||
// sizer_page->Add(item_auto_stop_liveview, 0, wxEXPAND, FromDIP(3));
|
||||
|
||||
#ifdef _WIN32
|
||||
sizer_page->Add(title_darkmode, 0, wxTOP | wxEXPAND, FromDIP(20));
|
||||
|
||||
@@ -441,18 +441,19 @@ void PrintHostQueueDialog::on_error(Event &evt)
|
||||
|
||||
set_state(evt.job_id, ST_ERROR);
|
||||
std::string response_msg = into_u8(evt.error);
|
||||
size_t pos_404 = evt.error.find("HTTP 404:");
|
||||
wxString code_msg = "";
|
||||
if (pos_404 != std::string::npos) {
|
||||
code_msg = _L("Network connection fails.");
|
||||
//y40
|
||||
if (response_msg.find("HTTP 404:") != std::string::npos) {
|
||||
size_t isAws = response_msg.find("AWS");
|
||||
if(isAws != std::string::npos)
|
||||
code_msg += _L("HTTP 404. Unable to get required resources from AWS server, please check your network settings.");
|
||||
if (isAws != std::string::npos)
|
||||
code_msg = _L("HTTP 404. Unable to get required resources from AWS server, please check your network settings.");
|
||||
else
|
||||
code_msg += _L("HTTP 404. Unable to get required resources from Aliyun server, please check your network settings.");
|
||||
}
|
||||
code_msg = _L("HTTP 404. Unable to get required resources from Aliyun server, please check your network settings.");
|
||||
}
|
||||
else if (response_msg.find("HTTP 401:") != std::string::npos)
|
||||
code_msg = _L("HTTP 401: Unauthorized. Please check whether your physical printer has added users. If a user exists, add the APIKEY when adding/editing the printer.");
|
||||
else
|
||||
code_msg = _L("Network connection times out. Please check the device network Settings.");
|
||||
code_msg = response_msg;
|
||||
auto errormsg = format_wxstr("%1%\n%2%", _L("Error uploading to print host") + ":", code_msg);
|
||||
job_list->SetValue(wxVariant(0), evt.job_id, COL_PROGRESS);
|
||||
job_list->SetValue(wxVariant(errormsg), evt.job_id, COL_ERRORMSG); // Stashes the error message into a hidden column for later
|
||||
|
||||
@@ -1239,6 +1239,9 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
|
||||
if (c) c(result, r, nullptr);
|
||||
}
|
||||
m_messages.clear();
|
||||
//1.9.7.52
|
||||
if (result)
|
||||
m_cond.timed_wait(l, boost::posix_time::seconds(10));
|
||||
while (true) {
|
||||
while (m_stopped) {
|
||||
if (m_session.owner == nullptr)
|
||||
|
||||
@@ -287,14 +287,12 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
if (m_pauseThread)
|
||||
break;
|
||||
|
||||
|
||||
BOOST_LOG_TRIVIAL(error) << "machine IP: " << (button->getIPLabel());
|
||||
std::string printer_host = button->getIPLabel().ToStdString();
|
||||
if (printer_host.find(":10088") == std::string::npos)
|
||||
printer_host += "10088";
|
||||
DynamicPrintConfig cfg_t;
|
||||
cfg_t.set_key_value("print_host", new ConfigOptionString(printer_host));
|
||||
cfg_t.set_key_value("host_type", new ConfigOptionString("ptfff"));
|
||||
cfg_t.set_key_value("printhost_apikey", new ConfigOptionString(into_u8(button->GetApikey())));
|
||||
std::unique_ptr<PrintHost> printhost(PrintHost::get_print_host(&cfg_t));
|
||||
if (!printhost) {
|
||||
BOOST_LOG_TRIVIAL(error) << ("Could not get a valid Printer Host reference");
|
||||
@@ -303,13 +301,14 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
wxString msg;
|
||||
std::string state = "standby";
|
||||
float progress = 0;
|
||||
state = printhost->get_status(msg, into_u8(button->getNameLabel()), button->getIPLabel());
|
||||
std::pair<std::string, float> state_progress = printhost->get_status_progress(msg);
|
||||
state = state_progress.first;
|
||||
|
||||
if ((button->GetStateText()).ToStdString() != state)
|
||||
button->SetStateText(state);
|
||||
|
||||
if (state == "printing") {
|
||||
progress = (printhost->get_progress(msg, into_u8(button->getNameLabel()), button->getIPLabel())) * 100;
|
||||
progress = state_progress.second * 100;
|
||||
int progressInt = static_cast<int>(progress);
|
||||
button->SetProgressText(wxString::Format(wxT("(%d%%)"), progressInt));
|
||||
}
|
||||
@@ -324,10 +323,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
break;
|
||||
if (!m_net_buttons.empty()) {
|
||||
BOOST_LOG_TRIVIAL(error) << "machine IP: " << device.local_ip;
|
||||
DynamicPrintConfig cfg_t;
|
||||
cfg_t.set_key_value("print_host", new ConfigOptionString(device.url));
|
||||
cfg_t.set_key_value("host_type", new ConfigOptionString("ptfff"));
|
||||
std::unique_ptr<PrintHost> printhost(PrintHost::get_print_host(&cfg_t));
|
||||
std::unique_ptr<PrintHost> printhost(PrintHost::get_print_host_url(device.url, device.local_ip));
|
||||
if (!printhost) {
|
||||
BOOST_LOG_TRIVIAL(error) << ("Could not get a valid Printer Host reference");
|
||||
return;
|
||||
@@ -335,14 +331,14 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
wxString msg;
|
||||
std::string state = "standby";
|
||||
float progress = 0;
|
||||
//y34
|
||||
state = printhost->get_status(msg, device.device_name, device.url);
|
||||
std::pair<std::string, float> state_progress = printhost->get_status_progress(msg);
|
||||
state = state_progress.first;
|
||||
BOOST_LOG_TRIVIAL(error) << ("State:", state);
|
||||
if ((m_net_buttons[count]->GetStateText()).ToStdString() != state)
|
||||
m_net_buttons[count]->SetStateText(state);
|
||||
|
||||
if (state == "printing") {
|
||||
progress = (printhost->get_progress(msg, device.device_name, device.url)) * 100;
|
||||
progress = state_progress.second * 100;
|
||||
int progressInt = static_cast<int>(progress);
|
||||
m_net_buttons[count]->SetProgressText(wxString::Format(wxT("(%d%%)"), progressInt));
|
||||
}
|
||||
@@ -372,6 +368,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
std::string actice_url = "";
|
||||
for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) {
|
||||
std::string host = (it->config.opt_string("print_host"));
|
||||
std::string apikey = (it->config.opt_string("printhost_apikey"));
|
||||
std::string preset_name = (it->config.opt_string("preset_name"));
|
||||
bool isQIDI_printer = false;
|
||||
if (qidi_printers.find(preset_name) != qidi_printers.end())
|
||||
@@ -404,7 +401,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
//BOOST_LOG_TRIVIAL(error) << (it->get_preset_name(full_name));
|
||||
//BOOST_LOG_TRIVIAL(error) << model_id;
|
||||
AddButton((it->get_short_name(full_name)), host, model_id, full_name, is_selected,
|
||||
(host_type == htOctoPrint));
|
||||
(host_type == htOctoPrint), apikey);
|
||||
m_machine.insert(std::make_pair((it->get_short_name(full_name)), *cfg_t));
|
||||
//y25
|
||||
m_exit_host.insert(host);
|
||||
@@ -418,31 +415,26 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
#endif
|
||||
CreatThread();
|
||||
}
|
||||
//y23 //y28 //y31
|
||||
//y40
|
||||
if(m_isNetMode)
|
||||
ShowNetPrinterButton();
|
||||
else
|
||||
ShowLocalPrinterButton();
|
||||
|
||||
if (webisNetMode == isNetWeb) {
|
||||
ShowNetPrinterButton();
|
||||
for (DeviceButton* button : m_net_buttons) {
|
||||
if (button->getIPLabel().find(m_ip) != std::string::npos) {
|
||||
button->SetIsSelected(true);
|
||||
wxCommandEvent event(wxEVT_BUTTON, button->GetId());
|
||||
wxPostEvent(button, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
toggleBar->SetValue(true);
|
||||
m_isNetMode = true;
|
||||
wxGetApp().app_config->set("machine_list_net", "1");
|
||||
} else if (webisNetMode == isLocalWeb) {
|
||||
ShowLocalPrinterButton();
|
||||
for (DeviceButton* button : m_buttons) {
|
||||
if (button->getIPLabel().find(m_ip) != std::string::npos) {
|
||||
button->SetIsSelected(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
toggleBar->SetValue(false);
|
||||
m_isNetMode = false;
|
||||
wxGetApp().app_config->set("machine_list_net", "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -450,7 +442,6 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
if (m_isNetMode)
|
||||
{
|
||||
//y30
|
||||
ShowNetPrinterButton();
|
||||
wxString url = wxString::Format("file://%s/web/qidi/link_missing_connection.html", from_u8(resources_dir()));
|
||||
if(strlang != "")
|
||||
url = wxString::Format("file://%s/web/qidi/link_missing_connection.html?lang=%s", from_u8(resources_dir()), strlang);
|
||||
@@ -458,7 +449,6 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowLocalPrinterButton();
|
||||
//y30
|
||||
wxString url = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir()));
|
||||
if (strlang != "")
|
||||
@@ -517,7 +507,8 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
const wxString & machine_type,
|
||||
const wxString & fullname,
|
||||
bool isSelected,
|
||||
bool isQIDI)
|
||||
bool isQIDI,
|
||||
const wxString& apikey)
|
||||
{
|
||||
wxString Machine_Name = Machine_Name.Format("%s%s", machine_type, "_thumbnail");
|
||||
|
||||
@@ -525,7 +516,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
std::pair<wxColour, int>(wxColour(76, 76, 80), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(67, 67, 71), StateColor::Normal));
|
||||
|
||||
DeviceButton *machine_button = new DeviceButton(leftScrolledWindow, fullname, Machine_Name, wxBU_LEFT, wxSize(80, 80), device_name, ip);
|
||||
DeviceButton *machine_button = new DeviceButton(leftScrolledWindow, fullname, Machine_Name, wxBU_LEFT, wxSize(80, 80), device_name, ip, apikey);
|
||||
machine_button->SetBackgroundColor(mac_btn_bg);
|
||||
machine_button->SetBorderColor(wxColour(57, 51, 55));
|
||||
machine_button->SetCanFocus(false);
|
||||
@@ -618,31 +609,38 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
|
||||
device_name, device.local_ip);
|
||||
machine_button->SetBackgroundColor(mac_btn_bg);
|
||||
machine_button->SetBorderColor(wxColour(57, 51, 55));
|
||||
machine_button->SetCanFocus(false);
|
||||
machine_button->SetIsSimpleMode(m_isSimpleMode);
|
||||
|
||||
machine_button->Bind(wxEVT_BUTTON, [this, device](wxCommandEvent &event) {
|
||||
//y34 //y35
|
||||
std::string formattedHost;
|
||||
if(wxGetApp().app_config->get("dark_color_mode") == "1")
|
||||
formattedHost = device.link_url + "&theme=dark";
|
||||
else
|
||||
formattedHost = device.link_url + "&theme=light";
|
||||
|
||||
std::string formattedHost1 = "http://fluidd_" + formattedHost;
|
||||
std::string formattedHost2 = "http://fluidd2_" + formattedHost;
|
||||
if (formattedHost1 == m_web || formattedHost2 == m_web)
|
||||
return;
|
||||
|
||||
if (m_isfluidd_1)
|
||||
if (device.isSpecialMachine)
|
||||
{
|
||||
formattedHost = "http://fluidd_" + formattedHost;
|
||||
m_isfluidd_1 = false;
|
||||
if(wxGetApp().app_config->get("dark_color_mode") == "1")
|
||||
formattedHost = device.link_url + "&theme=dark";
|
||||
else
|
||||
formattedHost = device.link_url + "&theme=light";
|
||||
|
||||
std::string formattedHost1 = "http://fluidd_" + formattedHost;
|
||||
std::string formattedHost2 = "http://fluidd2_" + formattedHost;
|
||||
if (formattedHost1 == m_web || formattedHost2 == m_web)
|
||||
return;
|
||||
|
||||
if (m_isfluidd_1)
|
||||
{
|
||||
formattedHost = "http://fluidd_" + formattedHost;
|
||||
m_isfluidd_1 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://fluidd2_" + formattedHost;
|
||||
m_isfluidd_1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://fluidd2_" + formattedHost;
|
||||
m_isfluidd_1 = true;
|
||||
formattedHost = "http://" + device.link_url;
|
||||
}
|
||||
load_net_url(formattedHost, device.local_ip);
|
||||
});
|
||||
@@ -810,7 +808,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
vec1.clear();
|
||||
vec2.clear();
|
||||
bool result2 = true;
|
||||
#if QDT_RELEASE_TO_PUBLIC
|
||||
#if QDT_RELEASE_TO_PUBLIC
|
||||
wxString msg;
|
||||
QIDINetwork m_qidinetwork;
|
||||
m_qidinetwork.get_device_list(msg);
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
#include <boost/thread.hpp>
|
||||
#include "./Widgets/SwitchButton.hpp"
|
||||
#include "./Widgets/DeviceButton.hpp"
|
||||
|
||||
#include "OctoPrint.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
@@ -90,7 +93,8 @@ public:
|
||||
const wxString & machine_type,
|
||||
const wxString & fullname,
|
||||
bool isSelected,
|
||||
bool isQIDI);
|
||||
bool isQIDI,
|
||||
const wxString & apikey);
|
||||
void DeleteButton();
|
||||
void UnSelectedButton();
|
||||
void ShowNetPrinterButton();
|
||||
@@ -106,11 +110,11 @@ public:
|
||||
{
|
||||
m_stopThread = true;
|
||||
//y36
|
||||
PrintHost::SetStop(true);
|
||||
OctoPrint::SetStop(true);
|
||||
if (m_statusThread.joinable()) {
|
||||
m_statusThread.join();
|
||||
}
|
||||
PrintHost::SetStop(false);
|
||||
OctoPrint::SetStop(false);
|
||||
};
|
||||
void SetPauseThread(bool status) { m_pauseThread = status; };
|
||||
void SetPresetChanged(bool status);
|
||||
|
||||
@@ -1212,7 +1212,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title)
|
||||
// y21
|
||||
wxPanel* switch_button_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxTAB_TRAVERSAL | wxBU_RIGHT);
|
||||
wxBoxSizer* printer_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
switch_button_panel->SetBackgroundColour(wxColor(255, 255, 255));
|
||||
switch_button_panel->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF")));
|
||||
m_switch_button = new SwitchButton(switch_button_panel);
|
||||
m_switch_button->SetMaxSize(wxSize(100, 100));
|
||||
m_switch_button->SetLabels(_L("Local"), _L("Link"));
|
||||
@@ -1982,8 +1982,14 @@ bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str,
|
||||
} else {
|
||||
json j = json::array();
|
||||
json mapping_info_json = json::array();
|
||||
|
||||
for (int i = 0; i < wxGetApp().preset_bundle->filament_presets.size(); i++) {
|
||||
//1.9.7.52
|
||||
BOOST_LOG_TRIVIAL(info) << "filaments size = " << m_filaments.size();
|
||||
int mapping_size = wxGetApp().preset_bundle->filament_presets.size();
|
||||
for (size_t i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||
mapping_size = std::max(mapping_size, m_ams_mapping_result[i].id);
|
||||
}
|
||||
mapping_size = std::min(mapping_size, 16);
|
||||
for (int i = 0; i <= mapping_size; i++) {
|
||||
int tray_id = -1;
|
||||
json mapping_item;
|
||||
mapping_item["ams"] = tray_id;
|
||||
@@ -1996,9 +2002,12 @@ bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str,
|
||||
tray_id = m_ams_mapping_result[k].tray_id;
|
||||
mapping_item["ams"] = tray_id;
|
||||
mapping_item["filamentType"] = m_filaments[k].type;
|
||||
auto it = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
|
||||
if (it != nullptr) {
|
||||
mapping_item["filamentId"] = it->filament_id;
|
||||
//1.9.7.52
|
||||
if (i >= 0 && i < wxGetApp().preset_bundle->filament_presets.size()) {
|
||||
auto it = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
|
||||
if (it != nullptr) {
|
||||
mapping_item["filamentId"] = it->filament_id;
|
||||
}
|
||||
}
|
||||
//convert #RRGGBB to RRGGBBAA
|
||||
mapping_item["sourceColor"] = m_filaments[k].color;
|
||||
@@ -2534,6 +2543,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||
{
|
||||
machine_url = machine.url;
|
||||
machine_ip = machine.ip;
|
||||
machine_apikey = machine.apikey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2547,6 +2557,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||
{
|
||||
machine_url = machine.url;
|
||||
machine_ip = machine.ip;
|
||||
machine_apikey = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3163,6 +3174,7 @@ void SelectMachineDialog::update_user_printer()
|
||||
machine.ip = py_printer.config.opt_string("print_host");
|
||||
machine.type = py_printer.config.opt_string("preset_name");
|
||||
machine.display_name = machine.name + " (" + machine.ip + ")";
|
||||
machine.apikey = py_printer.config.opt_string("printhost_apikey");
|
||||
machine_list_local.push_back(machine);
|
||||
}
|
||||
|
||||
@@ -4195,6 +4207,8 @@ void SelectMachineDialog::reset_and_sync_ams_list()
|
||||
m_materialList.clear();
|
||||
m_filaments.clear();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "extruders = " << extruders.size();
|
||||
|
||||
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);
|
||||
|
||||
@@ -68,6 +68,7 @@ struct Machine_info {
|
||||
std::string ip;
|
||||
std::string type;
|
||||
std::string display_name;
|
||||
std::string apikey;
|
||||
};
|
||||
|
||||
|
||||
@@ -381,6 +382,7 @@ private:
|
||||
std::string machine_name;
|
||||
std::string machine_url;
|
||||
std::string machine_ip;
|
||||
std::string machine_apikey;
|
||||
|
||||
Slic3r::DynamicPrintConfig m_required_data_config;
|
||||
Slic3r::Model m_required_data_model;
|
||||
@@ -561,6 +563,8 @@ public:
|
||||
std::string get_machine_ip() { return machine_ip; }
|
||||
std::string get_project_name() { return into_u8(m_current_project_name); }
|
||||
std::string NormalizeVendor(const std::string& str);
|
||||
std::string get_machine_apikey() { return machine_apikey; }
|
||||
|
||||
};
|
||||
|
||||
wxDECLARE_EVENT(EVT_FINISHED_UPDATE_MACHINE_LIST, wxCommandEvent);
|
||||
|
||||
@@ -383,9 +383,9 @@ void SendMultiMachinePage::refresh_user_device()
|
||||
const std::string name = py_printer.name;
|
||||
const std::string url = py_printer.config.opt_string("print_host");
|
||||
const std::string ip = py_printer.config.opt_string("print_host");
|
||||
//y24
|
||||
const std::string apikey = py_printer.config.opt_string("printhost_apikey");
|
||||
std::string display_name = name + " (" + ip + ")";
|
||||
MachineObject* obj = new MachineObject(display_name, url, ip);
|
||||
MachineObject* obj = new MachineObject(display_name, url, ip, apikey);
|
||||
obj->printer_type = py_printer.config.opt_string("preset_name");
|
||||
obj->print_status = "IDLE";
|
||||
SendDeviceItem* di = new SendDeviceItem(scroll_macine_list, obj);
|
||||
@@ -637,9 +637,11 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
|
||||
std::string name = obj->dev_name;
|
||||
std::string url = obj->dev_url;
|
||||
std::string ip = obj->dev_ip;
|
||||
std::string apikey = obj->dev_apikey;
|
||||
std::vector<std::string> host_vector;
|
||||
host_vector.push_back(url);
|
||||
host_vector.push_back(ip);
|
||||
host_vector.push_back(apikey);
|
||||
m_machine_info.insert(std::make_pair(name, host_vector));
|
||||
select_num++;
|
||||
}
|
||||
@@ -1050,7 +1052,7 @@ wxPanel* SendMultiMachinePage::create_page()
|
||||
m_table_head_panel = new wxPanel(main_page, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_table_head_panel->SetMinSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), -1));
|
||||
m_table_head_panel->SetMaxSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), -1));
|
||||
m_table_head_panel->SetBackgroundColour(TABLE_HEAR_NORMAL_COLOUR);
|
||||
m_table_head_panel->SetBackgroundColour(StateColor::darkModeColorFor(TABLE_HEAR_NORMAL_COLOUR));
|
||||
m_table_head_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_select_checkbox = new CheckBox(m_table_head_panel, wxID_ANY);
|
||||
|
||||
@@ -988,10 +988,10 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList,
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " GetFilamentInfo:VendorDirectory - " << VendorDirectory << ", Filepath - "<<filepath;
|
||||
|
||||
try {
|
||||
std::string contents;
|
||||
LoadFile(filepath, contents);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Json Contents: " << contents;
|
||||
json jLocal = json::parse(contents);
|
||||
//1.9.7.52
|
||||
boost::nowide::ifstream ifs(filepath);
|
||||
json jLocal;
|
||||
ifs >> jLocal;
|
||||
|
||||
if (sVendor == "") {
|
||||
if (jLocal.contains("filament_vendor"))
|
||||
@@ -1259,186 +1259,6 @@ void StringReplace(string &strBase, string strSrc, string strDes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath)
|
||||
//{
|
||||
// //wxString strFolder = strFilePath.BeforeLast(boost::filesystem::path::preferred_separator);
|
||||
// boost::filesystem::path file_path(strFilePath);
|
||||
// boost::filesystem::path vendor_dir = boost::filesystem::absolute(file_path.parent_path()/ strVendor).make_preferred();
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", vendor path %1%.")% vendor_dir.string();
|
||||
// try {
|
||||
//
|
||||
// //wxLogMessage("GUIDE: json_path1 %s", w2s(strFilePath));
|
||||
//
|
||||
// std::string contents;
|
||||
// LoadFile(strFilePath, contents);
|
||||
// //wxLogMessage("GUIDE: json_path1 content: %s", contents);
|
||||
// json jLocal=json::parse(contents);
|
||||
// //wxLogMessage("GUIDE: json_path1 Loaded");
|
||||
//
|
||||
// // QDS:models
|
||||
// json pmodels = jLocal["machine_model_list"];
|
||||
// int nsize = pmodels.size();
|
||||
//
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machine models")%nsize;
|
||||
//
|
||||
// for (int n = 0; n < nsize; n++) {
|
||||
// json OneModel = pmodels.at(n);
|
||||
//
|
||||
// OneModel["model"] = OneModel["name"];
|
||||
// OneModel.erase("name");
|
||||
//
|
||||
// std::string s1 = OneModel["model"];
|
||||
// std::string s2 = OneModel["sub_path"];
|
||||
//
|
||||
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
// std::string sub_file = sub_path.string();
|
||||
//
|
||||
// //wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
|
||||
// LoadFile(sub_file, contents);
|
||||
// //wxLogMessage("GUIDE: json_path2 content: %s", contents);
|
||||
// json pm=json::parse(contents);
|
||||
// //wxLogMessage("GUIDE: json_path2 loaded");
|
||||
//
|
||||
// OneModel["vendor"] = strVendor;
|
||||
// std::string NozzleOpt = pm["nozzle_diameter"];
|
||||
// StringReplace(NozzleOpt, " ", "");
|
||||
// OneModel["nozzle_diameter"] = NozzleOpt;
|
||||
// OneModel["materials"] = pm["default_materials"];
|
||||
//
|
||||
// //wxString strCoverPath = wxString::Format("%s\\%s\\%s_cover.png", strFolder, strVendor, std::string(s1.mb_str()));
|
||||
// std::string cover_file = s1+"_cover.png";
|
||||
// boost::filesystem::path cover_path = boost::filesystem::absolute(vendor_dir / cover_file).make_preferred();
|
||||
// OneModel["cover"] = cover_path.string();
|
||||
//
|
||||
// OneModel["nozzle_selected"] = "";
|
||||
//
|
||||
// m_ProfileJson["model"].push_back(OneModel);
|
||||
// }
|
||||
//
|
||||
// // QDS:Machine
|
||||
// json pmachine = jLocal["machine_list"];
|
||||
// nsize = pmachine.size();
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machines")%nsize;
|
||||
// for (int n = 0; n < nsize; n++) {
|
||||
// json OneMachine = pmachine.at(n);
|
||||
//
|
||||
// std::string s1 = OneMachine["name"];
|
||||
// std::string s2 = OneMachine["sub_path"];
|
||||
//
|
||||
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
// std::string sub_file = sub_path.string();
|
||||
// LoadFile(sub_file, contents);
|
||||
// json pm = json::parse(contents);
|
||||
//
|
||||
// std::string strInstant = pm["instantiation"];
|
||||
// if (strInstant.compare("true") == 0) {
|
||||
// OneMachine["model"] = pm["printer_model"];
|
||||
//
|
||||
// m_ProfileJson["machine"].push_back(OneMachine);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // QDS:Filament
|
||||
// json pFilament = jLocal["filament_list"];
|
||||
// nsize = pFilament.size();
|
||||
//
|
||||
// int nFalse = 0;
|
||||
// int nModel = 0;
|
||||
// int nFinish = 0;
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% filaments")%nsize;
|
||||
// for (int n = 0; n < nsize; n++) {
|
||||
// json OneFF = pFilament.at(n);
|
||||
//
|
||||
// std::string s1 = OneFF["name"];
|
||||
// std::string s2 = OneFF["sub_path"];
|
||||
//
|
||||
// if (!m_ProfileJson["filament"].contains(s1))
|
||||
// {
|
||||
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
// std::string sub_file = sub_path.string();
|
||||
// LoadFile(sub_file, contents);
|
||||
// json pm = json::parse(contents);
|
||||
//
|
||||
// std::string strInstant = pm["instantiation"];
|
||||
// if (strInstant == "true") {
|
||||
// std::string sV;
|
||||
// std::string sT;
|
||||
//
|
||||
// int nRet = GetFilamentInfo(sub_file, sV, sT);
|
||||
// if (nRet != 0) continue;
|
||||
//
|
||||
// OneFF["vendor"] = sV;
|
||||
// OneFF["type"] = sT;
|
||||
//
|
||||
// OneFF["models"] = "";
|
||||
// OneFF["selected"] = 0;
|
||||
// }
|
||||
// else
|
||||
// continue;
|
||||
//
|
||||
// } else {
|
||||
// OneFF = m_ProfileJson["filament"][s1];
|
||||
// }
|
||||
//
|
||||
// std::string vModel = "";
|
||||
// int nm = m_ProfileJson["model"].size();
|
||||
// int bFind = 0;
|
||||
// for (int m = 0; m < nm; m++) {
|
||||
// std::string strFF = m_ProfileJson["model"][m]["materials"];
|
||||
// strFF = (boost::format(";%1%;")%strFF).str();
|
||||
// std::string strTT = (boost::format(";%1%;")%s1).str();
|
||||
// if (strFF.find(strTT) != std::string::npos) {
|
||||
// std::string sModel = m_ProfileJson["model"][m]["model"];
|
||||
//
|
||||
// vModel = (boost::format("%1%[%2%]")%vModel %sModel).str();
|
||||
// bFind = 1;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OneFF["models"] = vModel;
|
||||
//
|
||||
// m_ProfileJson["filament"][s1] = OneFF;
|
||||
// }
|
||||
//
|
||||
// //process
|
||||
// json pProcess = jLocal["process_list"];
|
||||
// nsize = pProcess.size();
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% processes")%nsize;
|
||||
// for (int n = 0; n < nsize; n++) {
|
||||
// json OneProcess = pProcess.at(n);
|
||||
//
|
||||
// std::string s2 = OneProcess["sub_path"];
|
||||
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
// std::string sub_file = sub_path.string();
|
||||
// LoadFile(sub_file, contents);
|
||||
// json pm = json::parse(contents);
|
||||
//
|
||||
// std::string bInstall = pm["instantiation"];
|
||||
// if (bInstall == "true")
|
||||
// {
|
||||
// m_ProfileJson["process"].push_back(OneProcess);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch(nlohmann::detail::parse_error &err) {
|
||||
// BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<strFilePath <<" got a nlohmann::detail::parse_error, reason = " << err.what();
|
||||
// return -1;
|
||||
// }
|
||||
// catch (std::exception &e) {
|
||||
// // wxMessageBox(e.what(), "", MB_OK);
|
||||
// //wxLogMessage("GUIDE: LoadFamily Error: %s", e.what());
|
||||
// BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << strFilePath << " got exception: " << e.what();
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath)
|
||||
{
|
||||
// wxString strFolder = strFilePath.BeforeLast(boost::filesystem::path::preferred_separator);
|
||||
@@ -1447,12 +1267,10 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", vendor path %1%.") % vendor_dir.string();
|
||||
try {
|
||||
// wxLogMessage("GUIDE: json_path1 %s", w2s(strFilePath));
|
||||
|
||||
std::string contents;
|
||||
LoadFile(strFilePath, contents);
|
||||
// wxLogMessage("GUIDE: json_path1 content: %s", contents);
|
||||
json jLocal = json::parse(contents);
|
||||
// wxLogMessage("GUIDE: json_path1 Loaded");
|
||||
//1.9.7.52
|
||||
boost::nowide::ifstream ifs(strFilePath);
|
||||
json jLocal;
|
||||
ifs >> jLocal;
|
||||
|
||||
// QDS:models
|
||||
json pmodels = jLocal["machine_model_list"];
|
||||
@@ -1471,12 +1289,10 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||
|
||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
std::string sub_file = sub_path.string();
|
||||
|
||||
// wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
|
||||
LoadFile(sub_file, contents);
|
||||
// wxLogMessage("GUIDE: json_path2 content: %s", contents);
|
||||
json pm = json::parse(contents);
|
||||
// wxLogMessage("GUIDE: json_path2 loaded");
|
||||
//1.9.7.52
|
||||
boost::nowide::ifstream ifs(sub_file);
|
||||
json pm;
|
||||
ifs >> pm;
|
||||
|
||||
OneModel["vendor"] = strVendor;
|
||||
std::string NozzleOpt = pm["nozzle_diameter"];
|
||||
@@ -1507,8 +1323,10 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
std::string sub_file = sub_path.string();
|
||||
LoadFile(sub_file, contents);
|
||||
json pm = json::parse(contents);
|
||||
//1.9.7.52
|
||||
boost::nowide::ifstream ifs(sub_file);
|
||||
json pm;
|
||||
ifs >> pm;
|
||||
|
||||
std::string strInstant = pm["instantiation"];
|
||||
if (strInstant.compare("true") == 0) {
|
||||
@@ -1548,8 +1366,10 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
std::string sub_file = sub_path.string();
|
||||
LoadFile(sub_file, contents);
|
||||
json pm = json::parse(contents);
|
||||
//1.9.7.52
|
||||
boost::nowide::ifstream ifs(sub_file);
|
||||
json pm;
|
||||
ifs >> pm;
|
||||
|
||||
std::string strInstant = pm["instantiation"];
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Load Filament:" << s1 << ",Path:" << sub_file << ",instantiation:" << strInstant;
|
||||
@@ -1606,8 +1426,9 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
||||
std::string sub_file = sub_path.string();
|
||||
LoadFile(sub_file, contents);
|
||||
json pm = json::parse(contents);
|
||||
boost::nowide::ifstream ifs(sub_file);
|
||||
json pm;
|
||||
ifs >> pm;
|
||||
|
||||
std::string bInstall = pm["instantiation"];
|
||||
if (bInstall == "true") { m_ProfileJson["process"].push_back(OneProcess); }
|
||||
@@ -1649,23 +1470,23 @@ void GuideFrame::GetStardardFilePath(std::string &FilePath) {
|
||||
StrReplace(FilePath, "\/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator)));
|
||||
}
|
||||
|
||||
bool GuideFrame::LoadFile(std::string jPath, std::string &sContent)
|
||||
{
|
||||
try {
|
||||
boost::nowide::ifstream t(jPath);
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
sContent=buffer.str();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(", load %1% into buffer")% jPath;
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", got exception: "<<e.what();
|
||||
return false;
|
||||
}
|
||||
// bool GuideFrame::LoadFile(std::string jPath, std::string &sContent)
|
||||
// {
|
||||
// try {
|
||||
// boost::nowide::ifstream t(jPath);
|
||||
// std::stringstream buffer;
|
||||
// buffer << t.rdbuf();
|
||||
// sContent=buffer.str();
|
||||
// BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(", load %1% into buffer")% jPath;
|
||||
// }
|
||||
// catch (std::exception &e)
|
||||
// {
|
||||
// BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", got exception: "<<e.what();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
// }
|
||||
|
||||
int GuideFrame::DownloadPlugin()
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
void StrReplace(std::string &strBase, std::string strSrc, std::string strDes);
|
||||
std::string w2s(wxString sSrc);
|
||||
void GetStardardFilePath(std::string &FilePath);
|
||||
bool LoadFile(std::string jPath, std::string & sContent);
|
||||
// bool LoadFile(std::string jPath, std::string & sContent);
|
||||
|
||||
// install plugin
|
||||
int DownloadPlugin();
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
#include "libslic3r_version.h"
|
||||
#include "../Utils/Http.hpp"
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/toolbar.h>
|
||||
@@ -512,6 +515,17 @@ void WebViewPanel::SendRecentList(int images)
|
||||
|
||||
void WebViewPanel::SendDesignStaffpick(bool on)
|
||||
{
|
||||
//1.9.7.52
|
||||
static long long StaffPickMs = 0;
|
||||
|
||||
auto now = std::chrono::system_clock::now();
|
||||
long long TmpMs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
||||
long long nInterval = TmpMs - StaffPickMs;
|
||||
if (nInterval < 500) return;
|
||||
StaffPickMs = TmpMs;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Begin SendDesignStaffpick: " << nInterval;
|
||||
|
||||
try {
|
||||
if (on) {
|
||||
std::string sguide = wxGetApp().app_config->get("firstguide", "finish");
|
||||
@@ -1009,10 +1023,12 @@ void WebViewPanel::OnNewWindow(wxWebViewEvent& evt)
|
||||
if (wxGetApp().get_mode() == comDevelop)
|
||||
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'" + flag);
|
||||
|
||||
//If we handle new window events then just load them in this window as we
|
||||
//are a single window browser
|
||||
if (m_tools_handle_new_window->IsChecked())
|
||||
m_browser->LoadURL(evt.GetURL());
|
||||
//1.9.7.52
|
||||
//If we handle new window events then just load them in local browser
|
||||
if (m_tools_handle_new_window->IsChecked())
|
||||
{
|
||||
wxLaunchDefaultBrowser(evt.GetURL());
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
@@ -1421,7 +1437,7 @@ void WebViewPanel::SwitchLeftMenu(std::string strMenu)
|
||||
|
||||
void WebViewPanel::OpenOneMakerlab(std::string url) {
|
||||
auto host = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code());
|
||||
std::string LabUrl = (boost::format("%1%%2%") % host % url).str();
|
||||
std::string LabUrl = (boost::format("%1%%2%?from=qidistudio") % host % url).str();
|
||||
|
||||
wxString FinalUrl = LabUrl;
|
||||
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||
|
||||
@@ -23,7 +23,8 @@ END_EVENT_TABLE()
|
||||
* calling Refresh()/Update().
|
||||
*/
|
||||
|
||||
DeviceButton::DeviceButton(wxString name_text, wxString ip_text) : paddingSize(10, 8), m_name_text(name_text), m_ip_text(ip_text)
|
||||
//y40
|
||||
DeviceButton::DeviceButton(wxString name_text, wxString ip_text, wxString apikey_text) : paddingSize(10, 8), m_name_text(name_text), m_ip_text(ip_text), m_apikey(apikey_text)
|
||||
{
|
||||
background_color = StateColor(
|
||||
std::make_pair(0x262629, (int) StateColor::Disabled),
|
||||
@@ -36,14 +37,16 @@ DeviceButton::DeviceButton(wxString name_text, wxString ip_text) : paddingSize(1
|
||||
std::make_pair(*wxBLACK, (int) StateColor::Normal));
|
||||
}
|
||||
|
||||
//y40
|
||||
DeviceButton::DeviceButton(wxWindow *parent,
|
||||
wxString text,
|
||||
wxString icon,
|
||||
long style,
|
||||
wxSize iconSize /* = wxSize(16, 16)*/,
|
||||
wxString name_text,
|
||||
wxString ip_text)
|
||||
: DeviceButton(name_text,ip_text)
|
||||
wxString ip_text,
|
||||
wxString apikey_text)
|
||||
: DeviceButton(name_text,ip_text, apikey_text)
|
||||
{
|
||||
Create(parent, text, icon, style, iconSize);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ class DeviceButton : public StaticBox
|
||||
static const int buttonHeight = 50;
|
||||
|
||||
public:
|
||||
DeviceButton(wxString name_text, wxString ip_text);
|
||||
//y40
|
||||
DeviceButton(wxString name_text, wxString ip_text, wxString apikey_text);
|
||||
|
||||
DeviceButton(wxWindow *parent,
|
||||
wxString text,
|
||||
@@ -30,7 +31,8 @@ public:
|
||||
long style = 0,
|
||||
wxSize iconSize = wxSize(16, 16),
|
||||
wxString name_text = "",
|
||||
wxString ip_text = "");
|
||||
wxString ip_text = "",
|
||||
wxString apikey_text = "");
|
||||
|
||||
DeviceButton(wxWindow* parent, wxString icon, long style);
|
||||
|
||||
@@ -77,7 +79,8 @@ public:
|
||||
wxString GetStateText() { return m_state_text; }
|
||||
|
||||
wxString getNameLabel() { return m_name_text; }
|
||||
|
||||
//y40
|
||||
wxString GetApikey() { return m_apikey; };
|
||||
|
||||
void Rescale();
|
||||
|
||||
@@ -110,6 +113,7 @@ private:
|
||||
wxString m_progress_text = "(0%)";
|
||||
bool m_isSimpleMode = true;
|
||||
bool m_isSelected = false;
|
||||
wxString m_apikey;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user