An open source DAW for GNU/Linux, inspired by modular synths. http://noisicaa.odahoda.de/
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.
 
 
 
 
 
 
noisicaa/noisicaa/ui/qml/GraphConnection.py

61 lines
1.9 KiB

# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
import logging
import os.path
import random
from PySide2.QtCore import Qt
from PySide2 import QtCore
from PySide2 import QtQml
from PySide2 import QtQuick
from noisicaa import model
from noisicaa.ui import ui_base
from .GraphNode import GraphNodeWrapper
logger = logging.getLogger(__name__)
class GraphConnectionWrapper(ui_base.ProjectMixin, ui_base.PropertyContainer, QtCore.QObject):
highlighted, highlightedChanged = ui_base.Property('highlighted', bool)
def __init__(self, *, connection, nodeMap, **kwargs):
super().__init__(**kwargs)
self.__connection = connection
self.__srcNode = nodeMap[self.__connection.srcNodeId]
self.__destNode = nodeMap[self.__connection.destNodeId]
def __str__(self):
return '<{} {}>'.format(type(self).__name__, self.__connection)
@ui_base.ConstProperty(model.Connection)
def connection(self):
return self.__connection
@ui_base.ConstProperty(GraphNodeWrapper)
def srcNode(self):
return self.__srcNode
@ui_base.ConstProperty(GraphNodeWrapper)
def destNode(self):
return self.__destNode