Merge lp:~numerigraphe/openobject-client/6.1-configurable-spinbuttons into lp:openobject-client/6.1

Proposed by Numérigraphe
Status: Needs review
Proposed branch: lp:~numerigraphe/openobject-client/6.1-configurable-spinbuttons
Merge into: lp:openobject-client/6.1
Diff against target: 52 lines (+7/-2)
3 files modified
bin/options.py (+1/-0)
bin/widget/view/form_gtk/spinbutton.py (+3/-1)
bin/widget/view/form_gtk/spinint.py (+3/-1)
To merge this branch: bzr merge lp:~numerigraphe/openobject-client/6.1-configurable-spinbuttons
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+133089@code.launchpad.net

Description of the change

I propose to add a configuration key to set the spin buttons' increment.
By setting it to 0 in the configuration file, one can disable spinning altogether. This is seen as a useful improvement by several of our users, because using the mouse wheel to scroll the form actually spins int/float widgets instead if the mouse cursor is on such a widget.
The default remains to increment/decrement by 1.0 on spin.
Lionel Sausin.

To post a comment you must log in.

Unmerged revisions

2050. By Numerigraphe - Lionel Sausin <email address hidden>

[IMP] Add a configuration option to set the increment of all spinbuttons in the config file. Set to 0.0 to disable spinning (users with wheelmouse hate spinbuttons in forms!)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/options.py'
--- bin/options.py 2011-10-13 06:29:51 +0000
+++ bin/options.py 2012-11-06 16:10:33 +0000
@@ -117,6 +117,7 @@
117 'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',117 'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',
118 'client.timeout': 3600,118 'client.timeout': 3600,
119 'client.form_text_spellcheck': True,119 'client.form_text_spellcheck': True,
120 'client.spinbutton_increment': 1.0,
120 }121 }
121 loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')122 loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')
122 parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))123 parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))
123124
=== modified file 'bin/widget/view/form_gtk/spinbutton.py'
--- bin/widget/view/form_gtk/spinbutton.py 2012-07-11 10:43:23 +0000
+++ bin/widget/view/form_gtk/spinbutton.py 2012-11-06 16:10:33 +0000
@@ -25,12 +25,14 @@
25import interface25import interface
26import tools26import tools
27from tools import user_locale_format27from tools import user_locale_format
28import options
2829
29class spinbutton(interface.widget_interface):30class spinbutton(interface.widget_interface):
30 def __init__(self, window, parent, model, attrs={}, label=None):31 def __init__(self, window, parent, model, attrs={}, label=None):
31 interface.widget_interface.__init__(self, window, parent, model, attrs, label_ebox=label)32 interface.widget_interface.__init__(self, window, parent, model, attrs, label_ebox=label)
3233
33 adj = gtk.Adjustment(0.0, -sys.maxint, sys.maxint, 1.0, 5.0)34 adj = gtk.Adjustment(0.0, -sys.maxint, sys.maxint,
35 float(options.options['client.spinbutton_increment']), 5.0)
34 self.widget = gtk.SpinButton(adj, 1.0, digits=int( attrs.get('digits',(14,2))[1] ) )36 self.widget = gtk.SpinButton(adj, 1.0, digits=int( attrs.get('digits',(14,2))[1] ) )
35 self.widget.set_activates_default(True)37 self.widget.set_activates_default(True)
36 self.widget.connect('populate-popup', self._menu_open)38 self.widget.connect('populate-popup', self._menu_open)
3739
=== modified file 'bin/widget/view/form_gtk/spinint.py'
--- bin/widget/view/form_gtk/spinint.py 2012-07-11 10:43:23 +0000
+++ bin/widget/view/form_gtk/spinint.py 2012-11-06 16:10:33 +0000
@@ -25,13 +25,15 @@
25import interface25import interface
26import tools26import tools
27from tools import user_locale_format27from tools import user_locale_format
28import options
2829
29class spinint(interface.widget_interface):30class spinint(interface.widget_interface):
3031
31 def __init__(self, window, parent, model, attrs={}, label=None):32 def __init__(self, window, parent, model, attrs={}, label=None):
32 interface.widget_interface.__init__(self, window, parent, model, attrs, label_ebox=label)33 interface.widget_interface.__init__(self, window, parent, model, attrs, label_ebox=label)
3334
34 adj = gtk.Adjustment(0.0, -sys.maxint, sys.maxint, 1.0, 5.0)35 adj = gtk.Adjustment(0.0, -sys.maxint, sys.maxint,
36 float(options.options['client.spinbutton_increment']), 5.0)
35 self.widget = gtk.SpinButton(adj, 1, digits=0)37 self.widget = gtk.SpinButton(adj, 1, digits=0)
36 self.widget.set_width_chars(5)38 self.widget.set_width_chars(5)
37 self.widget.set_activates_default(True)39 self.widget.set_activates_default(True)

Subscribers

People subscribed via source and target branches