Don't close the settings window if something failed when renaming

e.g. the VM name already exists
This commit is contained in:
donoban 2018-05-31 00:39:34 +02:00
parent 4d103562bd
commit cb5bc16948
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5

View File

@ -478,6 +478,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
self.tr("Error!"),
self.tr("ERROR: {}").format(
t_monitor.error_msg))
return False
return True
def _rename_vm(self, t_monitor, name):
try:
@ -492,15 +494,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
t_monitor.set_finished()
def rename_vm(self):
new_vm_name, ok = QtGui.QInputDialog.getText(
self,
self.tr('Rename qube'),
self.tr('New name: (WARNING: all other changes will be discarded)'))
if ok:
self._run_in_thread(self._rename_vm, new_vm_name)
self.done(0)
if self._run_in_thread(self._rename_vm, new_vm_name):
self.done(0)
def _remove_vm(self, t_monitor):
try: