Reviewers: ,


Please review this at http://codereview.tryton.org/59001/

Affected files:
  M tryton/gui/window/view_form/view/form_gtk/binary.py
  M tryton/gui/window/view_form/view/form_gtk/calendar.py
  M tryton/gui/window/view_form/view/form_gtk/char.py
  M tryton/gui/window/view_form/view/form_gtk/checkbox.py
  M tryton/gui/window/view_form/view/form_gtk/float_time.py
  M tryton/gui/window/view_form/view/form_gtk/integer.py
  M tryton/gui/window/view_form/view/form_gtk/interface.py
  M tryton/gui/window/view_form/view/form_gtk/many2many.py
  M tryton/gui/window/view_form/view/form_gtk/one2many.py
  M tryton/gui/window/view_form/view/form_gtk/progressbar.py
  M tryton/gui/window/view_form/view/form_gtk/reference.py
  M tryton/gui/window/view_form/view/form_gtk/selection.py
  M tryton/gui/window/view_form/view/form_gtk/textbox.py


Index: tryton/gui/window/view_form/view/form_gtk/binary.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/binary.py
+++ b/tryton/gui/window/view_form/view/form_gtk/binary.py
@@ -185,12 +185,6 @@
         self.but_save_as.set_sensitive(bool(field.get(record)))
         return True

-    def display_value(self):
-        if self.wid_text:
-            return self.wid_text.get_text()
-        else:
-            return ''
-
     def set_value(self, record, field):
         if self.wid_text:
             self.filename_field.set_client(self.record,

Index: tryton/gui/window/view_form/view/form_gtk/calendar.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/calendar.py
+++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py
@@ -105,9 +105,6 @@
             self.entry.set_text(value)
         return True

-    def display_value(self):
-        return self.entry.get_text()
-
     def cal_open(self, widget):
         win = gtk.Dialog(_('Date Selection'), self.window,
                 gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
@@ -241,9 +238,6 @@
             self.entry.set_text(value)
         return True

-    def display_value(self):
-        return self.entry.get_text()
-
     def cal_open(self, widget):
         win = gtk.Dialog(_('Date Time Selection'), self.window,
                 gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,

Index: tryton/gui/window/view_form/view/form_gtk/char.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/char.py
+++ b/tryton/gui/window/view_form/view/form_gtk/char.py
@@ -68,18 +68,16 @@
             value = ''
         else:
             value = field.get(record) or ''
-        self.display_value(value)

-    def display_value(self, value):
         if not self.autocomplete:
             self.entry.set_text(value)
-            return
-        for idx, row in enumerate(self.entry_store):
-            if row[0] == value:
-                self.entry.set_active(idx)
-                return
         else:
-            self.entry.get_child().set_text(value)
+            for idx, row in enumerate(self.entry_store):
+                if row[0] == value:
+                    self.entry.set_active(idx)
+                    return
+            else:
+                self.entry.get_child().set_text(value)

     def _readonly_set(self, value):
sensitivity = {True: gtk.SENSITIVITY_OFF, False: gtk.SENSITIVITY_AUTO}

Index: tryton/gui/window/view_form/view/form_gtk/checkbox.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/checkbox.py
+++ b/tryton/gui/window/view_form/view/form_gtk/checkbox.py
@@ -29,9 +29,3 @@
             self.widget.set_active(False)
             return False
         self.widget.set_active(bool(field.get(record)))
-
-    def display_value(self):
-        if self.widget.get_active():
-            return _('True')
-        else:
-            return _('False')

Index: tryton/gui/window/view_form/view/form_gtk/float_time.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/float_time.py
+++ b/tryton/gui/window/view_form/view/form_gtk/float_time.py
@@ -48,9 +48,6 @@

         self.entry.set_text(common.float_time_to_text(val, self.conv))

-    def display_value(self):
-        return self.entry.get_text()
-
     def _readonly_set(self, value):
         super(FloatTime, self)._readonly_set(value)
         self.entry.set_editable(not value)

Index: tryton/gui/window/view_form/view/form_gtk/integer.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/integer.py
+++ b/tryton/gui/window/view_form/view/form_gtk/integer.py
@@ -30,9 +30,6 @@
         self.entry.set_text(locale.format('%d',
             field.get(record) or 0, True))

-    def display_value(self):
-        return self.entry.get_text()
-
     def sig_insert_text(self, entry, new_text, new_text_length, position):
         value = entry.get_text()
         position = entry.get_position()

Index: tryton/gui/window/view_form/view/form_gtk/interface.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/interface.py
+++ b/tryton/gui/window/view_form/view/form_gtk/interface.py
@@ -110,9 +110,6 @@
             self.visible = True
             widget.show()

-    def display_value(self):
-        return self.field.get_client(self.record)
-
     def _focus_in(self):
         pass


Index: tryton/gui/window/view_form/view/form_gtk/many2many.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/many2many.py
+++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py
@@ -194,15 +194,6 @@
         self.screen.display()
         return True

-    def display_value(self):
-        ids = self.field.get_default(self.record)
-        try:
-            result = rpc.execute('model', self.attrs['relation'], 'read',
-                    ids, ['rec_name'], rpc.CONTEXT)
-        except TrytonServerError:
-            return str(ids)
-        return ', '.join(x['rec_name'] for x in result)
-
     def set_value(self, record, field):
         self.screen.current_view.set_value()
         return True

Index: tryton/gui/window/view_form/view/form_gtk/one2many.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/one2many.py
+++ b/tryton/gui/window/view_form/view/form_gtk/one2many.py
@@ -380,9 +380,6 @@
         self.screen.display()
         return True

-    def display_value(self):
-        return '<' + self.attrs.get('string', '') + '>'
-
     def set_value(self, record, field):
         self.screen.current_view.set_value()
         if self.screen.modified(): # TODO check if required

Index: tryton/gui/window/view_form/view/form_gtk/progressbar.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/progressbar.py
+++ b/tryton/gui/window/view_form/view/form_gtk/progressbar.py
@@ -35,6 +35,3 @@
         self.widget.set_text(locale.format('%.' + str(digits[1]) + 'f',
             value, True))
         self.widget.set_fraction(value / 100.0)
-
-    def display_value(self):
-        return self.widget.get_text()

Index: tryton/gui/window/view_form/view/form_gtk/reference.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/reference.py
+++ b/tryton/gui/window/view_form/view/form_gtk/reference.py
@@ -289,10 +289,6 @@
             self.but_open.set_image(img)
         self.changed = True

-    def display_value(self):
-        return self.widget_combo.get_child().get_text() + ', ' + \
-                self.wid_text.get_text()
-
     def sig_key_pressed(self, *args):
         key = args[1].string.lower()
         if self.last_key[0] == key:

Index: tryton/gui/window/view_form/view/form_gtk/selection.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/selection.py
+++ b/tryton/gui/window/view_form/view/form_gtk/selection.py
@@ -178,9 +178,6 @@
                 child.set_text('')
         self.changed = True

-    def display_value(self):
-        return self.entry.get_child().get_text()
-
     def sig_changed(self, *args):
         if self.changed:
             self._focus_out()

Index: tryton/gui/window/view_form/view/form_gtk/textbox.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/textbox.py
+++ b/tryton/gui/window/view_form/view/form_gtk/textbox.py
@@ -118,10 +118,3 @@
             elif spell:
                 spell.detach()
                 del spell
-
-    def display_value(self):
-        lines = (self.field.get_client(self.record) or '').split('\n')
-        if len(lines) > 1:
-            return lines[0] + '...'
-        else:
-            return lines[0]



--
[email protected] mailing list

Reply via email to