Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/64'
Browse files Browse the repository at this point in the history
* origin/pr/64:
  Make pylint happy
  Do not react to events when running in "offline mode"
  • Loading branch information
marmarek committed May 17, 2024
2 parents 1dfe2b7 + 1b1bba1 commit 6bf329f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qubesappmenus/receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ def main(args=None):
vm = args.app.domains[env_vmname]
elif not args.domains:
parser.error("You must specify at least the VM name!")
# pylint doesn't know parser.error doesn't return
assert False
else:
vm = args.domains[0]

Expand Down
16 changes: 16 additions & 0 deletions qubesappmenusext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,24 @@ async def remove_from_disk(self, vm, event):

@qubes.ext.handler('property-set:label')
def label_setter(self, vm, event, **kwargs):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('property-set:provides_network')
def provides_network_setter(self, vm, event, **kwargs):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('property-set:guivm')
def provides_network_setter(self, vm, event, name, newvalue, oldvalue=None):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
if oldvalue and oldvalue != newvalue:
self.vm_tasks[vm.name].append(
Expand All @@ -178,33 +184,43 @@ def provides_network_setter(self, vm, event, name, newvalue, oldvalue=None):

@qubes.ext.handler('domain-feature-delete:appmenus-dispvm')
def on_feature_del_appmenus_dispvm(self, vm, event, feature):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('domain-feature-set:appmenus-dispvm')
def on_feature_set_appmenus_dispvm(self, vm, event, feature,
value, oldvalue=None):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('domain-feature-set:menu-items')
def on_feature_set_appmenus_dispvm(self, vm, event, feature,
value, oldvalue=None):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('domain-feature-delete:internal')
def on_feature_del_internal(self, vm, event, feature):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
self.vm_tasks[vm.name].append(
asyncio.ensure_future(self.update_appmenus(vm)))

@qubes.ext.handler('domain-feature-set:internal')
def on_feature_set_internal(self, vm, event, feature, value,
oldvalue=None):
if vm.app.vmm.offline_mode:
return
self.collect_done_tasks(vm)
if value:
self.vm_tasks[vm.name].append(
Expand Down

0 comments on commit 6bf329f

Please sign in to comment.