From 6635efe0bb47212e63efadb60868ba543b5a6ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Mon, 27 Apr 2020 20:37:00 +0200 Subject: [PATCH 1/2] Add vm.icon property This is a property for handling vm icons that change depending on vm type. Depends on https://github.com/QubesOS/qubes-artwork/pull/17 references QubesOS/qubes-issues#5767 --- qubesadmin/vm/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubesadmin/vm/__init__.py b/qubesadmin/vm/__init__.py index 1670cf35..91f7305a 100644 --- a/qubesadmin/vm/__init__.py +++ b/qubesadmin/vm/__init__.py @@ -370,6 +370,21 @@ def klass(self): self._klass = super(QubesVM, self).klass return self._klass + @property + def icon(self): + '''freedesktop icon name, suitable for use in + :py:meth:`PyQt4.QtGui.QIcon.fromTheme`''' + raw_icon_name = self.label.name + if self.klass == 'TemplateVM': + return 'templatevm-' + raw_icon_name + if self.klass == 'DispVM': + return 'dispvm-' + raw_icon_name + # if self.features.get('servicevm'): + if self.provides_network: + return 'servicevm-' + raw_icon_name + return 'appvm-' + raw_icon_name + + class DispVMWrapper(QubesVM): '''Wrapper class for new DispVM, supporting only service call From 51ff037bb4791fec09448c1568d2effa6603fd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Thu, 30 Apr 2020 21:22:58 +0200 Subject: [PATCH 2/2] Fixes for new pylint version --- qubesadmin/tools/__init__.py | 2 +- qubesadmin/tools/qvm_volume.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/qubesadmin/tools/__init__.py b/qubesadmin/tools/__init__.py index ef18e06c..ad000dd4 100644 --- a/qubesadmin/tools/__init__.py +++ b/qubesadmin/tools/__init__.py @@ -378,7 +378,7 @@ def __init__(self, want_app=True, want_app_no_instance=False, self.set_defaults(verbose=1, quiet=0) - def parse_args(self, *args, **kwargs): # pylint: disable=arguments-differ + def parse_args(self, *args, **kwargs): # pylint: disable=signature-differs # hack for tests app = kwargs.pop('app', None) namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs) diff --git a/qubesadmin/tools/qvm_volume.py b/qubesadmin/tools/qvm_volume.py index 5ed77d10..ef10ab26 100644 --- a/qubesadmin/tools/qvm_volume.py +++ b/qubesadmin/tools/qvm_volume.py @@ -137,7 +137,6 @@ def import_volume(args): ''' Import a file into volume ''' volume = args.volume - old_size = volume.size input_path = args.input_path if input_path == '-': input_file = sys.stdin.buffer