E5Gui/E5ComboBox.py

Wed, 30 Apr 2014 23:13:40 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 30 Apr 2014 23:13:40 +0200
branch
5_4_x
changeset 3553
389f83a37571
parent 3160
209a07d7e401
child 3178
f25fc1364c88
permissions
-rw-r--r--

Missing translation added; Translations regenerated.

# -*- coding: utf-8 -*-

# Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing combobox classes using the eric5 line edits.
"""

from PyQt4.QtGui import QComboBox


class E5ComboBox(QComboBox):
    """
    Class implementing a combobox using the eric5 line edit.
    """
    def __init__(self, parent=None, inactiveText=""):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        @param inactiveText text to be shown on inactivity (string)
        """
        super().__init__(parent)
        
        self.setMinimumHeight(24)
        
        from .E5LineEdit import E5LineEdit
        self.__lineedit = E5LineEdit(self, inactiveText)
        self.setLineEdit(self.__lineedit)
        
        self.setMinimumHeight(self.__lineedit.minimumHeight() + 3)
    
    def inactiveText(self):
        """
        Public method to get the inactive text.
        
        @return inactive text (string)
        """
        return self.__lineedit.inactiveText()
    
    def setInactiveText(self, inactiveText):
        """
        Public method to set the inactive text.
        
        @param inactiveText text to be shown on inactivity (string)
        """
        self.__lineedit.setInactiveText()


class E5ClearableComboBox(E5ComboBox):
    """
    Class implementing a combobox using the eric5 line edit.
    """
    def __init__(self, parent=None, inactiveText=""):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        @param inactiveText text to be shown on inactivity (string)
        """
        super().__init__(parent, inactiveText)
        
        from .E5LineEdit import E5ClearableLineEdit
        self.__lineedit = E5ClearableLineEdit(self, inactiveText)
        self.setLineEdit(self.__lineedit)

eric ide

mercurial