enthought / enthought/traitsui

AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack' is raised when running "demo.py"

Open
#115 0 comments 0 reactions 0 assignees View on GitHub
toolkit: Qt
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

issue with: pyface/ui/qt4/code_editor/pygments_highlighter.py

an AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack' is raised when PyQt4 is used as the Qt4 backend. The issue does not appear with PySide.
Checking whether the "syntax_stack" attr exists solves the issue.

```
def highlightBlock(self, qstring):
""" Highlight a block of text.
"""
qstring = unicode(qstring)
prev_data = self.previous_block_data()

if prev_data is not None:
# fix
if hasattr(prev_data, "syntax_stack"):
self._lexer._epd_state_stack = prev_data.syntax_stack
elif hasattr(self._lexer, '_epd_state_stack'):
del self._lexer._epd_state_stack
```

Tested on OSX, with the most recent macports py26-pyqt4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.