Refactor "Logs" menu population
This commit is contained in:
		
							parent
							
								
									b51cd2dd5f
								
							
						
					
					
						commit
						a604a3fce2
					
				| @ -1650,35 +1650,22 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | |||||||
| 
 | 
 | ||||||
|         # logs menu |         # logs menu | ||||||
|         self.logs_menu.clear() |         self.logs_menu.clear() | ||||||
|  | 
 | ||||||
|         if vm.qid == 0: |         if vm.qid == 0: | ||||||
|             text = "/var/log/xen/console/hypervisor.log" |             logfiles = ["/var/log/xen/console/hypervisor.log"] | ||||||
|             action = self.logs_menu.addAction(QIcon(":/log.png"), text) |  | ||||||
|             action.setData(QVariant(text)) |  | ||||||
|             self.logs_menu.setEnabled(True) |  | ||||||
|         else: |         else: | ||||||
|  |             logfiles = [ | ||||||
|  |                 "/var/log/xen/console/guest-" + vm.name + ".log", | ||||||
|  |                 "/var/log/xen/console/guest-" + vm.name + "-dm.log", | ||||||
|  |                 "/var/log/qubes/guid." + vm.name + ".log", | ||||||
|  |                 "/var/log/qubes/qrexec." + vm.name + ".log", | ||||||
|  |             ] | ||||||
|  | 
 | ||||||
|         menu_empty = True |         menu_empty = True | ||||||
|             text = "/var/log/xen/console/guest-" + vm.name + ".log" |         for logfile in logfiles: | ||||||
|             if os.path.exists(text): |             if os.path.exists(logfile): | ||||||
|                 action = self.logs_menu.addAction(QIcon(":/log.png"), text) |                 action = self.logs_menu.addAction(QIcon(":/log.png"), logfile) | ||||||
|                 action.setData(QVariant(text)) |                 action.setData(QVariant(logfile)) | ||||||
|                 menu_empty = False |  | ||||||
| 
 |  | ||||||
|             text = "/var/log/xen/console/guest-" + vm.name + "-dm.log" |  | ||||||
|             if os.path.exists(text): |  | ||||||
|                 action = self.logs_menu.addAction(QIcon(":/log.png"), text) |  | ||||||
|                 action.setData(QVariant(text)) |  | ||||||
|                 menu_empty = False |  | ||||||
| 
 |  | ||||||
|             text = "/var/log/qubes/guid." + vm.name + ".log" |  | ||||||
|             if os.path.exists(text): |  | ||||||
|                 action = self.logs_menu.addAction(QIcon(":/log.png"), text) |  | ||||||
|                 action.setData(QVariant(text)) |  | ||||||
|                 menu_empty = False |  | ||||||
| 
 |  | ||||||
|             text = "/var/log/qubes/qrexec." + vm.name + ".log" |  | ||||||
|             if os.path.exists(text): |  | ||||||
|                 action = self.logs_menu.addAction(QIcon(":/log.png"), text) |  | ||||||
|                 action.setData(QVariant(text)) |  | ||||||
|                 menu_empty = False |                 menu_empty = False | ||||||
| 
 | 
 | ||||||
|         self.logs_menu.setEnabled(not menu_empty) |         self.logs_menu.setEnabled(not menu_empty) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jean-Philippe Ouellet
						Jean-Philippe Ouellet