-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of lyrics through phase maker #4174
base: master
Are you sure you want to change the base?
Conversation
Generally seems to work well. Not sure why the blocks are created when you add lyrics. But export is correct. |
Blocks are probably added because of keyboard shortcuts, just have to disable it like typing in the search box. Originally Mr. Devin asked to initiate the lyrics row when print block is added to phrase maker widget. But in this PR their is no such implementation. Lyrics row will generate any way. I have to understand more deeply how it works. Although I have added a Boolean lyricsON, if you think that initiating lyrics row in Matrix by adding a print block is not necessary then we can just use the Boolean to add print blocks in the generated action block. |
@Commanderk3 I would like to continue it. |
I realized after I typed my comment that the extra note blocks must be generated (as you had mentioned) by keyboard short cuts. We should probably disable keyboard shortcuts whenever any of the widgets are open. I agree that the Lyrics row should not be a default. It should be driven by the presense of a print block. The glue for doing that is a bit messy, but you can follow the example for any of the graphics blocks. |
Sure, go ahead. |
Yes, I will look into it. The generation of cells excluding the first two is a bit tricky part. I will take my time on this one. |
i wont say the commit "update 3" is perfect. A bit hardcoded. Just sharing my idea, still have some issues. |
@Commanderk3 I am working on those issues. |
Okay I am satisfied with the recent commit. Everything is working fine. Instead of pushing "print" into rowLabels it will now mark lyricsON true. Irrespective of print block position the lyrics row will be generated at the end. Also removed keyboard shortcuts while typing. I have to make the formatting correct. I will update it after sometime and also will attach a video. |
@Commanderk3 Shouldn’t we add to rowLabels and rowArgs. Your implementation is not adding them in rowLabels and rowArgs array. |
No problem. It works. Adding it to rowLabels means modifying existing functions. This approach is much simpler. And the lyrics row is anyway going to be at last. If @walterbender and @pikurasa agree I shall make it a PR. |
But it can be confusing because in phrase maker we have print block, but it doesn't shows in rowArgs and rowLabels. @walterbender What do you think about it? |
Hmm...maybe. I actually prefer this one because of its simplicity. And everything works fine. |
I am working on this issue, and will come with a solution soon. |
js/blocks/ExtrasBlocks.js
Outdated
@@ -534,6 +534,8 @@ function setupExtrasBlocks(activity) { | |||
} | |||
} | |||
} | |||
} else if (logo.inMatrix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move this else if above the previous one so you don't need the && !logo.inMatrix ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i will do it. 👍
js/widgets/phrasemaker.js
Outdated
@@ -210,7 +210,7 @@ class PhraseMaker { | |||
|
|||
// This array keeps track of the position of the rows after sorting. | |||
/** | |||
* Map of row positions after sorting. | |||
* Map of row positions after sorting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove trailing space
js/widgets/phrasemaker.js
Outdated
lastConnection = null; | ||
} else { | ||
lastConnection = thisBlock + 3; | ||
lastConnection = thisBlock + 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove trailing space
js/widgets/phrasemaker.js
Outdated
ptmTableRow.insertCell().append(tempTable); | ||
|
||
console.log(tempTable2.outerHTML); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove console log in final PR (and extra new lines)
js/widgets/phrasemaker.js
Outdated
this._tupletValueRow = tempTable.insertRow(); | ||
this._noteValueRow = tempTable.insertRow(); | ||
this._noteValueRow = tempTable.insertRow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove trailing space
js/widgets/phrasemaker.js
Outdated
*/ | ||
this._lyrics = []; | ||
|
||
this._lyricsON = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use _ for fields that are accessed externally
I am somewhat on the fence. Sidestepping the rowBlocks mechanism is simpler but I wonder if it doesn't add a different kind of complexity in that now there are two different mechanism for managing rows. That said, I think we can live with this implementation and perhaps make the change at some point in a different PR. But we should add a comment in the code explaining that the lyrics are handled differently. Also a comment about disabling keyboard shortcuts and why. |
Roger that. Formatting I will fix now and other changes that you said. |
@walterbender I have fixed the issues you mentioned. |
@@ -1430,6 +1430,7 @@ function setupWidgetBlocks(activity) { | |||
logo.phraseMaker.rowArgs = []; | |||
logo.phraseMaker.graphicsBlocks = []; | |||
logo.phraseMaker.clearBlocks(); | |||
logo.phraseMaker._lyricsON = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to change to logo.phraseMaker.lyricsOn = false;
(Did you test after your updates?)
@@ -508,6 +508,8 @@ function setupExtrasBlocks(activity) { | |||
logo.oscilloscopeTurtles.indexOf(activity.turtles.turtleList[turtleIndex]) < 0 | |||
) | |||
logo.oscilloscopeTurtles.push(activity.turtles.turtleList[turtleIndex]); | |||
} else if (logo.inMatrix) { | |||
logo.phraseMaker._lyricsON = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to change (remove the _)
@@ -911,8 +926,78 @@ class PhraseMaker { | |||
this._rows[j] = ptmRow; | |||
|
|||
j += 1; | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove trailing spaces
|
||
const lyricsInput = document.createElement("input"); | ||
lyricsInput.type = "text"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the extra newline
@@ -5036,7 +5122,7 @@ class PhraseMaker { | |||
if (obj === null) { | |||
// add a hertz block | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no _
@@ -5061,7 +5147,7 @@ class PhraseMaker { | |||
} else if (drumName != null) { | |||
// add a playdrum block | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no _
@@ -5086,7 +5172,7 @@ class PhraseMaker { | |||
} else if (note[0][j].slice(0, 4) === "http") { | |||
// add a playdrum block with URL | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no _
@@ -5111,7 +5197,7 @@ class PhraseMaker { | |||
} else if (obj.length > 2) { | |||
// add a 2-arg graphics block | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
@@ -5143,7 +5229,7 @@ class PhraseMaker { | |||
} else if (obj.length > 1) { | |||
// add a 1-arg graphics block | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
@@ -5168,7 +5254,7 @@ class PhraseMaker { | |||
} else { | |||
// add a pitch block | |||
// The last connection in last pitch block is null. | |||
if (note[0].length === 1 || j === note[0].length - 1) { | |||
if (!this._lyricsON && (note[0].length === 1 || j === note[0].length - 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
} | ||
} | ||
} | ||
if (this._lyricsON) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
Please test before pushing your changes to the PR. |
My apologies sir. I did test, somehow it worked. I will take some time, right now I am traveling. |
#3842
I was able to figure out how we can add print blocks to the block stack. But addition of a "true" print block in the phase maker widget and detecting it in the matrix is challenging. I spent almost 2 days on this problem but no results were produced.
Hence I am making it a draft PR for the interested one. They can continue my work and also I am ready to collab.
Things we can focus on :-
for other blocks.
@walterbender @pikurasa Sir please check this PR.
lyric.mp4