mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
use string instead of custom type for signal parameter
This commit is contained in:
parent
1256c67428
commit
52e8601d44
1 changed files with 8 additions and 18 deletions
|
|
@ -43,24 +43,14 @@ from ..constants import (
|
|||
)
|
||||
|
||||
|
||||
class SelectionType:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, SelectionType):
|
||||
other = other.name
|
||||
return self.name == other
|
||||
|
||||
|
||||
class SelectionTypes:
|
||||
clear = SelectionType("clear")
|
||||
extend = SelectionType("extend")
|
||||
extend_to = SelectionType("extend_to")
|
||||
clear = "clear"
|
||||
extend = "extend"
|
||||
extend_to = "extend_to"
|
||||
|
||||
|
||||
class BaseGroupWidget(QtWidgets.QWidget):
|
||||
selected = QtCore.Signal(str, str, SelectionType)
|
||||
selected = QtCore.Signal(str, str, str)
|
||||
removed_selected = QtCore.Signal()
|
||||
|
||||
def __init__(self, group_name, parent):
|
||||
|
|
@ -269,7 +259,7 @@ class InstanceGroupWidget(BaseGroupWidget):
|
|||
class CardWidget(BaseClickableFrame):
|
||||
"""Clickable card used as bigger button."""
|
||||
|
||||
selected = QtCore.Signal(str, str, SelectionType)
|
||||
selected = QtCore.Signal(str, str, str)
|
||||
# Group identifier of card
|
||||
# - this must be set because if send when mouse is released with card id
|
||||
_group_identifier = None
|
||||
|
|
@ -755,11 +745,11 @@ class InstanceCardView(AbstractInstanceView):
|
|||
group_widget = self._widgets_by_group[group_name]
|
||||
new_widget = group_widget.get_widget_by_item_id(instance_id)
|
||||
|
||||
if selection_type is SelectionTypes.clear:
|
||||
if selection_type == SelectionTypes.clear:
|
||||
self._select_item_clear(instance_id, group_name, new_widget)
|
||||
elif selection_type is SelectionTypes.extend:
|
||||
elif selection_type == SelectionTypes.extend:
|
||||
self._select_item_extend(instance_id, group_name, new_widget)
|
||||
elif selection_type is SelectionTypes.extend_to:
|
||||
elif selection_type == SelectionTypes.extend_to:
|
||||
self._select_item_extend_to(instance_id, group_name, new_widget)
|
||||
|
||||
self.selection_changed.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue