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