Skip to content

Invalid resolve_placement code in generated plugin skeleton  #106

@gboeer

Description

@gboeer

The 'plugins' plugin has an operation to generate a plugin skeleton.
When selecting the 'Has Placement' option, the generated code (at least the one which can be previewed) does not contain valid code.

E.g., the preview code shows

def resolve_placement(self, ctx):
        return types.Placement(
            types.Places.SAMPLES-GRID-SECONDARY-ACTIONS,
            label="My placement label",
            icon="/path/to/icon.svg",
            prompt=False
        )

While it should be

def resolve_placement(self, ctx):
        return types.Placement(
            types.Places.SAMPLES_GRID_SECONDARY_ACTIONS,
            types.Button(
                label="My placement label",
                icon="/path/to/icon.svg",
                prompt=False,
            ),
        )

Note, the invalid type types.Places.SAMPLES-GRID-SECONDARY-ACTIONS
and also the returned type is a single tuple instead of a tuple of tuples, which in my case does not produce any icon at all.
Only when I change my plugin code to the second variant (tuple of tuples) an icon will be shown.

The cause of the error should be in the function
https://github.com/voxel51/fiftyone-plugins/blob/5c800f1ded53c285f8e17f37e1ad9b2472fa93e7/plugins/plugins/__init__.py#L1630C1-L1656C18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions