Added warning that the VM is currently running

Added warning that the VM is currently running. User still must shut it manually (by design).
This commit is contained in:
Marta Marczykowska-Górecka 2018-01-08 20:05:25 +01:00
parent 839696f6f9
commit 45496f73de
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -45,6 +45,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
# populate buttons and such
self.__init_buttons__()
# warn user if the VM is currently running
self.__warn_if_running__()
def reject(self):
self.done(0)
@ -62,8 +64,21 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
self.tr("ERROR!"),
self.tr("No file or block device selected; please select one."))
return
# warn user if the VM is currently running
self.__warn_if_running__()
qvm_start.main(['--cdrom', cdrom_location, self.vm.name])
def __warn_if_running__(self):
if self.vm.is_running():
QtGui.QMessageBox.warning(
None,
self.tr("Warning!"),
self.tr("VM must be turned off before booting it from"
"device. Please turn off the VM.")
)
def __init_buttons__(self):
self.fileVM.setEnabled(False)
self.selectFileButton.setEnabled(False)