def refreshToolTip(self): return # first we need to get the signals that are sent through the line, there might be more than one so we do it here. outinstance = self.outWidget.instance() outSignalIDs = [i[1] for i in redRSignalManager.getLinksByWidgetInstance(outinstance, self.inWidget.instance())] tip = 'Signal Data Summary:\n' for id in outSignalIDs: s = outinstance.outputs.getSignal(id) if s and s['value'] != None: tip += s['value'].summary()+'\n' #redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'orngCanvasItems in refreshToolTip; setting tooltip to %s' % tip) self.setToolTip(tip)
def mouseDoubleClickEvent(self, ev): point = self.mapToScene(ev.pos()) activeItem = self.scene().itemAt(point) if type(activeItem) in [orngCanvasItems.CanvasWidget]: # if we clicked on a widget #print activeItem, _('Item double clicked') self.tempWidget = activeItem self.openActiveWidget() elif type(activeItem) == orngCanvasItems.CanvasLine: import redRSignalManager enabled = False for l in redRSignalManager.getLinksByWidgetInstance(activeItem.outWidget.instance(), activeItem.inWidget.instance()): if l[2]: enabled = True break self.doc.resetActiveSignals(activeItem.outWidget, activeItem.inWidget, enabled = enabled) activeItem.inWidget.updateTooltip() activeItem.outWidget.updateTooltip() activeItem.updateTooltip()
def removeLineInstance(line): """This function removes all links between two widgets and also removes the line instance. This is called to remove any line instances.""" import redRSignalManager obsoleteSignals = redRSignalManager.getLinksByWidgetInstance(line.outWidget.instance(), line.inWidget.instance()) #obsoleteSignals = line.outWidget.instance().outputs.getSignalLinks(line.inWidget.instance()) redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, _('Removing obsolete signals %s') % unicode(obsoleteSignals)) redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'removing the following signals %s' % unicode(obsoleteSignals)) for o,i,e,n in obsoleteSignals: #signal = line.inWidget.instance().inputs.getSignal(id) line.outWidget.instance().outputs.removeSignal(i, o.wid) for k, l in _lines.items(): if l == line: del _lines[k] line.inWidget.removeLine(line) line.outWidget.removeLine(line) line.inWidget.updateTooltip() line.outWidget.updateTooltip() line.remove()
def getSignals(self): """Return a list of outName and inName for all signals connected to the inwidget instance""" return redRSignalManager.getLinksByWidgetInstance(self.outWidget.instance(), self.inWidget.instance())
def getEnabled(self): import redRSignalManager for l in redRSignalManager.getLinksByWidgetInstance(self.outWidget.instance(), self.inWidget.instance()): if l[2]: return True return False
def getNoData(self): import redRSignalManager for l in redRSignalManager.getLinksByWidgetInstance(self.outWidget.instance(), self.inWidget.instance()): if l[0].value == None: return True return False