diff --git a/src/odemis/gui/cont/menu.py b/src/odemis/gui/cont/menu.py
index 97447c9e25..17147141c2 100644
--- a/src/odemis/gui/cont/menu.py
+++ b/src/odemis/gui/cont/menu.py
@@ -141,6 +141,16 @@ def __init__(self, main_data: MainGUIData, main_frame: wx.Frame, data_collector:
menu_dev = main_frame.menu_item_edit_meteor_calibration.GetMenu()
menu_dev.Delete(main_frame.menu_item_edit_meteor_calibration)
+ # /Help/Share Data with Delmic
+ if main_data.role in ["meteor", "mimas"]:
+ self.consent_item = main_frame.menu_item_data_sharing
+ self.consent_item.Check(self._data_collector.get_consent() is True)
+ main_frame.Bind(wx.EVT_MENU, self._on_toggle_data_sharing, id=self.consent_item.GetId())
+ else:
+ menu = main_frame.menu_item_data_sharing.GetMenu()
+ menu.Remove(main_frame.menu_item_data_sharing)
+ main_frame.menu_item_data_sharing.Destroy()
+
# TODO: make it work on Windows too
# /Help/Report a problem...
if sys.platform.startswith('win32'):
@@ -158,9 +168,6 @@ def __init__(self, main_data: MainGUIData, main_frame: wx.Frame, data_collector:
# /Help/About
main_frame.Bind(wx.EVT_MENU, self._on_about, id=main_frame.menu_item_about.GetId())
- self._consent_menu_item = self._append_data_sharing_menu_item(main_frame)
- if self._consent_menu_item is not None:
- main_frame.Bind(wx.EVT_MENU, self._on_toggle_data_sharing, id=self._consent_menu_item.GetId())
# add a toggle for correlation tab in viewer mode
if main_data.is_viewer:
@@ -171,20 +178,6 @@ def __init__(self, main_data: MainGUIData, main_frame: wx.Frame, data_collector:
menu.Remove(main_frame.menu_item_show_correlation)
main_frame.menu_item_show_correlation.Destroy()
- def _append_data_sharing_menu_item(self, main_frame: wx.Frame) -> wx.MenuItem:
- """
- Append and initialize Help menu checkbox for data sharing consent.
- :param main_frame: The main application frame.
- :return: The created menu item, or None if the Help menu is not available.
- """
- help_menu = main_frame.menu_item_about.GetMenu()
- if help_menu is None:
- return None
- help_menu.AppendSeparator()
- item = help_menu.AppendCheckItem(wx.ID_ANY, "Share data with Delmic")
- item.Check(self._data_collector.get_consent() is True)
- return item
-
@call_in_wx_main
def _on_toggle_data_sharing(self, evt):
"""Show consent dialog when the data-sharing menu item is clicked."""
@@ -216,8 +209,7 @@ def _on_toggle_data_sharing(self, evt):
elif response == wx.ID_CANCEL:
self._data_collector.set_temporary_consent(days=1)
# Sync the Help menu checkbox to reflect the persisted choice.
- if self._consent_menu_item is not None:
- self._consent_menu_item.Check(self._data_collector.get_consent() is True)
+ self.consent_item.Check(self._data_collector.get_consent() is True)
except Exception:
logging.exception("Failed to run data-collection consent prompt.")
diff --git a/src/odemis/gui/main_xrc.py b/src/odemis/gui/main_xrc.py
index e84e01c8a2..a32fcbee06 100644
--- a/src/odemis/gui/main_xrc.py
+++ b/src/odemis/gui/main_xrc.py
@@ -282,6 +282,7 @@ def __init__(self, parent):
self.menu_item_debug = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_debug"))
self.menu_item_edit_meteor_calibration = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_edit_meteor_calibration"))
self.menu_item_bugreport = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_bugreport"))
+ self.menu_item_data_sharing = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_data_sharing"))
self.menu_item_update = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_update"))
self.menu_item_about = self.GetMenuBar().FindItemById(xrc.XRCID("menu_item_about"))
self.pnl_tabbuttons = xrc.XRCCTRL(self, "pnl_tabbuttons")
@@ -3147,6 +3148,13 @@ def __init_resources():
1
+
+