Kill VM option.
This commit is contained in:
		
							parent
							
								
									be0d4be5c1
								
							
						
					
					
						commit
						e3b8f50fee
					
				
							
								
								
									
										
											BIN
										
									
								
								icons/kill.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icons/kill.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 38 KiB | 
| @ -267,6 +267,7 @@ | ||||
|    <addaction name="action_resumevm"/> | ||||
|    <addaction name="action_pausevm"/> | ||||
|    <addaction name="action_shutdownvm"/> | ||||
|    <addaction name="action_killvm"/> | ||||
|    <addaction name="separator"/> | ||||
|    <addaction name="action_settings"/> | ||||
|    <addaction name="action_editfwrules"/> | ||||
| @ -318,7 +319,7 @@ | ||||
|     <string>Start/Resume VM</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Start/Resume a VM</string> | ||||
|     <string>Start/Resume selected VM</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_pausevm"> | ||||
| @ -333,7 +334,7 @@ | ||||
|     <string>Pause VM</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Pause a running VM</string> | ||||
|     <string>Pause selected VM</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_shutdownvm"> | ||||
| @ -348,7 +349,7 @@ | ||||
|     <string>Shutdown VM</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Shutdown a running VM</string> | ||||
|     <string>Shutdown selected VM</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_appmenus"> | ||||
| @ -386,7 +387,7 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="checked"> | ||||
|     <bool>true</bool> | ||||
|     <bool>false</bool> | ||||
|    </property> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
| @ -553,6 +554,18 @@ | ||||
|     <string>State</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_killvm"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/killvm.png</normaloff>:/killvm.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Kill VM</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Kill selected VM</string> | ||||
|    </property> | ||||
|   </action> | ||||
|  </widget> | ||||
|  <resources> | ||||
|   <include location="resources.qrc"/> | ||||
|  | ||||
| @ -608,6 +608,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | ||||
|         self.context_menu.addAction(self.action_resumevm) | ||||
|         self.context_menu.addAction(self.action_pausevm) | ||||
|         self.context_menu.addAction(self.action_shutdownvm) | ||||
|         self.context_menu.addAction(self.action_killvm) | ||||
|         self.context_menu.addAction(self.action_appmenus) | ||||
|         self.context_menu.addAction(self.action_editfwrules) | ||||
|         self.context_menu.addAction(self.action_updatevm) | ||||
| @ -896,6 +897,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | ||||
|             self.action_resumevm.setEnabled(not vm.last_running) | ||||
|             self.action_pausevm.setEnabled(vm.last_running and vm.qid != 0) | ||||
|             self.action_shutdownvm.setEnabled(vm.last_running and vm.qid != 0) | ||||
|             self.action_killvm.setEnabled(vm.last_running and vm.qid != 0) | ||||
|             self.action_appmenus.setEnabled(not vm.is_netvm()) | ||||
|             self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm())) | ||||
|             self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0) | ||||
| @ -905,6 +907,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | ||||
|             self.action_resumevm.setEnabled(False) | ||||
|             self.action_pausevm.setEnabled(False) | ||||
|             self.action_shutdownvm.setEnabled(False) | ||||
|             self.action_killvm.setEnabled(False) | ||||
|             self.action_appmenus.setEnabled(False) | ||||
|             self.action_editfwrules.setEnabled(False) | ||||
|             self.action_updatevm.setEnabled(False) | ||||
| @ -1170,6 +1173,28 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | ||||
|         QTimer.singleShot (vm_shutdown_timeout, self.shutdown_monitor[vm.qid].check_if_vm_has_shutdown) | ||||
| 
 | ||||
| 
 | ||||
|     @pyqtSlot(name='on_action_killvm_triggered') | ||||
|     def action_killvm_triggered(self): | ||||
|         vm = self.get_selected_vm() | ||||
|         assert vm.is_running() | ||||
| 
 | ||||
|         reply = QMessageBox.question(None, "VM Kill Confirmation", | ||||
|                                      "Are you sure you want to kill the VM <b>'{0}'</b>?<br>" | ||||
|                                      "<small>This will end <b>(not shutdown!)</b> all the running applications within this VM.</small>".format(vm.name), | ||||
|                                      QMessageBox.Yes | QMessageBox.Cancel, QMessageBox.Cancel) | ||||
| 
 | ||||
|         app.processEvents() | ||||
| 
 | ||||
|         if reply == QMessageBox.Yes: | ||||
|             try: | ||||
|                 vm.force_shutdown() | ||||
|             except Exception as ex: | ||||
|                 QMessageBox.critical (None, "Error while killing VM!", "<b>An exception ocurred while killing {0}.</b><br>ERROR: {1}".format(vm.name, ex)) | ||||
|                 return | ||||
| 
 | ||||
|             trayIcon.showMessage ("Qubes Manager", "VM '{0}' killed!".format(vm.name), msecs=3000) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     @pyqtSlot(name='on_action_settings_triggered') | ||||
|     def action_settings_triggered(self): | ||||
|  | ||||
| @ -35,9 +35,9 @@ | ||||
|     <file alias="createvm.png">icons/createvm.png</file> | ||||
|     <file alias="removevm.png">icons/removevm.png</file> | ||||
|     <file alias="shutdownvm.png">icons/shutdownvm.png</file> | ||||
|     <file alias="killvm.png">icons/kill.png</file> | ||||
|     <file alias="resumevm.png">icons/resumevm.png</file> | ||||
|     <file alias="pausevm.png">icons/pausevm.png</file> | ||||
|     <file alias="showallvms.png">icons/showallvms.png</file> | ||||
|     <file alias="showcpuload.png">icons/showcpuload.png</file> | ||||
|   </qresource> | ||||
|   <qresource/> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Agnieszka Kostrzewa
						Agnieszka Kostrzewa