Skip to content

Commit

Permalink
Allow selecting test mode with command-line argument
Browse files Browse the repository at this point in the history
Useful for local development.
  • Loading branch information
DemiMarie committed Dec 1, 2024
1 parent a7ad8d3 commit 56c9ea8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions qubes_menu/appmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ def __init__(self, qapp, dispatcher):
self.tasks = []

def _add_cli_options(self):
self.add_main_option(
"mock-qubes",
ord("m"),
GLib.OptionFlags.NONE,
GLib.OptionArg.NONE,
"Use fake Qubes object (FOR TESTING AND DEBUGGING ONLY)",
None,
)

self.add_main_option(
"keep-visible",
ord("k"),
Expand Down Expand Up @@ -166,6 +175,17 @@ def parse_options(self, options: Dict[str, Any]):
if int(v) == int(options["page"])][0]
if "background" in options:
self.start_in_background = True
if "mock-qubes" in options:
from qubesadmin.tests.mock_app import MockQubesComplete, MockDispatcher, MockQube
self.qapp = MockQubesComplete()

self.qapp._qubes['test-vm2'] = MockQube(name="test-vm2", qapp=self.qapp,
features={'menu-favorites': ''})
self.qapp._qubes['dom0'].features['menu-initial-page'] = 'favorites_page'
self.qapp._qubes['dom0'].features['menu-sort-running'] = '1'
self.qapp.update_vm_calls()

self.dispatcher = MockDispatcher(self.qapp)

@staticmethod
def _do_power_button(_widget):
Expand Down

0 comments on commit 56c9ea8

Please sign in to comment.