Skip to content

Commit befbb9b

Browse files
committed
Merge remote-tracking branch 'origin/pr/832'
* origin/pr/832: Move icon property to baseVM Pull request description: Every baseVM has a label, it should also have an icon. Fixes QubesOS/qubes-issues#10912
2 parents 5535093 + 043eeea commit befbb9b

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

qubes/vm/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,23 @@ def klass(self):
319319
"""Domain class name"""
320320
return type(self).__name__
321321

322+
@qubes.stateless_property
323+
def icon(self) -> str:
324+
"""freedesktop icon name, suitable for use in
325+
:py:meth:`PyQt4.QtGui.QIcon.fromTheme`"""
326+
raw_icon_name = self.label.name
327+
if self.klass == "TemplateVM":
328+
return "templatevm-" + raw_icon_name
329+
if self.features.get("servicevm", False):
330+
return "servicevm-" + raw_icon_name
331+
if self.klass == "DispVM":
332+
return "dispvm-" + raw_icon_name
333+
if self.klass == "StandaloneVM":
334+
return "standalonevm-" + raw_icon_name
335+
if self.klass == "RemoteVM":
336+
return "remotevm-" + raw_icon_name
337+
return "appvm-" + raw_icon_name
338+
322339
def close(self):
323340
super().close()
324341
del self.app

qubes/vm/qubesvm.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,23 +2707,6 @@ def start_time(self):
27072707

27082708
return None
27092709

2710-
@qubes.stateless_property
2711-
def icon(self) -> str:
2712-
"""freedesktop icon name, suitable for use in
2713-
:py:meth:`PyQt4.QtGui.QIcon.fromTheme`"""
2714-
raw_icon_name = self.label.name
2715-
if self.klass == "TemplateVM":
2716-
return "templatevm-" + raw_icon_name
2717-
if self.features.get("servicevm", False):
2718-
return "servicevm-" + raw_icon_name
2719-
if self.klass == "DispVM":
2720-
return "dispvm-" + raw_icon_name
2721-
if self.klass == "StandaloneVM":
2722-
return "standalonevm-" + raw_icon_name
2723-
if self.klass == "RemoteVM":
2724-
return "remotevm-" + raw_icon_name
2725-
return "appvm-" + raw_icon_name
2726-
27272710
@property
27282711
def kernelopts_common(self):
27292712
"""Kernel options which should be used in addition to *kernelopts*

0 commit comments

Comments
 (0)