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
This commit is contained in:
parent
492b8705b6
commit
4567707207
@ -27,15 +27,16 @@ import PyQt4.QtGui # pylint: disable=import-error
|
|||||||
# TODO icon
|
# TODO icon
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class AppListWidgetItem(PyQt4.QtGui.QListWidgetItem):
|
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)
|
super(AppListWidgetItem, self).__init__(name, parent)
|
||||||
# self.setToolTip(command)
|
if tooltip:
|
||||||
|
self.setToolTip(tooltip)
|
||||||
self.ident = ident
|
self.ident = ident
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_line(cls, line):
|
def from_line(cls, line):
|
||||||
ident, _icon_name, name = line.strip().split(maxsplit=2)
|
ident, name, comment = line.split('|', maxsplit=3)
|
||||||
return cls(name=name, ident=ident)
|
return cls(name=name, ident=ident, tooltip=comment)
|
||||||
|
|
||||||
|
|
||||||
class AppmenuSelectManager:
|
class AppmenuSelectManager:
|
||||||
@ -58,9 +59,10 @@ class AppmenuSelectManager:
|
|||||||
self.app_list.clear()
|
self.app_list.clear()
|
||||||
|
|
||||||
available_appmenus = [AppListWidgetItem.from_line(line)
|
available_appmenus = [AppListWidgetItem.from_line(line)
|
||||||
for line in subprocess.check_output(['qvm-appmenus',
|
for line in subprocess.check_output(
|
||||||
'--get-available', '--i-understand-format-is-unstable',
|
['qvm-appmenus', '--get-available',
|
||||||
self.vm.name]).decode().splitlines()]
|
'--i-understand-format-is-unstable', '--file-field',
|
||||||
|
'Comment', self.vm.name]).decode().splitlines()]
|
||||||
|
|
||||||
for app in available_appmenus:
|
for app in available_appmenus:
|
||||||
if app.ident in self.whitelisted:
|
if app.ident in self.whitelisted:
|
||||||
|
Loading…
Reference in New Issue
Block a user