Beispiel #1
0
    def createTickerPlotFromView(self, data):
        """

        """
        from profit.workbench.tickerplotdisplay import TickerPlotDisplay
        try:
            tid, sym = data[0:2]
        except (TypeError, ValueError, ):
            return
        sym = sym or self.symbolName(tid)
        icon = symbolIcon(sym) if sym else QIcon(':/images/icons/kchart.png')
        sym = sym or '%s' % tid
        widget = TickerPlotDisplay(self)
        session = self.session
        widget.setSessionPlot(session, session.maps.ticker, tid)
        index = self.addTab(widget, sym)
        self.setTextIconCurrentTab(index, sym, icon)
        return True
Beispiel #2
0
    def createTickerPlotTab(self, item):
        """ Creates or displays a ticker plot tab.

        @param value string or model item
        @return True if display widget created, otherwise None
        """
        from profit.workbench.tickerplotdisplay import TickerPlotDisplay
        tickerId, tickerIdValid = item.data(DataRoles.tickerId).toInt()
        symbol = str(item.data(DataRoles.tickerSymbol).toString())
        if tickerIdValid and self.setCurrentLabel(symbol):
            return True
        if tickerIdValid:
            widget = TickerPlotDisplay(self)
            session = self.session
            widget.setSessionPlot(session, session.maps.ticker, tickerId)
            index = self.addTab(widget, symbol)
            icon = QIcon(item.data(Qt.DecorationRole))
            self.setTextIconCurrentTab(index, symbol, icon)
            return True