mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Fix \n shenanigans in command output.
This commit is contained in:
parent
65c160212e
commit
510f68e9ad
@ -39,7 +39,7 @@ print( "-- File to read from has now been opened too\r\n" )
|
||||
|
||||
|
||||
def sendCommand( command ) :
|
||||
print( "Send: >>> "+command )
|
||||
print( "Send: >>> \n"+command )
|
||||
tofile.write( command + EOL )
|
||||
tofile.flush()
|
||||
|
||||
@ -55,7 +55,7 @@ def getResponse() :
|
||||
def doCommand( command ) :
|
||||
sendCommand( command )
|
||||
response = getResponse()
|
||||
print( "Rcvd: <<< " + response )
|
||||
print( "Rcvd: <<< \n" + response )
|
||||
return response
|
||||
|
||||
def do( command ) :
|
||||
@ -63,9 +63,6 @@ def do( command ) :
|
||||
|
||||
def quickTest() :
|
||||
do( 'Help: Command=Help' )
|
||||
do( 'Help: Command="SetTrackInfo"' )
|
||||
do( 'SetPreference: Name=GUI/Theme Value=light Reload=false' )
|
||||
|
||||
|
||||
def setup() :
|
||||
global path
|
||||
@ -169,25 +166,20 @@ def image8() :
|
||||
# Zoomed in to show points stem-plot
|
||||
def image9() :
|
||||
global path
|
||||
do( 'SetPreference: Name=/GUI/SampleView Value=1 Reload=True')
|
||||
makeMonoTracks(1)
|
||||
do( 'SelectTime: StartTime=0 EndTime=0.003' )
|
||||
do( 'ZoomSel' );
|
||||
do( 'Amplify: Ratio=3.0' )
|
||||
do( 'SetPreference: Name=/GUI/SampleView Value=1 Reload=1')
|
||||
do( 'Screenshot: Path='+path+' CaptureWhat=First_Track' )
|
||||
|
||||
# Zoomed in to show points no stem plot
|
||||
def image10() :
|
||||
def image9and10() :
|
||||
global path
|
||||
do( 'SetPreference: Name=/GUI/SampleView Value=0 Reload=True')
|
||||
makeMonoTracks(1)
|
||||
do( 'SelectTime: StartTime=0 EndTime=0.003' )
|
||||
do( 'ZoomSel' );
|
||||
do( 'Amplify: Ratio=3.0' )
|
||||
image9()
|
||||
do( 'SetPreference: Name=/GUI/SampleView Value=0 Reload=1')
|
||||
do( 'Screenshot: Path='+path+' CaptureWhat=First_Track' )
|
||||
|
||||
|
||||
|
||||
#quickTest()
|
||||
setup()
|
||||
image1()
|
||||
@ -198,6 +190,5 @@ image5()
|
||||
image6()
|
||||
image7()
|
||||
image8()
|
||||
image9()
|
||||
image10()
|
||||
image9and10()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# pipe-test.py
|
||||
# pipe_test.py
|
||||
# Tests the audacity pipe. Sends 3 commands.
|
||||
# Keep pipe-test.py short!!
|
||||
# Keep pipe_test.py short!!
|
||||
# You can make more complicated longer tests to test other functionality
|
||||
# or to generate screenshots etc in other scripts.
|
||||
|
||||
@ -41,7 +41,7 @@ print( "-- File to read from has now been opened too\r\n" )
|
||||
|
||||
|
||||
def sendCommand( command ) :
|
||||
print( "Send: >>> "+command )
|
||||
print( "Send: >>> \n"+command )
|
||||
tofile.write( command + EOL )
|
||||
tofile.flush()
|
||||
|
||||
@ -57,7 +57,7 @@ def getResponse() :
|
||||
def doCommand( command ) :
|
||||
sendCommand( command )
|
||||
response = getResponse()
|
||||
print( "Rcvd: <<< " + response )
|
||||
print( "Rcvd: <<< \n" + response )
|
||||
return response
|
||||
|
||||
def do( command ) :
|
||||
@ -65,7 +65,7 @@ def do( command ) :
|
||||
|
||||
def quickTest() :
|
||||
do( 'Help: Command=Help' )
|
||||
do( 'Help: Command="SetTrackInfo"' )
|
||||
do( 'SetPreference: Name=GUI/Theme Value=light Reload=false' )
|
||||
#do( 'Help: Command="GetInfo"' )
|
||||
do( 'SetPreference: Name=GUI/Theme Value=dark Reload=1' )
|
||||
|
||||
quickTest()
|
||||
|
@ -149,7 +149,8 @@ bool ApplyAndSendResponse::Apply()
|
||||
bool bResult = mCommand->Apply(*( mCtx.get()));
|
||||
return bResult; }
|
||||
);
|
||||
wxString response = GetName();
|
||||
wxString response = wxT( "\n" );
|
||||
response += GetName();
|
||||
// These three strings are deliberately not localised.
|
||||
// They are used in script responses and always happen in English.
|
||||
response += wxT(" finished: ");
|
||||
|
@ -218,17 +218,25 @@ class ResponseQueueTarget final : public CommandMessageTarget
|
||||
{
|
||||
private:
|
||||
ResponseQueue &mResponseQueue;
|
||||
wxString mBuffer;
|
||||
public:
|
||||
ResponseQueueTarget(ResponseQueue &responseQueue)
|
||||
: mResponseQueue(responseQueue)
|
||||
: mResponseQueue(responseQueue),
|
||||
mBuffer( wxEmptyString )
|
||||
{ }
|
||||
virtual ~ResponseQueueTarget()
|
||||
{
|
||||
if( mBuffer.StartsWith("\n" ) )
|
||||
mBuffer = mBuffer.Mid( 1 );
|
||||
mResponseQueue.AddResponse( mBuffer );
|
||||
mResponseQueue.AddResponse(wxString(wxT("\n")));
|
||||
}
|
||||
void Update(const wxString &message) override
|
||||
{
|
||||
mResponseQueue.AddResponse(message);
|
||||
mBuffer += message;
|
||||
#if 0
|
||||
mResponseQueue.AddResponse(message);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user