simple-carla 1.3.1__py2.py3-none-any.whl → 1.4.0__py2.py3-none-any.whl

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/__init__.py CHANGED
@@ -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
- __version__ = "1.3.1"
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 Carls host engine when the internal value of a parameter has changed.
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.__scale_points = {
3315
- sp['label']:sp['value'] \
3316
- for sp in [
3317
- carla.get_parameter_scalepoint_info(self.plugin_id, self.parameter_id, sc_idx) \
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 hasattr(self, "min"):
3348
- if hasattr(self, "max"):
3349
- if self.min <= value <= self.max:
3350
- if self.__value != value:
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.debug('PLUGIN %s PARAMETER %s HAS NO max', self.plugin(), self)
3358
- else:
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
  """
simple_carla/qt.py CHANGED
@@ -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 QObject, pyqtSignal
26
- from simple_carla import _SimpleCarla, Plugin, PatchbayClient, PatchbayPort, PatchbayConnection
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 QtPlugin(Plugin, QObject):
318
+ class AbstractQtPlugin(Plugin):
318
319
  """
319
- This is an abstract class which inherits from QObject, for use by plugins which
320
- have no direct user-interface, (i.e. track & channel filter instantiated by a
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
- To use:
325
- plugin = QtPlugin(plugin_def)
326
- plugin.sig_ready.connect(self.plugin_ready)
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
- sig_ready = pyqtSignal(Plugin)
332
- sig_removed = pyqtSignal(Plugin)
333
- sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
329
+ class MyVisualPlugin(QFrame, AbstractQtPlugin):
334
330
 
335
- def __init__(self, plugin_def=None, saved_state=None):
336
- QObject.__init__(self)
337
- Plugin.__init__(self, plugin_def, saved_state)
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
@@ -1,11 +1,10 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: simple_carla
3
- Version: 1.3.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
@@ -0,0 +1,10 @@
1
+ simple_carla/__init__.py,sha256=BPxOjFgZho2Yz_kpIQjj9E_YQYSUZqaZEA2vqwQVnwc,107435
2
+ simple_carla/plugin_dialog.py,sha256=AHbEC-Sq_28QcJgZ-2gKJBaVEfa4-dEVQFvX9_7tYuk,1455
3
+ simple_carla/qt.py,sha256=ufN7PHHjFB_IXyoJnuG_JcY2p-5CyuOcEDFYG4BHF-g,13957
4
+ simple_carla/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ simple_carla/scripts/sc_plugin_def.py,sha256=CVseichHuDCmGeD8v7CfHweeyHHXI60-RcvzU8OILqo,2214
6
+ simple_carla-1.4.0.dist-info/entry_points.txt,sha256=oqJRVQXTCIUOmspGNnqDWq9mhz397uoRMQQOhBFbIcs,73
7
+ simple_carla-1.4.0.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
8
+ simple_carla-1.4.0.dist-info/WHEEL,sha256=j3d_2VkBU36k09xOc4O9RZyJJ8uFqn4BR2AtKD7MOp8,99
9
+ simple_carla-1.4.0.dist-info/METADATA,sha256=M6lNYWD0f8X7h_ijK0eM07BKDeRyvkeMHMOziDh6UtQ,1717
10
+ simple_carla-1.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.12.0
2
+ Generator: flit 3.6.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -1,10 +0,0 @@
1
- simple_carla/__init__.py,sha256=k9jBBnemSwJI72f7pg8O6_asharbQUv3NHEqWc4YUpM,108040
2
- simple_carla/plugin_dialog.py,sha256=AHbEC-Sq_28QcJgZ-2gKJBaVEfa4-dEVQFvX9_7tYuk,1455
3
- simple_carla/qt.py,sha256=It4X0hc57Lk-1ve1CX77Co503FWsxCaO7Ot9ynuDszQ,12618
4
- simple_carla/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- simple_carla/scripts/sc_plugin_def.py,sha256=CVseichHuDCmGeD8v7CfHweeyHHXI60-RcvzU8OILqo,2214
6
- simple_carla-1.3.1.dist-info/entry_points.txt,sha256=oqJRVQXTCIUOmspGNnqDWq9mhz397uoRMQQOhBFbIcs,73
7
- simple_carla-1.3.1.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
8
- simple_carla-1.3.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
9
- simple_carla-1.3.1.dist-info/METADATA,sha256=hQUy66Hziek1xR2EYys3rbQfYpFXr10fIDVczYjDx_8,1739
10
- simple_carla-1.3.1.dist-info/RECORD,,