From 4c3027400c16e0c36e15ad8eb522dfd2dedda231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 20 Jul 2011 18:53:23 +0200 Subject: [PATCH] Remove unused display_value review59001 --- .../gui/window/view_form/view/form_gtk/binary.py | 6 ------ .../gui/window/view_form/view/form_gtk/calendar.py | 6 ------ tryton/gui/window/view_form/view/form_gtk/char.py | 14 ++++++-------- .../gui/window/view_form/view/form_gtk/checkbox.py | 6 ------ .../window/view_form/view/form_gtk/float_time.py | 3 --- .../gui/window/view_form/view/form_gtk/integer.py | 3 --- .../window/view_form/view/form_gtk/interface.py | 3 --- .../window/view_form/view/form_gtk/many2many.py | 9 --------- .../gui/window/view_form/view/form_gtk/one2many.py | 3 --- .../window/view_form/view/form_gtk/progressbar.py | 3 --- .../window/view_form/view/form_gtk/reference.py | 4 ---- .../window/view_form/view/form_gtk/selection.py | 3 --- .../gui/window/view_form/view/form_gtk/textbox.py | 7 ------- 13 files changed, 6 insertions(+), 64 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/binary.py b/tryton/gui/window/view_form/view/form_gtk/binary.py index 48bbd8b157..26c376e31f 100644 --- a/tryton/gui/window/view_form/view/form_gtk/binary.py +++ b/tryton/gui/window/view_form/view/form_gtk/binary.py @@ -184,12 +184,6 @@ class Binary(WidgetInterface): 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, diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index f746ec0e50..7b1ac1be87 100644 --- 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 @@ class Calendar(WidgetInterface): 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 @@ class DateTime(WidgetInterface): 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, diff --git a/tryton/gui/window/view_form/view/form_gtk/char.py b/tryton/gui/window/view_form/view/form_gtk/char.py index 1fca396a46..5913d71911 100644 --- 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 @@ class Char(WidgetInterface): 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} diff --git a/tryton/gui/window/view_form/view/form_gtk/checkbox.py b/tryton/gui/window/view_form/view/form_gtk/checkbox.py index f3d5bc34a6..af53de82ac 100644 --- 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 @@ class CheckBox(WidgetInterface): 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') diff --git a/tryton/gui/window/view_form/view/form_gtk/float_time.py b/tryton/gui/window/view_form/view/form_gtk/float_time.py index 3fa5c60b25..cefbec4c89 100644 --- 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 @@ class FloatTime(WidgetInterface): 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) diff --git a/tryton/gui/window/view_form/view/form_gtk/integer.py b/tryton/gui/window/view_form/view/form_gtk/integer.py index 77d950d845..1600b6c876 100644 --- 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 @@ class Integer(Char): 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() diff --git a/tryton/gui/window/view_form/view/form_gtk/interface.py b/tryton/gui/window/view_form/view/form_gtk/interface.py index b1644d4ee2..ac52d4f52b 100644 --- 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 @@ class WidgetInterface(object): self.visible = True widget.show() - def display_value(self): - return self.field.get_client(self.record) - def _focus_in(self): pass diff --git a/tryton/gui/window/view_form/view/form_gtk/many2many.py b/tryton/gui/window/view_form/view/form_gtk/many2many.py index bef11b06fb..8720c42ba5 100644 --- 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 @@ class Many2Many(WidgetInterface): 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 diff --git a/tryton/gui/window/view_form/view/form_gtk/one2many.py b/tryton/gui/window/view_form/view/form_gtk/one2many.py index da281d56ed..e3e6114ac0 100644 --- 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 @@ class One2Many(WidgetInterface): 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 diff --git a/tryton/gui/window/view_form/view/form_gtk/progressbar.py b/tryton/gui/window/view_form/view/form_gtk/progressbar.py index 79e2b00f03..9c1618da78 100644 --- 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 @@ class ProgressBar(WidgetInterface): 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() diff --git a/tryton/gui/window/view_form/view/form_gtk/reference.py b/tryton/gui/window/view_form/view/form_gtk/reference.py index b612de1c29..6d12ce9487 100644 --- a/tryton/gui/window/view_form/view/form_gtk/reference.py +++ b/tryton/gui/window/view_form/view/form_gtk/reference.py @@ -290,10 +290,6 @@ class Reference(WidgetInterface): 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: diff --git a/tryton/gui/window/view_form/view/form_gtk/selection.py b/tryton/gui/window/view_form/view/form_gtk/selection.py index f9eeb290f0..745579417a 100644 --- a/tryton/gui/window/view_form/view/form_gtk/selection.py +++ b/tryton/gui/window/view_form/view/form_gtk/selection.py @@ -179,9 +179,6 @@ class Selection(WidgetInterface): 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() diff --git a/tryton/gui/window/view_form/view/form_gtk/textbox.py b/tryton/gui/window/view_form/view/form_gtk/textbox.py index 17f4e9bd87..040fee5989 100644 --- 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 @@ class TextBox(WidgetInterface): 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]