Added wait argument to start_vm
Easier error handling for start vm's from other places
This commit is contained in:
		
							parent
							
								
									4343691b92
								
							
						
					
					
						commit
						f95bcbb1bc
					
				@ -857,12 +857,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
 | 
				
			|||||||
                    QMessageBox.Yes | QMessageBox.Cancel)
 | 
					                    QMessageBox.Yes | QMessageBox.Cancel)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if reply == QMessageBox.Yes:
 | 
					                if reply == QMessageBox.Yes:
 | 
				
			||||||
                    with common_threads.busy_cursor():
 | 
					                    self.start_vm(netvm.vm, True)
 | 
				
			||||||
                        try:
 | 
					 | 
				
			||||||
                            netvm.vm.start()
 | 
					 | 
				
			||||||
                        except exc.QubesException as ex:
 | 
					 | 
				
			||||||
                            QMessageBox.warning(self, "Error starting Qube!", str(ex))
 | 
					 | 
				
			||||||
                            return
 | 
					 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    return
 | 
					                    return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1332,7 +1327,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            self.start_vm(vm)
 | 
					            self.start_vm(vm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def start_vm(self, vm):
 | 
					    def start_vm(self, vm, wait=False):
 | 
				
			||||||
        if manager_utils.is_running(vm, False):
 | 
					        if manager_utils.is_running(vm, False):
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1341,6 +1336,10 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
 | 
				
			|||||||
        thread.finished.connect(self.clear_threads)
 | 
					        thread.finished.connect(self.clear_threads)
 | 
				
			||||||
        thread.start()
 | 
					        thread.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if wait:
 | 
				
			||||||
 | 
					            with common_threads.busy_cursor():
 | 
				
			||||||
 | 
					                thread.wait()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # noinspection PyArgumentList
 | 
					    # noinspection PyArgumentList
 | 
				
			||||||
    @pyqtSlot(name='on_action_startvm_tools_install_triggered')
 | 
					    @pyqtSlot(name='on_action_startvm_tools_install_triggered')
 | 
				
			||||||
    # TODO: replace with boot from device
 | 
					    # TODO: replace with boot from device
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user