Add new options to store columns width

This commit is contained in:
Cédric Krier committed 2008-06-26 19:04:28 +02:00
1 parent 4527afe2b0
commit caf04a54eb
5 files changed
+35 -2

No files matched your search

+9 -1
View File
@@ -915,11 +915,19 @@
<child>
<widget class="GtkCheckMenuItem" id="opt_form_toolbar">
<property name="visible">True</property>
<property name="label" translatable="yes">Right Toolbar</property>
<property name="label" translatable="yes">Toolbar</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_opt_form_toolbar_activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="opt_tree_width">
<property name="visible">True</property>
<property name="label" translatable="yes">Save columns width</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_opt_tree_width_activate"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="forms_tab">
<property name="visible">True</property>
+1
View File
@@ -72,6 +72,7 @@ class ConfigManager(object):
'form.toolbar': True,
'client.form_tab': 'left',
'client.form_tab_orientation': 90,
'client.tree_width': True,
'client.lang': 'en_US',
'client.actions': {
'odt': {0: find_path(['ooffice', 'ooffice2'], '%s'),
+2
View File
@@ -574,6 +574,8 @@ class Main(object):
signals = {
'on_opt_form_toolbar_activate': (fnc_menuitem, 'form.toolbar',
'opt_form_toolbar'),
'on_opt_tree_width_activate': (fnc_menuitem, 'client.tree_width',
'opt_tree_width'),
}
self.glade.get_widget('menubar_'+(CONFIG['client.toolbar'] or \
'both')).set_active(True)
+20
View File
@@ -9,6 +9,7 @@ from tryton.action import Action
from tryton.common import message
import gettext
import tryton.common as common
from tryton.config import CONFIG
_ = gettext.gettext
@@ -363,6 +364,25 @@ class ViewList(ParserView):
return None
def destroy(self):
if CONFIG['client.tree_width']:
fields = {}
last_col = None
for col in self.widget_tree.get_columns():
if col.get_width() != col.width and col.get_visible():
fields[col.name] = col.get_width()
if col.get_visible():
last_col = col
#Don't set width for last visible columns
#as it depends of the screen size
if last_col and last_col.name in fields:
del fields[last_col.name]
if fields:
try:
rpc.execute('object', 'execute', 'ir.ui.view_tree_width',
'set_width', self.screen.name, fields, rpc.CONTEXT)
except:
pass
self.widget_tree.destroy()
del self.screen
del self.widget_tree
@@ -153,7 +153,9 @@ class ParserTree(ParserInterface):
width = int(fields[fname]['width'])
else:
width = twidth.get(fields[fname]['type'], 100)
col.set_min_width(width)
col.width = width
if width > 0:
col.set_fixed_width(width)
#XXX doesn't work well when resize columns
#col.set_expand(True)
if not treeview.sequence: