Skip to content

Commit

Permalink
PlugPopup : Allow plugValueWidget activatedSignal to dismiss popup
Browse files Browse the repository at this point in the history
  • Loading branch information
murraystevenson committed May 28, 2024
1 parent dcf661f commit 0d14a72
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/GafferUI/PlugPopup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def __init__( self, plugs, title = None, warning = None, **kw ) :
colorPlugValueWidget.setColorChooserVisible( True )

self.visibilityChangedSignal().connect( Gaffer.WeakMethod( self.__visibilityChanged ), scoped = False )
self.focusChangedSignal().connect( Gaffer.WeakMethod( self.__focusChanged ), scoped = False )

def popup( self, center = None ) :

Expand Down Expand Up @@ -154,6 +155,19 @@ def __visibilityChanged( self, unused ) :
if gafferWidget is not None and self.isAncestorOf( gafferWidget ) :
gafferWidget._qtWidget().clearFocus()

def __focusChanged( self, oldWidget, newWidget ) :

if self.__plugValueWidget.isAncestorOf( newWidget ) and hasattr( newWidget, "activatedSignal" ) :
self.__widgetActivatedConnection = newWidget.activatedSignal().connect(
Gaffer.WeakMethod( self.__activated ), scoped = False
)
else :
self.__widgetActivatedConnection = None

def __activated( self, unused ) :

self.close()

@classmethod
def __firstTextWidget( cls, plugValueWidget ) :

Expand Down

0 comments on commit 0d14a72

Please sign in to comment.