6
from translation.translation import get_language
8
s = xmlrpclib.Server("http://192.168.0.4:8000")
10
view_form_end = """<?xml version="1.0"?>
11
<form string="Language file loaded.">
12
<image name="gtk-dialog-info" colspan="2"/>
13
<group colspan="2" col="4">
14
<separator string="Installation done" colspan="4"/>
15
<label align="0.0" string="Csv file for the selected language has been successfully installed in i18n" colspan="4"/>
19
view_form = """<?xml version="1.0"?>
20
<form string="Language Selection">
21
<image name="gtk-dialog-info" colspan="2"/>
22
<group colspan="2" col="4">
23
<separator string="Language List" colspan="4"/>
24
<label align="0.0" string="Choose a language to install:" colspan="4"/>
25
<field name="lang" colspan="4"/>
26
<label align="0.0" string="Note that this operation may take a few minutes." colspan="4"/>
31
class wizard_download_file_for_contrib(wizard.interface):
32
def _lang_install(self, cr, uid, data, context):
33
lang = data['form']['lang']
36
text = s.get_release(fname)
37
filename = tools.config["root_path"] + "/i18n/" + lang + ".csv"
38
fp = file(filename,'wb').write(text.encode('utf8'))
39
tools.s(cr.dbname, filename, lang)
42
raise wizard.except_wizard('Error !',"server is not properly configuraed")
45
def _get_language(sel, cr, uid,context):
46
return get_language(cr,uid,context,user='contributor')
49
'lang': {'string':'Language', 'type':'selection', 'selection':_get_language,
56
'result': {'type': 'form', 'arch': view_form, 'fields': fields_form,
58
('end', 'Cancel', 'gtk-cancel'),
59
('start', 'Download File', 'gtk-ok', True)
64
'actions': [_lang_install],
65
'result': {'type': 'form', 'arch': view_form_end, 'fields': {},
67
('end', 'Ok', 'gtk-ok', True)
72
wizard_download_file_for_contrib('download.contrib.file')