E5Gui/E5LineEdit.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2990
583beaf0b4b8
child 3145
a9de05d4a22f
--- a/E5Gui/E5LineEdit.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/E5Gui/E5LineEdit.py	Fri Oct 18 23:00:41 2013 +0200
@@ -10,8 +10,9 @@
 from __future__ import unicode_literals    # __IGNORE_WARNING__
 
 from PyQt4.QtCore import pyqtSignal, Qt, QEvent, qVersion
-from PyQt4.QtGui import QLineEdit, QStyle, QPainter, QPalette, QStyleOptionFrameV2, \
-    QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy
+from PyQt4.QtGui import QLineEdit, QStyle, QPainter, QPalette, \
+    QStyleOptionFrameV2, QWidget, QHBoxLayout, QBoxLayout, QLayout, \
+    QApplication, QSpacerItem, QSizePolicy
 
 import UI.PixmapCache
 
@@ -34,7 +35,7 @@
         """
         Protected method to handle events.
         
-        @param reference to the event (QEvent)
+        @param evt reference to the event (QEvent)
         @return flag indicating, whether the event was recognized (boolean)
         """
         if evt.type() == QEvent.LayoutRequest:
@@ -89,7 +90,8 @@
         else:
             self.__rightLayout.setDirection(QBoxLayout.LeftToRight)
         
-        horizontalSpacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
+        horizontalSpacer = QSpacerItem(
+            0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
         self.__mainLayout.addWidget(
             self.__leftWidget, 0, Qt.AlignVCenter | Qt.AlignLeft)
         self.__mainLayout.addItem(horizontalSpacer)
@@ -124,7 +126,7 @@
         """
         Protected method to handle events.
         
-        @param reference to the event (QEvent)
+        @param evt reference to the event (QEvent)
         @return flag indicating, whether the event was recognized (boolean)
         """
         if evt.type() == QEvent.LayoutDirectionChange:
@@ -152,8 +154,8 @@
                not self.hasFocus():
                 panel = QStyleOptionFrameV2()
                 self.initStyleOption(panel)
-                textRect = \
-                    self.style().subElementRect(QStyle.SE_LineEditContents, panel, self)
+                textRect = self.style().subElementRect(
+                    QStyle.SE_LineEditContents, panel, self)
                 textRect.adjust(2, 0, 0, 0)
                 left = self.textMargin(self.LeftSide)
                 right = self.textMargin(self.RightSide)
@@ -162,7 +164,8 @@
                 painter.setPen(self.palette().brush(
                     QPalette.Disabled, QPalette.Text).color())
                 painter.drawText(
-                    textRect, Qt.AlignLeft | Qt.AlignVCenter, self.__inactiveText)
+                    textRect, Qt.AlignLeft | Qt.AlignVCenter,
+                    self.__inactiveText)
     
     def _updateTextMargins(self):
         """
@@ -182,7 +185,8 @@
         Public method to add a widget to a side.
         
         @param widget reference to the widget to add (QWidget)
-        @param position position to add to (E5LineEdit.LeftSide, E5LineEdit.RightSide)
+        @param position position to add to (E5LineEdit.LeftSide,
+            E5LineEdit.RightSide)
         """
         if widget is None:
             return
@@ -232,7 +236,9 @@
         """
         Public method to get the text margin for a side.
         
-        @param position side to get margin for (E5LineEdit.LeftSide, E5LineEdit.RightSide)
+        @param position side to get margin for (E5LineEdit.LeftSide,
+            E5LineEdit.RightSide)
+        @return text margin (integer)
         """
         spacing = self.__rightLayout.spacing()
         w = 0
@@ -248,7 +254,7 @@
         """
         Public method to get the inactive text.
         
-        return inactive text (string)
+        @return inactive text (string)
         """
         if qVersion() < "4.7.0":
             return self.__inactiveText
@@ -270,17 +276,18 @@
 
 class E5ClearableLineEdit(E5LineEdit):
     """
-    Class implementing a line edit widget showing some inactive text and a clear button,
-    if it has some contents.
+    Class implementing a line edit widget showing some inactive text and a
+    clear button, if it has some contents.
     """
-    def __init__(self, parent=None, inactiveText="", side=E5LineEdit.RightSide):
+    def __init__(self, parent=None, inactiveText="",
+                 side=E5LineEdit.RightSide):
         """
         Constructor
         
         @param parent reference to the parent widget (QWidget)
         @keyparam inactiveText text to be shown on inactivity (string)
-        @keyparam side side the clear button should be shown at (E5LineEdit.RightSide,
-            E5LineEdit.LeftSide)
+        @keyparam side side the clear button should be shown at
+            (E5LineEdit.RightSide, E5LineEdit.LeftSide)
         """
         assert side in [E5LineEdit.RightSide, E5LineEdit.LeftSide]
         

eric ide

mercurial