chiark / gitweb /
Add a confirmation dialog before removing machines
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Tue, 5 Jan 2016 16:02:31 +0000 (11:02 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Tue, 5 Jan 2016 16:02:31 +0000 (11:02 -0500)
Fixes T346

Cura/gui/preferencesDialog.py

index 29d2c8a306a01b513173e9f7aae5543feaf7e4ff..bd3028f3cfb593b4d628cd9544ff0be16a9c6969 100644 (file)
@@ -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"),