From: Youness Alaoui Date: Tue, 5 Jan 2016 16:02:31 +0000 (-0500) Subject: Add a confirmation dialog before removing machines X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0c13d68da4b2c0a19d2e388eab945f3f772f7c7f;p=cura.git Add a confirmation dialog before removing machines Fixes T346 --- 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"),