Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # PatchBay Canvas engine using QGraphicsView/Scene
  4. # Copyright (C) 2010-2019 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. from PyQt5.QtGui import QColor
  20. from PyQt5.QtWidgets import QGraphicsDropShadowEffect
  21. # ------------------------------------------------------------------------------------------------------------
  22. # Imports (Custom)
  23. from . import canvas
  24. # ------------------------------------------------------------------------------------------------------------
  25. class CanvasBoxShadow(QGraphicsDropShadowEffect):
  26. def __init__(self, parent):
  27. QGraphicsDropShadowEffect.__init__(self, parent)
  28. self.m_fakeParent = None
  29. self.setBlurRadius(20)
  30. self.setColor(canvas.theme.box_shadow)
  31. self.setOffset(0, 0)
  32. def setFakeParent(self, fakeParent):
  33. self.m_fakeParent = fakeParent
  34. def setOpacity(self, opacity):
  35. color = QColor(canvas.theme.box_shadow)
  36. color.setAlphaF(opacity)
  37. self.setColor(color)
  38. def draw(self, painter):
  39. if self.m_fakeParent:
  40. self.m_fakeParent.repaintLines()
  41. QGraphicsDropShadowEffect.draw(self, painter)
  42. # ------------------------------------------------------------------------------------------------------------