From 3afc5bfb19fb3b104030ae8065ab99472ac1cf8d Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Tue, 25 Nov 2008 20:09:54 +0000 Subject: [PATCH] smaller default size for newforms floats and ints(2) --- deluge/ui/webui/lib/newforms_plus.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/deluge/ui/webui/lib/newforms_plus.py b/deluge/ui/webui/lib/newforms_plus.py index 7b4e07e45..66b3145f7 100644 --- a/deluge/ui/webui/lib/newforms_plus.py +++ b/deluge/ui/webui/lib/newforms_plus.py @@ -199,7 +199,15 @@ class _DelugeIntInputWidget(newforms.TextInput): pass return newforms.TextInput.render(self, name, value, attrs) -class DelugeInt(newforms.IntegerField): +class IntegerField(newforms.IntegerField): + def widget_attrs(self, widget): + return {'size': "8"} + +class FloatField(newforms.FloatField): + def widget_attrs(self, widget): + return {'size': "8"} + +class DelugeInt(IntegerField): def __init__(self, label , **kwargs): newforms.IntegerField.__init__(self, label=label, min_value=-1, max_value=sys.maxint, widget=_DelugeIntInputWidget, **kwargs) @@ -209,10 +217,6 @@ class DelugeInt(newforms.IntegerField): value = -1 return int(newforms.IntegerField.clean(self, value)) - def widget_attrs(self, widget): - return {'size': "8"} - - class DelugeFloat(DelugeInt): def clean(self, value): try: @@ -221,14 +225,6 @@ class DelugeFloat(DelugeInt): pass return float(DelugeInt.clean(self, value)) - def widget_attrs(self, widget): - return {'size': "8"} - -class FloatField(newforms.FloatField): - def widget_attrs(self, widget): - return {'size': "8"} - - class StringList(Field): """for a list of strings """