simple-carla 2.1.1__tar.gz → 2.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple_carla
3
- Version: 2.1.1
3
+ Version: 2.1.2
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
@@ -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 = "2.1.1"
21
+ current_version = "2.1.2"
22
22
  version_pattern = "MAJOR.MINOR.PATCH"
23
23
  commit_message = "Bump version {old_version} -> {new_version}"
24
24
  commit = true
@@ -240,7 +240,7 @@ from carla_backend import (
240
240
  )
241
241
 
242
242
 
243
- __version__ = "2.1.1"
243
+ __version__ = "2.1.2"
244
244
 
245
245
 
246
246
  # -------------------------------------------------------------------
@@ -3,10 +3,7 @@
3
3
  # Copyright 2024 liyang <liyang@veronica>
4
4
  #
5
5
  import logging
6
- from time import sleep
7
- from PyQt5.QtCore import pyqtSlot
8
- from PyQt5.QtWidgets import QApplication
9
- from PyQt5.QtWidgets import QMainWindow
6
+ from PyQt5.QtCore import Qt, QCoreApplication, QObject, pyqtSignal, pyqtSlot, QTimer
10
7
  from simple_carla import Plugin, PatchbayPort
11
8
  from simple_carla.qt import CarlaQt, QtPlugin
12
9
 
@@ -14,22 +11,24 @@ from simple_carla.qt import CarlaQt, QtPlugin
14
11
  APPLICATION_NAME = 'qt_carla'
15
12
 
16
13
 
17
- class TestApp(QMainWindow):
14
+ class TestApp(QObject):
18
15
 
19
- def __init__(self):
20
- super().__init__()
21
- self.ready = False
22
- carla = CarlaQt(APPLICATION_NAME)
23
- carla.sig_engine_started.connect(self.carla_started)
24
- carla.sig_engine_stopped.connect(self.carla_stopped)
16
+ sig_finished = pyqtSignal()
17
+
18
+ def run(self):
19
+ carla = CarlaQt('carla')
20
+ for src, tgt in [
21
+ (carla.sig_engine_started, self.slot_engine_started),
22
+ (carla.sig_engine_stopped, self.slot_engine_stopped)
23
+ ]: src.connect(tgt, type = Qt.QueuedConnection)
25
24
  if not carla.engine_init():
26
- audioError = carla.get_last_error()
27
- if audioError:
28
- raise Exception("Could not connect to JACK; possible reasons:\n%s" % audioError)
29
- raise Exception('Could not connect to JACK')
25
+ audio_error = carla.get_last_error()
26
+ if audio_error:
27
+ raise RuntimeError(f'Could not start carla; possible reasons:\n{audio_error}')
28
+ raise RuntimeError('Could not start carla')
30
29
 
31
30
  @pyqtSlot(int, int, int, int, float, str)
32
- def carla_started(self, plugin_count, process_mode, transport_mode, buffer_size, sample_rate, driver_name):
31
+ def slot_engine_started(self, *_):
33
32
  logging.debug('======= Engine started ======== ')
34
33
  self.meter = EBUMeter()
35
34
  self.meter.sig_ready.connect(self.meter_ready)
@@ -37,7 +36,7 @@ class TestApp(QMainWindow):
37
36
  self.meter.add_to_carla()
38
37
 
39
38
  @pyqtSlot()
40
- def carla_stopped(self):
39
+ def slot_engine_stopped(self):
41
40
  logging.debug('======= Engine stopped ========')
42
41
 
43
42
  @pyqtSlot(Plugin)
@@ -49,13 +48,11 @@ class TestApp(QMainWindow):
49
48
  @pyqtSlot(PatchbayPort, PatchbayPort, bool)
50
49
  def meter_connect(self, self_port, other_port, state):
51
50
  logging.debug('Received sig_connection_change: %s to %s: %s', self_port, other_port, state)
52
- self.close()
51
+ self.finish()
53
52
 
54
- def closeEvent(self, event):
55
- logging.debug('Closing');
53
+ def finish(self):
56
54
  CarlaQt.instance.delete()
57
- event.accept()
58
-
55
+ self.sig_finished.emit()
59
56
 
60
57
 
61
58
  class EBUMeter(QtPlugin):
@@ -86,12 +83,12 @@ if __name__ == "__main__":
86
83
  level = logging.DEBUG,
87
84
  format = "[%(filename)24s:%(lineno)-4d] %(message)s"
88
85
  )
89
- app = QApplication([])
90
- main_window = TestApp()
91
- main_window.show()
92
- logging.debug('Done')
86
+ app = QCoreApplication([])
87
+ tester = TestApp(app)
88
+ tester.sig_finished.connect(app.quit)
89
+ QTimer.singleShot(0, tester.run)
93
90
  app.exec()
94
-
91
+ logging.debug('Done')
95
92
 
96
93
 
97
94
  # end simple_carla/tests/qt_carla.py
File without changes
File without changes
File without changes