本文整理汇总了Python中qrtools.QR.decode_webcam方法的典型用法代码示例。如果您正苦于以下问题:Python QR.decode_webcam方法的具体用法?Python QR.decode_webcam怎么用?Python QR.decode_webcam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qrtools.QR
的用法示例。
在下文中一共展示了QR.decode_webcam方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readQR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def readQR():
future = time.time() + 10
ret = "NULL"
while time.time() < future and ret == "NULL":
myCode = QR()
myCode.decode_webcam()
ret = myCode.data
if ret == "NULL":
return -1
return ret
示例2: readtextfromQR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def readtextfromQR():
try :
from qrtools import QR
from codecs import BOM_UTF8
except ImportError :
print('Module qrtools missing! No QR-code import possible!')
raise
myCode = QR()
myCode.decode_webcam()
key = myCode.data_to_string().strip()
return key[len(BOM_UTF8):] # fixes zbar!
示例3: decodeWebcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decodeWebcam(self):
vdDialog = VideoDevices()
if vdDialog.exec_():
device = vdDialog.videoDevices[vdDialog.videoDevice.currentIndex()][1]
qr = QR()
qr.decode_webcam(device=device)
if qr.data_decode[qr.data_type](qr.data) == "NULL":
QtGui.QMessageBox.warning(
self,
self.trUtf8("Decoding Failed"),
self.trUtf8("<p>Oops! no code was found.<br /> Maybe your webcam didn't focus.</p>"),
QtGui.QMessageBox.Ok,
)
else:
self.showInfo(qr)
示例4: main
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def main():
qr = QR()
qr.decode_webcam()
if qr.data == "NULL":
print "FAIL"
return -1
data = qr.data.split(":")
if len(data) != 2:
print "FAIL"
return -1
if data[0] != "bitcoin":
print "NOTADDR"
return -1
print data[1]
return 0
示例5: read
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def read(self):
myCode = QR()
print(myCode.decode_webcam())
#print(myCode.data)
#print(myCode.data_type)
#print(myCode.data_to_string())
return myCode.data_to_string
示例6: decodificar
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decodificar():
global status
global decoded
noint = False
code = QR()
code.decode_webcam()
pre_decoded = code.data
decoded_vector = pre_decoded.split('#')
decoded = decoded_vector[0]
generarid(archlibros)
try:
int(decoded)
except ValueError:
noint = True
if (decoded != "NULL") and (decoded <= countstr) and (noint != True):
status = 1
示例7: decodeWebcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decodeWebcam(self):
QtGui.QMessageBox.information(
self,
u"Decode from webcam",
u"You are about to decode from your webcam. Please put the code in front of your webcam with a good light source and keep it steady. Once you see a green rectangle you can close the window by pressing any key.",
QtGui.QMessageBox.Ok
)
qr = QR()
qr.decode_webcam()
if qr.data_decode[qr.data_type](qr.data) == 'NULL':
QtGui.QMessageBox.warning(
self,
u"Decoding Failed",
u"<p>Oops! no code was found.<br /> \
Maybe your webcam didn't focus.</p>",
QtGui.QMessageBox.Ok
)
else:
self.showInfo(qr)
示例8: main
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def main():
if len(sys.argv) != 2:
print "FAIL"
return -1
qr = QR()
qr.decode_webcam()
if qr.data == "NULL":
print "FAIL"
return -1
data = qr.data.split(":", 1)
if len(data) != 2:
print "FAIL"
return -1
if data[0] != "seed":
print "NOTSEED"
return -1
password = sys.argv[1]
seed = call("echo \"%s\" | base64 -d | ccat -K %s" % (data[1], password))
if len(seed) != 32:
print "BADSEED"
return -1
print seed
return 0
示例9: decode
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decode():
"""
Decodes the QR code and returns a list of information
"""
my_code = QR()
result = my_code.decode_webcam()
if result:
if result[0]:
now = datetime.now()
return [result[1], now]
else:
return [None, result[1]]
else:
return [None, "Failed to initialise webcam"]
示例10: decode_from_webcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decode_from_webcam():
my_code = QR()
decoded = my_code.decode_webcam()
return decoded
示例11: decode_qr_code
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decode_qr_code(self):
qr_reader = QR()
qr_reader.decode_webcam(None, "http://192.168.0.20/video.cgi")
示例12: QR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
import qrtools
from qrtools import QR
myCode = QR()
print myCode.decode_webcam()
print myCode.data
print myCode.data_type
print myCode.data_to_string()
示例13: decodeWebcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def decodeWebcam(self):
qr = QR()
qr.decode_webcam()
if qr.data_to_string() != 'NULL':
示例14: scan_qr
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode_webcam [as 别名]
def scan_qr(self):
"""Scans a QR-Code and returns the data as a string"""
qr = QR()
qr.decode_webcam()
return str(qr.data)