Skip to content

Commit

Permalink
#401 better handles none text containing widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvisteach committed Mar 4, 2018
1 parent ee7fccb commit 2e5f6f6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions examples/issues/issue401.py
Expand Up @@ -7,7 +7,11 @@ def __init__(self, topLevel):
self._topLevel = topLevel

def buildTag(self, tag, data, details):
xml = "<" + tag + ">" + "<text>" + data + "</text>" + details + "</" + tag + ">\n"
xml = "<" + tag + ">"
if data is not None:
xml += "<text>" + data + "</text>"
xml += details
xml += "</" + tag + ">\n"
return xml

def getClass(self, widg):
Expand All @@ -19,11 +23,10 @@ def getClass(self, widg):

def getText(self, widg):
try:
text = widg.cget('text')
text = widg.cget('text').replace("&", "&amp;")
if text == "": text = "-EMPTY-"
except: text = "-NONE-"
text = text.replace("&", "&amp;")
return text
return text
except: return None

def getDetails(self, widg):
try:
Expand Down Expand Up @@ -82,3 +85,5 @@ def makeExplorer():

with app.subWindow("sub"):
app.label("in sub")

app.addStatusbar()

0 comments on commit 2e5f6f6

Please sign in to comment.