diff --git a/CHANGELOG b/CHANGELOG index be83ff6c1a..dd54b4a58a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Allow to store wizard size * Add reset default on fields * Store in config default width and height of main window * Added arrow navigation if supported by gtk diff --git a/tryton/config.py b/tryton/config.py index f4170bcc9d..08a8fb5328 100644 --- a/tryton/config.py +++ b/tryton/config.py @@ -77,7 +77,7 @@ class ConfigManager(object): 'client.modepda': False, 'client.toolbar': 'default', 'client.form_tab': 'left', - 'client.tree_width': True, + 'client.save_width_height': True, 'client.spellcheck': False, 'client.default_path': get_home_dir(), 'client.lang': locale.getdefaultlocale()[0], diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 7ef4890471..2a78c5fc47 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -625,15 +625,15 @@ class Main(object): if CONFIG['form.toolbar']: checkmenuitem_toolbar.set_active(True) - checkmenuitem_tree_width = gtk.CheckMenuItem(_('Save Columns Width')) - checkmenuitem_tree_width.connect('activate', - lambda menuitem: CONFIG.__setitem__('client.tree_width', + checkmenuitem_save_width_height = gtk.CheckMenuItem(_('Save Width/Height')) + checkmenuitem_save_width_height.connect('activate', + lambda menuitem: CONFIG.__setitem__('client.save_width_height', menuitem.get_active())) - checkmenuitem_tree_width.set_accel_path( - '/Options/Form/Save Columns Width') - menu_form.add(checkmenuitem_tree_width) - if CONFIG['client.tree_width']: - checkmenuitem_tree_width.set_active(True) + checkmenuitem_save_width_height.set_accel_path( + '/Options/Form/Save Width Height') + menu_form.add(checkmenuitem_save_width_height) + if CONFIG['client.save_width_height']: + checkmenuitem_save_width_height.set_active(True) checkmenuitem_spellcheck = gtk.CheckMenuItem(_('Spell Checking')) checkmenuitem_spellcheck.connect('activate', diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index c10eb24d1a..7c0a3a3979 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -477,7 +477,7 @@ class ViewList(ParserView): return None def destroy(self): - if CONFIG['client.tree_width']: + if CONFIG['client.save_width_height']: fields = {} last_col = None for col in self.widget_tree.get_columns(): diff --git a/tryton/wizard/main.py b/tryton/wizard/main.py index b28dc7b465..75fa0093b8 100644 --- a/tryton/wizard/main.py +++ b/tryton/wizard/main.py @@ -7,6 +7,7 @@ import thread, time from tryton.gui.window.view_form.screen import Screen import os import pango +from tryton.config import CONFIG _ = gettext.gettext @@ -15,8 +16,9 @@ class Dialog(object): "Dialog for wizard" def __init__(self, arch, fields, state, obj_name, parent, - context=None): + action='', size=(0, 0), context=None): self.parent = parent + self.action = action self.states = [] default = -1 self.dia = gtk.Dialog(_('Wizard'), parent, @@ -96,11 +98,11 @@ class Dialog(object): width, height = self.screen.screen_container.size_get() parent_width, parent_height = parent.get_size() - widget_width = min(parent_width - 20, width + 20) - widget_height = min(parent_height - 60, height + 25) - self.screen.widget.set_size_request(widget_width, widget_height) + self.widget_width = max(min(parent_width - 20, width + 20), size[0]) + self.widget_height = max(min(parent_height - 60, height + 25), size[1]) + self.dia.set_default_size(self.widget_width, + self.widget_height) self.screen.widget.show() - self.dia.set_title(self.screen.current_view.title) self.dia.show() self.screen.new(default=False) @@ -117,6 +119,17 @@ class Dialog(object): or (res<0) or (self.states[res]=='end'): break self.screen.display() + + if CONFIG['client.save_width_height']: + width, height = self.dia.get_size() + if (width, height) != (self.widget_width, self.widget_height): + try: + rpc.execute('model', 'ir.action.wizard_size', 'set_size', + self.action, self.screen.name, width, height, + rpc.CONTEXT) + except: + pass + if res < len(self.states) and res >= 0: datas.update(self.screen.get()) self.dia.hide() @@ -187,7 +200,8 @@ class Wizard(object): if res['type'] == 'form': if not dia: dia = Dialog(res['arch'], res['fields'], res['state'], - res['object'], parent, context=ctx) + res['object'], parent, action=action, + size=res['size'], context=ctx) dia.screen.current_model.set(datas['form']) res2 = dia.run(datas['form']) if not res2: