Skip to content

Context menu: use of shared instances #10

@csaez

Description

@csaez

Hi,

Today while re-working the integration of the outliner widget into our application framework (unfortunately we cannot use the dialogs as widgets need to get embedded) I noticed the assumption of singleton behaviour on some of the context menues launching dialogs, which is a bit problematic as we very often have multiple stages opened in the same session (via AL_USDMaya proxy shapes).

i.e.

def Do(self, context):
if context.selectedLayer:
dialog = LayerTextEditorDialog.GetSharedInstance(
context.selectedLayer,
parent=context.qtParent or context.layerDialog)
dialog.show()
dialog.raise_()
dialog.activateWindow()

I can certainly re-implement these MenuAction classes and the OutlinerRole on our side, but I feel like I'm already duplicating a big chunk of the glue code by not using the dialogs and was wondering if this use case would help to reconsider these default choices? Is there a particular reason for the reuse of the dialog?

Thanks!
C.

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