diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-12-11 12:33:11 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-12-12 15:17:01 +0300 |
commit | 2350fb62b9db77d67b5722751ad8013e38573464 (patch) | |
tree | 339577cfa84e5d5728cbe5ac6dc9b594b77864e1 /src/slic3r/GUI/PrintHostDialogs.cpp | |
parent | 0bba11645533e4db2e7b839092a3c36e9b6f85d7 (diff) |
WIP OctoPrint integration
Diffstat (limited to 'src/slic3r/GUI/PrintHostDialogs.cpp')
-rw-r--r-- | src/slic3r/GUI/PrintHostDialogs.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp new file mode 100644 index 000000000..a5de7c3c6 --- /dev/null +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -0,0 +1,49 @@ +#include "PrintHostDialogs.hpp" + +#include <wx/frame.h> +#include <wx/event.h> +#include <wx/progdlg.h> +#include <wx/sizer.h> +#include <wx/stattext.h> +#include <wx/textctrl.h> +#include <wx/checkbox.h> + +#include "slic3r/GUI/GUI.hpp" +#include "slic3r/GUI/MsgDialog.hpp" +#include "slic3r/GUI/I18N.hpp" + +namespace fs = boost::filesystem; + +namespace Slic3r { + +PrintHostSendDialog::PrintHostSendDialog(const fs::path &path) + : MsgDialog(nullptr, _(L("Send G-Code to printer host")), _(L("Upload to Printer Host with the following filename:")), wxID_NONE) + , txt_filename(new wxTextCtrl(this, wxID_ANY, path.filename().wstring())) + , box_print(new wxCheckBox(this, wxID_ANY, _(L("Start printing after upload")))) +{ + 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); + + content_sizer->Add(txt_filename, 0, wxEXPAND); + content_sizer->Add(label_dir_hint); + content_sizer->AddSpacer(VERT_SPACING); + content_sizer->Add(box_print, 0, wxBOTTOM, 2*VERT_SPACING); + + btn_sizer->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL)); + + txt_filename->SetFocus(); + wxString stem(path.stem().wstring()); + txt_filename->SetSelection(0, stem.Length()); + + Fit(); +} + +fs::path PrintHostSendDialog::filename() const +{ + return fs::path(txt_filename->GetValue().wx_str()); +} + +bool PrintHostSendDialog::start_print() const +{ + return box_print->GetValue(); } +} |