Browse Source

Remove custom return host on carla-control, no longer needed

tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
565f485370
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 14 additions and 210 deletions
  1. +2
    -140
      resources/ui/carla_osc_connect.ui
  2. +12
    -69
      source/frontend/carla_control.py
  3. +0
    -1
      source/frontend/carla_host.py

+ 2
- 140
resources/ui/carla_osc_connect.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>443</width>
<height>281</height>
<width>435</width>
<height>183</height>
</rect>
</property>
<property name="windowTitle">
@@ -108,144 +108,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="group_reported_host">
<property name="title">
<string>Reported host</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>92</width>
<height>38</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2">
<widget class="QRadioButton" name="rb_reported_auto">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatic</string>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>92</width>
<height>38</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="rb_reported_custom">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Custom:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="le_reported_host"/>
</item>
<item row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPlainTextEdit" name="te_reported_hint">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="midLineWidth">
<number>1</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="plainText">
<string>In some networks (like USB connections), the remote system cannot reach the local network. You can specify here which hostname or IP to make the remote Carla connect to.
If you are unsure, leave it as 'Automatic'.</string>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">


+ 12
- 69
source/frontend/carla_control.py View File

@@ -60,11 +60,6 @@ class ConnectDialog(QDialog):

self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

# Make PlainTextEdit background the same color as the window background
palette = self.ui.te_reported_hint.palette()
palette.setColor(QPalette.Base, palette.color(QPalette.Background))
self.ui.te_reported_hint.setPalette(palette)

# -------------------------------------------------------------------------------------------------------------
# Load settings

@@ -74,80 +69,40 @@ class ConnectDialog(QDialog):
# Set-up connections

self.finished.connect(self.slot_saveSettings)
self.ui.rb_reported_auto.clicked.connect(self.slot_reportedAutoClicked)
self.ui.rb_reported_custom.clicked.connect(self.slot_reportedCustomClicked)
self.ui.le_host.textChanged.connect(self.slot_hostChanged)
self.ui.le_reported_host.textChanged.connect(self.slot_reportedHostChanged)

# -----------------------------------------------------------------------------------------------------------------

def getResult(self):
return (self.ui.le_host.text(),
self.ui.le_reported_host.text() if self.ui.rb_reported_custom.isChecked() else "",
self.ui.sb_tcp_port.value(),
self.ui.sb_udp_port.value())

def checkIfButtonBoxShouldBeEnabled(self, host, reportedHostAutomatic, reportedHost):
def checkIfButtonBoxShouldBeEnabled(self, host):
enabled = len(host) > 0

if enabled and not reportedHostAutomatic:
enabled = len(reportedHost) > 0

self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)

def loadSettings(self):
settings = QSafeSettings("falkTX", "CarlaOSCConnect")

if settings.value("ReportedHostAutomatic", True, bool):
self.ui.rb_reported_custom.setChecked(False)
self.ui.rb_reported_auto.setChecked(True)
else:
self.ui.rb_reported_auto.setChecked(False)
self.ui.rb_reported_custom.setChecked(True)

self.ui.le_host.setText(settings.value("Host", "127.0.0.1", str))
self.ui.le_reported_host.setText(settings.value("ReportedHost", "", str))
self.ui.sb_tcp_port.setValue(settings.value("TCPPort", CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, int))
self.ui.sb_udp_port.setValue(settings.value("UDPPort", CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, int))

self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(),
self.ui.rb_reported_auto.isChecked(),
self.ui.le_reported_host.text())
self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text())

# ------------------------------------------------------------------------------------------------------------------

@pyqtSlot(bool)
def slot_reportedAutoClicked(self, clicked):
self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(),
clicked,
self.ui.le_reported_host.text())

@pyqtSlot(bool)
def slot_reportedCustomClicked(self, clicked):
self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(),
not clicked,
self.ui.le_reported_host.text())

@pyqtSlot(str)
def slot_hostChanged(self, text):
self.checkIfButtonBoxShouldBeEnabled(text,
self.ui.rb_reported_auto.isChecked(),
self.ui.le_reported_host.text())

@pyqtSlot(str)
def slot_reportedHostChanged(self, text):
self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(),
self.ui.rb_reported_auto.isChecked(),
text)
self.checkIfButtonBoxShouldBeEnabled(text)

@pyqtSlot()
def slot_saveSettings(self):
settings = QSafeSettings("falkTX", "CarlaOSCConnect")
settings.setValue("Host", self.ui.le_host.text())
settings.setValue("ReportedHost", self.ui.le_reported_host.text())
settings.setValue("TCPPort", self.ui.sb_tcp_port.value())
settings.setValue("UDPPort", self.ui.sb_udp_port.value())
settings.setValue("ReportedHostAutomatic", self.ui.rb_reported_auto.isChecked())

# ------------------------------------------------------------------------------------------------------------------

@@ -312,14 +267,13 @@ class CarlaHostOSC(CarlaHostQtPlugin):
# OSC Control server

class CarlaControlServerTCP(Server):
def __init__(self, host, rhost):
def __init__(self, host):
Server.__init__(self, proto=LO_TCP)

if False:
host = CarlaHostOSC()

self.host = host
self.rhost = rhost

