Skip to content

[MSD-763][fix] adjust data sharing menu item - #3549

Open
K4rishma wants to merge 1 commit into
delmic:masterfrom
K4rishma:adjust_data_sharing_menu_item
Open

[MSD-763][fix] adjust data sharing menu item#3549
K4rishma wants to merge 1 commit into
delmic:masterfrom
K4rishma:adjust_data_sharing_menu_item

Conversation

@K4rishma

@K4rishma K4rishma commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Change the order of data sharing in Help menu and remove data sharing for all systems other than meteor and mimas

@K4rishma
K4rishma requested review from pieleric and tmoerkerken and a lite review from Copilot and removed request for Copilot August 11, 2026 07:56
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f620f7a-2832-43ad-a795-91fee065338c

📥 Commits

Reviewing files that changed from the base of the PR and between 4ea0251 and 8beeb16.

📒 Files selected for processing (3)
  • src/odemis/gui/cont/menu.py
  • src/odemis/gui/main_xrc.py
  • src/odemis/gui/xmlh/resources/frame_main.xrc
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/odemis/gui/cont/menu.py
  • src/odemis/gui/xmlh/resources/frame_main.xrc
  • src/odemis/gui/main_xrc.py

📝 Walkthrough

Walkthrough

The Help menu now includes a checkable “Share Data with Delmic” item. The main window initializes its reference. MenuController keeps and binds the item for meteor and mimas roles. For other roles, it removes and destroys the item. Dynamic consent-item appending is no longer used.

Sequence Diagram(s)

sequenceDiagram
  participant MainWindow
  participant MenuController
  participant DataSharingMenuItem
  participant ToggleHandler

  MainWindow->>MenuController: Initialize menu controller
  MenuController->>DataSharingMenuItem: Check active role
  alt meteor or mimas
    MenuController->>DataSharingMenuItem: Synchronize checkbox state
    MenuController->>ToggleHandler: Bind toggle handler
  else Other role
    MenuController->>DataSharingMenuItem: Remove and destroy item
  end
Loading

Mergeability Score: ⚪ Minimal · up to 8beeb

This change only adjusts the Help menu presentation and system-specific data-sharing visibility; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately explains the Help-menu update and the restriction of data sharing to Meteor and Mimas.
Title check ✅ Passed The title clearly identifies the data-sharing menu item fix described by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/odemis/gui/cont/menu.py (1)

181-194: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove _append_data_sharing_menu_item and initialize _consent_menu_item.

No callers remain for _append_data_sharing_menu_item, so delete it. The constructor never assigns self._consent_menu_item; clicking the item raises AttributeError during checkbox synchronization. Store the XRC item in self._consent_menu_item.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/odemis/gui/cont/menu.py` around lines 181 - 194, Remove the unused
_append_data_sharing_menu_item method. In the constructor, initialize
self._consent_menu_item by retrieving the existing XRC menu item, so checkbox
synchronization can access it without raising AttributeError.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/odemis/gui/cont/menu.py`:
- Around line 145-148: Update MenuController initialization and the role branch
around _on_toggle_data_sharing so the consent menu item is stored on
self._consent_menu_item, initializing it to None before the role check when
necessary. Use that instance attribute for the existing checkbox setup and
binding, ensuring the handler can synchronize the menu item without raising
AttributeError.

---

Outside diff comments:
In `@src/odemis/gui/cont/menu.py`:
- Around line 181-194: Remove the unused _append_data_sharing_menu_item method.
In the constructor, initialize self._consent_menu_item by retrieving the
existing XRC menu item, so checkbox synchronization can access it without
raising AttributeError.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df046101-eba3-4646-b7a2-54fd2ac52063

📥 Commits

Reviewing files that changed from the base of the PR and between 117150e and 4ea0251.

📒 Files selected for processing (3)
  • src/odemis/gui/cont/menu.py
  • src/odemis/gui/main_xrc.py
  • src/odemis/gui/xmlh/resources/frame_main.xrc

Comment thread src/odemis/gui/cont/menu.py Outdated
Comment thread src/odemis/gui/cont/menu.py Outdated
consent_item.Check(self._data_collector.get_consent() is True)
main_frame.Bind(wx.EVT_MENU, self._on_toggle_data_sharing, id=consent_item.GetId())
else:
menu = main_frame.menu_item_data_sharing.GetMenu()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This else block is a bit odd to me. Feels like we could have placed the instantiation of main_frame.menu_item_data_sharing in the if part and leave out the else part, unless there is a menu-specific constraint that I'm missing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always instantiated, from the XRC file. That's how all the menu items are done.

Comment thread src/odemis/gui/cont/menu.py Outdated
<assign_var>1</assign_var>
</XRCED>
</object>
<object class="wxMenuItem" name="menu_item_data_sharing">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR states that the order is changed, but I'm only seeing something added and not (re)moved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same item was earlier appended in the list of menu items so it was done from the code. Now I have removed that and added here because with append it is the last item which we do not want

Comment thread src/odemis/gui/xmlh/resources/frame_main.xrc Outdated
Comment thread src/odemis/gui/cont/menu.py Outdated
consent_item.Check(self._data_collector.get_consent() is True)
main_frame.Bind(wx.EVT_MENU, self._on_toggle_data_sharing, id=consent_item.GetId())
else:
menu = main_frame.menu_item_data_sharing.GetMenu()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always instantiated, from the XRC file. That's how all the menu items are done.

Change the order of data sharing in Help menu and remove data sharing for all system other than meteor and mimas
Copilot AI lite review requested due to automatic review settings August 13, 2026 04:10
@K4rishma
K4rishma force-pushed the adjust_data_sharing_menu_item branch from 4ea0251 to 8beeb16 Compare August 13, 2026 04:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GUI Help menu to surface a data-sharing consent checkbox in a fixed position and ensures the option is only available on METEOR and MIMAS systems.

Changes:

  • Added a new checkable “Share Data with Delmic” menu item to the Help menu XRC resources.
  • Wired the new XRC menu item into main_xrc.py so the main frame exposes it as menu_item_data_sharing.
  • Updated the menu controller to bind the consent toggle only for roles meteor and mimas, and remove the menu item for all other roles.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/odemis/gui/xmlh/resources/frame_main.xrc Adds the new Help menu checkbox entry for data sharing.
src/odemis/gui/main_xrc.py Exposes the new XRC menu item on the main frame (generated resource + lookup).
src/odemis/gui/cont/menu.py Binds consent handling for METEOR/MIMAS and removes the menu item for other roles.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +200 to +202
<object class="wxMenuItem" name="menu_item_data_sharing">
<label>Share Data with Delmic</label>
<checkable>1</checkable>
Comment on lines +3151 to +3153
<object class="wxMenuItem" name="menu_item_data_sharing">
<label>Share Data with Delmic</label>
<checkable>1</checkable>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants