<reponame>jimpassmore/imagepy<filename>imagepy/menus/Help/Language/language_plgs.py
from imagepy import IPy
from imagepy.core.manager import ColorManager, LanguageManager
from imagepy.core.engine import Free

class Plugin(Free):
	def __init__(self, key):
		self.title = key
		asyn = False

	#process
	def run(self, para = None):
		LanguageManager.set(self.title)
		IPy.curapp.reload_plugins()

	def __call__(self):
		return self

plgs = [Plugin(i) for i in list(LanguageManager.langs.keys())]
plgs.insert(0, Plugin('English'))
plgs.append('-')


class NewLanguage(Free):
	title = 'New Language'
	para = {'name':'your language'}
	view = [(str, 'name', 'name','')]

	def run(self, para = None):
		LanguageManager.newdic(para['name'])
		LanguageManager.write()

class UpdateDictionary(Free):
	title = 'Update Dictionary'

	def run(self, para = None):
		LanguageManager.add()
		LanguageManager.write()

class CleanDictionary(Free):
	title = 'Clean Dictionary'

	def run(self, para = None):
		LanguageManager.rm()
		LanguageManager.write()

plgs.extend([NewLanguage, UpdateDictionary, CleanDictionary])

print(plgs)

if __name__ == '__main__':
	print(list(ColorManager.luts.keys()))
    