More localization improvements, new POT

+ fixed crash after application closing with non-saved presets
This commit is contained in:
YuSanka 2019-05-10 15:10:17 +02:00
parent 4df38d4c4b
commit ec252eb71d
5 changed files with 249 additions and 259 deletions

File diff suppressed because it is too large Load Diff

View File

@ -820,15 +820,15 @@ bool GUI_App::check_unsaved_changes()
for (Tab *tab : tabs_list)
if (tab->supports_printer_technology(printer_technology) && tab->current_preset_is_dirty())
if (dirty.empty())
dirty = _(tab->name());
dirty = tab->title();
else
dirty += wxString(", ") + _(tab->name());
dirty += wxString(", ") + tab->title();
if (dirty.empty())
// No changes, the application may close or reload presets.
return true;
// Ask the user.
wxMessageDialog dialog(mainframe,
_(L("The following presets were modified")) + ": " + dirty + "\n" + _(L("Discard changes and continue anyway?")),
_(L("The presets on the following tabs were modified")) + ": " + dirty + "\n\n" + _(L("Discard changes and continue anyway?")),
wxString(SLIC3R_APP_NAME) + " - " + _(L("Unsaved Presets")),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
return dialog.ShowModal() == wxID_YES;

View File

@ -917,7 +917,7 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
#if 0
for (auto tab : wxGetApp().tabs_list)
if (tab->supports_printer_technology(printer_technology)) {
if (tab->name() == "printer")
if (tab->type() == Slic3r::Preset::TYPE_PRINTER)
static_cast<TabPrinter*>(tab)->update_pages();
tab->load_config(config);
}

View File

@ -38,12 +38,13 @@ namespace GUI {
wxDEFINE_EVENT(EVT_TAB_VALUE_CHANGED, wxCommandEvent);
wxDEFINE_EVENT(EVT_TAB_PRESETS_CHANGED, SimpleEvent);
Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
m_parent(parent), m_title(title), m_name(name)
// Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
// m_parent(parent), m_title(title), m_name(name)
Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) :
m_parent(parent), m_title(title), m_type(type)
{
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL, name);
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL/*, name*/);
this->SetFont(Slic3r::GUI::wxGetApp().normal_font());
set_type();
m_compatible_printers.type = Preset::TYPE_PRINTER;
m_compatible_printers.key_list = "compatible_printers";
@ -463,7 +464,8 @@ void Tab::update_changed_ui()
// Thaw();
wxTheApp->CallAfter([this]() {
update_changed_tree_ui();
if (parent()) //To avoid a crash, parent should be exist for a moment of a tree updating
update_changed_tree_ui();
});
}

View File

@ -228,12 +228,14 @@ public:
int m_update_cnt = 0;
public:
Tab(wxNotebook* parent, const wxString& title, const char* name);
~Tab() {}
// Tab(wxNotebook* parent, const wxString& title, const char* name);
Tab(wxNotebook* parent, const wxString& title, Preset::Type type);
~Tab() {}
wxWindow* parent() const { return m_parent; }
wxString title() const { return m_title; }
std::string name() const { return m_name; }
// std::string name() const { return m_name; }
std::string name() const { return m_presets->name(); }
Preset::Type type() const { return m_type; }
bool complited() const { return m_complited; }
virtual bool supports_printer_technology(const PrinterTechnology tech) = 0;
@ -312,7 +314,8 @@ class TabPrint : public Tab
bool is_msg_dlg_already_exist {false};
public:
TabPrint(wxNotebook* parent) :
Tab(parent, _(L("Print Settings")), L("print")) {}
// Tab(parent, _(L("Print Settings")), L("print")) {}
Tab(parent, _(L("Print Settings")), Slic3r::Preset::TYPE_PRINT) {}
~TabPrint() {}
ogStaticText* m_recommended_thin_wall_thickness_description_line;
@ -330,7 +333,8 @@ class TabFilament : public Tab
ogStaticText* m_cooling_description_line;
public:
TabFilament(wxNotebook* parent) :
Tab(parent, _(L("Filament Settings")), L("filament")) {}
// Tab(parent, _(L("Filament Settings")), L("filament")) {}
Tab(parent, _(L("Filament Settings")), Slic3r::Preset::TYPE_FILAMENT) {}
~TabFilament() {}
void build() override;
@ -363,7 +367,9 @@ public:
PrinterTechnology m_printer_technology = ptFFF;
TabPrinter(wxNotebook* parent) : Tab(parent, _(L("Printer Settings")), L("printer")) {}
// TabPrinter(wxNotebook* parent) : Tab(parent, _(L("Printer Settings")), L("printer")) {}
TabPrinter(wxNotebook* parent) :
Tab(parent, _(L("Printer Settings")), Slic3r::Preset::TYPE_PRINTER) {}
~TabPrinter() {}
void build() override;
@ -386,7 +392,8 @@ class TabSLAMaterial : public Tab
{
public:
TabSLAMaterial(wxNotebook* parent) :
Tab(parent, _(L("Material Settings")), L("sla_material")) {}
// Tab(parent, _(L("Material Settings")), L("sla_material")) {}
Tab(parent, _(L("Material Settings")), Slic3r::Preset::TYPE_SLA_MATERIAL) {}
~TabSLAMaterial() {}
void build() override;
@ -400,7 +407,8 @@ class TabSLAPrint : public Tab
{
public:
TabSLAPrint(wxNotebook* parent) :
Tab(parent, _(L("Print Settings")), L("sla_print")) {}
// Tab(parent, _(L("Print Settings")), L("sla_print")) {}
Tab(parent, _(L("Print Settings")), Slic3r::Preset::TYPE_SLA_PRINT) {}
~TabSLAPrint() {}
void build() override;
void reload_config() override;