8000 Fix flags locking when group editing and inconsistent flags by wkentaro · Pull Request #1594 · wkentaro/labelme · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix flags locking when group editing and inconsistent flags #1594

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

Conversation

wkentaro
Copy link
Owner
@wkentaro wkentaro commented Jun 2, 2025

Why?

Because flags widgets are dynamically created, so locking has to happen after creation.

@wkentaro wkentaro self-assigned this Jun 2, 2025
@wkentaro wkentaro requested a review from Copilot June 2, 2025 22:12
Copy link
@Copilot Copilot AI left a comment

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 centralizes the disabling of flag widgets by deferring it to the dialog’s popUp method and cleans up redundant loops in the label editor.

  • Added a flags_disabled parameter to popUp and moved flag disabling into that method after widget creation.
  • Refactored _edit_label to pass flags_disabled instead of manually iterating over flag widgets, removing duplicate loops.

Reviewed Changes

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

File Description
labelme/widgets/label_dialog.py Added flags_disabled param to popUp and moved flag-disabling logic
labelme/app.py Removed manual flag disable/enable loops and passed flags_disabled

@@ -211,6 +219,9 @@ def popUp(self, text=None, move=True, flags=None, group_id=None, description=Non
self.setFlags(flags)
else:
self.resetFlags(text)
if flags_disabled:
for i in range(self.flagsLayout.count()):
self.flagsLayout.itemAt(i).widget().setDisabled(True)
Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

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

Currently popUp only disables flag widgets when flags_disabled is true but never re-enables them when it's false, which can leave flags permanently disabled. Consider adding an else branch to call setEnabled(True) on each widget.

Suggested change
self.flagsLayout.itemAt(i).widget().setDisabled(True)
self.flagsLayout.itemAt(i).widget().setDisabled(True)
else:
for i in range(self.flagsLayout.count()):
self.flagsLayout.itemAt(i).widget().setEnabled(True)

Copilot uses AI. Check for mistakes.

flags=None,
group_id=None,
description=None,
flags_disabled: bool = False,
Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

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

The new flags_disabled parameter lacks documentation. Please update the popUp docstring to explain its purpose and default behavior.

Copilot uses AI. Check for mistakes.

@wkentaro
Copy link
Owner Author
wkentaro commented Jun 2, 2025

Merged in #1595

@wkentaro wkentaro closed this Jun 2, 2025
@wkentaro wkentaro deleted the fix_flags_locking_when_group_editing_and_inconsistent_flags branch June 2, 2025 23:28
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.

1 participant
0