@@ -1908,40 +1908,44 @@ async def try_stop_on_index_error(self, prompt_session:PromptSession) -> LoopRes
1908
1908
ch .release_all ()
1909
1909
1910
1910
if self .shell :
1911
- # self.shell PROMPT
1912
- # log(orr(self.tracks[0].scale,self.scale).mode_name(orr(self.tracks[0].mode,self.mode)))
1913
- # cur_oct = self.tracks[0].octave
1914
- # cline = FG.GREEN + 'txbt> '+FG.BLUE+ '('+str(int(self.tempo))+'bpm x'+str(int(self.grid))+' '+\
1915
- # note_name(self.tracks[0].transpose) + ' ' +\
1916
- # orr(self.tracks[0].scale,self.scale).mode_name(orr(self.tracks[0].mode,self.mode,-1))+\
1917
- # ')> '
1918
- modename = orr (self .tracks [0 ].scale ,self .scale ).mode_name (orr (self .tracks [0 ].mode ,self .mode ,- 1 ))
1919
-
1920
- keynote = note_name (self .transpose + self .tracks [0 ].transpose )
1921
- keynote = keynote if keynote != 'C' else ''
1922
- parts = [
1923
- str (int (self .tempo ))+ 'bpm' , # tempo
1924
- 'x' + str (int (self .grid )), # subdiv
1925
- keynote ,
1926
- ('' if modename == 'ionian' else modename )
1927
- ]
1928
- cline = 'txbt> (' + \
1929
- ' ' .join (filter (lambda x : x , parts ))+ \
1930
- ')> '
1931
- # if bufline.endswith('.txbt'):
1932
- # play file?
1933
- # bufline = raw_input(cline)
1934
- bufline = await prompt_session .prompt_async (cline )
1935
- bufline = list (filter (None , bufline .split (' ' )))
1936
- bufline = list (map (lambda b : b .replace (';' ,' ' ), bufline ))
1911
+ self .buf += await self .mk_prompt (prompt_session )
1937
1912
# elif self.remote:
1938
1913
# pass # not yet implemented
1939
1914
else :
1940
- assert False
1941
-
1942
- self .buf += bufline
1943
-
1915
+ assert False
1944
1916
return LoopResult .CONTINUE
1945
1917
1946
1918
else :
1947
1919
return LoopResult .BREAK
1920
+ return LoopResult .PROCEED
1921
+
1922
+ async def mk_prompt (self , prompt_session :PromptSession ):
1923
+ """Creates a new prompt for the current line"""
1924
+ # self.shell PROMPT
1925
+ # log(orr(self.tracks[0].scale,self.scale).mode_name(orr(self.tracks[0].mode,self.mode)))
1926
+ # cur_oct = self.tracks[0].octave
1927
+ # cline = FG.GREEN + 'txbt> '+FG.BLUE+ '('+str(int(self.tempo))+'bpm x'+str(int(self.grid))+' '+\
1928
+ # note_name(self.tracks[0].transpose) + ' ' +\
1929
+ # orr(self.tracks[0].scale,self.scale).mode_name(orr(self.tracks[0].mode,self.mode,-1))+\
1930
+ # ')> '
1931
+ modename = orr (self .tracks [0 ].scale ,self .scale ).mode_name (orr (self .tracks [0 ].mode ,self .mode ,- 1 ))
1932
+
1933
+ keynote = note_name (self .transpose + self .tracks [0 ].transpose )
1934
+ keynote = keynote if keynote != 'C' else ''
1935
+ parts = [
1936
+ str (int (self .tempo ))+ 'bpm' , # tempo
1937
+ 'x' + str (int (self .grid )), # subdiv
1938
+ keynote ,
1939
+ ('' if modename == 'ionian' else modename )
1940
+ ]
1941
+ cline = 'txbt> (' + \
1942
+ ' ' .join (filter (lambda x : x , parts ))+ \
1943
+ ')> '
1944
+ # if bufline.endswith('.txbt'):
1945
+ # play file?
1946
+ # bufline = raw_input(cline)
1947
+ bufline = await prompt_session .prompt_async (cline )
1948
+ bufline = list (filter (None , bufline .split (' ' )))
1949
+ bufline = list (map (lambda b : b .replace (';' ,' ' ), bufline ))
1950
+
1951
+ return bufline
0 commit comments