Skip to content

Commit 9774d5f

Browse files
committed
Cleanup shutdown label initialization
1 parent 1da8bb8 commit 9774d5f

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

qui/tray/domains.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,15 @@ def __init__(
203203
icon_name="shutdown",
204204
):
205205
if force:
206-
super().__init__(
207-
vm,
208-
label=force_label or _("Force shutdown"),
209-
icon_cache=icon_cache,
210-
icon_name=icon_name,
211-
)
206+
init_label = force_label or _("Force shutdown")
212207
else:
213-
super().__init__(
214-
vm,
215-
label=label or _("Shutdown"),
216-
icon_cache=icon_cache,
217-
icon_name=icon_name,
218-
)
208+
init_label = label or _("Shutdown")
209+
super().__init__(
210+
vm,
211+
label=init_label,
212+
icon_cache=icon_cache,
213+
icon_name=icon_name,
214+
)
219215
self.force = force
220216
self.follow_shift = follow_shift
221217

qui/updater/summary_page.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
from typing import Optional, Any
3232

3333
import qubesadmin
34-
from qubesadmin.utils.shutdown import shutdown
35-
from qubesadmin.utils.start import start
34+
import qubesadmin.utils
3635

3736
from qubes_config.widgets.gtk_utils import (
3837
load_icon,
@@ -315,7 +314,9 @@ async def shutdown_domains(self, to_shutdown):
315314
"""
316315
Try to shut down vms and wait to finish.
317316
"""
318-
failed = await shutdown(domains=to_shutdown, force=True, wait=True)
317+
failed = await qubesadmin.utils.shutdown(
318+
domains=to_shutdown, force=True, wait=True
319+
)
319320
if not failed:
320321
return to_shutdown
321322
self.status = RestartStatus.ERROR_TMPL_DOWN
@@ -334,7 +335,7 @@ async def restart_vms(self, to_restart):
334335
shutdowns = await self.shutdown_domains(to_restart)
335336

336337
# restart shutdown qubes
337-
failed = await start(domains=shutdowns)
338+
failed = await qubesadmin.utils.start(domains=shutdowns)
338339
if not failed:
339340
return
340341
for qube, exc in failed.items():

0 commit comments

Comments
 (0)