當前位置: 首頁>>代碼示例>>Python>>正文


Python View.newData方法代碼示例

本文整理匯總了Python中Display.View.newData方法的典型用法代碼示例。如果您正苦於以下問題:Python View.newData方法的具體用法?Python View.newData怎麽用?Python View.newData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Display.View的用法示例。


在下文中一共展示了View.newData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: User

# 需要導入模塊: from Display import View [as 別名]
# 或者: from Display.View import newData [as 別名]
class User(QDialog, Ui_Dialog):
    """
    Class documentation goes here.
    """
    def __init__(self, parent = None):
        """
        Constructor
        """
#        QDialog.__init__(self, parent, Qt.FramelessWindowHint)
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        self.nerfModel = Model()
        self.dispView = View(None, NUM_CHANNEL, DISPLAY_SCALING, VIEWER_REFRESH_RATE, \
                             CHANNEL_COLOR)
                             

        self.dispView.show()
        self.data = []
        self.isLogData = False
        
        self.connect(self.dispView.timer, SIGNAL("timeout()"), self.onCheckMoney)
#        self.connect(self, SIGNAL("initRT"), self.on_horizontalSlider_sliderMoved)
#        self.emit(SIGNAL("initRT"), 1)
        self.on_horizontalSlider_valueChanged(1)
        
#        self.connect(self.doubleSpinBox_0, SIGNAL("editingFinished()"), self.onNewWire00In)
#        self.connect(self.doubleSpinBox_0, SIGNAL("valueChanged(double)"), self.onNewWire00In)
#
#        self.connect(self.doubleSpinBox_1, SIGNAL("editingFinished()"), self.onNewWire01In)
#        self.connect(self.doubleSpinBox_1, SIGNAL("valueChanged(double)"), self.onNewWire01In)

        self.connect(self.doubleSpinBox_2, SIGNAL("editingFinished()"), self.onNewWireIn2)
        self.connect(self.doubleSpinBox_2, SIGNAL("valueChanged(double)"), self.onNewWireIn2)

        self.connect(self.doubleSpinBox_3, SIGNAL("editingFinished()"), self.onNewWireIn3)
        self.connect(self.doubleSpinBox_3, SIGNAL("valueChanged(double)"), self.onNewWireIn3)
#
        self.connect(self.doubleSpinBox_4, SIGNAL("editingFinished()"), self.onNewWireIn4)
        self.connect(self.doubleSpinBox_4, SIGNAL("valueChanged(double)"), self.onNewWireIn4)

        self.connect(self.doubleSpinBox_5, SIGNAL("editingFinished()"), self.onNewWireIn5)
        self.connect(self.doubleSpinBox_5, SIGNAL("valueChanged(double)"), self.onNewWireIn5)

        self.connect(self.doubleSpinBox_6, SIGNAL("editingFinished()"), self.onNewWireIn6)
        self.connect(self.doubleSpinBox_6, SIGNAL("valueChanged(double)"), self.onNewWireIn6)
#
#        self.connect(self.doubleSpinBox_7, SIGNAL("editingFinished()"), self.onNewWire07In)
#        self.connect(self.doubleSpinBox_7, SIGNAL("valueChanged(double)"), self.onNewWire07In)
#        
#        self.connect(self.doubleSpinBox_8, SIGNAL("editingFinished()"), self.onNewWire08In)
#        self.connect(self.doubleSpinBox_8, SIGNAL("valueChanged(double)"), self.onNewWire08In)
#
#        self.connect(self.doubleSpinBox_9, SIGNAL("editingFinished()"), self.onNewWire09In)
#        self.connect(self.doubleSpinBox_9, SIGNAL("valueChanged(double)"), self.onNewWire09In)

        self.connect(self.doubleSpinBox_14, SIGNAL("editingFinished()"), self.onNewWireIn14)
        self.connect(self.doubleSpinBox_14, SIGNAL("valueChanged(double)"), self.onNewWireIn14)
        
        self.connect(self.doubleSpinBox_15, SIGNAL("editingFinished()"), self.onNewWireIn15)
        self.connect(self.doubleSpinBox_15, SIGNAL("valueChanged(double)"), self.onNewWireIn15)


    def onCheckMoney(self):
        """
        This method is the handler for "WANT MONEY" messages,
        """
        newData = [0.0 for ix in range(NUM_CHANNEL)]
        
        for i in xrange(NUM_CHANNEL):
            newData[i] = self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])
            #if i == 3: 
                #newData[i] = newData[i] / 100
            #newData[i] = max(-65535, min(65535, self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])))
            if i == 5:
                print newData[i]
            
#        newSpike = self.nerfModel.ReadPipe(0xA1, 4000) # read ## bytes
        
        self.dispView.newData(newData)
#        if (self.isLogData):
#            self.data.append(newData)
        
    def onClkRate(self, value):   
        newHalfCnt = 100 * (10 **6) / SAMPLING_RATE / NUM_NEURON / value / 2 / 4
        self.nerfModel.SendPara(newVal = newHalfCnt, trigEvent = DATA_EVT_CLKRATE)
        
#    def onNewWireIn(self, evt):
#        newWireIn = eval('self.doubleSpinBox_'+str(evt)+u'.value()')
#        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = evt)
   
    def onNewWireIn2(self):
        newWireIn = eval('self.doubleSpinBox_'+str(2)+u'.value()')
        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 2)

    def onNewWireIn3(self):
        newWireIn = self.doubleSpinBox_3.value()
        if SEND_TYPE[3] == 'int32': newWireIn = int(newWireIn)
        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 3)
        
