Skip to content

Commit

Permalink
add append method
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Sep 27, 2023
1 parent 760e927 commit 15946d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/superqt/utils/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _store_connection(*args, **kwargs):
# perform the connection
connection = CONNECT(*args, **kwargs)
# store the connection for later disconnection
self._connections.append(connection)
self.append(connection)
return connection

# create a patcher for SignalInstance.connect
Expand All @@ -92,6 +92,10 @@ def __exit__(self, *args: Any) -> None:
def __len__(self) -> int:
return len(self._connections)

def append(self, connection: QMetaObject.Connection) -> None:
"""Manually store a connection."""
self._connections.append(connection)

def disconnect(self) -> None:
"""Disconnect all connections stored in this token."""
while self._connections:
Expand Down

0 comments on commit 15946d2

Please sign in to comment.