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

Allow zones to be edited #186

Merged
merged 32 commits into from
Aug 23, 2021
Merged

Allow zones to be edited #186

merged 32 commits into from
Aug 23, 2021

Conversation

BryceBeagle
Copy link
Member

This PR is the first step to allowing zones to be edited without deletion/recreation.

Right now, you can only add new points. (This means the changes are pretty useless for Lines). We will need future changes to delete points, and to move points.

Addresses #181

@apockill
Copy link
Member

Wouldn't it be just as simple to have the Zone coords be reset, instead of adding lines?

I don't think this PR is useful right now at all, unless it lets you start a zone from scratch.

brainframe_qt/ui/dialogs/task_configuration/core/zone.py Outdated Show resolved Hide resolved
Comment on lines 225 to 226
# TODO(Bryce Beagle): Do this dynamically:
# TODO(Bryce Beagle): Do this dynamically:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# TODO(Bryce Beagle): Do this dynamically:
# TODO(Bryce Beagle): Do this dynamically:
# TODO(Bryce Beagle): Do this dynamically:

dedup

@@ -0,0 +1,136 @@
from typing import List, Optional
Copy link
Member

Choose a reason for hiding this comment

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

Is this all new, or from another file?

Copy link
Member Author

Choose a reason for hiding this comment

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

A bit of both. The file was moved and changed, and that confused git enough

Copy link
Member

Choose a reason for hiding this comment

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

Which file was it from? I can manually diff it on my end to try to provide feedback

Copy link
Member Author

Choose a reason for hiding this comment

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

brainframe_qt/ui/dialogs/task_configuration/video_task_config/video_task_config.py

@@ -0,0 +1,154 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
Copy link
Member

Choose a reason for hiding this comment

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

image
I believe that previously, the Screen was always first in the list. I think if it's no big deal to add, it might be nice to keep that 'feature'.

Copy link
Member Author

Choose a reason for hiding this comment

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

Umm weird... I didn't think I changed anything that would affect ordering here. I also haven't seen Screen anywhere but the top. I'll investigate

Copy link
Member Author

Choose a reason for hiding this comment

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

So I think the only way this could happen is if api.get_zones returns Screen not as the first Zone. Do you know why that would happen?

Copy link
Member

Choose a reason for hiding this comment

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

I tested it, and it appears that api.get_zones() returns Screen first, but api.get_zones(stream_id=...) returns Screen last (or maybe everything just in inverse order?).

I only have two streams of sample size, but hey.

Since this is more of a UI thing, we probably don't want to rely on the server to maintain this visual nicety. We could add this after the api.get_zones() call, to ensure the Screen zone is always first:

zones = list(map(Zone.from_api_zone, api_zones))

# These lines
screen_index = next(i for i, z in enumerate(zones) if z.name == FULL_FRAME_ZONE_NAME)
zones.insert(0, zones.pop(screen_index))

Copy link
Member

Choose a reason for hiding this comment

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

Anyways, I approved the PR, but this would be a visual nicety to have. It makes sense to have the "always persistent" uneditable zone at the top of the list always.

Copy link
Member Author

Choose a reason for hiding this comment

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

Has this functionality changed during this PR? I'm inclined to open an issue and change this in a different changeset. Also, the backend should probably be changed to have consistent ordering.

Copy link
Member

Choose a reason for hiding this comment

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

Well, yeah, it changed in the sense that now Screen is always at the bottom as opposed to always being at the top.

I consider it a minor UI regression, because I think most brainframe users have gotten used to the screen being right at the top

Copy link
Member Author

Choose a reason for hiding this comment

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

This should be resolved now

@@ -0,0 +1,136 @@
from typing import List, Optional
Copy link
Member

Choose a reason for hiding this comment

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

Which file was it from? I can manually diff it on my end to try to provide feedback

self.polygon_is_valid_signal.emit(True)

def on_frame(self, frame: ZoneStatusFrame) -> None:
# Only change the video frame if we're in the process of creating a new zone
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the video freezes when you're drawing a zone? How have I never noticed this??

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this has not changed during the PR, just moved.

No, the super().on_frame clears all elements from the frame, but we want those to stay while we're editing. The else here ensures that the new frame is drawn.

I'll admit the comment is confusing though, so I'll change it

Copy link
Member Author

Choose a reason for hiding this comment

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

Better?

Copy link
Member

@velovix velovix left a comment

Choose a reason for hiding this comment

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

Me reviewing UI changes like :empty_brain:

@BryceBeagle BryceBeagle changed the title First step to allowing zone editing Allow zones to be edited Aug 23, 2021
@BryceBeagle BryceBeagle merged commit d564154 into main Aug 23, 2021
@BryceBeagle BryceBeagle deleted the feature/181-edit-regions branch August 23, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants