mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 10:11:58 +08:00
partially implemented open_model as a free function in misc_ui. Initial dir and the file patterns are not implemented yet.
This commit is contained in:
parent
a998324962
commit
3b17844fba
@ -1,10 +1,12 @@
|
|||||||
#include "misc_ui.hpp"
|
#include "misc_ui.hpp"
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
#include <wx/arrstr.h>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
@ -110,5 +112,22 @@ sub show_error {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
std::vector<wxString> open_model(wxWindow* parent, const Settings& settings, wxWindow* top) {
|
||||||
|
auto dialog {new wxFileDialog((parent != nullptr ? parent : top), _("Choose one or more files") + wxString(" (STL/OBJ/AMF/3MF):"), ".", "",
|
||||||
|
"", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)};
|
||||||
|
if (dialog->ShowModal() != wxID_OK) {
|
||||||
|
dialog->Destroy();
|
||||||
|
return std::vector<wxString>();
|
||||||
|
}
|
||||||
|
std::vector<wxString> tmp;
|
||||||
|
wxArrayString tmpout;
|
||||||
|
dialog->GetPaths(tmpout);
|
||||||
|
for (const auto& i : tmpout) {
|
||||||
|
tmp.push_back(i);
|
||||||
|
}
|
||||||
|
dialog->Destroy();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include "Settings.hpp"
|
||||||
|
|
||||||
#include "Log.hpp"
|
#include "Log.hpp"
|
||||||
|
|
||||||
/// Common static (that is, free-standing) functions, not part of an object hierarchy.
|
/// Common static (that is, free-standing) functions, not part of an object hierarchy.
|
||||||
@ -98,6 +100,8 @@ sub CallAfter {
|
|||||||
wxString decode_path(const wxString& in);
|
wxString decode_path(const wxString& in);
|
||||||
wxString encode_path(const wxString& in);
|
wxString encode_path(const wxString& in);
|
||||||
|
|
||||||
|
std::vector<wxString> open_model(wxWindow* parent, const Settings& settings, wxWindow* top);
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
#endif // MISC_UI_HPP
|
#endif // MISC_UI_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user