From 0c13d68da4b2c0a19d2e388eab945f3f772f7c7f Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Tue, 5 Jan 2016 11:02:31 -0500 Subject: [PATCH] Add a confirmation dialog before removing machines Fixes T346 --- Cura/gui/preferencesDialog.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 29d2c8a3..bd3028f3 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -199,15 +199,22 @@ class machineSettingsDialog(wx.Dialog): wx.MessageBox(_("Cannot remove the last machine configuration in Cura"), _("Machine remove error"), wx.OK | wx.ICON_ERROR) return - self.Hide() - profile.removeMachine(self.nb.GetSelection()) - self.parent.reloadSettingPanels() - self.parent.updateMachineMenu() - - prefDialog = machineSettingsDialog(self.parent) - prefDialog.Centre() - prefDialog.Show() - wx.CallAfter(self.Close) + dlg = wx.MessageDialog(self, + _("Are you sure you want to remove the selected machine?"), + _('Remove machine?'), + wx.YES_NO | wx.ICON_EXCLAMATION) + remove = dlg.ShowModal() == wx.ID_YES + dlg.Destroy() + if remove: + self.Hide() + profile.removeMachine(self.nb.GetSelection()) + self.parent.reloadSettingPanels() + self.parent.updateMachineMenu() + + prefDialog = machineSettingsDialog(self.parent) + prefDialog.Centre() + prefDialog.Show() + wx.CallAfter(self.Close) def OnRenameMachine(self, e): dialog = wx.TextEntryDialog(self, _("Enter the new name:"), _("Change machine name"), -- 2.30.2