Beispiel #1
0
class SeaAN24(QDialog, Ui_SeaAN24):
    """
    Class documentation goes here.
    """
    n = 0
    """
    此处用真实搜索到的name:address字典来替换AN24Dict的内容,变量名不要换。
    """
    #print '111111111111'
    AN24Dict = init_An24.scan_bluetooth()  #!!!!!!!!!!!!!!
    #print '22222'
    NameList = []
    Address = ''
    Name = ''
    for key in AN24Dict:
        NameList.append(key)

    def __init__(self, parent=None):
        """
        Constructor
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.timerScan = QTimer()
        QtCore.QObject.connect(self.timerScan, SIGNAL("timeout()"),
                               self.addItems)
        self.timerScan.start(1000)

    def addItems(self):
        print 'Scan', SeaAN24.n
        self.listWidget.addItems([SeaAN24.NameList[SeaAN24.n]])
        if SeaAN24.n == len(SeaAN24.AN24Dict) - 1:
            self.timerScan.stop()
            print 'stop'
        SeaAN24.n += 1

    @pyqtSignature("QListWidgetItem*")
    def on_listWidget_itemClicked(self, item):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        foot = self.listWidget.currentRow()
        SeaAN24.Name = SeaAN24.NameList[foot]
        SeaAN24.Address = SeaAN24.AN24Dict[SeaAN24.Name]
        print SeaAN24.Name, SeaAN24.Address
        self.pushButton.setEnabled(True)

    @pyqtSignature("bool")
    def on_pushButton_clicked(self, checked):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        #print '333'
        DlgCntAN24.show()
        CntAN24.timerConnecting.start(100)
Beispiel #2
0
def scan_bt():
    '''return AN24s dict'''

    AN24_dict = init_An24.scan_bluetooth()
    return AN24_dict
Beispiel #3
0
def scan_bt():
    '''return AN24s dict'''

    AN24_dict = init_An24.scan_bluetooth()
    return AN24_dict