Allow to store wizard size
This commit is contained in:
1 parent
cbb27a36d7
commit
d39317bc55
5 files changed
+31
-16
No files matched your search
@@ -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
|
||||
|
||||
+1
-1
@@ -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],
|
||||
|
||||
+8
-8
@@ -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(
|
||||
'<tryton>/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(
|
||||
'<tryton>/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',
|
||||
|
||||
@@ -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():
|
||||
|
||||
+20
-6
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user