Bug 669658

Summary: PyQt binding have no some functions from Qt 4.6
Product: Red Hat Enterprise Linux 6 Reporter: Коренберг Марк <mark>
Component: PyQt4Assignee: Than Ngo <than>
Status: CLOSED NOTABUG QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: low    
Version: 6.0Keywords: Reopened
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-28 23:02:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Коренберг Марк 2011-01-14 10:37:20 UTC
http://doc.qt.nokia.com/4.6-snapshot/qicon.html#fromTheme

pyqt binding does not have this function. It appear that binding is built against Qt 4.5

This function has appear in Qt 4.6

# strings /usr/lib/libQtGui.so | fgrep fromTheme
_ZN5QIcon9fromThemeERK7QStringRKS_
#

# strings /usr/lib/python2.6/site-packages/PyQt4/QtGui.so | fgrep fromTheme
#

Comment 2 Коренберг Марк 2011-01-14 11:07:08 UTC
also, this binding does not support keyword arguments:

... traceback cutted...
    (r,v)=QInputDialog.getText(None,self.title,labelify(label),text=init)
TypeError: getText() takes no keyword arguments


in Ubuntu, fromTheme and keyword are work from box

Comment 3 RHEL Program Management 2011-01-14 11:09:56 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 4 Than Ngo 2011-02-09 12:11:11 UTC
(In reply to comment #0)
> http://doc.qt.nokia.com/4.6-snapshot/qicon.html#fromTheme
> 
> pyqt binding does not have this function. It appear that binding is built
> against Qt 4.5
> 
> This function has appear in Qt 4.6
> 
> # strings /usr/lib/libQtGui.so | fgrep fromTheme
> _ZN5QIcon9fromThemeERK7QStringRKS_
> #
> 
> # strings /usr/lib/python2.6/site-packages/PyQt4/QtGui.so | fgrep fromTheme
> #

It's supported in qt-4.6 but not yet supported in PyQt4-4.6.2 upstream which is included in rhel6. For this function fromTheme the new version PyQt4 is needed.

(In reply to comment #2)
> also, this binding does not support keyword arguments:
> 
> ... traceback cutted...
>     (r,v)=QInputDialog.getText(None,self.title,labelify(label),text=init)
> TypeError: getText() takes no keyword arguments
> 
> 
> in Ubuntu, fromTheme and keyword are work from box
i wonder how it works for you, but taken a look at the qt source the function getText needs more arguments.

static QString getText(QWidget *parent, const QString &title, const QString &label,
                           QLineEdit::EchoMode echo = QLineEdit::Normal,
                           const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0);


so the 4. argument "QLineEdit::EchoMode" is missing here (r,v)=QInputDialog.getText(None,self.title,labelify(label),text=init) seems

Comment 5 Than Ngo 2011-02-10 16:35:34 UTC
the bug is closed as notabug, we don't plan to update new pyqt4 version in next rhel6 update.

Comment 6 Коренберг Марк 2011-02-14 13:13:31 UTC
No, QLineEdit::EchoMode is not missing. first 3 arguments are positional arguments, foreth argument is so called "keyword" argument. So, replacing "text=init" to just "init" will cause error.

Ubuntu:
================================================
mmarkk@mmarkk-work:~$ dpkg -l | fgrep -i python-qt
ii  python-qt4   4.7.4-0ubuntu1  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In [2]: from PyQt4.QtGui import *

In [3]: app=QApplication(list())
In [4]: QInputDialog.getText(None,'title','label')
Out[4]: (PyQt4.QtCore.QString(u'xxx'), True)

In [5]: QInputDialog.getText(None,'title','label','defaulttext')
---------------------------------------------------------------------------
TypeError: QInputDialog.getText(QWidget, QString, QString, QLineEdit.EchoMode mode=QLineEdit.Normal, QString text=QString(), Qt.WindowFlags flags=0) -> (QString, bool): argument 4 has unexpected type 'str'

In [8]: QInputDialog.getText(None,'title','label',text='init')
Out[8]: (PyQt4.QtCore.QString(u'init'), True)


RHEL6:
================================================
[mmarkk@RHEL6 ~]$ rpm -qa | fgrep -i pyqt
PyQt4-4.6.2-8.el6.i686
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>> from PyQt4.QtGui import *
>>> app=QApplication(list())
>>> QInputDialog.getText(None,'title','label')
(PyQt4.QtCore.QString(u'xxx'), True)

>>> QInputDialog.getText(None,'title','label',text='init')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: getText() takes no keyword arguments

Comment 7 Than Ngo 2012-06-28 23:02:32 UTC
(In reply to comment #6)
> No, QLineEdit::EchoMode is not missing. first 3 arguments are positional
> arguments, foreth argument is so called "keyword" argument. So, replacing
> "text=init" to just "init" will cause error.
> 
> Ubuntu:
> ================================================
> mmarkk@mmarkk-work:~$ dpkg -l | fgrep -i python-qt
> ii  python-qt4   4.7.4-0ubuntu1

it's new feature in sip-4.10/PyQt4-4.7.x which has the support for the keyword arguments. You should please use QInputDialog.getText(None,'title','label', QlineEdit.Normal, 'init' which is correct for PyQt-4.6/sip-4.9