Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #881 from cmft/py3_taurusgraphic
Browse files Browse the repository at this point in the history
Adapt TaurusGraphicsAttributeItem to be compatible with python3
  • Loading branch information
Carlos Pascual authored Mar 20, 2019
2 parents 2440c73 + fc4a527 commit ff3edaf
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/taurus/qt/qtgui/graphic/taurusgraphic.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,21 @@ class QGraphicsTextBoxing(Qt.QGraphicsItemGroup):
_TEXT_RATIO = 0.8

def __init__(self, parent=None, scene=None):
Qt.QGraphicsItemGroup.__init__(self, parent, scene)
self._rect = Qt.QGraphicsRectItem(self, scene)
Qt.QGraphicsItemGroup.__init__(self, parent)
if scene is not None:
scene.addItem(self)
self._rect = Qt.QGraphicsRectItem(self)
if scene is not None:
scene.addItem(self._rect)
self._rect.setBrush(Qt.QBrush(Qt.Qt.NoBrush))
self._rect.setPen(Qt.QPen(Qt.Qt.NoPen))
self._text = Qt.QGraphicsTextItem(self, scene)
self._text.scale(self._TEXT_RATIO, self._TEXT_RATIO)
self._text = Qt.QGraphicsTextItem(self)
if scene is not None:
scene.addItem(self._text)
self._text.setTransform(
Qt.QTransform.fromScale(self._TEXT_RATIO, self._TEXT_RATIO),
True)

self._validBackground = None
# using that like the previous code create a worst result
self.__layoutValide = True
Expand Down Expand Up @@ -1163,8 +1172,9 @@ def updateStyle(self):
_frName = None
else:
_frName = 'rvalue.magnitude'
text = self._currText = self.getDisplayValue(fragmentName=_frName)
self._currText = text.decode('unicode-escape')
text = self.getDisplayValue(fragmentName=_frName)

self._currText = text
self._currHtmlText = None

TaurusGraphicsItem.updateStyle(self)
Expand Down

0 comments on commit ff3edaf

Please sign in to comment.