Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mission_item_protocol: correct behaviour when wxpython not present #1260

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions MAVProxy/modules/lib/mission_item_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def init_gui_menus(self):
'''initialise menus for console and map'''
self.menu_added_console = False
self.menu_added_map = False
self.menu = None

if not mp_util.has_wxpython:
return

Expand Down Expand Up @@ -123,6 +125,15 @@ def completions(self):

def unload(self):
self.remove_command(self.command_name())
self.unload_remove_menu_items()

def unload_remove_menu_items(self):
'''remove out menu items from other modules'''

if self.menu is None:
'''can get here if wxpython is not present'''
return

if self.module('console') is not None and self.menu_added_console:
self.menu_added_console = False
self.module('console').remove_menu(self.menu)
Expand Down Expand Up @@ -294,6 +305,15 @@ def idle_task(self):
print("re-requesting %s %s" % (self.itemstype(), str(wps)))
self.send_wp_requests(wps)

self.idle_task_add_menu_items()

def idle_task_add_menu_items(self):
'''check for load of other modules, add our items as required'''

if self.menu is None:
'''can get here if wxpython is not present'''
return

if self.module('console') is not None:
if not self.menu_added_console:
self.menu_added_console = True
Expand Down