#.........這裏部分代碼省略.........
開發者ID:usc-bbdl,項目名稱:R01_HSC_NI_system,代碼行數:103,代碼來源:Controls.py

示例2: User

# 需要導入模塊: from Display import View [as 別名]
# 或者: from Display.View import newData [as 別名]
class User(QDialog, Ui_Dialog):
    """
    Class documentation goes here.
    """
    def __init__(self, parent = None):
        """
        Constructor
        """
#        QDialog.__init__(self, parent, Qt.FramelessWindowHint)
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        self.nerfModel = Model()
        self.dispView = View(None, NUM_CHANNEL, DISPLAY_SCALING, VIEWER_REFRESH_RATE, \
                             CHANNEL_COLOR)
                             

        self.dispView.show()
        self.data = []
        self.isLogData = False
        
        self.connect(self.dispView.timer, SIGNAL("timeout()"), self.onCheckMoney)
#        self.connect(self, SIGNAL("initRT"), self.on_horizontalSlider_sliderMoved)
#        self.emit(SIGNAL("initRT"), 1)
        self.on_horizontalSlider_valueChanged(1)
        
#        self.connect(self.doubleSpinBox_0, SIGNAL("editingFinished()"), self.onNewWire00In)
#        self.connect(self.doubleSpinBox_0, SIGNAL("valueChanged(double)"), self.onNewWire00In)
#
#        self.connect(self.doubleSpinBox_1, SIGNAL("editingFinished()"), self.onNewWire01In)
#        self.connect(self.doubleSpinBox_1, SIGNAL("valueChanged(double)"), self.onNewWire01In)

        self.connect(self.doubleSpinBox_2, SIGNAL("editingFinished()"), self.onNewWireIn2)
        self.connect(self.doubleSpinBox_2, SIGNAL("valueChanged(double)"), self.onNewWireIn2)

#        self.connect(self.doubleSpinBox_3, SIGNAL("editingFinished()"), self.onNewWire03In)
#        self.connect(self.doubleSpinBox_3, SIGNAL("valueChanged(double)"), self.onNewWire03In)
#
        self.connect(self.doubleSpinBox_4, SIGNAL("editingFinished()"), self.onNewWireIn4)
        self.connect(self.doubleSpinBox_4, SIGNAL("valueChanged(double)"), self.onNewWireIn4)

        self.connect(self.doubleSpinBox_5, SIGNAL("editingFinished()"), self.onNewWireIn5)
        self.connect(self.doubleSpinBox_5, SIGNAL("valueChanged(double)"), self.onNewWireIn5)

#        self.connect(self.doubleSpinBox_6, SIGNAL("editingFinished()"), self.onNewWire06In)
#        self.connect(self.doubleSpinBox_6, SIGNAL("valueChanged(double)"), self.onNewWire06In)
#
#        self.connect(self.doubleSpinBox_7, SIGNAL("editingFinished()"), self.onNewWire07In)
#        self.connect(self.doubleSpinBox_7, SIGNAL("valueChanged(double)"), self.onNewWire07In)
#        
#        self.connect(self.doubleSpinBox_8, SIGNAL("editingFinished()"), self.onNewWire08In)
#        self.connect(self.doubleSpinBox_8, SIGNAL("valueChanged(double)"), self.onNewWire08In)
#
#        self.connect(self.doubleSpinBox_9, SIGNAL("editingFinished()"), self.onNewWire09In)
#        self.connect(self.doubleSpinBox_9, SIGNAL("valueChanged(double)"), self.onNewWire09In)

        self.connect(self.doubleSpinBox_14, SIGNAL("editingFinished()"), self.onNewWireIn14)
        self.connect(self.doubleSpinBox_14, SIGNAL("valueChanged(double)"), self.onNewWireIn14)
        
        self.connect(self.doubleSpinBox_15, SIGNAL("editingFinished()"), self.onNewWireIn15)
        self.connect(self.doubleSpinBox_15, SIGNAL("valueChanged(double)"), self.onNewWireIn15)


    def onCheckMoney(self):
        """
        This method is the handler for "WANT MONEY" messages,
        """
        newData = [0.0 for ix in range(NUM_CHANNEL)]
        
        for i in xrange(NUM_CHANNEL):
            #newVal[i] = self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i])
            newData[i] = max(-65535, min(65535, self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])))
#            if i == 0:
#                print newData[i]
            
        self.dispView.newData(newData)
        if (self.isLogData):
            self.data.append(newData)
        
    def onClkRate(self, value):   
        newHalfCnt = 200 * (10 **6) / SAMPLING_RATE / NUM_NEURON / value / 2 / 4
        self.nerfModel.SendPara(newVal = newHalfCnt, trigEvent = DATA_EVT_CLKRATE)
        
#    def onNewWireIn(self, evt):
#        newWireIn = eval('self.doubleSpinBox_'+str(evt)+u'.value()')
#        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = evt)
   
    def onNewWireIn2(self):
        newWireIn = eval('self.doubleSpinBox_'+str(2)+u'.value()')
        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 2)

    def onNewWireIn4(self):
        newWireIn = self.doubleSpinBox_4.value()
        print newWireIn, 
        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 4)

    def onNewWireIn5(self):
        newWireIn = self.doubleSpinBox_5.value()
        self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 5)

#.........這裏部分代碼省略.........
開發者ID:usc-bbdl,項目名稱:R01_HSC_NI_system,代碼行數:103,代碼來源:Controls.py


注:本文中的Display.View.newData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。