#!/usr/bin/python #WERD, is a phonetic transliterator that helps users write english #text but read the same in the chosen Indic font. #Copyright (C) 2007-2011 Atul Nene (www.atulnene.com) # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; specifically version 2 #of the License # #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details at #http://www.gnu.org/licenses/gpl.html . import string from Tkinter import * import os import sys class FontDict: def __init__(self): #dict of dicts self.fontDictDict = {} #dict for each font supported self.fontDict_Shivaji01 = {} self.fontDict_xdvng = {} self.fontDict_dev2 = {} self.fontDict_uni = {} #init the Shivaji01 font self.fontDict_Shivaji01["a"] = "A" # "A" self.fontDict_Shivaji01["aa"] = "Aa" # "A" self.fontDict_Shivaji01["ai"] = "eo" # "eo" self.fontDict_Shivaji01["ai_maatraa"] = "O" # "O" self.fontDict_Shivaji01["b"] = "b" # "b" self.fontDict_Shivaji01["ba"] = "ba" # "b" self.fontDict_Shivaji01["bh"] = "B" # "B" self.fontDict_Shivaji01["bhr"] = "B" + u'\u0060' # "B`" self.fontDict_Shivaji01["br"] = "b" + u'\u0060' # "B`" self.fontDict_Shivaji01["ch"] = "c" # "c" self.fontDict_Shivaji01["cha"] = "ca" # "c" self.fontDict_Shivaji01["chandra"] = u'\u005E' # "^" self.fontDict_Shivaji01["chandra_bindu"] = u'\u00D0' # "Ð" self.fontDict_Shivaji01["chha"] = "C" # "C" self.fontDict_Shivaji01["da"] = "d" # "d" self.fontDict_Shivaji01["deerghaviraam"] = u'\u00C8' + u'\u00C8' # "ÈÈ" self.fontDict_Shivaji01["dh"] = "Q" # "Q" self.fontDict_Shivaji01["dnya"] = "&" # "&" self.fontDict_Shivaji01["Da"] = "D" # "D" self.fontDict_Shivaji01["Dha"] = "Z" # "Z" self.fontDict_Shivaji01["e"] = "e" # "e" self.fontDict_Shivaji01["e_maatraa"] = "o" # "o" self.fontDict_Shivaji01["ee"] = u"\u0161" self.fontDict_Shivaji01["ee_velaanti"] = "I" # "I" self.fontDict_Shivaji01["g"] = "g" # "g" self.fontDict_Shivaji01["gh"] = "G" # "G" self.fontDict_Shivaji01["gr"] = "g" + "a" + u'\u0060' # "g`" self.fontDict_Shivaji01["gunile"] = u'\u00D7' # "×" self.fontDict_Shivaji01["h"] = u'\u002A' # ")" self.fontDict_Shivaji01["ha"] = "h" # "h" self.fontDict_Shivaji01["i"] = "[" # "[" self.fontDict_Shivaji01["i_velaanti"] = "i" # "i" self.fontDict_Shivaji01["j"] = "j" # "j" self.fontDict_Shivaji01["ja"] = "ja" # "j" self.fontDict_Shivaji01["jh"] = "J" # "J" self.fontDict_Shivaji01["k"] = "@" # "@" self.fontDict_Shivaji01["ka"] = "k" # "k" self.fontDict_Shivaji01["kaanaa"] = "a" # "a" self.fontDict_Shivaji01["kaawaLaa"] = u'\u002F' self.fontDict_Shivaji01["kh"] = "#" # "#" self.fontDict_Shivaji01["kha"] = "K" # "K" self.fontDict_Shivaji01["ksh"] = "x" # "x" self.fontDict_Shivaji01["kr"] = u'\u00CB' # self.fontDict_Shivaji01["l"] = "l" # "l" self.fontDict_Shivaji01["la"] = "la" # "l" self.fontDict_Shivaji01["L"] = "L" + u"\u005C" # "L" self.fontDict_Shivaji01["La"] = "L" # "L" self.fontDict_Shivaji01["m"] = "m" # "m" self.fontDict_Shivaji01["n"] = "n" # "n" self.fontDict_Shivaji01["N"] = "N" # "N" self.fontDict_Shivaji01["o"] = "Aao" # "N" self.fontDict_Shivaji01["o_maatraa"] = "ao" # "N" self.fontDict_Shivaji01["om"] = "!" # "!" self.fontDict_Shivaji01["oo"] = "}" # "}" self.fontDict_Shivaji01["oo_maatraa"] = "U" # "U" self.fontDict_Shivaji01["ou"] = "AaO" # "N" self.fontDict_Shivaji01["ou_maatraa"] = "aO" # "N" self.fontDict_Shivaji01["paayamoDyaa"] = u"\u005C" # "\" self.fontDict_Shivaji01["p"] = "P" # "P" self.fontDict_Shivaji01["pa"] = "p" # "p" self.fontDict_Shivaji01["ph"] = "F" # "F" self.fontDict_Shivaji01["pha"] = "f" # "f" self.fontDict_Shivaji01["potphoDyaara"] = u"\u00AD" # "\" self.fontDict_Shivaji01["pra"] = "p" + u"\u0060" # "p`" self.fontDict_Shivaji01["ra"] = "r" # "r" self.fontDict_Shivaji01["Ru"] = "?" # "r" self.fontDict_Shivaji01["rafar"] = u"\u002D" # '-' self.fontDict_Shivaji01["rukar"] = u"\u0052" self.fontDict_Shivaji01["s"] = "s" # "s" self.fontDict_Shivaji01["sa"] = "s" # "s" self.fontDict_Shivaji01["sh"] = "X" # "X" self.fontDict_Shivaji01["shh"] = "Y" # "Y" self.fontDict_Shivaji01["shr"] = "E" # "E" self.fontDict_Shivaji01["t"] = "%" # "%" self.fontDict_Shivaji01["ta"] = "%a" # "%" self.fontDict_Shivaji01["th"] = "q" # "q" self.fontDict_Shivaji01["tilda"] = "|" # "|" self.fontDict_Shivaji01["timba"] = "M" # "M" self.fontDict_Shivaji01["tr"] = "~" # "~" self.fontDict_Shivaji01["Ta"] = "T" # "T" self.fontDict_Shivaji01["Tha"] = "z" # "z" self.fontDict_Shivaji01["u"] = "]" # "]" self.fontDict_Shivaji01["u_maatraa"] = "u" # "u" self.fontDict_Shivaji01["v"] = "v" # "v" self.fontDict_Shivaji01["va"] = "va" # "v" self.fontDict_Shivaji01["y"] = "y" # "y" self.fontDict_Shivaji01["ya"] = "ya" # "y" self.fontDict_Shivaji01["0"] = u'\u0030' # "0" self.fontDict_Shivaji01["1"] = u'\u0031' # "1" self.fontDict_Shivaji01["2"] = u'\u0032' # "2" self.fontDict_Shivaji01["3"] = u'\u0033' # "3" self.fontDict_Shivaji01["4"] = u'\u0034' # "4" self.fontDict_Shivaji01["5"] = u'\u0035' # "5" self.fontDict_Shivaji01["6"] = u'\u0036' # "6" self.fontDict_Shivaji01["7"] = u'\u0037' # "7" self.fontDict_Shivaji01["8"] = u'\u0038' # "8" self.fontDict_Shivaji01["9"] = u'\u0039' # "9" self.fontDict_Shivaji01["."] = "." # "." self.fontDict_Shivaji01[","] = u'\u00B8' # " " self.fontDict_Shivaji01[":"] = u'\u00C1' # "Á" self.fontDict_Shivaji01[";"] = u'\u00C2' # "Â" self.fontDict_Shivaji01["?"] = u'\u00C6' # "Æ" self.fontDict_Shivaji01["*"] = u'\u00B5' # "µ" self.fontDict_Shivaji01["^"] = u'\u00D8' # "Ø" self.fontDict_Shivaji01["'"] = "'" # "'" self.fontDict_Shivaji01['"'] = '"' # """ self.fontDict_Shivaji01['%'] = u'\u0089' # "‰" self.fontDict_Shivaji01['$'] = u'\u00C9' + u'\u00BA' # "ɺ" self.fontDict_Shivaji01['-'] = u'\u00B9' # "¹" self.fontDict_Shivaji01['+'] = u'\u00B1' # "±" self.fontDict_Shivaji01['='] = u'\u00C4' # "Ä" self.fontDict_Shivaji01['@'] = u'\u00C7' # "Ç" self.fontDict_Shivaji01['`'] = u'\u00AA' # "ª" self.fontDict_Shivaji01['#'] = u'\u0021' # "!" self.fontDict_Shivaji01['&'] = u'\u0021' # "!" self.fontDict_Shivaji01['('] = u'\u00B3' # "³" self.fontDict_Shivaji01[')'] = u'\u00B4' # "´" self.fontDict_Shivaji01['['] = u'\u00A4' # "¤" self.fontDict_Shivaji01[']'] = u'\u00A5' # "¥" self.fontDict_Shivaji01['{'] = u'\u00A1' # "¡" self.fontDict_Shivaji01['}'] = u'\u00A3' # "£" self.fontDict_Shivaji01['<'] = u'\u00C3' # "Ã" self.fontDict_Shivaji01['>'] = u'\u00C5' # "Å" self.fontDict_Shivaji01['/'] = u'\u00C0' # "À" self.fontDict_Shivaji01['\\'] = u'\u00D2' # "Ò" self.fontDict_Shivaji01['|'] = u'\u00C8' # "È" self.fontDict_Shivaji01['!'] = u'\u00D1' # "Ñ" #self.fontDict_Shivaji01[' '] = " " self.fontDict_Shivaji01[' '] = " " self.fontDictDict["Shivaji01"] = self.fontDict_Shivaji01 self.fontDictDict["Shivaji02"] = self.fontDict_Shivaji01 self.fontDictDict["Shivaji05"] = self.fontDict_Shivaji01 #init the xdvng font self.fontDict_xdvng["a"] = u'\u0041' #"A" self.fontDict_xdvng["aa"] = u'\u0041' + u'\u0061' #"A" self.fontDict_xdvng["ai"] = u'\u004F' + u'\u00F0' #"Oð" self.fontDict_xdvng["ai_maatraa"] = u'\u00F2' #"ò" self.fontDict_xdvng["b"] = u'\u0062' #"b" self.fontDict_xdvng["ba"] = u'\u0062' + u'\u0061' #"v" self.fontDict_xdvng["bh"] = u'\u0042' #"B" self.fontDict_xdvng["bhr"] = u'\u0042' + u'\u00D2' #"BÒ" self.fontDict_xdvng["br"] = u'\u0062' + u'\u00D2' #"BÒ" self.fontDict_xdvng["ch"] = u'\u0063' #"c" self.fontDict_xdvng["cha"] = u'\u0063' + u'\u0061' #"c" self.fontDict_xdvng["chandra"] = u'\u00F4' #"ô" self.fontDict_xdvng["chandra_bindu"] = u'\u00FA' #"ú" self.fontDict_xdvng["chha"] = u'\u0043' #"C" self.fontDict_xdvng["da"] = u'\u0064' #"d" self.fontDict_xdvng["deerghaviraam"] = u'\u002F' #"/" self.fontDict_xdvng["dh"] = u'\u0044' #"D" self.fontDict_xdvng["dnya"] = u'\u0077' #"w" self.fontDict_xdvng["Da"] = u'\u0052' #"R" self.fontDict_xdvng["Dha"] = u'\u005A' #"Z" self.fontDict_xdvng["e"] = u'\u004F' #"O" self.fontDict_xdvng["e_maatraa"] = u'\u00F1' #"ñ" self.fontDict_xdvng["ee"] = u'\u0049' #"I" self.fontDict_xdvng["ee_velaanti"] = u'\u0069' #"i" self.fontDict_xdvng["g"] = u'\u0067' #"g" self.fontDict_xdvng["gh"] = u'\u0047' #"G" self.fontDict_xdvng["gr"] = u'\u0067' + u'\u0061' + u'\u00D2' #"gÒ" self.fontDict_xdvng["gunile"] = u'\u0021' #"!" self.fontDict_xdvng["h"] = u'\u0068' + u'\u00CE' #"hÎ" self.fontDict_xdvng["ha"] = u'\u0068' #"h" self.fontDict_xdvng["i"] = u'\u0045' #"E" self.fontDict_xdvng["i_velaanti"] = u'\u0065' #"e" self.fontDict_xdvng["j"] = u'\u006A' #"j" self.fontDict_xdvng["ja"] = u'\u006A' + u'\u0061' #"j" self.fontDict_xdvng["jh"] = u'\u004A' #"J" self.fontDict_xdvng["k"] = u'\u0056' #"V" self.fontDict_xdvng["ka"] = u'\u006B' #"k" self.fontDict_xdvng["kaanaa"] = u'\u0061' #"a" self.fontDict_xdvng["kaawaLaa"] = u'\u00D6' #"a" self.fontDict_xdvng["kh"] = u'\u004B' #"K" self.fontDict_xdvng["kha"] = u'\u004B' +u'\u0061' #"Ka" self.fontDict_xdvng["ksh"] = u'\u0078' #"x" self.fontDict_xdvng["kr"] = u'\u006B' + u'\u00D2' self.fontDict_xdvng["l"] = u'\u006C' #"l" self.fontDict_xdvng["la"] = u'\u006C' + u'\u0061' #"l" self.fontDict_xdvng["L"] = u'\u004D' #"M" self.fontDict_xdvng["La"] = u'\u004C' #"M" self.fontDict_xdvng["m"] = u'\u006D' #"m" self.fontDict_xdvng["n"] = u'\u006E' #"n" self.fontDict_xdvng["N"] = u'\u004E' #"N" self.fontDict_xdvng["o"] = u'\u0041' + u'\u0061' + u'\u00F1' #"N" self.fontDict_xdvng["o_maatraa"] = u'\u0061' + u'\u00F1' #"N" self.fontDict_xdvng["om"] = u'\u0021' #"!" self.fontDict_xdvng["oo"] = u'\u0055' #"U" self.fontDict_xdvng["oo_maatraa"] = u'\u00DC' #"Ü" self.fontDict_xdvng["ou"] = u'\u0041' + u'\u0061' + u'\u00F2' #"N" self.fontDict_xdvng["ou_maatraa"] = u'\u0061' + u'\u00F2' #"N" self.fontDict_xdvng["paayamoDyaa"] = u'\u00CE' #"Î" self.fontDict_xdvng["p"] = u'\u0070' #"p" self.fontDict_xdvng["pa"] = u'\u0070' + u'\u0061' #"pa" self.fontDict_xdvng["ph"] = u'\u005B' #"[" self.fontDict_xdvng["pha"] = u'\u0050' #"P" self.fontDict_xdvng["potphoDyaara"] = u'\u0022' #"Î" self.fontDict_xdvng["pra"] = u'\u0070' + u'\u0061' + u'\u00D2' #"paÒ" self.fontDict_xdvng["ra"] = u'\u0072' #"r" self.fontDict_xdvng["Ru"] = u'\u003F' #"r" self.fontDict_xdvng["rafar"] = u'\u00FC' #"ü" self.fontDict_xdvng["rukar"] = u'\u00E0' #"ü" self.fontDict_xdvng["s"] = u'\u0073' #"s" self.fontDict_xdvng["sa"] = u'\u0073' + u'\u0061' #"s" self.fontDict_xdvng["sh"] = u'\u0053' #"S" self.fontDict_xdvng["shh"] = u'\u005C' #"\" self.fontDict_xdvng["shr"] = u'\u00C2' #"Â" self.fontDict_xdvng["t"] = u'\u0074' #"t" self.fontDict_xdvng["ta"] = u'\u0074' + u'\u0061' #"t" self.fontDict_xdvng["th"] = u'\u0054' #"T" self.fontDict_xdvng["tilda"] = u'\u007C' #"|" self.fontDict_xdvng["timba"] = u'\u007E' #"~" self.fontDict_xdvng["tr"] = u'\u002A' + u'\u0061' #"*a" self.fontDict_xdvng["Ta"] = u'\u0058' #"X" self.fontDict_xdvng["Tha"] = u'\u0059' #"Y" self.fontDict_xdvng["u"] = u'\u0075' #"u" self.fontDict_xdvng["u_maatraa"] = u'\u00D8' #"Ø" self.fontDict_xdvng["v"] = u'\u0076' #"v" self.fontDict_xdvng["va"] = u'\u0076' + u'\u0061' #"v" self.fontDict_xdvng["y"] = u'\u0079' #"y" self.fontDict_xdvng["ya"] = u'\u0079' + u'\u0061' #"y" self.fontDict_xdvng["0"] = u'\u0030' # "0" self.fontDict_xdvng["1"] = u'\u0031' # "1" self.fontDict_xdvng["2"] = u'\u0032' # "2" self.fontDict_xdvng["3"] = u'\u0033' # "3" self.fontDict_xdvng["4"] = u'\u0034' # "4" self.fontDict_xdvng["5"] = u'\u0035' # "5" self.fontDict_xdvng["6"] = u'\u0036' # "6" self.fontDict_xdvng["7"] = u'\u0037' # "7" self.fontDict_xdvng["8"] = u'\u0038' # "8" self.fontDict_xdvng["9"] = u'\u0039' # "9" self.fontDict_xdvng["."] = u'\u002E' #"." self.fontDict_xdvng[","] = u'\u0020' + u'\u00D3' #" Ó" self.fontDict_xdvng[":"] = u'\u0048' #"H" self.fontDict_xdvng[";"] = u'\u0048' #"H" self.fontDict_xdvng["?"] = u'\u0021' #"!" self.fontDict_xdvng["*"] = u'\u0021' #"!" self.fontDict_xdvng["^"] = u'\u0021' #"!" self.fontDict_xdvng["'"] = u'\u0091' #"‘" self.fontDict_xdvng['"'] = u'\u0021' #"!" self.fontDict_xdvng['%'] = u'\u0021' #"!" self.fontDict_xdvng['$'] = u'\u002C' + u'\u0026' #",&" self.fontDict_xdvng['-'] = u'\u0021' #"!" self.fontDict_xdvng['+'] = u'\u0021' #"!" self.fontDict_xdvng['='] = u'\u0021' #"!" self.fontDict_xdvng['@'] = u'\u0021' #"!" self.fontDict_xdvng['`'] = u'\u0091' #"‘" self.fontDict_xdvng['#'] = u'\u0021' #"!" self.fontDict_xdvng['&'] = u'\u0021' #"!" self.fontDict_xdvng['('] = u'\u0021' #"!" self.fontDict_xdvng[')'] = u'\u0021' #"!" self.fontDict_xdvng['['] = u'\u0021' #"!" self.fontDict_xdvng[']'] = u'\u0021' #"!" self.fontDict_xdvng['{'] = u'\u0021' #"!" self.fontDict_xdvng['}'] = u'\u0021' #"!" self.fontDict_xdvng['<'] = u'\u0021' #"!" self.fontDict_xdvng['>'] = u'\u0021' #"!" self.fontDict_xdvng['/'] = u'\u0021' #"!" self.fontDict_xdvng['\\'] = u'\u0021' #"!" self.fontDict_xdvng['|'] = u'\u002E' #"." self.fontDict_xdvng['!'] = u'\u0021' #"!" self.fontDict_xdvng[' '] = u'\u0020' #" " self.fontDictDict["xdvng"] = self.fontDict_xdvng #init the aakrutidev font self.fontDict_dev2["a"] = u'\u0041' # "A" self.fontDict_dev2["aa"] = u'\u0041' + u'\u00EB' # "A" self.fontDict_dev2["ai"] = u'\u0046' + u'\u00E9' # "Fé" self.fontDict_dev2["ai_maatraa"] = u'\u00EA' # "ê" self.fontDict_dev2["b"] = u'\u00A3' # "£" self.fontDict_dev2["ba"] = u'\u0061' # "£" self.fontDict_dev2["bh"] = u'\u00A4' # "¤" self.fontDict_dev2["bhr"] = u'\u00A4' + u'\u00FE' # "¤#254" self.fontDict_dev2["br"] = u'\u00A3' + u'\u00FE' # "¤#254" self.fontDict_dev2["ch"] = u'\u0074' # "t" self.fontDict_dev2["cha"] = u'\u004C' # "t" self.fontDict_dev2["chandra"] = u'\u00F6' # "ö" self.fontDict_dev2["chandra_bindu"] = u'\u00F7' # "÷" self.fontDict_dev2["chha"] = u'\u004D' # "M" self.fontDict_dev2["da"] = u'\u0058' # "X" self.fontDict_dev2["deerghaviraam"] = u'\u005C' + u'\u005C' # "\\" self.fontDict_dev2["dh"] = u'\u007C' # "|" self.fontDict_dev2["dnya"] = u'\u00B3' + u'\u00EB' # "³ë" self.fontDict_dev2["Da"] = u'\u0053' # "S" self.fontDict_dev2["Dha"] = u'\u0054' # "T" self.fontDict_dev2["e"] = u'\u0046' # "F" self.fontDict_dev2["e_maatraa"] = u'\u00E9' # "é" self.fontDict_dev2["ee"] = u'\u0042' + u'\u00E1' # "Bá" self.fontDict_dev2["ee_velaanti"] = u'\u00ED' # "í" self.fontDict_dev2["g"] = u'\u0072' # "r" self.fontDict_dev2["gh"] = u'\u0073' # "s" self.fontDict_dev2["gr"] = u'\u0072' + u'\u00EB' + u'\u00FE' # "rþ" self.fontDict_dev2["gunile"] = u'\u0178' # "Ÿ" self.fontDict_dev2["h"] = u'\u00AF' # "¯" self.fontDict_dev2["ha"] = u'\u006E' # "n" self.fontDict_dev2["i"] = u'\u0042' # "B" self.fontDict_dev2["i_velaanti"] = u'\u00EC' # "ì" self.fontDict_dev2["j"] = u'\u0075' # "u" self.fontDict_dev2["ja"] = u'\u004E' # "u" self.fontDict_dev2["jh"] = u'\u0076' # "v" self.fontDict_dev2["k"] = u'\u0070' # "p" self.fontDict_dev2["ka"] = u'\u0047' # "G" self.fontDict_dev2["kaanaa"] = u'\u00EB' # "ë" self.fontDict_dev2["kaawaLaa"] = u'\u00DB' # "ë" self.fontDict_dev2["kh"] = u'\u0071' # "q" self.fontDict_dev2["kha"] = u'\u0048' # "H" self.fontDict_dev2["ksh"] = u'\u00B1' # "±" self.fontDict_dev2["kr"] = u'\u0047' + u'\u00FE' self.fontDict_dev2["l"] = u'\u00A8' # "¨" self.fontDict_dev2["la"] = u'\u0066' # "¨" self.fontDict_dev2["L"] = u'\u00B0' # "h" self.fontDict_dev2["La"] = u'\u0068' # "h" self.fontDict_dev2["m"] = u'\u00A5' # "¥" self.fontDict_dev2["n"] = u'\u007E' # "~" self.fontDict_dev2["N"] = u'\u0078' # "x" self.fontDict_dev2["o"] = u'\u0041' + u'\u00EB' + u'\u00E9' # "x" self.fontDict_dev2["o_maatraa"] = u'\u00EB' + u'\u00E9' # "x" self.fontDict_dev2["om"] = u'\u00FB' # "û" self.fontDict_dev2["oo"] = u'\u0044' # "D" self.fontDict_dev2["oo_maatraa"] = u'\u00DE' # "Þ" self.fontDict_dev2["paayamoDyaa"] = u'\u00F9' # "ù" self.fontDict_dev2["ou"] = u'\u0041' + u'\u00EB' + u'\u00EA' # "x" self.fontDict_dev2["ou_maatraa"] = u'\u00EB' + u'\u00EA' # "x" self.fontDict_dev2["p"] = u'\u00A1' # "¡" self.fontDict_dev2["pa"] = u'\u005E' # "^" self.fontDict_dev2["ph"] = u'\u00A2' # "¢" self.fontDict_dev2["pha"] = u'\u005F' # "_" self.fontDict_dev2["potphoDyaara"] = u'\u00A9' # "ù" self.fontDict_dev2["pra"] = u'\u005E' + u'\u00FE' # "^þ" self.fontDict_dev2["ra"] = u'\u0065' # "e" self.fontDict_dev2["Ru"] = u'\u0045' # "e" self.fontDict_dev2["rafar"] = u'\u00E1' # "á" self.fontDict_dev2["rukar"] = u'\u00DC' # "á" self.fontDict_dev2["s"] = u'\u00AE' # "®" self.fontDict_dev2["sa"] = u'\u00AE' # "®" self.fontDict_dev2["sh"] = u'\u006A' # "j" self.fontDict_dev2["shh"] = u'\u00AB' # "«" self.fontDict_dev2["shr"] = u'\u00D0' # "Ð" self.fontDict_dev2["t"] = u'\u0079' # "y" self.fontDict_dev2["ta"] = u'\u0056' # "y" self.fontDict_dev2["th"] = u'\u007A' # "z" self.fontDict_dev2["tilda"] = u'\u00FA' # "ú" self.fontDict_dev2["timba"] = u'\u00F8' # "ø" self.fontDict_dev2["tr"] = u'\u00B2' + u'\u00EB' # "²ë" self.fontDict_dev2["Ta"] = u'\u0051' # "Q" self.fontDict_dev2["Tha"] = u'\u0052' # "R" self.fontDict_dev2["u"] = u'\u0043' # "C" self.fontDict_dev2["u_maatraa"] = u'\u00DD' # "Ý" self.fontDict_dev2["v"] = u'\u00AA' # "ª" self.fontDict_dev2["va"] = u'\u0069' # "ª" self.fontDict_dev2["y"] = u'\u00A6' # "¦" self.fontDict_dev2["ya"] = u'\u0064' # "¦" self.fontDict_dev2["0"] = u'\u0030' # "0" self.fontDict_dev2["1"] = u'\u0031' # "1" self.fontDict_dev2["2"] = u'\u0032' # "2" self.fontDict_dev2["3"] = u'\u0033' # "3" self.fontDict_dev2["4"] = u'\u0034' # "4" self.fontDict_dev2["5"] = u'\u0035' # "5" self.fontDict_dev2["6"] = u'\u0036' # "6" self.fontDict_dev2["7"] = u'\u0037' # "7" self.fontDict_dev2["8"] = u'\u0038' # "8" self.fontDict_dev2["9"] = u'\u0039' # "9" self.fontDict_dev2["."] = u'\u002E' # "\" self.fontDict_dev2[","] = u'\u002C' # "," self.fontDict_dev2[":"] = u'\u003A' # ":" self.fontDict_dev2[";"] = u'\u003B' # ";" self.fontDict_dev2["?"] = u'\u003F' # "?" self.fontDict_dev2["*"] = u'\u002A' # "*" self.fontDict_dev2["^"] = u'\u00FB' # "û" self.fontDict_dev2["'"] = u'\u0027' # "'" self.fontDict_dev2['"'] = u'\u0022' # """ self.fontDict_dev2['%'] = u'\u0025' # "%" self.fontDict_dev2['$'] = u'\u00CB' + u'\u002E' # "Ë" self.fontDict_dev2['-'] = u'\u002D' # "-" self.fontDict_dev2['+'] = u'\u002B' # "+" self.fontDict_dev2['='] = u'\u003D' # "=" self.fontDict_dev2['@'] = u'\u0040' # "@" self.fontDict_dev2['`'] = u'\u0027' # "'" self.fontDict_dev2['#'] = u'\u0023' # "#" self.fontDict_dev2['&'] = u'\u0026' # "&" self.fontDict_dev2['('] = u'\u0028' # "(" self.fontDict_dev2[')'] = u'\u0029' # ")" self.fontDict_dev2['['] = u'\u005B' # "[" self.fontDict_dev2[']'] = u'\u005D' # "]" self.fontDict_dev2['{'] = u'\u007B' # "{" self.fontDict_dev2['}'] = u'\u007D' # "}" self.fontDict_dev2['<'] = u'\u003C' # "<" self.fontDict_dev2['>'] = u'\u003E' # ">" self.fontDict_dev2['/'] = u'\u002F' # "/" self.fontDict_dev2['\\'] = u'\u00FB' # "û" self.fontDict_dev2['|'] = u'\u005C' # "\" self.fontDict_dev2['!'] = u'\u0021' # "!" self.fontDict_dev2[' '] = u'\u0020' # " " self.fontDictDict["akrutidev2"] = self.fontDict_dev2 #init the unicode font self.fontDict_uni["a"] = u'\u0905' self.fontDict_uni["aa"] = u'\u0906' self.fontDict_uni["ai"] = u'\u0910' self.fontDict_uni["ai_maatraa"] = u'\u0948' self.fontDict_uni["b"] = u'\u092C' + u'\u094D' self.fontDict_uni["ba"] = u'\u092C' self.fontDict_uni["bh"] = u'\u092D' self.fontDict_uni["bhr"] = u'\u092D' + u'\u094D' + u'\u0930' self.fontDict_uni["br"] = u'\u092C' + u'\u094D' + u'\u0930' self.fontDict_uni["ch"] = u'\u091A' + u'\u094D' self.fontDict_uni["cha"] = u'\u091A' self.fontDict_uni["chandra"] = u'\u0945' self.fontDict_uni["chandra_bindu"] = u'\u0901' self.fontDict_uni["chha"] = u'\u091B' self.fontDict_uni["d"] = u'\u0926' self.fontDict_uni["da"] = u'\u0926' self.fontDict_uni["deerghaviraam"] = u'\u0965' self.fontDict_uni["dh"] = u'\u0927' self.fontDict_uni["dnya"] = u'\u091C'+ u'\u094D' + u'\u091E' self.fontDict_uni["D"] = u'\u0921' self.fontDict_uni["Da"] = u'\u0921' self.fontDict_uni["Dh"] = u'\u0922' self.fontDict_uni["Dha"] = u'\u0922' self.fontDict_uni["e"] = u'\u090F' self.fontDict_uni["e_maatraa"] = u'\u0947' self.fontDict_uni["ee"] = u'\u0908' self.fontDict_uni["ee_velaanti"] = u'\u0940' self.fontDict_uni["g"] = u'\u0917' self.fontDict_uni["gh"] = u'\u0918' self.fontDict_uni["gr"] = u'\u0917' + u'\u094D' + u'\u0930' self.fontDict_uni["gunile"] = u'\u00D7' self.fontDict_uni["h"] = u'\u0939' + u'\u094D' self.fontDict_uni["ha"] = u'\u0939' self.fontDict_uni["i"] = u'\u0907' self.fontDict_uni["i_velaanti"] = u'\u093F' self.fontDict_uni["j"] = u'\u091C' + u'\u094D' self.fontDict_uni["ja"] = u'\u091C' self.fontDict_uni["jh"] = u'\u091D' self.fontDict_uni["k"] = u'\u0915' + u'\u094D' self.fontDict_uni["ka"] = u'\u0915' self.fontDict_uni["kaanaa"] = u'\u093E' self.fontDict_uni["kaawaLaa"] = u'\u093E' self.fontDict_uni["kh"] = u'\u0916' + u'\u094D' self.fontDict_uni["kha"] = u'\u0916' self.fontDict_uni["ksh"] = u'\u0915' + u'\u094D' + u'\u0937' self.fontDict_uni["kr"] = u'\u0915' + u'\u094D' + u'\u0930' self.fontDict_uni["l"] = u'\u0932' + u'\u094D' self.fontDict_uni["la"] = u'\u0932' self.fontDict_uni["L"] = u'\u0933' + u'\u094D' self.fontDict_uni["La"] = u'\u0933' self.fontDict_uni["m"] = u'\u092E' self.fontDict_uni["n"] = u'\u0928' self.fontDict_uni["N"] = u'\u0923' self.fontDict_uni["o"] = u'\u0913' self.fontDict_uni["o_maatraa"] = u'\u094B' self.fontDict_uni["om"] = u'\u0950' self.fontDict_uni["oo"] = u'\u090A' self.fontDict_uni["oo_maatraa"] = u'\u0942' self.fontDict_uni["ou"] = u'\u0914' self.fontDict_uni["ou_maatraa"] = u'\u094C' self.fontDict_uni["paayamoDyaa"] = u'\u094D' self.fontDict_uni["p"] = u'\u092A' + u'\u094D' self.fontDict_uni["pa"] = u'\u092A' self.fontDict_uni["ph"] = u'\u092B' + u'\u094D' self.fontDict_uni["pha"] = u'\u092B' self.fontDict_uni["potphoDyaara"] = u'\u0931' + u'\u094D' self.fontDict_uni["pra"] = u'\u092A' + u'\u094D' + u'\u0930' self.fontDict_uni["ra"] = u'\u0930' self.fontDict_uni["Ru"] = u'\u090B' self.fontDict_uni["rafar"] = u'\u0930'+ u'\u094D' self.fontDict_uni["rukar"] = u'\u0943' self.fontDict_uni["s"] = u'\u0938' + u'\u094D' self.fontDict_uni["sa"] = u'\u0938' self.fontDict_uni["sh"] = u'\u0936' self.fontDict_uni["shh"] = u'\u0937' self.fontDict_uni["shr"] = u'\u0936' + u'\u094D' + u'\u0930' self.fontDict_uni["t"] = u'\u0924' + u'\u094D' self.fontDict_uni["ta"] = u'\u0924' self.fontDict_uni["th"] = u'\u0925' self.fontDict_uni["tilda"] = u'\u007E' self.fontDict_uni["timba"] = u'\u0902' self.fontDict_uni["tr"] =u'\u0924' + u'\u094D' + u'\u0930' self.fontDict_uni["Ta"] = u'\u091F' self.fontDict_uni["Tha"] = u'\u0920' self.fontDict_uni["u"] = u'\u0909' self.fontDict_uni["u_maatraa"] = u'\u0941' self.fontDict_uni["v"] = u'\u0935' + u'\u094D' self.fontDict_uni["va"] = u'\u0935' self.fontDict_uni["y"] = u'\u092F' + u'\u094D' self.fontDict_uni["ya"] = u'\u092F' self.fontDict_uni["0"] = u'\u0966' self.fontDict_uni["1"] = u'\u0967' self.fontDict_uni["2"] = u'\u0968' self.fontDict_uni["3"] = u'\u0969' self.fontDict_uni["4"] = u'\u096A' self.fontDict_uni["5"] = u'\u096B' self.fontDict_uni["6"] = u'\u096C' self.fontDict_uni["7"] = u'\u096D' self.fontDict_uni["8"] = u'\u096E' self.fontDict_uni["9"] = u'\u096F' self.fontDict_uni["."] = u'\u002E' self.fontDict_uni[","] = u'\u002C' self.fontDict_uni[":"] = u'\u003A' self.fontDict_uni[";"] = u'\u003B' self.fontDict_uni["?"] = u'\u003F' self.fontDict_uni["*"] = u'\u002A' self.fontDict_uni["^"] = u'\u005E' self.fontDict_uni["'"] = u'\u0027' self.fontDict_uni['"'] = u'\u0022' self.fontDict_uni['%'] = u'\u0025' self.fontDict_uni['$'] = u'\u0930' + u'\u0941' + u'\u002E' self.fontDict_uni['-'] = u'\u002D' self.fontDict_uni['+'] = u'\u002B' self.fontDict_uni['='] = u'\u003D' self.fontDict_uni['@'] = u'\u0040' self.fontDict_uni['`'] = u'\u0027' self.fontDict_uni['#'] = u'\u0023' self.fontDict_uni['&'] = u'\u0026' self.fontDict_uni['('] = u'\u0028' self.fontDict_uni[')'] = u'\u0029' self.fontDict_uni['['] = u'\u005B' self.fontDict_uni[']'] = u'\u005D' self.fontDict_uni['{'] = u'\u007B' self.fontDict_uni['}'] = u'\u007D' self.fontDict_uni['<'] = u'\u003C' self.fontDict_uni['>'] = u'\u003E' self.fontDict_uni['/'] = u'\u002F' self.fontDict_uni['\\'] = u'\u005C' self.fontDict_uni['|'] = u'\u0964' self.fontDict_uni['!'] = u'\u0021' self.fontDict_uni[' '] = u'\u0020' self.fontDictDict["Mangal"] = self.fontDict_uni self.fontDictDict["Hindi_Gargi"] = self.fontDict_uni def getDict(self, fontID): return self.fontDictDict[fontID] class TransLit: unicodeConsiderations = False def setUnicodeConsiderations(self, flag): self.unicodeConsiderations = flag def translateStr(self, text, fontDict): output = '' tmpstr = '' wordlist = string.split (text, ' ') for word in wordlist: index = 0 while index < len(word): #print "Translating char", word[index] + " ," + output, "index=", index tmpstr, charsTranslated = self.translateChar(word[index], index, word, fontDict) output += tmpstr index = index + 1 if charsTranslated > 1: index += charsTranslated - 1 #print tmpstr, "chars translated", charsTranslated output = output + ' ' return output def translateChar(self, char, index, word, fontDict): #print index, len(word), word output = '' charsTranslated = 1 if char in "Aa": if index == 0: if index < len(word)-1 and word[index+1] in 'aA': output = output + fontDict["aa"] charsTranslated = 2 else: output = output + fontDict["a"] else: output = output + fontDict["kaanaa"] elif char in "Bb": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ba"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["bh"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 elif index < len(word)-2 and word[index+2] in 'rR': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["bhr"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["bhr"] charsTranslated = 3 else: output = output + fontDict["bh"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["br"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["b"] elif char in "Cc": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ka"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["cha"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 elif index < len(word)-2 and word[index+2] in 'hH': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["chha"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["chha"] + fontDict["paayamoDyaa"] charsTranslated = 3 else: output = output + fontDict["ch"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["kr"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiIuU": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["k"] elif char == "d": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["da"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["dh"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["dh"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'nN': if index < len(word)-2 and word[index+2] in 'yY': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["dnya"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["dnya"] + fontDict["paayamoDyaa"] charsTranslated = 3 else: output = output + fontDict["da"] + fontDict["paayamoDyaa"] + fontDict["n"] + fontDict["kaanaa"] + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["da"] + fontDict["paayamoDyaa"] elif char == "D": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["Da"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["Dha"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["Dha"] + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["Da"] + fontDict["paayamoDyaa"] elif char in "Ee": if index == 0: if index < len(word)-1 and word[index+1] in 'iI': output = output + fontDict["ai"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'Ee': output = output + fontDict["ee"] charsTranslated = 2 else: output = output + fontDict["e"] else: if index < len(word)-1 and word[index+1] in 'iI': output = output + fontDict["ai_maatraa"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'Ee': output = output + fontDict["ee_velaanti"] charsTranslated = 2 else: output = output + fontDict["e_maatraa"] elif char in "Ff": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["pha"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["ph"] elif char in "Gg": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["g"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["gh"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["gh"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["gr"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["gr"] charsTranslated = 2 else: output = output + fontDict["g"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] elif char in "Hh": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ha"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["h"] elif char in "Ii": if index == 0: output = output + fontDict["i"] else: output = output + fontDict["i_velaanti"] elif char in "Jj": #print "in Jj" + word if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ja"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': #print "in jh " + word if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["jh"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] #print "putting kaanaa " + word #else: # output = output + fontDict["paayamoDyaa"] # print "putting paayamoDyaa " + word if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["jh"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] print "putting nustech paayamoDyaa " + word charsTranslated = 2 else: output = output + fontDict["j"] elif char in "Kk": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ka"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["kha"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["kh"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'sS': if index < len(word)-2 and word[index+2] in 'hH': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ksh"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["ksh"] charsTranslated = 3 else: output = output + fontDict["k"] + fontDict["s"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["kr"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["kr"] charsTranslated = 2 else: output = output + fontDict["k"] elif char == "l": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["la"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["l"] elif char == "L": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["La"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["L"] elif char in "Mm": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["m"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] not in 'aAeEiIoOuU': output = output + fontDict["m"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] else: output = output + fontDict["m"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] output = output + fontDict["paayamoDyaa"] elif char in "n": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["n"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] not in 'aAeEiIoOuU': output = output + fontDict["n"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] else: output = output + fontDict["n"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] output = output + fontDict["paayamoDyaa"] elif char in "N": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["N"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] not in 'aAeEiIoOuU': output = output + fontDict["N"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] else: output = output + fontDict["N"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] output = output + fontDict["paayamoDyaa"] elif char in "Oo": if index == 0: if index < len(word)-1 and word[index+1] in 'oO': output = output + fontDict["oo"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'uU': output = output + fontDict["ou"] charsTranslated = 2 else: output = output + fontDict["o"] else: if index < len(word)-1 and word[index+1] in 'oO': output = output + fontDict["oo_maatraa"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'uU': output = output + fontDict["ou_maatraa"] charsTranslated = 2 else: output = output + fontDict["o_maatraa"] elif char in "Pp": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["pa"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["pha"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["ph"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["pra"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["pra"] + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["p"] elif char in "r": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ra"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["ra"] + fontDict["paayamoDyaa"] elif char in "R": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': output = output + fontDict["Ru"] charsTranslated = 2 else: output = output + fontDict["Ru"] + fontDict["paayamoDyaa"] elif char in "Ss": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["sa"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["sh"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 elif index < len(word)-2 and word[index+2] in 'hH': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["shh"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["shh"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] charsTranslated = 3 elif index < len(word)-2 and word[index+2] in 'rR': if index < len(word)-3 and word[index+3] in 'aAeEiIoOuU': if word[index+3] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["shr"] if word[index+3] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+3] in "AaiI": charsTranslated = 4 else: charsTranslated = 3 else: output = output + fontDict["shr"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] charsTranslated = 3 else: output = output + fontDict["sh"] if self.unicodeConsiderations == True: output = output + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["s"] elif char == "t": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ta"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["th"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["th"] charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'rR': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["tr"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["tr"] + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["t"] elif char == "T": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["Ta"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+1] in "AaiI": charsTranslated = 2 elif index < len(word)-1 and word[index+1] in 'hH': if index < len(word)-2 and word[index+2] in 'aAeEiIoOuU': if word[index+2] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["Tha"] if word[index+2] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if word[index+2] in "AaiI": charsTranslated = 3 else: charsTranslated = 2 else: output = output + fontDict["Tha"] + fontDict["paayamoDyaa"] charsTranslated = 2 else: output = output + fontDict["Ta"] + fontDict["paayamoDyaa"] elif char in "Uu": if index == 0: if index < len(word)-1 and word[index+1] in 'uU': output = output + fontDict["oo"] charsTranslated = 2 else: output = output + fontDict["u"] else: if index < len(word)-1 and word[index+1] in 'uU': output = output + fontDict["oo_maatraa"] charsTranslated = 2 else: output = output + fontDict["u_maatraa"] elif char in "VvwW": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["va"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["v"] elif char in "Xx": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ksh"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["ksh"] elif char in "Yy": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["ya"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] #if self.unicodeConsiderations == False: # output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["y"] elif char in "Zz": if index < len(word)-1 and word[index+1] in 'aAeEiIoOuU': if word[index+1] in "Ii" and self.unicodeConsiderations == False: output = output + fontDict["i_velaanti"] output = output + fontDict["jh"] if word[index+1] in "Ii" and self.unicodeConsiderations == True: output = output + fontDict["i_velaanti"] if self.unicodeConsiderations == False: output = output + fontDict["kaanaa"] if word[index+1] in "AaiI": charsTranslated = 2 else: output = output + fontDict["jh"] elif char == "0": output = output + fontDict["0"] elif char == "1": output = output + fontDict["1"] elif char == "2": output = output + fontDict["2"] elif char == "3": output = output + fontDict["3"] elif char == "4": output = output + fontDict["4"] elif char == "5": output = output + fontDict["5"] elif char == "6": output = output + fontDict["6"] elif char == "7": output = output + fontDict["7"] elif char == "8": output = output + fontDict["8"] elif char == "9": output = output + fontDict["9"] elif char == ".": if index < len(word)-1 and word[index+1] in 'hmnorRx|MNcCuU': if word[index+1] in "h": output = output + fontDict[":"] charsTranslated = 2 elif word[index+1] in "mn": output = output + fontDict["timba"] charsTranslated = 2 elif word[index+1] in "MN": output = output + fontDict["chandra_bindu"] charsTranslated = 2 elif word[index+1] in "r": output = output + fontDict["rafar"] charsTranslated = 2 elif word[index+1] in "R": output = output + fontDict["kaawaLaa"] charsTranslated = 2 elif word[index+1] in "uU": output = output + fontDict["rukar"] charsTranslated = 2 elif word[index+1] in "x": output = output + fontDict["gunile"] charsTranslated = 2 elif word[index+1] in "|": output = output + fontDict["deerghaviraam"] charsTranslated = 2 elif word[index+1] in "c": output = output + fontDict["chandra"] charsTranslated = 2 elif word[index+1] in "C": output = output + fontDict["potphoDyaara"] charsTranslated = 2 elif word[index+1] in "o": if index < len(word)-2 and word[index+2] in "m": output = output + fontDict["om"] charsTranslated = 3 else: output = output + fontDict["."] else: output = output + fontDict["."] else: output = output + fontDict["."] elif char == ",": output = output + fontDict[","] elif char == ":": output = output + fontDict[":"] elif char == ";": output = output + fontDict[";"] elif char == "?": output = output + fontDict["?"] elif char == "*": output = output + fontDict["*"] elif char == "^": output = output + fontDict["^"] elif char == "'": output = output + fontDict["'"] elif char == '"': output = output + fontDict['"'] elif char == '%': output = output + fontDict['%'] elif char == '$': output = output + fontDict['$'] elif char == '-': output = output + fontDict['-'] elif char == '+': output = output + fontDict['+'] elif char == '=': output = output + fontDict['='] elif char in "@": output = output + fontDict['@'] elif char in "~": output = output + fontDict["tilda"] elif char in "`": output = output + fontDict["`"] elif char in "#": output = output + fontDict["#"] elif char in "&": output = output + fontDict["&"] elif char in "(": output = output + fontDict["("] elif char in ")": output = output + fontDict[")"] elif char in "[": output = output + fontDict["["] elif char in "]": output = output + fontDict["]"] elif char in "{": output = output + fontDict["{"] elif char in "}": output = output + fontDict["}"] elif char in "<": output = output + fontDict["<"] elif char in ">": output = output + fontDict[">"] elif char in "/": output = output + fontDict["/"] elif char in "\\": output = output + fontDict["\\"] elif char in "|": output = output + fontDict["|"] elif char in "!": output = output + fontDict["!"] elif char in " ": output = output + fontDict[" "] elif char in "\n": output = output + "\n" elif char in "\r": output = output + "\r" else: output = output + fontDict["om"] return output, charsTranslated class App: def __init__(self, master): self.werd_version = "1.3.2" self.werd_copyright = "WERD v 1.3.2 (C) 2007-2011, Atul Nene (www.atulnene.com)" self.master = master self.statusText = StringVar() self.mTextStr = StringVar() self.editorFontSize = StringVar() self.editorFontSize.set("L") # default value self.marathiFontName = "Shivaji01" self.marathiLabelFontSize = 15 self.marathiEditFontSize = 20 self.determineEditorFontSize() self.unicodeConsiderations = False self.tabList = {} self.pageList = {} self.currTabID = "About" self.fontDict = FontDict().getDict("Shivaji01") self.tr = TransLit() self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.fontDict1 = FontDict().getDict("Shivaji02") self.fontDict2 = FontDict().getDict("Shivaji02") self.fontDict3 = FontDict().getDict("Shivaji05") self.fontDict4 = FontDict().getDict("xdvng") self.fontDict5 = FontDict().getDict("akrutidev2") self.fontDict6 = FontDict().getDict("Mangal") self.fontDict7 = FontDict().getDict("Hindi_Gargi") self.currentWord = "" self.samples = [".| shree gaNeshaaya nama.h .|","a aa i ee e ei o ou am a.h", "ka kaa ki kee ku koo ke kei ka.c ko kou ka.m ka.M ka.h", "$ ~ om .om", "namaskaara, namashkaara", "aapa keise ho ? saba kushala ma.ngala to hei ?", "deepaka to mu.nshee premachandajee kaa fa.cna hei", "(98 + 5 - 3) .x 2 = 200", "kaamaata aahesa kaa ?", "maazyaashee bola naa, cha.cTa ? eemela ?", "pu. la. vaachala.nsa ? aaNee kusumaagraja ?", "yaa janmaawara yaa jagaNyaawara ka.upayaa prema karaave", "bhaarateeya sabhyataa bahuta praacheena hei", "paga ghu.ngaroo baa.ndha meeraa naachee thee", "pleeja mujhe kala sTeshana para Dra.capa karanaa, naa bhoolanaa", "1 Daalara kareeba $ 42 ke baraabara hei", "bhaarata maazee maata.ubhoomee aahe", "chhatrapatee shivaajee maharaajaa.nchaa vijaya aso", "mu.ngyaa.nnee merupava.rta tara giLalaa naahee naa ?", "o paavana.n, mhora.n bagaa kee", "o yaara, munne ko paraa.nThe khilaa", "are o saambhaa ! kitane aadamee the ?", "devanaagaree me sabhee bhaashhaa e.n vyakta ho sakatee hei.n", "ruda.RveeNaa me jyaadaatara khaja.r ke swara bajate hei.n", "chha dnyaa Thi khee kshe bhei Dho thou ha.m la.h", "( ) [ ] { } < > ", " - + .x = / \ | ! .|", "ka.rta.utvavaana chaa.Ndabeebeelaa kha.cafa navhataa", "shantanoo, vaa.Cyaawarachee varaata, da.ryaa, kramaa.nka, Rusheekesha, dnyaaneshwara, kshipraa" ] self.currSampleId = 0 self.frame = Frame (master) master.title(self.werd_copyright) self.frame.grid() self.infoFrame = Frame (self.frame, bd=1, relief=SUNKEN) self.infoFrame.grid(row=0,column=0,sticky=NSEW) self.workPanel = Frame (self.frame, bd=1, relief=SUNKEN) self.workPanel.grid(row=0, column=1, sticky=NSEW) self.tabPanel = Frame (self.workPanel) self.tabPanel.pack(fill=BOTH) self.fonts = ["Shivaji01", "Shivaji02", "Shivaji05", "xdvng", "akrutidev2", "Mangal (Unicode)", "Gargi (Unicode)"] self.label0 = Label (self.infoFrame, wraplength=150, text = "Write in English, Read in Devanagari with \nWERD, \nthe phonetic transliterator.\n", font=("Helvetica", 10, "bold")) self.label0.grid (row=0, columnspan=2) self.fontLabel = Label(self.infoFrame, text="Font :", anchor=CENTER) self.fontLabel.grid(row=1, column=0, columnspan=2, sticky=NSEW) self.varFont = IntVar() self.varFont.set(1) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[0], variable=self.varFont, value=1, command=self.cmdShivaji01) tmpRadio.grid(row=2, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[1], variable=self.varFont, value=2, command=self.cmdShivaji02) tmpRadio.grid(row=3, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[2], variable=self.varFont, value=3, command=self.cmdShivaji05) tmpRadio.grid(row=4, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[3], variable=self.varFont, value=4, command=self.cmdxdvng) tmpRadio.grid(row=5, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[4], variable=self.varFont, value=5, command=self.cmdAkrutiDev2) tmpRadio.grid(row=6, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[5], variable=self.varFont, value=6, command=self.cmdMangal) tmpRadio.grid(row=7, column=1, sticky=W) tmpRadio = Radiobutton (self.infoFrame, text=self.fonts[6], variable=self.varFont, value=7, command=self.cmdGargi) tmpRadio.grid(row=8, column=1, sticky=W) self.editorFontSizeLabel = Label(self.infoFrame, text="Size :", anchor=CENTER) #self.editorFontSizeLabel.pack(side=LEFT) self.editorFontSizeLabel.grid(row=9, column=0, columnspan=2, sticky=NSEW) self.tmpPanel = Frame (self.infoFrame) self.tmpPanel.grid (row=10, column=0, columnspan=2) editorFontSizes = ["S", "M", "L", "XL", "XXL"] tmpColumn = 0 for size in editorFontSizes: tmpRadio = Radiobutton (self.tmpPanel, text=size, variable=self.editorFontSize, value=size, command=self.cmdEditorFontSize, indicatoron=0) #tmpRadio.pack(side=LEFT) tmpRadio.grid(row=5, column=tmpColumn) tmpColumn = tmpColumn + 1 self.titleHindi = "a.ngrejee likho, devanaagaree paDho" self.label1 = Label (self.infoFrame, wraplength=150, text = self.tr.translateStr (self.titleHindi,self.fontDict), font=(self.marathiFontName, self.marathiLabelFontSize, "bold")) self.label1.grid (row=11, columnspan=2) self.titleMarathi = "i.ngrajee lihaa, devanaagaree vaachaa" self.label2 = Label (self.infoFrame, wraplength=150, text = self.tr.translateStr (self.titleMarathi,self.fontDict), font=(self.marathiFontName, self.marathiLabelFontSize, "bold")) self.label2.grid (row=12, columnspan=2) self.tmpPanel1 = Frame (self.workPanel) self.tmpPanel1.pack (fill=BOTH, expand=1) #self.separatorButton = Button (self.tmpPanel1, text=" ", relief=FLAT, bd=1) #self.separatorButton.grid (row=0, column=1) self.aboutTab = Button (self.tmpPanel1, relief=FLAT, text="About WERD", command=self.commandAbout) self.aboutTab.grid (row=1, column=0, sticky=NSEW) self.tabList["About"] = self.aboutTab self.helpTab = Button (self.tmpPanel1, relief=SUNKEN, text="Help", command=self.commandHelp) self.helpTab.grid (row=1, column=1, sticky=NSEW) self.tabList["Help"] = self.helpTab self.editorTab = Button (self.tmpPanel1, relief=SUNKEN, text="Transliterator", command=self.commandEditor) self.editorTab.grid (row=1, column=2, sticky=NSEW) self.tabList["Editor"] = self.editorTab self.examplesTab = Button (self.tmpPanel1, relief=SUNKEN, text="Examples", command=self.commandExamples) self.examplesTab.grid (row=1, column=3, sticky=NSEW) self.tabList["Examples"] = self.examplesTab self.schemeTab = Button (self.tmpPanel1, relief=SUNKEN, text="Phonetic Font Map", command=self.commandScheme) self.schemeTab.grid (row=1, column=4, sticky=NSEW) self.tabList["Scheme"] = self.schemeTab self.careTab = Button (self.tmpPanel1, relief=SUNKEN, text="Show You Care", command=self.commandCare) self.careTab.grid (row=1, column=5, sticky=NSEW) self.tabList["Care"] = self.careTab self.holderPanel = Frame (self.workPanel) self.holderPanel.pack(fill=BOTH, expand=1) self.aboutPanel = Frame (self.holderPanel) self.aboutPanel.pack(fill=BOTH, expand=1) self.pageList["About"] = self.aboutPanel self.currTabID = "About" self.label5 = Label (self.aboutPanel, text = "WERD is a phonetic transliterator that helps users write english text\nbut read the same in the chosen Devanagari (Indic) font. It lets a user type \nusing the english keyboard, and phonetically transliterates it for the \nappropriate Indic-Devanagari font, so that he can read in the Indian language \nof his choice. \n\nUser can then use the devanagari text for chat, email, and documents.", anchor=CENTER, justify=LEFT) self.label5.grid(row=0, sticky=NSEW) self.label3 = Label (self.aboutPanel, text = self.werd_copyright + "\nWERD comes with ABSOLUTELY NO WARRANTY; \n This is free software, and you are welcome to \nredistribute it under certain conditions; see \nhttp://www.gnu.org/licenses/gpl.html for details.\n") self.label3.grid(row=1, sticky=NSEW) self.label4 = Label (self.aboutPanel, text = "Please see http://werd.sourceforge.net/ for downloading fonts and other help.\n") self.label4.grid(row=2, sticky=NSEW) self.help = Label(self.aboutPanel, text='Ensure you have installed one of the fonts. \nThe Mangal font should be installed by default on your Windows system.\n\nUse WERD with your favorite application this way : \n1. Set the correct font in that application (eg. chat window, html email composer, \ndocument editor)\n2. Simply select and copy the devanagari content from Transliterate tab and paste into it.\nIts that easy ! Be sure to tell your friends too ...\nNote: Characters not supported by chosen font are displayed as "om"', bd=1, relief=SUNKEN, anchor=W, justify=LEFT) self.help.grid(row=3,sticky=NSEW) self.helpPanel = Frame (self.holderPanel) self.helpPanel.pack(fill=BOTH, expand=1) self.pageList["Help"] = self.helpPanel self.pageList["Help"].forget() tcl_patchLevel = root.tk.eval("return $tcl_patchLevel") tk_patchLevel = root.tk.eval("return $tk_patchLevel") python_version = sys.version self.label6 = Label (self.helpPanel, text = "Start typing in the upper text box on the \"Transliterate\" tab.\nThink of the sound of the Devanagari word you want to type. Start typing the \ncharacters that represent that sound. You will see the resulting word \nin the grey box below, so that you know you are typing the right english \ncharacters. \nIf you make a mistake, use the backspace key to delete and then type again.\nOnce you are done typing a word and press the space key, you will see your \nprevious word added to the lower text box. \n\nIts that easy, why don't you start with your name!\n\nAnytime you make any change to the text in the upper box, you can press \nthe \"Transliterate\" button to see the changes in the lower box. \nIf you are unsure what to type to get a particular devanagari output, you can \nlookup a few examples on the \"Examples\" tab. You can also see details \nof what sound maps to what output in the \"Phonetic Font Map\" tab.\n\nPlease note that for unicode fonts, the ouput will depend on the \nunicode rendering ability of your Operating System.", anchor=CENTER, justify=LEFT) self.label6.grid(row=0, sticky=NSEW) self.label8 = Label (self.helpPanel, text = "\nPlease see http://werd.sourceforge.net/ for downloading fonts and other help.\n\nPlease write to atul@atulnene.com with comments, suggestions and \ncustomization requests and include the following information in your email:") self.label8.grid(row=2, sticky=NSEW) self.versionText = Text (self.helpPanel, height=5, width=80, bd=1, background="light grey") self.versionText.insert(END, "WERD : v" + self.werd_version + "\nPython : " + python_version + "\nTCL : " + tcl_patchLevel + ", Tk : " + tk_patchLevel + "\nOS : " + os.name + ", Platform : " + sys.platform + ", Hex Version : " + `sys.hexversion`) if os.name == "nt": self.versionText.insert(END, "\nWindows Version : " + `sys.getwindowsversion()`) self.versionText.grid(row=5, column=0, padx=5) self.editorPanel = Frame (self.holderPanel) self.editorPanel.pack(fill=BOTH, expand=1) self.pageList["Editor"] = self.editorPanel self.pageList["Editor"].forget() self.eNotePanel = Frame (self.editorPanel) self.eNotePanel.pack(fill=BOTH, expand=1) self.eNoteScrollbar = Scrollbar (self.eNotePanel) self.eNoteScrollbar.pack(side=RIGHT, fill=Y) self.eNote = Text (self.eNotePanel, height=10, width=30, yscrollcommand=self.eNoteScrollbar.set) self.eNote.pack(side=LEFT, fill=BOTH, expand=1) self.eNote.bind('', self.reportEvent) self.eNoteScrollbar.config(command=self.eNote.yview) self.buttonPanel = Frame (self.editorPanel) self.buttonPanel.pack(fill=BOTH) self.preview = Label (self.buttonPanel, height=1, width=15, bd=1, relief=SUNKEN, anchor=W, justify=LEFT, font=(self.marathiFontName, self.marathiEditFontSize)) self.preview.pack(side=LEFT) self.trans = Button (self.buttonPanel, text="Transliterate Now", command=self.transliterate) self.trans.pack(side=LEFT) self.copyTo = Button (self.buttonPanel, text="Copy To Clipboard (Select+^C))", command=self.copyToClipboard) self.copyTo.pack(side=LEFT) self.appendTo = Button (self.buttonPanel, text="Add To Clipboard", command=self.appendToClipboard) self.appendTo.pack(side=LEFT) self.mNotePanel = Frame (self.editorPanel) self.mNotePanel.pack(fill=BOTH, expand=1) self.mNoteScrollbar = Scrollbar (self.mNotePanel) self.mNoteScrollbar.pack(side=RIGHT, fill=Y) self.mNote = Text (self.mNotePanel, height=10, width=20, font=(self.marathiFontName, self.marathiEditFontSize), yscrollcommand=self.mNoteScrollbar.set) self.mNote.pack(side=LEFT, fill=BOTH, expand=1) self.mNoteScrollbar.config(command=self.mNote.yview) self.examplePanel = Frame (self.holderPanel) self.examplePanel.pack(fill=BOTH, expand=1) self.pageList["Examples"] = self.examplePanel self.pageList["Examples"].forget() self.label00 = Label (self.examplePanel, text = "What you type ...") self.label00.grid(row=0, column=0) self.label01 = Label (self.examplePanel, text = "What you see ...") self.label01.grid(row=0, column=1) self.exMore = Button (self.examplePanel, text="More Examples >>", command=self.moreExamples) self.exMore.grid (row=7, column=0, sticky=NSEW, columnspan=2) self.exLabel10 = Label (self.examplePanel, wraplength=200, text=self.samples[0], font=("Helvetica", 10, "bold")) self.exLabel10.grid (row=1, column=0, stick=W) self.exLabel11 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[0],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel11.grid (row=1, column=1, sticky=W) self.exLabel20 = Label (self.examplePanel, wraplength=200, text=self.samples[1], font=("Helvetica", 10, "bold")) self.exLabel20.grid (row=2, column=0, sticky=W) self.exLabel21 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[1],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel21.grid (row=2, column=1, sticky=W) self.exLabel30 = Label (self.examplePanel, wraplength=200, text=self.samples[2], font=("Helvetica", 10, "bold")) self.exLabel30.grid (row=3, column=0, sticky=W) self.exLabel31 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[2],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel31.grid (row=3, column=1, sticky=W) self.exLabel40 = Label (self.examplePanel, wraplength=200, text=self.samples[3], font=("Helvetica", 10, "bold")) self.exLabel40.grid (row=4, column=0, sticky=W) self.exLabel41 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[3],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel41.grid (row=4, column=1, sticky=W) self.exLabel50 = Label (self.examplePanel, wraplength=200, text=self.samples[4], font=("Helvetica", 10, "bold")) self.exLabel50.grid (row=5, column=0, sticky=W) self.exLabel51 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[4],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel51.grid (row=5, column=1, sticky=W) self.exLabel60 = Label (self.examplePanel, wraplength=200, text=self.samples[5], font=("Helvetica", 10, "bold")) self.exLabel60.grid (row=6, column=0, sticky=W) self.exLabel61 = Label (self.examplePanel, wraplength=400, text = self.tr.translateStr (self.samples[5],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel61.grid (row=6, column=1, sticky=W) self.schemePanel = Frame (self.holderPanel) self.schemePanel.pack(fill=BOTH, expand=1) self.pageList["Scheme"] = self.schemePanel self.pageList["Scheme"].forget() self.labelA0 = Label (self.schemePanel, text="Sound", font=("bold")) self.labelA0.grid(row=0,column=0) self.labelB0 = Label (self.schemePanel, text="Shivaji01", font=("bold")) self.labelB0.grid(row=0,column=1) self.labelC0 = Label (self.schemePanel, text="Shivaji02", font=("bold")) self.labelC0.grid(row=0,column=2) self.labelD0 = Label (self.schemePanel, text="Shivaji05", font=("bold")) self.labelD0.grid(row=0,column=3) self.labelE0 = Label (self.schemePanel, text="xdvng", font=("bold")) self.labelE0.grid(row=0,column=4) self.labelF0 = Label (self.schemePanel, text="akrutidev2", font=("bold")) self.labelF0.grid(row=0,column=5) self.labelG0 = Label (self.schemePanel, text="Mangal", font=("bold")) self.labelG0.grid(row=0,column=6) self.labelH0 = Label (self.schemePanel, text="Gargi", font=("bold")) self.labelH0.grid(row=0,column=7) sounds = self.fontDict.keys() i = 1 self.labelA1 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA1.grid(row=1,column=0) self.labelB1 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB1.grid(row=1,column=1) self.labelC1 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC1.grid(row=1,column=2) self.labelD1 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD1.grid(row=1,column=3) self.labelE1 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE1.grid(row=1,column=4) self.labelF1 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF1.grid(row=1,column=5) self.labelG1 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG1.grid(row=1,column=6) self.labelH1 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH1.grid(row=1,column=7) i = i + 1 self.labelA2 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA2.grid(row=2,column=0) self.labelB2 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB2.grid(row=2,column=1) self.labelC2 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC2.grid(row=2,column=2) self.labelD2 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD2.grid(row=2,column=3) self.labelE2 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE2.grid(row=2,column=4) self.labelF2 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF2.grid(row=2,column=5) self.labelG2 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG2.grid(row=2,column=6) self.labelH2 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH2.grid(row=2,column=7) i = i + 1 self.labelA3 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA3.grid(row=3,column=0) self.labelB3 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB3.grid(row=3,column=1) self.labelC3 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC3.grid(row=3,column=2) self.labelD3 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD3.grid(row=3,column=3) self.labelE3 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE3.grid(row=3,column=4) self.labelF3 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF3.grid(row=3,column=5) self.labelG3 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG3.grid(row=3,column=6) self.labelH3 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH3.grid(row=3,column=7) i = i + 1 self.labelA4 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA4.grid(row=4,column=0) self.labelB4 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB4.grid(row=4,column=1) self.labelC4 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC4.grid(row=4,column=2) self.labelD4 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD4.grid(row=4,column=3) self.labelE4 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE4.grid(row=4,column=4) self.labelF4 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF4.grid(row=4,column=5) self.labelG4 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG4.grid(row=4,column=6) self.labelH4 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH4.grid(row=4,column=7) i = i + 1 self.labelA5 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA5.grid(row=5,column=0) self.labelB5 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB5.grid(row=5,column=1) self.labelC5 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC5.grid(row=5,column=2) self.labelD5 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD5.grid(row=5,column=3) self.labelE5 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE5.grid(row=5,column=4) self.labelF5 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF5.grid(row=5,column=5) self.labelG5 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG5.grid(row=5,column=6) self.labelH5 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH5.grid(row=5,column=7) i = i + 1 self.labelA6 = Label (self.schemePanel, text=sounds[i], font=("Helvetica", 15, "bold")) self.labelA6.grid(row=6,column=0) self.labelB6 = Label (self.schemePanel, text=" " + self.fontDict1[sounds[i]], font=("Shivaji01", self.marathiEditFontSize, "bold")) self.labelB6.grid(row=6,column=1) self.labelC6 = Label (self.schemePanel, text=" " + self.fontDict2[sounds[i]], font=("Shivaji02", self.marathiEditFontSize, "bold")) self.labelC6.grid(row=6,column=2) self.labelD6 = Label (self.schemePanel, text=" " + self.fontDict3[sounds[i]], font=("Shivaji05", self.marathiEditFontSize, "bold")) self.labelD6.grid(row=6,column=3) self.labelE6 = Label (self.schemePanel, text=" " + self.fontDict4[sounds[i]], font=("xdvng", self.marathiEditFontSize, "bold")) self.labelE6.grid(row=6,column=4) self.labelF6 = Label (self.schemePanel, text=" " + self.fontDict5[sounds[i]], font=("akrutidev2", self.marathiEditFontSize, "bold")) self.labelF6.grid(row=6,column=5) self.labelG6 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Mangal", self.marathiEditFontSize, "bold")) self.labelG6.grid(row=6,column=6) self.labelH6 = Label (self.schemePanel, text=" " + self.fontDict6[sounds[i]], font=("Hindi_Gargi", self.marathiEditFontSize, "bold")) self.labelH6.grid(row=6,column=7) i = i + 1 self.currIndex = 1 self.schemeMore = Button (self.schemePanel, text="More Sounds >>", command=self.moreSchemes) self.schemeMore.grid (row=7, column=0, columnspan=8, sticky=NSEW) self.carePanel = Frame (self.holderPanel) self.carePanel.pack(fill=BOTH, expand=1) self.pageList["Care"] = self.carePanel self.pageList["Care"].forget() self.label9 = Label (self.carePanel, text = "WERD is made available as free (as in freedom) software, to express my care for a cause. \nIf you like WERD, it would be a nice gesture on your part if you express your care \nfor something - sing a song to cheer someone up, donate for a cause, or help your \ncommunity, the environment, and the planet!\n\nWERD supports the cause of positive social change through educational empowerment \nbrought about by the non-governmental, non-profit, charitable organization \ncalled Jnana Prabodhini. Please see http://jnanaprabodhini.org/ for more information \nabout them and their work. You may want to follow @jnanaprabodhini on Twitter. \nYou are welcome to donate money, time, mindspace and/or contribute in any manner \nyou like.\n\nDo something to show you care!\n", anchor=CENTER, justify=LEFT) self.label9.grid(row=0, sticky=NSEW) self.avahanHindi = "mufta nahee.n, mukta prograama - yadee aapane yaha prograama upayukta paayaa ho, to ka.upayaa apane pasandeedaa maaga.r kaa chayana kara isa duniyaa ko behatara banaaye.n |" self.label10 = Label (self.carePanel, wraplength=300, text = self.tr.translateStr (self.avahanHindi,self.fontDict), font=(self.marathiFontName, self.marathiLabelFontSize, "bold")) self.label10.grid (row=2, sticky=NSEW) self.avahanMarathi = "phukaTa naahee, swatantra prograama - jara aapalyaalaa haa prograama upayukta waaTalaa asela tara ka.upayaa aapalyaalaa aawaDela tyaa maagaa.rne he jaga su.ndara hoNyaasa madata karaa |" self.label11 = Label (self.carePanel, wraplength=300, text = "\n" + self.tr.translateStr (self.avahanMarathi,self.fontDict), font=(self.marathiFontName, self.marathiLabelFontSize, "bold")) self.label11.grid (row=3, sticky=NSEW) def switchToTab(self, pageID): #print "current pageid " + self.currTabID self.tabList[self.currTabID].configure(relief=SUNKEN) self.pageList[self.currTabID].forget() self.currTabID = pageID #print "new pageid " + self.currTabID self.pageList[self.currTabID].pack() self.tabList[self.currTabID].configure(relief=FLAT) def commandAbout(self): if self.currTabID != "About": self.switchToTab ("About") def commandHelp(self): if self.currTabID != "Help": self.switchToTab ("Help") def commandEditor(self): if self.currTabID != "Editor": self.switchToTab ("Editor") def commandExamples(self): if self.currTabID != "Examples": self.switchToTab ("Examples") def commandScheme(self): if self.currTabID != "Scheme": self.switchToTab ("Scheme") def commandCare(self): if self.currTabID != "Care": self.switchToTab ("Care") def determineEditorFontSize(self): if self.marathiFontName == "xdvng" or self.marathiFontName=="Mangal" or self.marathiFontName=="Hindi_Gargi": if self.editorFontSize.get() == "S": self.marathiEditFontSize = 7 elif self.editorFontSize.get() == "M": self.marathiEditFontSize = 11 elif self.editorFontSize.get() == "L": self.marathiEditFontSize = 15 elif self.editorFontSize.get() == "XL": self.marathiEditFontSize = 19 elif self.editorFontSize.get() == "XXL": self.marathiEditFontSize = 21 else: if self.editorFontSize.get() == "S": self.marathiEditFontSize = 12 elif self.editorFontSize.get() == "M": self.marathiEditFontSize = 16 elif self.editorFontSize.get() == "L": self.marathiEditFontSize = 20 elif self.editorFontSize.get() == "XL": self.marathiEditFontSize = 24 elif self.editorFontSize.get() == "XXL": self.marathiEditFontSize = 28 def cmdEditorFontSize(self): oldMarathiEditFontSize = self.marathiEditFontSize self.determineEditorFontSize() if oldMarathiEditFontSize != self.marathiEditFontSize: self.mNote.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.preview.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.label1.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold")) self.label2.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold")) self.label10.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold")) self.label11.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold")) self.exLabel11.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel21.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel31.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel41.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel51.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel61.config(font=(self.marathiFontName, self.marathiEditFontSize)) def cmdMangal(self): self.marathiFontName = "Mangal" self.marathiLabelFontSize = 10 self.unicodeConsiderations = True self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdGargi(self): self.marathiFontName = "Hindi_Gargi" self.marathiLabelFontSize = 10 self.unicodeConsiderations = True self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdAkrutiDev2(self): self.marathiFontName = "akrutidev2" self.marathiLabelFontSize = 15 self.unicodeConsiderations = False self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdxdvng(self): self.marathiFontName = "xdvng" self.marathiLabelFontSize = 10 self.unicodeConsiderations = False self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdShivaji01(self): self.marathiFontName = "Shivaji01" self.marathiLabelFontSize = 15 self.unicodeConsiderations = False self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdShivaji02(self): self.marathiFontName = "Shivaji02" self.marathiLabelFontSize = 15 self.unicodeConsiderations = False self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def cmdShivaji05(self): self.marathiFontName = "Shivaji05" self.marathiLabelFontSize = 15 self.unicodeConsiderations = False self.tr.setUnicodeConsiderations (self.unicodeConsiderations) self.determineEditorFontSize() self.affectFontChange() def affectFontChange(self): self.fontDict = FontDict().getDict(self.marathiFontName) self.label1.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold"),text = self.tr.translateStr (self.titleHindi,self.fontDict)) self.label2.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold"),text = self.tr.translateStr (self.titleMarathi,self.fontDict)) self.label10.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold"),text = self.tr.translateStr (self.avahanHindi,self.fontDict)) self.label11.config(font=(self.marathiFontName, self.marathiEditFontSize, "bold"),text = self.tr.translateStr (self.avahanMarathi,self.fontDict)) self.preview.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.mNote.config(font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel11.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId], self.fontDict)) self.exLabel21.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId+1], self.fontDict)) self.exLabel31.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId+2], self.fontDict)) self.exLabel41.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId+3], self.fontDict)) self.exLabel51.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId+4], self.fontDict)) self.exLabel61.config(font=(self.marathiFontName, self.marathiEditFontSize),text = self.tr.translateStr (self.samples[self.currSampleId+5], self.fontDict)) self.transliterate() def reportEvent(self, event): #self.eNote.insert(END,event.keysym) #print event.keysym #print event.char #print event.keycode #print event.num #print event.type if event.keysym == "space": self.transliterate() self.currentWord = "" self.preview.config(text="") #self.preview.delete (1.0,END) elif event.keysym == "BackSpace": if len(self.currentWord) >= 1: self.currentWord = self.currentWord.rstrip(self.currentWord[len(self.currentWord)-1]) self.preview.config(text=self.tr.translateStr(self.currentWord, self.fontDict)) else: self.currentWord = self.currentWord + event.char self.preview.config(text=self.tr.translateStr(self.currentWord, self.fontDict)) def transliterate(self): self.mNote.delete (1.0,END) self.mNote.insert (END, self.tr.translateStr(self.eNote.get(1.0, END), self.fontDict)) def copyToClipboard(self): root.clipboard_clear() root.clipboard_append(self.mNote.get(1.0,END)) def appendToClipboard(self): root.clipboard_append(self.mNote.get(1.0,END)) def moreExamples(self): if (self.currSampleId + 6) == len(self.samples): self.currSampleId = 0 elif (self.currSampleId + 6) > len(self.samples): self.currSampleId = len(self.samples) - 6 else: self.currSampleId = self.currSampleId + 6 if (self.currSampleId + 6) > len(self.samples): self.currSampleId = len(self.samples) - 6 self.determineEditorFontSize() self.exLabel10.config(text=self.samples[self.currSampleId]) self.exLabel11.config(text = self.tr.translateStr (self.samples[self.currSampleId],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel20.config(text=self.samples[self.currSampleId+1]) self.exLabel21.config(text = self.tr.translateStr (self.samples[self.currSampleId+1],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel30.config(text=self.samples[self.currSampleId+2]) self.exLabel31.config(text = self.tr.translateStr (self.samples[self.currSampleId+2],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel40.config(text=self.samples[self.currSampleId+3]) self.exLabel41.config(text = self.tr.translateStr (self.samples[self.currSampleId+3],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel50.config(text=self.samples[self.currSampleId+4]) self.exLabel51.config(text = self.tr.translateStr (self.samples[self.currSampleId+4],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) self.exLabel60.config(text=self.samples[self.currSampleId+5]) self.exLabel61.config(text = self.tr.translateStr (self.samples[self.currSampleId+5],self.fontDict), font=(self.marathiFontName, self.marathiEditFontSize)) def moreSchemes(self): sounds = self.fontDict.keys() #print len (sounds), self.currIndex if (self.currIndex + 6) == len(sounds): self.currIndex = 0 elif (self.currIndex + 6) > len(sounds): self.currIndex = len(sounds) - 6 else: self.currIndex = self.currIndex + 6 if (self.currIndex + 6) > len(sounds): self.currIndex = len(sounds) - 6 #print len (sounds), self.currIndex i = self.currIndex self.labelA1.config(text=sounds[i]) self.labelB1.config(text=" " + self.fontDict1[sounds[i]]) self.labelC1.config(text=" " + self.fontDict2[sounds[i]]) self.labelD1.config(text=" " + self.fontDict3[sounds[i]]) self.labelE1.config(text=" " + self.fontDict4[sounds[i]]) self.labelF1.config(text=" " + self.fontDict5[sounds[i]]) self.labelG1.config(text=" " + self.fontDict6[sounds[i]]) self.labelH1.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 self.labelA2.config(text=sounds[i]) self.labelB2.config(text=" " + self.fontDict1[sounds[i]]) self.labelC2.config(text=" " + self.fontDict2[sounds[i]]) self.labelD2.config(text=" " + self.fontDict3[sounds[i]]) self.labelE2.config(text=" " + self.fontDict4[sounds[i]]) self.labelF2.config(text=" " + self.fontDict5[sounds[i]]) self.labelG2.config(text=" " + self.fontDict6[sounds[i]]) self.labelH2.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 self.labelA3.config(text=sounds[i]) self.labelB3.config(text=" " + self.fontDict1[sounds[i]]) self.labelC3.config(text=" " + self.fontDict2[sounds[i]]) self.labelD3.config(text=" " + self.fontDict3[sounds[i]]) self.labelE3.config(text=" " + self.fontDict4[sounds[i]]) self.labelF3.config(text=" " + self.fontDict5[sounds[i]]) self.labelG3.config(text=" " + self.fontDict6[sounds[i]]) self.labelH3.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 self.labelA4.config(text=sounds[i]) self.labelB4.config(text=" " + self.fontDict1[sounds[i]]) self.labelC4.config(text=" " + self.fontDict2[sounds[i]]) self.labelD4.config(text=" " + self.fontDict3[sounds[i]]) self.labelE4.config(text=" " + self.fontDict4[sounds[i]]) self.labelF4.config(text=" " + self.fontDict5[sounds[i]]) self.labelG4.config(text=" " + self.fontDict6[sounds[i]]) self.labelH4.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 self.labelA5.config(text=sounds[i]) self.labelB5.config(text=" " + self.fontDict1[sounds[i]]) self.labelC5.config(text=" " + self.fontDict2[sounds[i]]) self.labelD5.config(text=" " + self.fontDict3[sounds[i]]) self.labelE5.config(text=" " + self.fontDict4[sounds[i]]) self.labelF5.config(text=" " + self.fontDict5[sounds[i]]) self.labelG5.config(text=" " + self.fontDict6[sounds[i]]) self.labelH5.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 self.labelA6.config(text=sounds[i]) self.labelB6.config(text=" " + self.fontDict1[sounds[i]]) self.labelC6.config(text=" " + self.fontDict2[sounds[i]]) self.labelD6.config(text=" " + self.fontDict3[sounds[i]]) self.labelE6.config(text=" " + self.fontDict4[sounds[i]]) self.labelF6.config(text=" " + self.fontDict5[sounds[i]]) self.labelG6.config(text=" " + self.fontDict6[sounds[i]]) self.labelH6.config(text=" " + self.fontDict7[sounds[i]]) i = i + 1 def doQuit(self): self.master.quit() def doHelp(self): #TODO: dont know how to do this yet in a platform independent way #import os #os.popen("start http://www.atulnene.com/") pass root = Tk() app = App(root) root.mainloop () print"Thanks for using WERD. Bye"