mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added back password_dialog and implemented 'PressHoverButton' in utils
This commit is contained in:
parent
54b8a04653
commit
1a445e2f77
3 changed files with 71 additions and 0 deletions
|
|
@ -15,6 +15,8 @@ from .widgets import (
|
|||
IconButton,
|
||||
PixmapButton,
|
||||
SeparatorWidget,
|
||||
PressHoverButton,
|
||||
|
||||
VerticalExpandButton,
|
||||
SquareButton,
|
||||
RefreshButton,
|
||||
|
|
@ -71,6 +73,7 @@ __all__ = (
|
|||
"IconButton",
|
||||
"PixmapButton",
|
||||
"SeparatorWidget",
|
||||
"PressHoverButton",
|
||||
|
||||
"VerticalExpandButton",
|
||||
"SquareButton",
|
||||
|
|
|
|||
|
|
@ -782,6 +782,41 @@ class SeparatorWidget(QtWidgets.QFrame):
|
|||
self._set_size(self._size)
|
||||
|
||||
|
||||
class PressHoverButton(QtWidgets.QPushButton):
|
||||
_mouse_pressed = False
|
||||
_mouse_hovered = False
|
||||
change_state = QtCore.Signal(bool)
|
||||
|
||||
@property
|
||||
def mouse_pressed(self):
|
||||
return self._mouse_pressed
|
||||
|
||||
@property
|
||||
def mouse_hovered(self):
|
||||
return self._mouse_hovered
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
self._mouse_pressed = True
|
||||
self._mouse_hovered = True
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
super(PressHoverButton, self).mousePressEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
self._mouse_pressed = False
|
||||
self._mouse_hovered = False
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
super(PressHoverButton, self).mouseReleaseEvent(event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
mouse_pos = self.mapFromGlobal(QtGui.QCursor.pos())
|
||||
under_mouse = self.rect().contains(mouse_pos)
|
||||
if under_mouse != self._mouse_hovered:
|
||||
self._mouse_hovered = under_mouse
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
|
||||
super(PressHoverButton, self).mouseMoveEvent(event)
|
||||
|
||||
|
||||
def get_refresh_icon():
|
||||
return get_qta_icon_by_name_and_color(
|
||||
"fa.refresh", get_default_tools_icon_color()
|
||||
|
|
|
|||
33
client/ayon_core/widgets/password_dialog.py
Normal file
33
client/ayon_core/widgets/password_dialog.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# TODO remove - kept for kitsu addon which imported it
|
||||
from qtpy import QtWidgets, QtCore, QtGui
|
||||
|
||||
|
||||
class PressHoverButton(QtWidgets.QPushButton):
|
||||
"""
|
||||
Deprecated:
|
||||
Use `openpype.tools.utils.PressHoverButton` instead.
|
||||
"""
|
||||
_mouse_pressed = False
|
||||
_mouse_hovered = False
|
||||
change_state = QtCore.Signal(bool)
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
self._mouse_pressed = True
|
||||
self._mouse_hovered = True
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
super(PressHoverButton, self).mousePressEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
self._mouse_pressed = False
|
||||
self._mouse_hovered = False
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
super(PressHoverButton, self).mouseReleaseEvent(event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
mouse_pos = self.mapFromGlobal(QtGui.QCursor.pos())
|
||||
under_mouse = self.rect().contains(mouse_pos)
|
||||
if under_mouse != self._mouse_hovered:
|
||||
self._mouse_hovered = under_mouse
|
||||
self.change_state.emit(self._mouse_hovered)
|
||||
|
||||
super(PressHoverButton, self).mouseMoveEvent(event)
|
||||
Loading…
Add table
Add a link
Reference in a new issue