Swap out some noop code for pylint suppression

This commit is contained in:
Chris Jones 2009-09-06 23:52:58 +01:00
parent 1d2e96ac72
commit d5ff98211c

View File

@ -17,12 +17,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor
# , Boston, MA 02110-1301 USA
# pylint: disable-msg=W0212
""" Editable Label class"""
import gtk
import gobject
class EditableLabel(gtk.EventBox):
# pylint: disable-msg=W0212
# pylint: disable-msg=R0904
"""
An eventbox that partialy emulate a gtk.Label
On double-click, the label is editable, entering an empty will revert back to automatic text
@ -62,9 +63,10 @@ class EditableLabel(gtk.EventBox):
def get_text( self ):
"""get the text from the label"""
return self._label.get_text()
return(self._label.get_text())
def _on_click_text(self, widget, event):
# pylint: disable-msg=W0613
"""event handling text edition"""
if event.type == gtk.gdk._2BUTTON_PRESS:
self.remove (self._label)
@ -80,12 +82,11 @@ class EditableLabel(gtk.EventBox):
self._on_entry_keypress)
self._entry_handler_id.append(sig)
self._entry.grab_focus ()
return True
# make pylint happy
if 1 or widget or event:
return False
return(True)
return(False)
def _entry_to_label (self, widget, event):
# pylint: disable-msg=W0613
"""replace gtk.Entry by the gtk.Label"""
if self._entry and self._entry in self.get_children():
#disconnect signals to avoid segfault :s
@ -98,12 +99,11 @@ class EditableLabel(gtk.EventBox):
self._entry = None
self.show_all ()
self.emit('edit-done')
return True
#make pylint happy
if 1 or widget or event:
return False
return(True)
return(False)
def _on_entry_activated (self, widget):
# pylint: disable-msg=W0613
"""get the text entered in gtk.Entry"""
entry = self._entry.get_text ()
label = self._label.get_text ()
@ -115,17 +115,11 @@ class EditableLabel(gtk.EventBox):
self._label.set_text (entry)
self._entry_to_label (None, None)
# make pylint happy
if 1 or widget:
return
def _on_entry_keypress (self, widget, event):
# pylint: disable-msg=W0613
"""handle keypressed in gtk.Entry"""
key = gtk.gdk.keyval_name (event.keyval)
if key == 'Escape':
self._entry_to_label (None, None)
# make pylint happy
if 1 or widget or event:
return
gobject.type_register(EditableLabel)