simple-carla 1.3.1__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_carla-1.3.1 → simple_carla-1.4.0}/PKG-INFO +2 -3
- {simple_carla-1.3.1 → simple_carla-1.4.0}/pyproject.toml +1 -1
- {simple_carla-1.3.1 → simple_carla-1.4.0}/simple_carla/__init__.py +19 -33
- {simple_carla-1.3.1 → simple_carla-1.4.0}/simple_carla/qt.py +63 -18
- {simple_carla-1.3.1 → simple_carla-1.4.0}/.gitignore +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/LICENSE +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/README.md +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/simple_carla/plugin_dialog.py +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/simple_carla/scripts/__init__.py +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/simple_carla/scripts/sc_plugin_def.py +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/tests/carla.py +0 -0
- {simple_carla-1.3.1 → simple_carla-1.4.0}/tests/qt_carla.py +0 -0
@@ -1,11 +1,10 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: simple_carla
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.4.0
|
4
4
|
Summary: An easy-to-use, object-oriented interface to the carla plugin host.
|
5
5
|
Author-email: Leon Dionne <ldionne@dridesign.sh.cn>
|
6
6
|
Description-Content-Type: text/markdown
|
7
7
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
8
|
-
License-File: LICENSE
|
9
8
|
Requires-Dist: numpy
|
10
9
|
Requires-Dist: log_soso
|
11
10
|
Requires-Dist: PyQt5
|
@@ -18,7 +18,7 @@ build-backend = "flit_core.buildapi"
|
|
18
18
|
sc-plugin-def = "simple_carla.scripts.sc_plugin_def:main"
|
19
19
|
|
20
20
|
[bumpver]
|
21
|
-
current_version = "1.
|
21
|
+
current_version = "1.4.0"
|
22
22
|
version_pattern = "MAJOR.MINOR.PATCH"
|
23
23
|
commit_message = "Bump version {old_version} -> {new_version}"
|
24
24
|
commit = true
|
@@ -233,8 +233,10 @@ from carla_backend import (
|
|
233
233
|
FILE_CALLBACK_SAVE
|
234
234
|
)
|
235
235
|
|
236
|
+
from resources_rc import qCleanupResources
|
236
237
|
|
237
|
-
|
238
|
+
|
239
|
+
__version__ = "1.4.0"
|
238
240
|
|
239
241
|
|
240
242
|
# -------------------------------------------------------------------
|
@@ -1534,7 +1536,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1534
1536
|
self._plugin_by_uuid[plugin.uuid] = plugin
|
1535
1537
|
if self.is_engine_running():
|
1536
1538
|
if not self._add_plugin( # Carla parameter
|
1537
|
-
|
1539
|
+
# ----------------------------------------- # ---------------
|
1538
1540
|
plugin.plugin_def['build'], # btype
|
1539
1541
|
plugin.plugin_def['type'], # ptype
|
1540
1542
|
plugin.plugin_def['filename'], # filename
|
@@ -1543,7 +1545,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1543
1545
|
int(plugin.plugin_def['uniqueId'] or 0), # uniqueId
|
1544
1546
|
None, # extraPtr
|
1545
1547
|
PLUGIN_OPTIONS_NULL # options
|
1546
|
-
|
1548
|
+
# ----------------------------------------- # ---------------
|
1547
1549
|
): raise Exception("Failed to add plugin")
|
1548
1550
|
|
1549
1551
|
# -------------------------------------------------------------------
|
@@ -2680,7 +2682,7 @@ class Plugin(PatchbayClient):
|
|
2680
2682
|
# -------------------------------------------------------------------
|
2681
2683
|
# Internal lifecycle events
|
2682
2684
|
|
2683
|
-
def __init__(self, plugin_def=None, saved_state=None):
|
2685
|
+
def __init__(self, plugin_def = None, saved_state = None):
|
2684
2686
|
if plugin_def is None:
|
2685
2687
|
if self.plugin_def is None:
|
2686
2688
|
raise RuntimeError("No definition for plugin")
|
@@ -2997,7 +2999,7 @@ class Plugin(PatchbayClient):
|
|
2997
2999
|
|
2998
3000
|
def parameter_internal_value_changed(self, parameter, value):
|
2999
3001
|
"""
|
3000
|
-
Called by the
|
3002
|
+
Called by the Carla host engine when the internal value of a parameter has changed.
|
3001
3003
|
"parameter" is a Parameter object.
|
3002
3004
|
"value" is the new value of the Parameter.
|
3003
3005
|
The value of the Parameter object will have already been set when this is called.
|
@@ -3307,27 +3309,17 @@ class Parameter:
|
|
3307
3309
|
setattr(self, k, v)
|
3308
3310
|
self.range = self.max - self.min
|
3309
3311
|
|
3310
|
-
#logging.debug('%s min %s max %s step %s stepSmall %s stepLarge %s using unit "%s"',
|
3311
|
-
#self.name, self.min, self.max, self.step, self.stepSmall, self.stepLarge, self.unit)
|
3312
|
-
|
3313
3312
|
# Scale points (get_parameter_scalepoint_info) if necessary
|
3314
|
-
self.
|
3315
|
-
|
3316
|
-
for
|
3317
|
-
|
3318
|
-
for sc_idx in range(self.scalePointCount)
|
3319
|
-
]} if self.uses_scalepoints else None
|
3320
|
-
if not self.__scale_points is None and len(self.__scale_points) > 2:
|
3321
|
-
logging.debug('%s SCALEPOINTS USED:', str(self.plugin()))
|
3322
|
-
with StreamToLogger() as slog:
|
3323
|
-
print(self.__scale_points, file = slog)
|
3313
|
+
self.scale_points = [ ( sp['label'], sp['value'] ) for sp in [
|
3314
|
+
carla.get_parameter_scalepoint_info(self.plugin_id, self.parameter_id, sc_idx) \
|
3315
|
+
for sc_idx in range(self.scalePointCount)
|
3316
|
+
]] if self.uses_scalepoints else None
|
3324
3317
|
|
3325
3318
|
def internal_value_changed(self, value):
|
3326
3319
|
"""
|
3327
|
-
Called from Carla engine when the value of this Parameter changed
|
3320
|
+
Called from Carla engine when the value of this Parameter changed, as by a
|
3321
|
+
custom dialog rendered via carla.
|
3328
3322
|
"""
|
3329
|
-
#TODO: Test if called when parameter is set, and note in docs
|
3330
|
-
#logging.debug('internal_value_changed %s %s', self, value)
|
3331
3323
|
self.__value = value
|
3332
3324
|
|
3333
3325
|
@property
|
@@ -3344,19 +3336,13 @@ class Parameter:
|
|
3344
3336
|
Sets the value of this Parameter both in Carla and cached.
|
3345
3337
|
"value" must be in the range of this Parameter's "min" and "max".
|
3346
3338
|
"""
|
3347
|
-
if
|
3348
|
-
if
|
3349
|
-
|
3350
|
-
|
3351
|
-
self.__value = value
|
3352
|
-
Carla.instance.set_parameter_value(self.plugin_id, self.parameter_id, value)
|
3353
|
-
else:
|
3354
|
-
logging.warning('Parameter "%s" (%s) out of range. Min: %s Max %s',
|
3355
|
-
self.name, value, self.min, self.max)
|
3339
|
+
if self.__value != value:
|
3340
|
+
if self.min <= value <= self.max:
|
3341
|
+
self.__value = value
|
3342
|
+
Carla.instance.set_parameter_value(self.plugin_id, self.parameter_id, value)
|
3356
3343
|
else:
|
3357
|
-
logging.
|
3358
|
-
|
3359
|
-
logging.debug('PLUGIN %s PARAMETER %s HAS NO min', self.plugin(), self)
|
3344
|
+
logging.warning('Parameter "%s" (%s) out of range. Min: %s Max %s',
|
3345
|
+
self.name, value, self.min, self.max)
|
3360
3346
|
|
3361
3347
|
def get_internal_value(self):
|
3362
3348
|
"""
|
@@ -22,8 +22,9 @@ Qt -enabled classes which utilize signals rather than callbacks.
|
|
22
22
|
"""
|
23
23
|
import logging, traceback, os, sys
|
24
24
|
import qt_extras.autofit
|
25
|
-
from PyQt5.QtCore import
|
26
|
-
from simple_carla import
|
25
|
+
from PyQt5.QtCore import QObject, pyqtSignal
|
26
|
+
from simple_carla import _SimpleCarla, Plugin, Parameter, \
|
27
|
+
PatchbayClient, PatchbayPort, PatchbayConnection
|
27
28
|
|
28
29
|
from carla_backend import (
|
29
30
|
|
@@ -314,27 +315,36 @@ class CarlaQt(_SimpleCarla, QObject):
|
|
314
315
|
|
315
316
|
|
316
317
|
|
317
|
-
class
|
318
|
+
class AbstractQtPlugin(Plugin):
|
318
319
|
"""
|
319
|
-
This is an abstract class
|
320
|
-
|
321
|
-
TrackWidget). (Qt does not allow inheriting from multiple classes which
|
322
|
-
extend QObject)
|
320
|
+
This is an abstract class for use by classes which you wish to inherit from a
|
321
|
+
class which itself already inherits from QObject.
|
323
322
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
plugin.add_to_carla()
|
323
|
+
Qt does not allow inheriting from multiple classes which extend QObject, so
|
324
|
+
extending QObject in THIS class would make it impossible for you to use it as
|
325
|
+
a base class.
|
328
326
|
|
329
|
-
|
327
|
+
For example:
|
330
328
|
|
331
|
-
|
332
|
-
sig_removed = pyqtSignal(Plugin)
|
333
|
-
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
329
|
+
class MyVisualPlugin(QFrame, AbstractQtPlugin):
|
334
330
|
|
335
|
-
|
336
|
-
|
337
|
-
Plugin
|
331
|
+
# You must define these signals!
|
332
|
+
sig_ready = pyqtSignal(Plugin)
|
333
|
+
sig_removed = pyqtSignal(Plugin)
|
334
|
+
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
335
|
+
sig_parameter_changed = pyqtSignal(Plugin, Parameter, float)
|
336
|
+
|
337
|
+
plugin_def = {...}
|
338
|
+
|
339
|
+
def __init__(self, parent, plugin_def, saved_state = None):
|
340
|
+
QFrame.__init__(self, parent)
|
341
|
+
AbstractQtPlugin.__init__(self, plugin_def, saved_state)
|
342
|
+
|
343
|
+
plugin = MyVisualPlugin()
|
344
|
+
plugin.sig_ready.connect(self.plugin_ready)
|
345
|
+
plugin.add_to_carla()
|
346
|
+
layout.addWidget(plugin)
|
347
|
+
"""
|
338
348
|
|
339
349
|
def ready(self):
|
340
350
|
"""
|
@@ -354,5 +364,40 @@ class QtPlugin(Plugin, QObject):
|
|
354
364
|
if not self.removing_from_carla:
|
355
365
|
self.sig_connection_change.emit(connection.out_port, connection.in_port, state)
|
356
366
|
|
367
|
+
def parameter_internal_value_changed(self, parameter, value):
|
368
|
+
"""
|
369
|
+
Called by the Carla host engine when the internal value of a parameter has changed.
|
370
|
+
"parameter" is a Parameter object.
|
371
|
+
"value" is the new value of the Parameter.
|
372
|
+
|
373
|
+
The value of the Parameter object will have already been set when this is called.
|
374
|
+
"""
|
375
|
+
self.sig_parameter_changed.emit(self, parameter, value)
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
class QtPlugin(AbstractQtPlugin, QObject):
|
380
|
+
"""
|
381
|
+
A class which inherits from both Plugin and QObject. It can be used by plugins
|
382
|
+
which have no direct user-interface, but still need to emit signals.
|
383
|
+
|
384
|
+
For example:
|
385
|
+
|
386
|
+
plugin = QtPlugin(plugin_def)
|
387
|
+
plugin.sig_ready.connect(self.plugin_ready)
|
388
|
+
plugin.add_to_carla()
|
389
|
+
|
390
|
+
"""
|
391
|
+
|
392
|
+
sig_ready = pyqtSignal(Plugin)
|
393
|
+
sig_removed = pyqtSignal(Plugin)
|
394
|
+
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
395
|
+
sig_parameter_changed = pyqtSignal(Plugin, Parameter, float)
|
396
|
+
|
397
|
+
def __init__(self, plugin_def=None, saved_state=None):
|
398
|
+
QObject.__init__(self)
|
399
|
+
Plugin.__init__(self, plugin_def, saved_state)
|
400
|
+
|
401
|
+
|
357
402
|
|
358
403
|
# end simple_carla/qt.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|