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