Changeset 3831:37c83162790b in orange


Ignore:
Timestamp:
05/06/08 14:46:48 (6 years ago)
Author:
gregor <gregor@…>
Branch:
default
Convert:
116dfb079baafd7db2c8b2f6c2c094f2994c51de
Message:
  • cleaned the code
  • bug fix: <> in exceptions were not printed
  • now printing also " "
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeCanvas/orngOutput.py

    r3816 r3831  
    1919        self.textOutput = QTextEdit(self) 
    2020        self.textOutput.setReadOnly(1) 
    21         self.textOutput.setCurrentFont(QFont('Courier New',10, QFont.Normal)) 
    22         #self.setCentralWidget(self.textOutput) 
     21 
    2322        self.setWidget(self.textOutput) 
    2423        self.setWindowTitle("Output Window") 
     
    3433 
    3534        self.logFile = open(os.path.join(canvasDlg.canvasSettingsDir, "outputLog.htm"), "w") # create the log file 
    36         #self.printExtraOutput = 0 
    3735        self.unfinishedText = "" 
    3836        self.verbosity = 0 
     
    8886 
    8987    def clear(self): 
    90         self.textOutput.setHtml("") 
     88        self.textOutput.clear() 
    9189 
    9290    # print text produced by warning and error widget calls 
     
    124122        cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)      # the text will be appended to the end of the 
    125123        self.textOutput.setTextCursor(cursor)                             # existing text 
    126         self.textOutput.insertHtml(text)                                  # then append the text 
     124        if text == " ": self.textOutput.insertHtml("&nbsp;") 
     125        else:           self.textOutput.insertHtml(text)                                  # then append the text 
    127126        cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)      # and then scroll down to the end of the text 
    128127        self.textOutput.setTextCursor(cursor) 
     
    151150            text += "<hr>" 
    152151        t = localtime() 
    153         text += "<nobr>Unhandled exception of type <b>%s </b> occured at %d:%02d:%02d:</nobr><br><nobr>Traceback:</nobr><br>" % ( str(type) , t[3],t[4],t[5]) 
     152        text += "<nobr>Unhandled exception of type <b>%s </b> occured at %d:%02d:%02d:</nobr><br><nobr>Traceback:</nobr><br>" % ( str(type).replace("<", "(").replace(">", ")") , t[3],t[4],t[5]) 
    154153 
    155154        if self.printException: 
     
    173172 
    174173        value = str(value).replace("<", "(").replace(">", ")")    # since this is rich text control, we have to replace special characters 
    175         text += "<nobr>" + totalSpace + "Exception type: <b>" + str(type) + "</b></nobr><br>" 
     174        text += "<nobr>" + totalSpace + "Exception type: <b>" + str(type).replace("<", "(").replace(">", ")") + "</b></nobr><br>" 
    176175        text += "<nobr>" + totalSpace + "Exception value: <b>" + value+ "</b></nobr><hr>" 
    177176        text = text.replace("<br>","<br>\n") 
Note: See TracChangeset for help on using the changeset viewer.