Changeset 8124:2fb0b52428b4 in orange


Ignore:
Timestamp:
07/29/11 11:42:08 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
e69020efecb752f75cc93a74229b4c9248a92968
Message:

Fixed an error when reseting the widget signals (a line was deleted but its in/outWidget attr was still accessed).

Location:
orange/OrangeCanvas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeCanvas/orngCanvasItems.py

    r8042 r8124  
    212212 
    213213    def updateTooltip(self): 
    214         status = self.getEnabled() == 0 and " (Disabled)" or "" 
    215         string = "<nobr><b>" + self.outWidget.caption + "</b> --> <b>" + self.inWidget.caption + "</b>" + status + "</nobr><hr>Signals:<br>" 
    216         for (outSignal, inSignal) in self.getSignals(): 
    217             string += "<nobr> &nbsp; &nbsp; - " + outSignal + " --> " + inSignal + "</nobr><br>" 
    218         string = string[:-4] 
    219         self.setToolTip(string) 
    220  
    221         # print the text with the signals 
    222         self.caption = "\n".join([outSignal for (outSignal, inSignal) in self.getSignals()]) 
    223         self.captionItem.setHtml("<center>%s</center>" % self.caption.replace("\n", "<br/>")) 
    224         self.updatePainterPath() 
     214        if self.inWidget and self.outWidget: 
     215            status = self.getEnabled() == 0 and " (Disabled)" or "" 
     216            string = "<nobr><b>" + self.outWidget.caption + "</b> --> <b>" + self.inWidget.caption + "</b>" + status + "</nobr><hr>Signals:<br>" 
     217            for (outSignal, inSignal) in self.getSignals(): 
     218                string += "<nobr> &nbsp; &nbsp; - " + outSignal + " --> " + inSignal + "</nobr><br>" 
     219            string = string[:-4] 
     220            self.setToolTip(string) 
     221     
     222            # print the text with the signals 
     223            self.caption = "\n".join([outSignal for (outSignal, inSignal) in self.getSignals()]) 
     224            self.captionItem.setHtml("<center>%s</center>" % self.caption.replace("\n", "<br/>")) 
     225            self.updatePainterPath() 
    225226 
    226227    def hoverEnterEvent(self, event): 
  • orange/OrangeCanvas/orngView.py

    r8042 r8124  
    163163    def resetLineSignals(self): 
    164164        if self.selectedLine: 
    165             self.doc.resetActiveSignals(self.selectedLine.outWidget, self.selectedLine.inWidget, enabled = self.doc.signalManager.getLinkEnabled(self.selectedLine.outWidget.instance, self.selectedLine.inWidget.instance)) 
    166             self.selectedLine.inWidget.updateTooltip() 
    167             self.selectedLine.outWidget.updateTooltip() 
     165            outWidget, inWidget = self.selectedLine.outWidget, self.selectedLine.inWidget 
     166            self.doc.resetActiveSignals(outWidget, inWidget, enabled = self.doc.signalManager.getLinkEnabled(outWidget.instance, inWidget.instance)) 
     167            inWidget.updateTooltip() 
     168            outWidget.updateTooltip() 
    168169            self.selectedLine.updateTooltip() 
    169170 
     
    391392                QMessageBox.information( self, "Orange Canvas", "Please wait until Orange finishes processing signals.") 
    392393                return 
    393             self.doc.resetActiveSignals(activeItem.outWidget, activeItem.inWidget, enabled = self.doc.signalManager.getLinkEnabled(activeItem.outWidget.instance, activeItem.inWidget.instance)) 
    394             activeItem.inWidget.updateTooltip() 
    395             activeItem.outWidget.updateTooltip() 
     394            inWidget, outWidget = activeItem.inWidget, activeItem.outWidget 
     395            self.doc.resetActiveSignals(outWidget, inWidget, enabled = self.doc.signalManager.getLinkEnabled(outWidget.instance, inWidget.instance)) 
     396            inWidget.updateTooltip() 
     397            outWidget.updateTooltip() 
    396398            activeItem.updateTooltip() 
    397399             
Note: See TracChangeset for help on using the changeset viewer.