RefactoringRope/AddParameterDialog.py

Sun, 06 Jul 2014 14:23:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 06 Jul 2014 14:23:25 +0200
changeset 87
1fbf5fdbe721
parent 76
936b2a98fe4e
child 88
e71619898d0f
child 94
03d6a17c66ac
permissions
-rw-r--r--

Ported to PyQt5 and eric6.

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

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

"""
Module implementing the Add New Parameter dialog.
"""

from __future__ import unicode_literals

from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog, QDialogButtonBox

from Ui_AddParameterDialog import Ui_AddParameterDialog


class AddParameterDialog(QDialog, Ui_AddParameterDialog):
    """
    Class implementing the Add New Parameter dialog.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
        self.__okButton.setEnabled(False)
        
        msh = self.minimumSizeHint()
        self.resize(max(self.width(), msh.width()), msh.height())
    
    @pyqtSlot(str)
    def on_nameEdit_textChanged(self, txt):
        """
        Private slot called, when the name entry is changed.
        
        @param txt text of the entry (string)
        """
        self.__okButton.setEnabled(txt != "")
    
    def getData(self):
        """
        Public method to extract the data entered into the dialog.
        
        @return tuple of three strings (name, default and value)
        """
        return (self.nameEdit.text(),
                self.defaultEdit.text(),
                self.valueEdit.text())

eric ide

mercurial