Skip to content

Commit

Permalink
Merge pull request #55 from klauer/qlabel_fallback
Browse files Browse the repository at this point in the history
REF: fall back to QLabel if no channel is associated with PyDMLabel
  • Loading branch information
prjemian committed Jun 24, 2020
2 parents e28b5d6 + 7136c5d commit 3b1fecf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/adl2pydm/output_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def write_basic_attribute(self, qw, block):
brush = self.writer.writeOpenTag(propty, "brush", brushstyle=fill)
self.write_color_element(brush, block.color, alpha="255")

if qw.attrib["class"] not in ("PyDMLabel",):
if qw.attrib["class"] not in ("PyDMLabel", "QLabel"):
propty = self.writer.writeOpenProperty(qw, "penStyle", stdset="0")
pen = dict(
solid = "Qt::SolidLine",
Expand Down Expand Up @@ -230,7 +230,13 @@ def write_block(self, parent, block):
handler = self.pydm_widget_handlers.get(
block.symbol,
self.write_block_default)

cls = widget_info["pydm_widget"]
if cls == 'PyDMLabel' and not (block.contents.get('monitor') or
block.contents.get('control')):
# Fall back to QLabel, as there is no associated channel.
cls = 'QLabel'

# if block.symbol.find("chart") >= 0:
# _z = 2
# TODO: PyDMDrawingMMM (Line, Polygon, Oval, ...) need more decisions here
Expand Down

0 comments on commit 3b1fecf

Please sign in to comment.