def idle(self):
self.fReceivedMsgs = False
@@ -328,8 +282,6 @@ class CarlaControlServerTCP(Server):
pass

def getFullURL(self):
if self.rhost:
return "osc.tcp://%s:%i/ctrl" % (self.rhost, self.get_port())
return "%sctrl" % self.get_url()

@make_method('/ctrl/cb', 'iiiiifs')
@@ -516,14 +468,13 @@ class CarlaControlServerTCP(Server):
# ---------------------------------------------------------------------------------------------------------------------

class CarlaControlServerUDP(Server):
def __init__(self, host, rhost):
def __init__(self, host):
Server.__init__(self, proto=LO_UDP)

if False:
host = CarlaHostOSC()

self.host = host
self.rhost = rhost

def idle(self):
self.fReceivedMsgs = False
@@ -532,8 +483,6 @@ class CarlaControlServerUDP(Server):
pass

def getFullURL(self):
if self.rhost:
return "osc.udp://%s:%i/ctrl" % (self.rhost, self.get_port())
return "%sctrl" % self.get_url()

@make_method('/ctrl/runtime', 'fiihiiif')
@@ -586,7 +535,7 @@ class HostWindowOSC(HostWindow):
if oscAddr:
QTimer.singleShot(0, self.connectOsc)

def connectOsc(self, addrTCP = None, addrUDP = None, rhost = None):
def connectOsc(self, addrTCP = None, addrUDP = None):
if self.fCustomOscAddress is not None:
addrTCP = self.fCustomOscAddress.replace("osc.udp://","osc.tcp://")
addrUDP = self.fCustomOscAddress.replace("osc.tcp://","osc.udp://")
@@ -596,8 +545,6 @@ class HostWindowOSC(HostWindow):
self.fOscAddressTCP = addrTCP
if addrUDP is not None:
self.fOscAddressUDP = addrUDP
if rhost is not None:
self.fOscReportedHost = rhost

lo_target_tcp_name = addrTCP.rsplit("/", 1)[-1]
lo_target_udp_name = addrUDP.rsplit("/", 1)[-1]
@@ -606,11 +553,11 @@ class HostWindowOSC(HostWindow):

try:
lo_target_tcp = Address(addrTCP)
lo_server_tcp = CarlaControlServerTCP(self.host, rhost)
lo_server_tcp = CarlaControlServerTCP(self.host)
lo_send(lo_target_tcp, "/register", lo_server_tcp.getFullURL())

lo_target_udp = Address(addrUDP)
lo_server_udp = CarlaControlServerUDP(self.host, rhost)
lo_server_udp = CarlaControlServerUDP(self.host)
lo_send(lo_target_udp, "/register", lo_server_udp.getFullURL())

except AddressError as e:
@@ -720,7 +667,6 @@ class HostWindowOSC(HostWindow):
if self.fCustomOscAddress is not None:
self.fOscAddressTCP = settings.value("RemoteAddressTCP", "osc.tcp://127.0.0.1:22752/Carla", str)
self.fOscAddressUDP = settings.value("RemoteAddressUDP", "osc.udp://127.0.0.1:22752/Carla", str)
self.fOscReportedHost = settings.value("RemoteReportedHost", "", str)

def saveSettings(self):
settings = HostWindow.saveSettings(self)
@@ -728,8 +674,6 @@ class HostWindowOSC(HostWindow):
settings.setValue("RemoteAddressTCP", self.fOscAddressTCP)
if self.fOscAddressUDP:
settings.setValue("RemoteAddressUDP", self.fOscAddressUDP)
if self.fOscReportedHost:
settings.setValue("RemoteReportedHost", self.fOscReportedHost)

# --------------------------------------------------------------------------------------------------------

@@ -740,12 +684,11 @@ class HostWindowOSC(HostWindow):
if not dialog.exec_():
return

host, rhost, tcpPort, udpPort = dialog.getResult()
host, tcpPort, udpPort = dialog.getResult()

self.disconnectOsc()
self.connectOsc("osc.tcp://%s:%i/Carla" % (host, tcpPort),
"osc.udp://%s:%i/Carla" % (host, udpPort),
rhost)
"osc.udp://%s:%i/Carla" % (host, udpPort))

@pyqtSlot()
def slot_fileRefresh(self):
@@ -765,8 +708,8 @@ class HostWindowOSC(HostWindow):
self.removeAllPlugins()
patchcanvas.clear()

self.host.lo_server_tcp = CarlaControlServerTCP(self.host, self.fOscReportedHost)
self.host.lo_server_udp = CarlaControlServerUDP(self.host, self.fOscReportedHost)
self.host.lo_server_tcp = CarlaControlServerTCP(self.host)
self.host.lo_server_udp = CarlaControlServerUDP(self.host)

try:
lo_send(self.host.lo_target_tcp, "/register", self.host.lo_server_tcp.getFullURL())


+ 0
- 1
source/frontend/carla_host.py View File

@@ -173,7 +173,6 @@ class HostWindow(QMainWindow):
self.fSampleRate = 0.0
self.fOscAddressTCP = ""
self.fOscAddressUDP = ""
self.fOscReportedHost = ""

if MACOS:
self.fMacClosingHelper = True


Loading…
Cancel
Save