From 38484070ea7d6f40d14f080e39f843bd6927f704 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Mon, 10 Aug 2015 12:37:11 +0200 Subject: [PATCH] Worked on adding manual word entry to current wordlist --- MainPage.praat | 79 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/MainPage.praat b/MainPage.praat index 4bbd8ce..bc80be3 100644 --- a/MainPage.praat +++ b/MainPage.praat @@ -308,6 +308,7 @@ procedure processMainPageSelectWords .clickX .clickY .pressed$ .pinyinText$ = "Pinyin" .characterText$ = "Character" + .manualEntryText$ = "Manual Entry" # Get lesson names select sgc.currentWordlist @@ -423,6 +424,7 @@ procedure processMainPageSelectWords .clickX .clickY .pressed$ .wordListName$ = Get value: .w, "Name" option: .wordListName$ endfor + option: "*"+.manualEntryText$+"*" endif endif @@ -488,22 +490,69 @@ procedure processMainPageSelectWords .clickX .clickY .pressed$ endfor # Get and merge the selected list - select sgc.allWordLists - .wordlistNum = Search column: "Name", .tmp$ - .wordlistPath$ = Get value: .wordlistNum, "Directory" - .wordlistPath$ = replace_regex$(.wordlistPath$, "[ ]", "&", 0) - call read_wordlist "'.tmp$'" '.wordlistPath$' - .newList = read_wordlist.wordlistID - call merge_into_wordlist '.newList' '.tmp$' - select .newList - Remove - # Add wordlistname to Lesson column - select sgc.allWordLists - .numRows = Get number of rows - if .numRows > 1 - Remove row: .wordlistNum + # Enter words by hand + if .tmp$ = "*"+.manualEntryText$+"*" + .man_clicked = 3 + while .man_clicked > 1 + .manualText$ = .manualEntryText$ + .manPinyin$ = "" + .manCharacter$ = "" + .manLesson$ = "" + beginPause: .manualEntryText$ + text: .pinyinText$, .pinyinText$ + text: .characterText$, .characterText$ + text: .manualText$, .manualText$ + .man_clicked = endPause("'.cancelText$'", "'.continueText$'", 2, 1) + if .man_clicked = 2 + .tmp$ = replace_regex$(.pinyinText$, "\s", "_", 0) + .tmp$ = replace_regex$(.tmp$, "^(.+)$", "\l\1", 0) + if '.tmp$'$ <> .pinyinText$ + .manPinyin$ = '.tmp$'$ + else + # Quit + .man_clicked = 0 + endif + .tmp$ = replace_regex$(.characterText$, "\s", "_", 0) + .tmp$ = replace_regex$(.tmp$, "^(.+)$", "\l\1", 0) + if '.tmp$'$ <> .characterText$ + .manCharacter$ = '.tmp$'$ + endif + .tmp$ = replace_regex$(.manualText$, "\s", "_", 0) + .tmp$ = replace_regex$(.tmp$, "^(.+)$", "\l\1", 0) + .manLesson$ = '.tmp$'$ + + select sgc.currentWordlist + Append row + .numRows = Get number of rows + if .manPinyin$ <> "" + Set string value: .numRows, "Pinyin", .manPinyin$ + Set string value: .numRows, "Character", .manCharacter$ + Set string value: .numRows, "Lesson", .manLesson$ + endif + + endif + endwhile else - Set string value: 1, "Name", "---" + # Existing lessons + select sgc.allWordLists + .wordlistNum = Search column: "Name", .tmp$ + if .wordlistNum > 0 + .wordlistPath$ = Get value: .wordlistNum, "Directory" + .wordlistPath$ = replace_regex$(.wordlistPath$, "[ ]", "&", 0) + call read_wordlist "'.tmp$'" '.wordlistPath$' + .newList = read_wordlist.wordlistID + call merge_into_wordlist '.newList' '.tmp$' + select .newList + Remove + # Add wordlistname to Lesson column + select sgc.allWordLists + .numRows = Get number of rows + if .numRows > 1 + Remove row: .wordlistNum + else + Set string value: 1, "Name", "---" + endif + endif endif # Gather Lesson names select sgc.currentWordlist -- 2.11.4.GIT