Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around a difference between PyQt4 and PySide QFont #54

Merged
merged 2 commits into from
Sep 24, 2013
Merged

Work around a difference between PyQt4 and PySide QFont #54

merged 2 commits into from
Sep 24, 2013

Conversation

WarrenWeckesser
Copy link
Contributor

by always calling setStyle() and setCapitalization() with arguments defined in the QFont class.

Without this change, several examples (e.g. examples/widgets/dock_area.enaml), and the test included in this PR, raise an exception because QFont.setStyle() is being called with an argument of the wrong type. For example, here's the output of running the new test:

$ nosetests test_q_resource_helpers.py 
E
======================================================================
ERROR: test_q_resource_helpers.test_QFont_from_Font
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/warren/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/warren/gitwork/nucleic_enaml/tests/test_q_resource_helpers.py", line 17, in test_QFont_from_Font
    qf = QFont_from_Font(f)
  File "/home/warren/local_anaconda_enaml/lib/python2.7/site-packages/enaml-0.8.0-py2.7-linux-x86_64.egg/enaml/qt/q_resource_helpers.py", line 188, in QFont_from_Font
    qfont.setStyle(font.style)
TypeError: 'PySide.QtGui.QFont.setStyle' called with wrong argument types:
  PySide.QtGui.QFont.setStyle(int)
Supported signatures:
  PySide.QtGui.QFont.setStyle(PySide.QtGui.QFont.Style)

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

by always calling setStyle() and setCapitalization() with
arguments defined in the QFont class.
@@ -9,6 +9,27 @@
from .QtGui import QColor, QFont, QImage, QIcon, QPixmap


from ..fontext import FontStyle, FontCaps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change this to "from enaml.fontext import ..."? I'm not fan of relative imports above the current (sub)package level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

sccolbert added a commit that referenced this pull request Sep 24, 2013
…pers

Work around a difference between PyQt4 and PySide QFont
@sccolbert sccolbert merged commit 90e1d1e into nucleic:master Sep 24, 2013
@sccolbert
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants