mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-04 18:08:44 +03:00
Optimized the interface for sending files
This commit is contained in:
@@ -52,15 +52,18 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
|||||||
auto *headtext = new wxStaticText(this, wxID_ANY, headline);
|
auto *headtext = new wxStaticText(this, wxID_ANY, headline);
|
||||||
headtext->SetFont(boldfont);
|
headtext->SetFont(boldfont);
|
||||||
headtext->Wrap(CONTENT_WIDTH*wxGetApp().em_unit());
|
headtext->Wrap(CONTENT_WIDTH*wxGetApp().em_unit());
|
||||||
|
//B61
|
||||||
|
if (title != _L("Send G-Code to printer host")) {
|
||||||
rightsizer->Add(headtext);
|
rightsizer->Add(headtext);
|
||||||
rightsizer->AddSpacer(VERT_SPACING);
|
rightsizer->AddSpacer(VERT_SPACING);
|
||||||
|
}
|
||||||
|
|
||||||
rightsizer->Add(content_sizer, 1, wxEXPAND);
|
rightsizer->Add(content_sizer, 1, wxEXPAND);
|
||||||
btn_sizer->AddStretchSpacer();
|
btn_sizer->AddStretchSpacer();
|
||||||
|
|
||||||
//B44
|
//B44 //B61
|
||||||
logo = new wxStaticBitmap(this, wxID_ANY, bitmap.IsOk() ? bitmap : wxNullBitmap);
|
logo = new wxStaticBitmap(this, wxID_ANY, bitmap.IsOk() ? bitmap : wxNullBitmap);
|
||||||
if (title == "App Update available") {
|
if (title == "App Update available" or title == _L("Send G-Code to printer host")) {
|
||||||
topsizer->Add(rightsizer, 1, wxLEFT | wxTOP | wxRIGHT | wxEXPAND, BORDER);
|
topsizer->Add(rightsizer, 1, wxLEFT | wxTOP | wxRIGHT | wxEXPAND, BORDER);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -73,7 +76,8 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
|||||||
//B50
|
//B50
|
||||||
// if (style & wxOK)
|
// if (style & wxOK)
|
||||||
// add_button(wxID_OK, true);
|
// add_button(wxID_OK, true);
|
||||||
if (title != "App Update available") {
|
//B61
|
||||||
|
if (title != "App Update available" and title != _L("Send G-Code to printer host")) {
|
||||||
apply_style(style);
|
apply_style(style);
|
||||||
}
|
}
|
||||||
SetSizerAndFit(main_sizer);
|
SetSizerAndFit(main_sizer);
|
||||||
|
|||||||
@@ -7726,6 +7726,13 @@ void publish(Model &model) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//B61
|
||||||
|
ThumbnailData Plater::get_thumbnailldate() {
|
||||||
|
ThumbnailData thumbnail_data;
|
||||||
|
ThumbnailsParams thumbnail_params = {{}, false, true, true, true};
|
||||||
|
p->generate_thumbnail(thumbnail_data, THUMBNAIL_SIZE_3MF.first, THUMBNAIL_SIZE_3MF.second, thumbnail_params, Camera::EType::Ortho);
|
||||||
|
return thumbnail_data;
|
||||||
|
}
|
||||||
bool Plater::export_3mf(const boost::filesystem::path& output_path)
|
bool Plater::export_3mf(const boost::filesystem::path& output_path)
|
||||||
{
|
{
|
||||||
if (p->model.objects.empty()) {
|
if (p->model.objects.empty()) {
|
||||||
@@ -7960,8 +7967,10 @@ void Plater::send_gcode()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//B61
|
||||||
|
PrintHostSendDialog dlg(default_output_file, upload_job.printhost->get_post_upload_actions(), groups, storage_paths, storage_names,
|
||||||
|
this, (this->fff_print().print_statistics()));
|
||||||
|
|
||||||
PrintHostSendDialog dlg(default_output_file, upload_job.printhost->get_post_upload_actions(), groups, storage_paths, storage_names);
|
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
if (dlg.ShowModal() == wxID_OK) {
|
||||||
if (printer_technology() == ptFFF) {
|
if (printer_technology() == ptFFF) {
|
||||||
const std::string ext = boost::algorithm::to_lower_copy(dlg.filename().extension().string());
|
const std::string ext = boost::algorithm::to_lower_copy(dlg.filename().extension().string());
|
||||||
@@ -7969,7 +7978,8 @@ void Plater::send_gcode()
|
|||||||
wxGetApp().app_config->get_bool("use_binary_gcode_when_supported");
|
wxGetApp().app_config->get_bool("use_binary_gcode_when_supported");
|
||||||
const wxString error_str = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, binary_output);
|
const wxString error_str = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, binary_output);
|
||||||
if (! error_str.IsEmpty()) {
|
if (! error_str.IsEmpty()) {
|
||||||
ErrorDialog(this, error_str, t_kill_focus([](const std::string& key) -> void { wxGetApp().sidebar().jump_to_option(key); })).ShowModal();
|
ErrorDialog(this, error_str, t_kill_focus([](const std::string &key) -> void { wxGetApp().sidebar().jump_to_option(key); }))
|
||||||
|
.ShowModal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool supports_binary = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode");
|
bool supports_binary = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode");
|
||||||
|
|||||||
@@ -291,6 +291,8 @@ public:
|
|||||||
|
|
||||||
void apply_cut_object_to_model(size_t init_obj_idx, const ModelObjectPtrs& cut_objects);
|
void apply_cut_object_to_model(size_t init_obj_idx, const ModelObjectPtrs& cut_objects);
|
||||||
|
|
||||||
|
//B61
|
||||||
|
ThumbnailData get_thumbnailldate();
|
||||||
void export_gcode(bool prefer_removable);
|
void export_gcode(bool prefer_removable);
|
||||||
void export_stl_obj(bool extended = false, bool selection_only = false);
|
void export_stl_obj(bool extended = false, bool selection_only = false);
|
||||||
void export_amf();
|
void export_amf();
|
||||||
|
|||||||
@@ -39,14 +39,25 @@ static const char *CONFIG_KEY_PATH = "printhost_path";
|
|||||||
static const char *CONFIG_KEY_GROUP = "printhost_group";
|
static const char *CONFIG_KEY_GROUP = "printhost_group";
|
||||||
static const char* CONFIG_KEY_STORAGE = "printhost_storage";
|
static const char* CONFIG_KEY_STORAGE = "printhost_storage";
|
||||||
|
|
||||||
PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups, const wxArrayString& storage_paths, const wxArrayString& storage_names)
|
//B61
|
||||||
: MsgDialog(static_cast<wxWindow*>(wxGetApp().mainframe), _L("Send G-Code to printer host"), _L("Upload to Printer Host with the following filename:"), 0) // Set style = 0 to avoid default creation of the "OK" button.
|
PrintHostSendDialog::PrintHostSendDialog(const fs::path & path,
|
||||||
|
PrintHostPostUploadActions post_actions,
|
||||||
|
const wxArrayString & groups,
|
||||||
|
const wxArrayString & storage_paths,
|
||||||
|
const wxArrayString & storage_names,
|
||||||
|
Plater * plater,
|
||||||
|
const PrintStatistics & ps)
|
||||||
|
: MsgDialog(static_cast<wxWindow *>(wxGetApp().mainframe),
|
||||||
|
_L("Send G-Code to printer host"),
|
||||||
|
_L(""),
|
||||||
|
0) // Set style = 0 to avoid default creation of the "OK" button.
|
||||||
// All buttons will be added later in this constructor
|
// All buttons will be added later in this constructor
|
||||||
, txt_filename(new wxTextCtrl(this, wxID_ANY))
|
, txt_filename(new wxTextCtrl(this, wxID_ANY))
|
||||||
, combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr)
|
, combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr)
|
||||||
, combo_storage(storage_names.GetCount() > 1 ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, storage_names, wxCB_READONLY) : nullptr)
|
, combo_storage(storage_names.GetCount() > 1 ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, storage_names, wxCB_READONLY) : nullptr)
|
||||||
, post_upload_action(PrintHostPostUploadAction::None)
|
, post_upload_action(PrintHostPostUploadAction::None)
|
||||||
, m_paths(storage_paths)
|
, m_paths(storage_paths)
|
||||||
|
, m_plater(plater)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
txt_filename->OSXDisableAllSmartSubstitutions();
|
txt_filename->OSXDisableAllSmartSubstitutions();
|
||||||
@@ -55,7 +66,52 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo
|
|||||||
|
|
||||||
auto *label_dir_hint = new wxStaticText(this, wxID_ANY, _L("Use forward slashes ( / ) as a directory separator if needed."));
|
auto *label_dir_hint = new wxStaticText(this, wxID_ANY, _L("Use forward slashes ( / ) as a directory separator if needed."));
|
||||||
label_dir_hint->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
label_dir_hint->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
|
//B61
|
||||||
|
auto *label_dir_hint2 = new wxStaticText(this, wxID_ANY, _L("Upload to Printer Host with the following filename:"));
|
||||||
|
label_dir_hint2->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
|
|
||||||
|
//B61
|
||||||
|
ThumbnailData thumbnail_data = m_plater->get_thumbnailldate();
|
||||||
|
|
||||||
|
wxImage image(thumbnail_data.width, thumbnail_data.height);
|
||||||
|
image.InitAlpha();
|
||||||
|
|
||||||
|
for (unsigned int r = 0; r < thumbnail_data.height; ++r) {
|
||||||
|
unsigned int rr = (thumbnail_data.height - 1 - r) * thumbnail_data.width;
|
||||||
|
for (unsigned int c = 0; c < thumbnail_data.width; ++c) {
|
||||||
|
unsigned char *px = (unsigned char *) thumbnail_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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wxBitmap bitmap(image);
|
||||||
|
wxStaticBitmap *static_bitmap = new wxStaticBitmap(this, wxID_ANY, bitmap);
|
||||||
|
//static_bitmap->SetSize(wxSize(20, 20));
|
||||||
|
static_bitmap->SetMinSize(wxSize(100, 100));
|
||||||
|
content_sizer->Add(static_bitmap, 0, wxALL | wxALIGN_CENTER);
|
||||||
|
|
||||||
|
wxBoxSizer *row_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
// Add add.svg image
|
||||||
|
//wxBitmap add_bitmap(*get_bmp_bundle("add.svg"), wxBITMAP_TYPE_SVG);
|
||||||
|
wxStaticBitmap *add_bitmap = new wxStaticBitmap(this, wxID_ANY, *get_bmp_bundle("print_time", 20));
|
||||||
|
row_sizer->Add(add_bitmap, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
|
|
||||||
|
// Add ps.estimated_normal_print_time text
|
||||||
|
wxStaticText *estimated_print_time_text = new wxStaticText(this, wxID_ANY, wxString::Format("%s", ps.estimated_normal_print_time));
|
||||||
|
row_sizer->Add(estimated_print_time_text, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
|
|
||||||
|
// Add delete.svg image
|
||||||
|
wxStaticBitmap *delete_static_bitmap = new wxStaticBitmap(this, wxID_ANY, *get_bmp_bundle("cost_weight", 20));
|
||||||
|
row_sizer->Add(delete_static_bitmap, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
|
|
||||||
|
// Add ps.total_weight text
|
||||||
|
wxStaticText *total_weight_text = new wxStaticText(this, wxID_ANY, wxString::Format("%.4fg", ps.total_weight));
|
||||||
|
row_sizer->Add(total_weight_text, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
|
|
||||||
|
content_sizer->Add(row_sizer, 0, wxALIGN_CENTER);
|
||||||
|
//B61
|
||||||
|
content_sizer->Add(label_dir_hint2);
|
||||||
content_sizer->Add(txt_filename, 0, wxEXPAND);
|
content_sizer->Add(txt_filename, 0, wxEXPAND);
|
||||||
content_sizer->Add(label_dir_hint);
|
content_sizer->Add(label_dir_hint);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "MsgDialog.hpp"
|
#include "MsgDialog.hpp"
|
||||||
#include "../Utils/PrintHost.hpp"
|
#include "../Utils/PrintHost.hpp"
|
||||||
|
//B61
|
||||||
|
#include "Plater.hpp"
|
||||||
|
#include "libslic3r/Print.hpp"
|
||||||
|
|
||||||
class wxButton;
|
class wxButton;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
@@ -36,7 +39,14 @@ struct PhysicalPrinterPresetData
|
|||||||
class PrintHostSendDialog : public GUI::MsgDialog
|
class PrintHostSendDialog : public GUI::MsgDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString& groups, const wxArrayString& storage_paths, const wxArrayString& storage_names);
|
//B61
|
||||||
|
PrintHostSendDialog(const boost::filesystem::path &path,
|
||||||
|
PrintHostPostUploadActions post_actions,
|
||||||
|
const wxArrayString & groups,
|
||||||
|
const wxArrayString & storage_paths,
|
||||||
|
const wxArrayString & storage_names,
|
||||||
|
Plater * plater,
|
||||||
|
const PrintStatistics & ps);
|
||||||
boost::filesystem::path filename() const;
|
boost::filesystem::path filename() const;
|
||||||
PrintHostPostUploadAction post_action() const;
|
PrintHostPostUploadAction post_action() const;
|
||||||
std::string group() const;
|
std::string group() const;
|
||||||
@@ -57,6 +67,8 @@ private:
|
|||||||
//B53
|
//B53
|
||||||
std::vector<PhysicalPrinterPresetData> m_presetData;
|
std::vector<PhysicalPrinterPresetData> m_presetData;
|
||||||
std::vector<bool> m_checkbox_states;
|
std::vector<bool> m_checkbox_states;
|
||||||
|
//B61
|
||||||
|
Plater *m_plater{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user