Don't exit if Audacity not running
Handle Audacity integration better Fixes: #215
This commit is contained in:
parent
4fce750223
commit
2ecb67629e
@ -227,8 +227,11 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.move_source_model: Optional[PlaylistProxyModel] = None
|
||||
self.audacity_file_path: Optional[str] = None
|
||||
# Initialise Audacity access
|
||||
self.audacity_client = pipeclient.PipeClient()
|
||||
log.info(f"{hex(id(self.audacity_client))=}")
|
||||
try:
|
||||
self.audacity_client = pipeclient.PipeClient()
|
||||
log.info(f"{hex(id(self.audacity_client))=}")
|
||||
except RuntimeError as e:
|
||||
log.error(f"Unable to initialise Audacity: {str(e)}")
|
||||
|
||||
if Config.CARTS_HIDE:
|
||||
self.cartsWidget.hide()
|
||||
|
||||
@ -81,7 +81,7 @@ import argparse
|
||||
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
sys.exit('PipeClient Error: Python 3.x required')
|
||||
raise RuntimeError('PipeClient Error: Python 3.x required')
|
||||
|
||||
# Platform specific constants
|
||||
if sys.platform == 'win32':
|
||||
@ -156,7 +156,7 @@ class PipeClient():
|
||||
# Allow a little time for connection to be made.
|
||||
time.sleep(0.1)
|
||||
if not self._write_pipe:
|
||||
sys.exit('PipeClientError: Write pipe cannot be opened.')
|
||||
raise RuntimeError('PipeClientError: Write pipe cannot be opened.')
|
||||
|
||||
def _write_pipe_open(self) -> None:
|
||||
"""Open _write_pipe."""
|
||||
@ -187,7 +187,7 @@ class PipeClient():
|
||||
self._write_pipe.write(command + EOL)
|
||||
# Check that read pipe is alive
|
||||
if PipeClient.reader_pipe_broken.is_set():
|
||||
sys.exit('PipeClient: Read-pipe error.')
|
||||
raise RuntimeError('PipeClient: Read-pipe error.')
|
||||
try:
|
||||
self._write_pipe.flush()
|
||||
if self.timer:
|
||||
@ -196,7 +196,7 @@ class PipeClient():
|
||||
PipeClient.reply_ready.clear()
|
||||
except IOError as err:
|
||||
if err.errno == errno.EPIPE:
|
||||
sys.exit('PipeClient: Write-pipe error.')
|
||||
raise RuntimeError('PipeClient: Write-pipe error.')
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user