def _moduleListMenu(userid): modulemenu = popuplib.easymenu('xalistmodulemenu_'+str(userid),None,_modulemenu_select) modulemenu.settitle(xalang['module overview']) modulemenu.submenu(mainmenu) menulist.append(modulemenu) for module in sorted(xa.modules()): module = xa.find(module) if os.path.exists("%s/modules/%s/strings.ini" % (xa.coredir(), module)): modulemenu.addoption(str(module), xalanguage.language.createLanguageString(module.getAddonInfo().name)) return modulemenu
def _moduleListMenu(userid): modulemenu = popuplib.easymenu('xalistmodulemenu_' + str(userid), None, _modulemenu_select) modulemenu.settitle(xalang['module overview']) modulemenu.submenu(mainmenu) menulist.append(modulemenu) for module in sorted(xa.modules()): module = xa.find(module) if os.path.exists("%s/modules/%s/strings.ini" % (xa.coredir(), module)): modulemenu.addoption( str(module), xalanguage.language.createLanguageString( module.getAddonInfo().name)) return modulemenu
def _inputbox_handle(): userid = es.getcmduserid() count = int(es.getargc()) if count > 5: parent = es.getargv(1) if popuplib.exists(parent): module = es.getargv(2) if xa.exists(module): module = xa.find(module) keylist = langlist[str(module)] lang = es.getargv(3) key = es.getargv(4) if not key in keylist: key = es.getargv(4).replace('+', ' ') if module and lang and key in keylist: i = 5 newvalue = '' while i < count: newvalue = newvalue + ' ' + es.getargv(i) i = i + 1 newvalue = newvalue.strip() if newvalue: language = cfglib.AddonINI( "%s/modules/%s/strings.custom.ini" % (xa.coredir(), module)) language.addValueToGroup(key, lang, newvalue, True) language.write() es.tell( userid, '#green', xalang('string warning', playerlib.getPlayer(userid).get('lang'))) else: newvalue = langlist[str(module)](key, lang) try: langlist[str(module)] = module.language.getLanguage() except IOError: pass es.esctextbox( 10, userid, "Changed '" + str(keylist(key, lang)) + "' string", "Changed '%s' to '%s'\nThe language menu is open again.\nPress [ESC] a second time." % (keylist(key, lang), newvalue)) menu = _stringEditMenu(userid, module, key, parent) menu.send(userid) else: es.esctextbox(10, userid, "Invalid Entry", "<string>")
def _inputbox_handle(): userid = es.getcmduserid() count = int(es.getargc()) if count > 5: parent = es.getargv(1) if popuplib.exists(parent): module = es.getargv(2) if xa.exists(module): module = xa.find(module) keylist = langlist[str(module)] lang = es.getargv(3) key = es.getargv(4) if not key in keylist: key = es.getargv(4).replace('+', ' ') if module and lang and key in keylist: i = 5 newvalue = '' while i < count: newvalue = newvalue+' '+es.getargv(i) i = i + 1 newvalue = newvalue.strip() if newvalue: language = cfglib.AddonINI("%s/modules/%s/strings.custom.ini" % (xa.coredir(), module)) language.addValueToGroup(key, lang, newvalue, True) language.write() es.tell(userid, '#green', xalang('string warning', playerlib.getPlayer(userid).get('lang'))) else: newvalue = langlist[str(module)](key, lang) try: langlist[str(module)] = module.language.getLanguage() except IOError: pass es.esctextbox(10, userid, "Changed '"+str(keylist(key, lang))+"' string", "Changed '%s' to '%s'\nThe language menu is open again.\nPress [ESC] a second time." %(keylist(key, lang),newvalue)) menu = _stringEditMenu(userid, module, key, parent) menu.send(userid) else: es.esctextbox(10, userid, "Invalid Entry", "<string>")