Clean up AudacityManager
This commit is contained in:
parent
0082f76b56
commit
33fdc40f66
@ -37,20 +37,19 @@ class AudacityManager:
|
||||
self.to_pipe: str = "/tmp/audacity_script_pipe.to." + str(os.getuid())
|
||||
self.from_pipe: str = "/tmp/audacity_script_pipe.from." + str(os.getuid())
|
||||
self.eol: str = "\n"
|
||||
self.path = None
|
||||
self.path = ""
|
||||
|
||||
def open_file(self, path):
|
||||
def open_file(self, path: str) -> str:
|
||||
"""Open passed file in Audacity"""
|
||||
|
||||
self.path = path
|
||||
response = self._do_command(f'Import2: Filename="{self.path}"')
|
||||
return response
|
||||
return self._do_command(f'Import2: Filename="{self.path}"')
|
||||
|
||||
def export_file(self):
|
||||
def export_file(self) -> str:
|
||||
"""Export current file"""
|
||||
|
||||
if not self.path:
|
||||
return
|
||||
return "Error: no path selected"
|
||||
|
||||
sa_response = self._do_command("SelectAll:")
|
||||
if sa_response == "\nBatchCommand finished: OK\n":
|
||||
@ -59,7 +58,7 @@ class AudacityManager:
|
||||
)
|
||||
return exp_response
|
||||
else:
|
||||
print("SelectAll response: " + sa_response)
|
||||
return "SelectAll response: " + sa_response
|
||||
|
||||
def _send_command(self, command: str) -> None:
|
||||
"""Send a single command."""
|
||||
@ -91,7 +90,7 @@ class AudacityManager:
|
||||
|
||||
|
||||
def ask_yes_no(
|
||||
title: str, question: str, default_yes: bool = False, parent: QMainWindow = None
|
||||
title: str, question: str, default_yes: bool = False, parent: Optional[QMainWindow] = None
|
||||
) -> bool:
|
||||
"""Ask question; return True for yes, False for no"""
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user