Code: Select all
init:
$ J_ki_word=''
$ J_ki_jamo=0
$ J_ki_tail=0
$ J_ki_vowel=0
$ J_ki_lead=0
$ J_ki_word_placeholder='[]'
$ J_ki_last_alphabet=''
$ J_ki_num=-1
$ this_got_final=None
$ J_ki_limit=999
label korean_inputer:
############################################### Put Whatever show or scene in here#######################################################
$ J_ki_limit=5
###############################################################################################################################
if J_ki_word_placeholder=='':
$ J_ki_word_placeholder='[]'
$ J_ki_identifier=[]
$ J_ki_all_korean_alphabets=[(u"\u3131",1,0),(u"\u3134",3,0),(u"\u3137",4,0),(u"\u3139",6,0),(u"\u3141",7,0),(u"\u3142",8,0),(u"\u3145",10,0),(u"\u3147",12,0),(u"\u3148",13,0),(u"\u314a",15,0),(u"\u314b",16,0),(u"\u314c",17,0),(u"\u314d",18,0),(u"\u314e",19,0),("", 'x', 5),(u"\u3132",2,0), (u"\u3138",5,0),(u"\u3143",9,0),(u"\u3146",11,0),(u"\u3149",14,0), (u"\u314f",1,1),(u"\u3151",3,1),(u"\u3153",5,1),(u"\u3155",7,1),(u"\u3157",9,1),(u"\u315b",13,1),(u"\u315c",14,1),(u"\u3160",18,1),(u"\u3161",19,1),(u"\u3163",21,1),("", 'x', 5),(u"\u3150",2,1),(u"\u3152",4,1),(u"\u3154",6,1),(u"\u3156",8,1),("", 'x', 5),(u"\u3158",10,1),(u"\u3159",11,1),(u"\u315a",12,1),(u"\u315d",15,1),(u"\u315e",16,1),(u"\u315f",17,1),(u"\u3162",20,1), (u"\u3131",1,2),(u"\u3134",4,2),(u"\u3137",7,2),(u"\u3139",8,2),(u"\u3141",16,2),(u"\u3142",17,2),(u"\u3145",19,2),(u"\u3147",21,2),(u"\u3148",22,2),(u"\u314a",23,2),(u"\u314b",24,2),(u"\u314c",25,2),(u"\u314d",26,2),(u"\u314e",27,2),("", 'x', 5), (u"\u3132",2,2),(u"\u3146",20,2),("", 'x', 5),(u"\u3133",3,2),(u"\u3135",5,2),(u"\u3136",6,2),(u"\u313a",9,2),(u"\u313b",10,2),(u"\u313c",11,2),(u"\u313d",12,2),(u"\u313e",13,2),(u"\u313f",14,2),(u"\u3140",15,2),(u"\u3144",18,2),("", 'x', 5),("",0,11),("Space",19,20),("Backspace",19,15),("Done",19,12)]
$ ui.frame(xpos=.5, ypos=.5, xanchor=.5)
$ ui.vbox( )
$ ui.hbox()
$ ui.text(J_ki_word)
if J_ki_limit>=len(J_ki_word) + 1:
$ ui.text(J_ki_word_placeholder)
$ ui.close()
$ ui.null(height=20)
if J_ki_jamo==0 and J_ki_limit>=len(J_ki_word) + 1:
$ ui.text('Initial')
elif J_ki_jamo==1:
$ ui.text('Median')
elif J_ki_jamo==2:
$ ui.text('Final')
$ ui.hbox()
python:
for alphabets, unicode_value,type in J_ki_all_korean_alphabets:
if len(J_ki_word)<=J_ki_limit-1:
if J_ki_jamo==type:
ui.button(clicked=ui.returns(unicode_value))
ui.text(alphabets)
if J_ki_jamo==type-9:
ui.button(clicked=ui.returns(unicode_value))
ui.text(alphabets)
if J_ki_jamo==type-20 and J_ki_word:
ui.button(clicked=ui.returns(alphabets))
ui.text(alphabets)
if (J_ki_jamo==type-13 or J_ki_jamo==type-14 or J_ki_jamo==type-15) and (J_ki_word or not J_ki_jamo==0):
ui.button(clicked=ui.returns(alphabets))
ui.text(alphabets)
if J_ki_jamo==type-12 and J_ki_word:
ui.button(clicked=ui.jumps('J_ki_done'))
ui.text(alphabets)
if type==5:
ui.close()
ui.hbox()
$ ui.close()
$ ui.close()
$ J_ki_button_selection=ui.interact()
if J_ki_jamo==0:
if J_ki_button_selection=="Space":
$ J_ki_word=J_ki_word+u" "
jump korean_inputer
elif J_ki_button_selection=="Backspace":
$ J_ki_jamo=0
$ J_ki_tail=0
$ J_ki_vowel=0
$ J_ki_lead=0
$ J_ki_word_placeholder=''
$ J_ki_word=J_ki_word[:-1]
if len(J_ki_word)>=1:
$ J_ki_last_alphabet=J_ki_word[-1]
if J_ki_last_alphabet==" ":
while J_ki_last_alphabet==" " and not len(J_ki_word)<-(J_ki_num):
$ J_ki_last_alphabet=J_ki_word[J_ki_num]
$ J_ki_num-=1
if J_ki_last_alphabet==" ":
jump korean_inputer
$ J_ki_last_alphabet=repr(J_ki_last_alphabet)
$ J_ki_last_alphabet=J_ki_last_alphabet[:-1]
$ J_ki_last_alphabet=J_ki_last_alphabet[4:]
$ J_ki_hex=str(J_ki_last_alphabet)
python:
J_ki_dec = "%d" % int(J_ki_hex, 16)
J_ki_dec=int(J_ki_dec)
J_ki_dec=(J_ki_dec-44032)%588
J_ki_dec=J_ki_dec%28
if J_ki_dec==0:
$ this_got_final=None
else:
$ this_got_final=True
jump korean_inputer
$ J_ki_lead=J_ki_button_selection
$ J_ki_jamo=1
python:
for alphabets, unicode_value,type in J_ki_all_korean_alphabets:
if J_ki_lead==unicode_value and type==0:
J_ki_word_placeholder="[" + alphabets + "]"
elif J_ki_jamo==1:
if J_ki_button_selection=="Backspace":
$ J_ki_jamo=0
$ J_ki_tail=0
$ J_ki_vowel=0
$ J_ki_lead=0
$ J_ki_word_placeholder=''
jump korean_inputer
$ J_ki_vowel=J_ki_button_selection
$ J_ki_jamo=2
$ J_ki_word_placeholder= (J_ki_vowel-1)*28 + (J_ki_lead-1)*588 + 44032
$ J_ki_word_placeholder=unichr(J_ki_word_placeholder )
$ J_ki_word_placeholder="["+J_ki_word_placeholder+"]"
elif J_ki_jamo==2:
if J_ki_button_selection=="Backspace":
$ J_ki_jamo=0
$ J_ki_tail=0
$ J_ki_vowel=0
$ J_ki_lead=0
$ J_ki_word_placeholder=''
jump korean_inputer
$ this_got_final=True
if J_ki_button_selection==0:
$ this_got_final=None
$ J_ki_tail=J_ki_button_selection
$ J_ki_jamo=0
$ J_ki_word_placeholder = J_ki_tail + (J_ki_vowel-1)*28 + (J_ki_lead-1)*588 + 44032
$ J_ki_word_placeholder=unichr(J_ki_word_placeholder )
$ J_ki_word=J_ki_word+J_ki_word_placeholder
$ J_ki_word_placeholder='[]'
$ J_ki_tail=0
$ J_ki_vowel=0
$ J_ki_lead=0
jump korean_inputer
label J_ki_done:
python:
if J_ki_word[-1]==' ':
while J_ki_word[-1]==' ':
J_ki_word=J_ki_word[:-1]
$ variable=J_ki_word
# Let the variable you want the name in =J_ki_word
if this_got_final:
"Hello, %(variable)s은"
else:
"Hello, %(variable)s는"