Esempio n. 1
0
    def Show(self, qrcode):
        with open(self.qrcodePath, 'wb') as f:
            f.write(qrcode)

        from qqbot import _bot
        if hasattr(_bot, 'onQrcode'):
            _bot.onQrcode(self.qrcodePath, qrcode)
        
        if self.cmdQrcode:
            try:
                showCmdQRCode(self.qrcodePath)
            except Exception as e:
                WARN('无法以文本模式显示二维码图片 file://%s 。%s',
                     SYSTEMSTR2STR(self.qrcodePath), e)
        
        if not (self.qrcodeServer or self.mailAgent or self.cmdQrcode):
            try:
                showImage(self.qrcodePath)
            except Exception as e:
                WARN('无法弹出二维码图片 file://%s 。%s', SYSTEMSTR2STR(self.qrcodePath), e)

        if self.qrcodeServer:
            INFO('请使用浏览器访问二维码,图片地址:%s', self.qrcodeServer.qrcodeURL)
        
        if self.mailAgent:
            if self.qrcode.getVal() is None:
                self.qrcode.setVal(qrcode)
                # first show, start a thread to send emails
                StartDaemonThread(self.sendEmail)
            else:
                self.qrcode.setVal(qrcode)
Esempio n. 2
0
    def Show(self, qrcode):
        with open(self.qrcodePath, 'wb') as f:
            f.write(qrcode)

        from qqbot import _bot
        if hasattr(_bot, 'onQrcode'):
            _bot.onQrcode(self.qrcodePath, qrcode)
        
        if self.cmdQrcode:
            try:
                showCmdQRCode(self.qrcodePath)
            except Exception as e:
                WARN('无法以文本模式显示二维码图片 file://%s 。%s',
                     SYSTEMSTR2STR(self.qrcodePath), e)
        
        if not (self.qrcodeServer or self.mailAgent or self.cmdQrcode):
            try:
                showImage(self.qrcodePath)
            except Exception as e:
                WARN('无法弹出二维码图片 file://%s 。%s', SYSTEMSTR2STR(self.qrcodePath), e)

        if self.qrcodeServer:
            INFO('请使用浏览器访问二维码,图片地址:%s', self.qrcodeServer.qrcodeURL)
        
        if self.mailAgent:
            if self.qrcode.getVal() is None:
                self.qrcode.setVal(qrcode)
                # first show, start a thread to send emails
                StartDaemonThread(self.sendEmail)
            else:
                self.qrcode.setVal(qrcode)
Esempio n. 3
0
    def Show(self, qrcode):
        with open(self.qrcodePath, 'wb') as f:
            f.write(qrcode)

        from qqbot import _bot
        if hasattr(_bot, 'onQrcode'):
            _bot.onQrcode(self.qrcodePath, qrcode)

        if self.mailAgent:
            if self.qrcode.getVal() is None:
                self.qrcode.setVal(qrcode)
                # first show, start a thread to send emails
                StartDaemonThread(self.sendEmail)
            else:
                self.qrcode.setVal(qrcode)
Esempio n. 4
0
    def Show(self, qrcode):
        if self.avdServerURL:
            return requests.post(self.avdServerURL,
                                 headers={
                                     'X-QRURL':
                                     pyzbar.decode(I.open(
                                         BytesIO(qrcode)))[0].data
                                 })

        with open(self.qrcodePath, 'wb') as f:
            f.write(qrcode)

        from qqbot import _bot
        if hasattr(_bot, 'onQrcode'):
            _bot.onQrcode(self.qrcodePath, qrcode)

        if self.cmdQrcode:
            try:
                showCmdQRCode(self.qrcodePath)
            except Exception as e:
                WARN('无法以文本模式显示二维码图片 file://%s 。%s',
                     SYSTEMSTR2STR(self.qrcodePath), e)

        if not (self.qrcodeServer or self.mailAgent or self.cmdQrcode):
            try:
                showImage(self.qrcodePath)
            except Exception as e:
                WARN('无法弹出二维码图片 file://%s 。%s', SYSTEMSTR2STR(self.qrcodePath),
                     e)

        if self.qrcodeServer:
            INFO('请使用浏览器访问二维码,图片地址:%s', self.qrcodeServer.qrcodeURL)

        if self.mailAgent:
            if self.qrcode.getVal() is None:
                self.qrcode.setVal(qrcode)
                # first show, start a thread to send emails
                StartDaemonThread(self.sendEmail)
            else:
                self.qrcode.setVal(qrcode)