diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-07-22 16:24:36 +0200 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-07-22 16:24:36 +0200 |
| commit | 2dd9723b8b3d38df8c8962300ab67afffa5cdaaa (patch) | |
| tree | 13dbea91b265af5ad775af16efcdef4ae6ef962c /bin/addons/base/module/wizard/wizard_export_lang.py | |
| parent | c5c7c2ef07b346b72eb5a48d6e8cc7a433fba2e8 (diff) | |
convert tabs to 4 spaces
bzr revid: christophe@tinyerp.com-20080722142436-143iu4ryy47w3av0
Diffstat (limited to 'bin/addons/base/module/wizard/wizard_export_lang.py')
| -rw-r--r-- | bin/addons/base/module/wizard/wizard_export_lang.py | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/bin/addons/base/module/wizard/wizard_export_lang.py b/bin/addons/base/module/wizard/wizard_export_lang.py index 3f7fa8f99df..3a4a4e82ae9 100644 --- a/bin/addons/base/module/wizard/wizard_export_lang.py +++ b/bin/addons/base/module/wizard/wizard_export_lang.py @@ -40,114 +40,114 @@ from osv import fields,osv ''' view_form_init="""<?xml version="1.0"?> <form string="Export language"> - <image name="gtk-dialog-info" colspan="2"/> - <group colspan="2" col="4"> - <separator string="Export translation file" colspan="4"/> - <label align="0.0" string="Choose a language to export:" colspan="4"/> - <field name="lang" colspan="4"/> - </group> + <image name="gtk-dialog-info" colspan="2"/> + <group colspan="2" col="4"> + <separator string="Export translation file" colspan="4"/> + <label align="0.0" string="Choose a language to export:" colspan="4"/> + <field name="lang" colspan="4"/> + </group> </form>""" view_form_finish="""<?xml version="1.0"?> <form string="Export language"> - <image name="gtk-dialog-info" colspan="2"/> - <group colspan="2" col="4"> - <separator string="Export done" colspan="4"/> - <field name="data" readonly="1" colspan="3"/> - <label align="0.0" string="Save this document to a .CSV file and open it with\n your favourite spreadsheet software. The file\n encoding is UTF-8. You have to translate the latest\n column before reimporting it." colspan="4"/> - </group> + <image name="gtk-dialog-info" colspan="2"/> + <group colspan="2" col="4"> + <separator string="Export done" colspan="4"/> + <field name="data" readonly="1" colspan="3"/> + <label align="0.0" string="Save this document to a .CSV file and open it with\n your favourite spreadsheet software. The file\n encoding is UTF-8. You have to translate the latest\n column before reimporting it." colspan="4"/> + </group> </form>""" class wizard_export_lang(wizard.interface): - def _get_language(self, cr, uid, context): - lang_obj=pooler.get_pool(cr.dbname).get('res.lang') - ids=lang_obj.search(cr, uid, [('active', '=', True),]) - langs=lang_obj.browse(cr, uid, ids) - return [(lang.code, lang.translatable and lang.name or _('New language')) for lang in langs] + def _get_language(self, cr, uid, context): + lang_obj=pooler.get_pool(cr.dbname).get('res.lang') + ids=lang_obj.search(cr, uid, [('active', '=', True),]) + langs=lang_obj.browse(cr, uid, ids) + return [(lang.code, lang.translatable and lang.name or _('New language')) for lang in langs] - def _get_file(self, cr, uid, data, context): - file=tools.trans_generate(data['form']['lang'], 'all', dbname=cr.dbname) - buf=StringIO.StringIO() - writer=csv.writer(buf, 'UNIX') - for row in file: - writer.writerow(row) - del file - out=base64.encodestring(buf.getvalue()) - buf.close() - return {'data': out} + def _get_file(self, cr, uid, data, context): + file=tools.trans_generate(data['form']['lang'], 'all', dbname=cr.dbname) + buf=StringIO.StringIO() + writer=csv.writer(buf, 'UNIX') + for row in file: + writer.writerow(row) + del file + out=base64.encodestring(buf.getvalue()) + buf.close() + return {'data': out} - fields_form={ - 'lang': {'string':'Language', 'type':'selection', 'selection':_get_language,}, - } - fields_form_finish={ - 'data': {'string':'File', 'type':'binary', 'readonly': True,}, - } - states={ - 'init':{ - 'actions': [], - 'result': {'type': 'form', 'arch': view_form_init, 'fields': fields_form, - 'state': [ - ('end', 'Cancel', 'gtk-cancel'), - ('finish', 'Ok', 'gtk-ok', True) - ] - } - }, - 'finish':{ - 'actions': [_get_file], - 'result': {'type': 'form', 'arch': view_form_finish, - 'fields': fields_form_finish, - 'state': [ - ('end', 'Close', 'gtk-cancel', True) - ] - } - }, - } + fields_form={ + 'lang': {'string':'Language', 'type':'selection', 'selection':_get_language,}, + } + fields_form_finish={ + 'data': {'string':'File', 'type':'binary', 'readonly': True,}, + } + states={ + 'init':{ + 'actions': [], + 'result': {'type': 'form', 'arch': view_form_init, 'fields': fields_form, + 'state': [ + ('end', 'Cancel', 'gtk-cancel'), + ('finish', 'Ok', 'gtk-ok', True) + ] + } + }, + 'finish':{ + 'actions': [_get_file], + 'result': {'type': 'form', 'arch': view_form_finish, + 'fields': fields_form_finish, + 'state': [ + ('end', 'Close', 'gtk-cancel', True) + ] + } + }, + } wizard_export_lang('module.lang.export') ''' class wizard_export_lang(osv.osv_memory): - def _get_languages(self, cr, uid, context): - lang_obj=pooler.get_pool(cr.dbname).get('res.lang') - ids=lang_obj.search(cr, uid, [('active', '=', True),]) - langs=lang_obj.browse(cr, uid, ids) - return [(lang.code, lang.translatable and lang.name or _('New language')) for lang in langs] - + def _get_languages(self, cr, uid, context): + lang_obj=pooler.get_pool(cr.dbname).get('res.lang') + ids=lang_obj.search(cr, uid, [('active', '=', True),]) + langs=lang_obj.browse(cr, uid, ids) + return [(lang.code, lang.translatable and lang.name or _('New language')) for lang in langs] + - def act_cancel(self, cr, uid, ids, context=None): - #self.unlink(cr, uid, ids, context) - return {'type':'ir.actions.act_window_close' } + def act_cancel(self, cr, uid, ids, context=None): + #self.unlink(cr, uid, ids, context) + return {'type':'ir.actions.act_window_close' } - def act_destroy(self, *args): - return {'type':'ir.actions.act_window_close' } + def act_destroy(self, *args): + return {'type':'ir.actions.act_window_close' } - def act_getfile(self, cr, uid, ids, context=None): - this = self.browse(cr, uid, ids)[0] - mods = map(lambda m: m.name, this.modules) - mods.sort() - buf=StringIO.StringIO() - - tools.trans_export(this.lang, mods, buf, this.format, dbname=cr.dbname) + def act_getfile(self, cr, uid, ids, context=None): + this = self.browse(cr, uid, ids)[0] + mods = map(lambda m: m.name, this.modules) + mods.sort() + buf=StringIO.StringIO() + + tools.trans_export(this.lang, mods, buf, this.format, dbname=cr.dbname) - if this.format == 'csv': - this.advice = _("Save this document to a .CSV file and open it with your favourite spreadsheet software. The file encoding is UTF-8. You have to translate the latest column before reimporting it.") - elif this.format == 'po': - this.advice = _("Save this document to a .po file and edit it with a specific software or a text editor. The file encoding is UTF-8.") - - out=base64.encodestring(buf.getvalue()) - buf.close() - return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice}, context=context) + if this.format == 'csv': + this.advice = _("Save this document to a .CSV file and open it with your favourite spreadsheet software. The file encoding is UTF-8. You have to translate the latest column before reimporting it.") + elif this.format == 'po': + this.advice = _("Save this document to a .po file and edit it with a specific software or a text editor. The file encoding is UTF-8.") + + out=base64.encodestring(buf.getvalue()) + buf.close() + return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice}, context=context) - _name = "wizard.module.lang.export" - _columns = { - 'lang': fields.selection(_get_languages, 'Language',required=True), - 'format': fields.selection( ( ('csv','CSV File'), ('po','PO File') ), 'File Format', required=True), - 'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules', domain=[('state','=','installed')]), - 'data': fields.binary('File', readonly=True), - 'advice': fields.text('', readonly=True), - 'state': fields.selection( ( ('choose','choose'), # choose language - ('get','get'), # get the file - ) ), - } - _defaults = { 'state': lambda *a: 'choose', } + _name = "wizard.module.lang.export" + _columns = { + 'lang': fields.selection(_get_languages, 'Language',required=True), + 'format': fields.selection( ( ('csv','CSV File'), ('po','PO File') ), 'File Format', required=True), + 'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules', domain=[('state','=','installed')]), + 'data': fields.binary('File', readonly=True), + 'advice': fields.text('', readonly=True), + 'state': fields.selection( ( ('choose','choose'), # choose language + ('get','get'), # get the file + ) ), + } + _defaults = { 'state': lambda *a: 'choose', } wizard_export_lang() |
