File -> Import -> Import Zip Archive
This commit is contained in:
parent
d9a8208e16
commit
daaa9669e9
@ -480,6 +480,8 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = {
|
||||
/* FT_TEX */ { "Texture"sv, { ".png"sv, ".svg"sv } },
|
||||
|
||||
/* FT_SL1 */ { "Masked SLA files"sv, { ".sl1"sv, ".sl1s"sv, ".pwmx"sv } },
|
||||
|
||||
/* FT_ZIP */ { "Zip files"sv, { ".zip"sv } },
|
||||
};
|
||||
|
||||
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
|
||||
@ -1977,6 +1979,17 @@ void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) const
|
||||
dialog.GetPaths(input_files);
|
||||
}
|
||||
|
||||
void GUI_App::import_zip(wxWindow* parent, wxString& input_file) const
|
||||
{
|
||||
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
||||
_L("Choose ZIP file:"),
|
||||
from_u8(app_config->get_last_dir()), "",
|
||||
file_wildcards(FT_ZIP), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
input_file = dialog.GetPath();
|
||||
}
|
||||
|
||||
void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const
|
||||
{
|
||||
input_file.Clear();
|
||||
|
@ -73,6 +73,8 @@ enum FileType
|
||||
|
||||
FT_SL1,
|
||||
|
||||
FT_ZIP,
|
||||
|
||||
FT_SIZE,
|
||||
};
|
||||
|
||||
@ -252,6 +254,7 @@ public:
|
||||
void keyboard_shortcuts();
|
||||
void load_project(wxWindow *parent, wxString& input_file) const;
|
||||
void import_model(wxWindow *parent, wxArrayString& input_files) const;
|
||||
void import_zip(wxWindow* parent, wxString& input_file) const;
|
||||
void load_gcode(wxWindow* parent, wxString& input_file) const;
|
||||
|
||||
static bool catch_error(std::function<void()> cb, const std::string& err);
|
||||
|
@ -1293,6 +1293,10 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->import_sl1_archive(); }, "import_plater", nullptr,
|
||||
[this](){return m_plater != nullptr && m_plater->get_ui_job_worker().is_idle(); }, this);
|
||||
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import ZIP Achive") + dots, _L("Load a zip achive"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->import_zip_archive(); }, "import_plater", nullptr,
|
||||
[this]() {return m_plater != nullptr; }, this);
|
||||
|
||||
import_menu->AppendSeparator();
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import &Config") + dots + "\tCtrl+L", _L("Load exported configuration file"),
|
||||
[this](wxCommandEvent&) { load_config_file(); }, "import_config", nullptr,
|
||||
|
@ -5479,6 +5479,17 @@ void Plater::add_model(bool imperial_units/* = false*/)
|
||||
wxGetApp().mainframe->update_title();
|
||||
}
|
||||
|
||||
void Plater::import_zip_archive()
|
||||
{
|
||||
wxString input_file;
|
||||
wxGetApp().import_zip(this, input_file);
|
||||
if (input_file.empty())
|
||||
return;
|
||||
|
||||
fs::path path = into_path(input_file);
|
||||
preview_zip_archive(path);
|
||||
}
|
||||
|
||||
void Plater::import_sl1_archive()
|
||||
{
|
||||
auto &w = get_ui_job_worker();
|
||||
|
@ -166,6 +166,7 @@ public:
|
||||
void load_project();
|
||||
void load_project(const wxString& filename);
|
||||
void add_model(bool imperial_units = false);
|
||||
void import_zip_archive();
|
||||
void import_sl1_archive();
|
||||
void extract_config_from_project();
|
||||
void load_gcode();
|
||||
|
Loading…
Reference in New Issue
Block a user