From 4567707207440444f2f4a440994529f995082731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 5 Jun 2019 16:19:38 +0200 Subject: [PATCH] Add tooltip to application list in VM settings The 'Comment' field will now be displayed as a tooltip in VM settings. Requires https://github.com/QubesOS/qubes-desktop-linux-common/pull/12 references QubesOS/qubes-issues#5076 --- qubesmanager/appmenu_select.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/qubesmanager/appmenu_select.py b/qubesmanager/appmenu_select.py index f042011..9d593a5 100755 --- a/qubesmanager/appmenu_select.py +++ b/qubesmanager/appmenu_select.py @@ -27,15 +27,16 @@ import PyQt4.QtGui # pylint: disable=import-error # TODO icon # pylint: disable=too-few-public-methods class AppListWidgetItem(PyQt4.QtGui.QListWidgetItem): - def __init__(self, name, ident, parent=None): + def __init__(self, name, ident, tooltip=None, parent=None): super(AppListWidgetItem, self).__init__(name, parent) -# self.setToolTip(command) + if tooltip: + self.setToolTip(tooltip) self.ident = ident @classmethod def from_line(cls, line): - ident, _icon_name, name = line.strip().split(maxsplit=2) - return cls(name=name, ident=ident) + ident, name, comment = line.split('|', maxsplit=3) + return cls(name=name, ident=ident, tooltip=comment) class AppmenuSelectManager: @@ -58,9 +59,10 @@ class AppmenuSelectManager: self.app_list.clear() available_appmenus = [AppListWidgetItem.from_line(line) - for line in subprocess.check_output(['qvm-appmenus', - '--get-available', '--i-understand-format-is-unstable', - self.vm.name]).decode().splitlines()] + for line in subprocess.check_output( + ['qvm-appmenus', '--get-available', + '--i-understand-format-is-unstable', '--file-field', + 'Comment', self.vm.name]).decode().splitlines()] for app in available_appmenus: if app.ident in self.whitelisted: